# For AI agents

The docs are built so that an AI assistant — Claude, ChatGPT, Cursor, Codex — can read them
in full and write the integration without guessing. There are three ways.

## 1. Markdown version of any page { #markdown }

Append `.md` to a page address to get its source Markdown with code samples:

| HTML | Markdown |
| --- | --- |
| `/en/quickstart/` | `/en/quickstart.md` |
| `/signing/` (Russian) | `/signing.md` |
| `/en/` | `/en/index.md` |

Every page header has a **Copy as Markdown** button and an "Open in ChatGPT / Claude"
menu that opens the assistant with a link to the page.

## 2. llms.txt { #llms-txt }

- <a href="/llms.txt"><code>/llms.txt</code></a> — every page in both languages with a one-line
  description, per the [llms.txt standard](https://llmstxt.org/).
- <a href="/llms-full.txt"><code>/llms-full.txt</code></a> — all the docs in one file, handy to
  paste into context.

## 3. Docs MCP server { #mcp }

The MCP server gives the assistant search and read tools over the docs. Read-only, no
authentication.

| Tool | What it does |
| --- | --- |
| `search_docs(query, lang)` | Full-text search, returns sections with excerpts |
| `get_page(path, lang)` | A whole page in Markdown |
| `list_pages(lang)` | All pages with descriptions |
| `get_api_operation(operation_id)` | An API method from the OpenAPI spec: `createPayment`, `getPayment`, `getProject` |
| `get_code_example(language, topic)` | A tested sample: `curl`, `php`, `python`, `node`, `go` × `sign_request`, `verify_callback`, `create_sbp_payment`, `generate_key`, `callback_receiver` |

Pages are also MCP resources: `docs://ru/quickstart`, `docs://en/signing`.

Server address: `/mcp`, on the same host as these docs (Streamable HTTP transport).

=== "Claude Code"

    ```bash
    claude mcp add --transport http payment-api-docs /mcp
    ```

=== "Cursor"

    `.cursor/mcp.json` in the project or `~/.cursor/mcp.json`:

    ```json
    {
      "mcpServers": {
        "payment-api-docs": { "url": "/mcp" }
      }
    }
    ```

=== "Codex"

    `~/.codex/config.toml`:

    ```toml
    [mcp_servers.payment-api-docs]
    url = "/mcp"
    ```

=== "ChatGPT"

    In ChatGPT: **Settings → Apps & Connectors → Advanced → Developer mode**, then
    **Create**, enter the server URL and choose **No authentication**. ChatGPT connects only
    to a public `https://` address: for a local copy of the docs, use a tunnel.

## Prompt for your assistant { #prompt }

Paste at the start of a conversation:

```text
You are helping integrate the payments API. The source of truth is the docs:
/mcp (MCP) or llms.txt. Rules:
- Every POST is signed per RFC 9421 with Ed25519: use the ready-made function from
  get_code_example(<language>, "sign_request"); do not write signing from scratch.
- Check the function against the test vector on the signing page.
- merchant_payment_id is the idempotency key: on retry keep the id, re-sign the request.
- Verify callbacks with HMAC-SHA256 over the raw body: get_code_example(<language>, "verify_callback").
- Keep the API base URL {{base_url}} (sandbox and production differ) in configuration, not in code.
```