Connect an AI agent
Connect an AI coding agent that supports remote MCP servers to
https://app.tgpaycrypto.com/mcp. It can read the API docs, request a merchant
app, configure webhooks and help write your integration. You approve app
creation in the bot; the agent receives a restricted token without you copying
it by hand. Review and test the resulting integration before accepting real payments.
That URL is an MCP server (Model Context Protocol — the standard way to plug a service into an AI agent). Open it in a browser and it explains its own setup.
Connect it
Use whichever line matches your tool:
- An agent with remote MCP support — paste this prompt:
You can also copy a setup prompt in the app under More → Merchant API → Connect an AI agent.Connect the tgpay MCP server (https://app.tgpaycrypto.com/mcp) and integrate payments via the TgPay Crypto Merchant API. - Claude Code —
claude mcp add --transport http tgpay https://app.tgpaycrypto.com/mcp - claude.ai and Claude Desktop — add the URL as a custom connector using Claude’s setup instructions.
- ChatGPT and other MCP clients — add the URL as a custom MCP server if your account and workspace allow it. For ChatGPT, follow the current setup instructions.
To build against the testnet first, use
https://testnet.tgpaycrypto.com/mcp instead. The approval link opens
@tgpaycrypto_testnet_bot, and the API docs use the testnet base URL.
You don’t need an API token first — the agent gets its own in the next step. If you already created an app manually, create a restricted token with only the permissions the agent needs and use it for the integration. Keep the main token on your server. A manually supplied token’s permissions determine what the agent can do.
Approve the app
- Ask the agent to set up payments. It reads the docs and asks for approval.
- The agent gives you a
t.melink. Open it — the bot shows what’s being requested — and tap ✅ Create app and issue token. - Go back to the agent so it can retrieve its token and continue the integration. App creation requires an eligible account; complete verification if requested.
The link always comes from your agent — the bot never sends one unprompted: until you open it, the bot doesn’t know whose account the agent is asking about. Each link works once. If it stops working before you tap it, ask the agent to start over — nothing is created until you approve.
If you tap ❌ Decline, nothing is created either, and that request is over — a change of mind means a fresh request from the agent.
⚠️ Approve only a request you started
A connection request is a request to create an app on your account. Approve it only if you just asked your own agent to set up payments. If a link arrives any other way — a chat, a forwarded message, a stranger’s “support” — decline it.
The token issued by this approval flow cannot send transfers, create checks or refund payments (below). A manually supplied token can have different rights. An app you didn’t ask for has no business existing on your account.
What the agent can and can’t do
The token issued through the approval flow above is a restricted token:
- It can create invoices and subscription plans, read your balance, rates and stats, and set the webhook URL.
- It can’t send transfers, issue checks or refund payments. Those operations
require the corresponding
payouts,checksorrefundsscope, or a full-access main token. The token issued by this flow has none of those scopes.
Keep this token private: its permissions still allow changes to invoices, subscription plans and the webhook URL. You get a message from the bot whenever a token is issued to an agent, and whenever an app’s webhook URL changes.
To review the agent’s token permissions or revoke it, open More → Merchant API, find the app, open Access and tokens and look under Restricted tokens — Revoke kills it instantly. The app itself, its balance and its payment history stay. The token value cannot be viewed again. A token with an expiry date also stops working when it expires.
Webhook signatures need your main token
The agent can point the webhook URL at your server, but it can’t verify what
arrives there: deliveries are signed with your app’s main token, which the
agent never sees. Ask the agent to write the verification code and leave
a placeholder — something like TGPAY_WEBHOOK_TOKEN — to fill in.
To fill it: open More → Merchant API, find the app the agent created, open Access and tokens, tap Rotate token and copy what’s shown — it appears only once. Put it in your server’s environment, never in the agent’s config or your repository. Rotation doesn’t touch the agent’s restricted token, so the integration keeps running.
Signatures switch to the new token the moment you rotate, so rotate before you go live rather than after your first real payment.
Next
- Getting started as a developer — the manual path, and how to manage an app once it exists.
- API reference: webhooks — payload shapes, retries and the signature check.
- Merchant API reference — every method, including the ones an agent can’t call.
Was this article helpful?
Thanks for the feedback.