# MCP server

> Connect the TapPay MCP server to Claude Code, Cursor or Claude Desktop to search the docs and call the sandbox.

Source: https://docs.tappay.mn/ai/mcp/

The MCP server `@tappay-mn/mcp` gives an AI tool eight tools. Three tools read the docs and need no key. Four tools call the [sandbox](https://docs.tappay.mn/glossary.md#sandbox) with your sandbox [secret key](https://docs.tappay.mn/glossary.md#secret-key). One tool checks a webhook [signature](https://docs.tappay.mn/glossary.md#signature) locally, without a network call.

## Install

Claude Code:

```bash
claude mcp add tappay -e TAPPAY_SECRET_KEY=sk_test_YOUR_SECRET_KEY -- npx -y @tappay-mn/mcp
```

Cursor, in `.cursor/mcp.json`, and Claude Desktop, in `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "tappay": {
      "command": "npx",
      "args": ["-y", "@tappay-mn/mcp"],
      "env": { "TAPPAY_SECRET_KEY": "sk_test_YOUR_SECRET_KEY" }
    }
  }
}
```

## Environment variables

| Variable | Used by | Default | Rule |
| - | - | - | - |
| `TAPPAY_SECRET_KEY` | Sandbox tools | None | A sandbox secret key that starts with `sk_test_`. Read on every call and never stored. |
| `TAPPAY_SIGNING_SECRET` | Sandbox tools | None | Optional. The signing secret, if your key requires signed requests. |
| `TAPPAY_WEBHOOK_SECRET` | `verify_webhook_signature` | None | The secret of your sandbox [webhook endpoint](https://docs.tappay.mn/glossary.md#webhook-endpoint). |
| `TAPPAY_API_BASE` | Sandbox tools | `https://sandbox-api.tappay.mn` | An `https:` URL, or `localhost` for local development. The [production](https://docs.tappay.mn/glossary.md#production) API host is rejected. |
| `TAPPAY_DOCS_URL` | Docs tools | `https://docs.tappay.mn` | An `https:` URL, or `localhost`. |
| `TAPPAY_NODE_VERSION` | Sandbox tools | The latest [API version](https://docs.tappay.mn/glossary.md#api-version) | Sent as the `TapPay-Version` header. |
| `TAPPAY_MCP_LOG` | All tools | None | Set to `debug` to write logs to stderr. Keys and secrets are never logged. |

## Tools

| Tool | What it does | Example prompt |
| - | - | - |
| `search_docs` | Searches the docs. | "How do I verify a TapPay webhook?" |
| `read_page` | Reads one docs page as Markdown. | "Read the checkout guide." |
| `read_operation` | Reads one API operation from OpenAPI. | "Show the request body of create [invoice](https://docs.tappay.mn/glossary.md#invoice)." |
| `create_invoice` | Creates an invoice in the sandbox. | "Create a sandbox invoice for 1000 MNT." |
| `create_checkout_session` | Creates a [checkout session](https://docs.tappay.mn/glossary.md#checkout-session) in the sandbox. | "Create a checkout session and give me the URL." |
| `simulate_payment` | Simulates a [payment](https://docs.tappay.mn/glossary.md#payment) result in the sandbox. | "Pay that invoice in the sandbox." |
| `list_events` | Lists recent [event](https://docs.tappay.mn/glossary.md#event)s. | "Which events did that payment create?" |
| `verify_webhook_signature` | Checks a webhook [signature](https://docs.tappay.mn/glossary.md#signature) against your secret. | "Is this webhook signature valid?" |

## Security

- The server accepts only a sandbox secret key. It rejects a [production](https://docs.tappay.mn/glossary.md#production) key, a [publishable key](https://docs.tappay.mn/glossary.md#publishable-key) and a playground token before any network call.
- The TapPay API also rejects a sandbox key on production and a production key on the sandbox.
- The docs tools never read a key.
- The server does not save keys or secrets, and it never writes them to logs or results.
