Connecting a payment tool

How to add a payment tool to Claude Code

Add a remote MCP payment server to Claude Code with claude mcp add, choose a scope, and keep a coding agent from paying for things you didn't intend.

Use claude mcp add with the HTTP transport, the server URL and an Authorization header, for example claude mcp add --transport http veyra https://veyra.money/api/mcp --header "Authorization: Bearer veyra_…". Then check it with /mcp and give the agent low limits to start.

Why is this harder than it sounds?

A coding agent reads far more untrusted text than a chat assistant: dependencies, READMEs, issue threads, test output, web pages it fetches. Any of it can contain instructions. Giving that agent a payment tool is useful (buying API credits, paying for a dataset, renewing a service in a deploy script) but it widens what a bad instruction can do. Claude Code also lets you add servers at different scopes, and a server added to a shared project config travels with the repository, which is not where a payment credential belongs.

How do you do it?

  1. Create a credential with low limits. Make a dedicated endpoint for Claude Code with small per-payment and daily limits, and a recipient allowlist if you know who it should pay.
  2. Add the server. Run claude mcp add --transport http <name> <url> --header "Authorization: Bearer <token>". Claude Code's docs describe --transport http for remote servers and --header for authentication headers.
  3. Choose the scope deliberately. Claude Code supports local, project and user scopes. Keep a payment credential out of the project scope, which writes a .mcp.json file meant to be shared with the repository.
  4. Check the connection. Run /mcp inside Claude Code to see the server's status and tools. Ask the agent to call get_budget; it should report your limits back.
  5. Try one payment on a simulated source. Ask for a small payment and watch the tool call. Then try one in the approval band and confirm you receive the request.
  6. Write the rule into your instructions. Tell the agent in CLAUDE.md when it may pay and that it must never retry a payment that is awaiting approval.

What it does not mean

  • Adding a server at project scope is not private. Anything in a committed .mcp.json is visible to everyone with the repository.
  • Claude Code asking permission before a tool call is not a budget. Approving the call does not tell you the amount.
  • A payment tool does not need shell access to your wallet. If a server asks for a key in an environment variable, it is signing on your machine with it.

Common questions

Can I keep the token out of my shell history?

Claude Code's MCP docs describe ${VAR} expansion in .mcp.json headers, so a shared file can say Bearer ${VEYRA_TOKEN} while the token stays in your environment. Or add the server at local or user scope, which stores it in your own ~/.claude.json.

What if Claude Code says unauthorized?

Use the full veyra_ token from when you created the endpoint. If you rotated it, update the header. Paused or revoked endpoints can't pay.

Where does Veyra fit?

The command above is the one in Veyra's docs. Once added, Claude Code sees Veyra's seven tools: get_capabilities, get_budget, list_payment_sources, create_payment, get_payment, list_payments and cancel_payment. Limits, the allowlist and approvals are enforced on Veyra's server, so nothing in Claude Code's config can raise them. You can rotate or revoke the credential from the endpoint page, and the bearer token is shown once when you create it.

Sources

Terms on this page

This page explains how agent payments and the related technology work. It is not financial, investment, legal or tax advice. Protocols and provider features change; check the linked official sources before relying on a detail.