# iStores MCP: minimal bot guide

Connect an OAuth-capable MCP client to `https://api.istores.co.il/mcp` using Streamable HTTP. Use the client's OAuth support, without a manually configured API key or Authorization header.

## Public endpoints

Discover the endpoints and capabilities at runtime; the current discovery URLs are:

| Purpose | Method and URL |
|---|---|
| Protected resource discovery | `GET https://api.istores.co.il/.well-known/oauth-protected-resource/mcp` |
| OAuth server discovery | `GET https://api.istores.co.il/.well-known/oauth-authorization-server` |
| Dynamic registration, when needed | `POST https://api.istores.co.il/mcp/oauth/register` |
| Browser authorization | `GET https://api.istores.co.il/mcp/oauth/authorize` |
| Code exchange and token refresh | `POST https://api.istores.co.il/mcp/oauth/token` |
| MCP connection | `https://api.istores.co.il/mcp` |

## Connection flow

1. Discover the OAuth server and identify the client with a supported HTTPS client metadata document or dynamic registration. For public-client metadata, support authentication method `none`.
2. Start Authorization Code with PKCE (`S256`), using the MCP URL as `resource`. Let the MCP client generate and manage `state`, the verifier and the callback URL. Local callback ports may change between logins.
3. Ask the user to complete iStores login and approve permissions in their browser, with the intended company selected. Never ask for their password in chat. An existing browser session can skip the login screen; approval is still required.
4. Let the client exchange the returned code using the same `client_id`, exact `redirect_uri` and matching PKCE verifier. It then sends the issued bearer token on MCP requests and refreshes it according to the token response.
5. Initialize the MCP session, send `notifications/initialized`, and discover tools with `tools/list`. Follow returned pagination cursors and use the returned tool names and input schemas for `tools/call`.
6. Confirm access with a read such as `list_languages`. Use IDs returned for the connected store; do not substitute another company's IDs.

Codex CLI setup:

```bash
codex mcp add istores-design-ops --url https://api.istores.co.il/mcp
codex mcp login istores-design-ops
```

## Using tools

- Discover tools instead of treating REST paths as tool names.
- Read current values before editing. Make only changes authorized by the user, including deletion and paid generation.
- After a timeout, read the current state before retrying a write. Follow tool-provided polling delays for asynchronous work.
- If authentication or permissions are missing, request reconnection or approval through the client. Do not request or display credentials in chat.
- For repeated OAuth errors, report the client/version, attempt time and error text to support. Do not share tokens or full callback URLs.

See the [full MCP guide](https://apidocs.istores.co.il/mcp) for setup and troubleshooting.
