Pre-release: the public API is not live yet and has no base URL. Routes and fields are in the OpenAPI contract, at /openapi.yaml.

Skip to Content
xaseDocumentation

MCP

Connect an AI agent to the API through the Model Context Protocol, with every operation as a tool.

The API has a Model Context Protocol server, at /mcp on the same host as /v1. It is the public API by another transport: every operation of the OpenAPI contract is a tool, and calling a tool is making the request of that operation. Validation, scopes, idempotency, errors and rate limits are the same.

Connecting

  • Endpoint: POST /mcp.
  • Transport: Streamable HTTP, without sessions. Each POST stands on its own.
  • Protocol revision: 2026-07-28, and the earlier revisions for clients that have not moved yet.
  • Credential: the API key, in the Authorization header, as Bearer sk_test_….

The key is the same one that /v1 takes, and it decides the environment: a test key connects the agent to test mode, a live key to live. See Authentication. There is no OAuth sign-in: a client connects only if it can send a fixed header.

ClientWhere the header goes
Claude Codeclaude mcp add --transport http xase https://API_HOST/mcp --header "Authorization: Bearer sk_test_…"
ClaudeIn Customize > Connectors, add a custom connector with the URL of /mcp, choose No sign in, and under Request headers add Authorization with the value Bearer sk_test_…
CursorIn mcp.json, a server with "url" and "headers": {"Authorization": "Bearer ${env:XASE_API_KEY}"}
VS CodeIn .mcp.json, a server with "type": "http", "url" and "headers": {"Authorization": "Bearer ${XASE_API_KEY}"}

API_HOST stands for the host of the API. A client that only connects through OAuth, such as ChatGPT, cannot connect.

  • Without a valid key the answer is 401, the same as in /v1. Some clients react to a 401 by starting an OAuth sign-in, which leads nowhere here: set the header.
  • A request that carries the Origin header is refused with 403 and the code origin_not_allowed. The endpoint is for programs, and a browser sends that header when a web page makes the request.
  • GET and DELETE answer 405: there is no stream and no session to open or close.
  • The server has tools only: no resources, no prompts, and it never asks the client for anything.

Tools

Each tool has the name of its operation in the contract, such as createCharge, and the description the contract gives it. The pages of each resource say what the operations do: Charges, Refunds, Disputes, Offers, Balance and Test mode.

The arguments of a tool are the fields of the request body of the operation, plus one argument for each of its parameters, under the name the contract gives it:

In the contractIn the toolExample
A field of the request bodyAn argument with the same nameamount_cents
A path parameterAn argument with the same nameid
A query parameterAn argument with the same namelimit
A headerAn argument with the same nameIdempotency-Key

So createCharge takes amount_cents, expires_in and Idempotency-Key, and getCharge takes id. An argument the contract does not have is refused, like a field that is not in the contract is refused in /v1.

The result of a tool is the JSON the operation answers, as text and as structured content. An operation that answers without a body, like simulatePayment, returns the description of that answer.

The tools a key sees

The list of tools is the list of what the key can do:

  • Every operation asks the key for a scope, and a tool only appears for a key that has the scope of its operation. See What a key can do.
  • A key with the read scopes alone sees the seven tools that read, getCharge, listCharges, getRefund, listRefunds, getOffer, listOffers and getBalance, and none that writes.
  • Writing does not include reading: a key with charges:write alone sees createCharge and not getCharge.
  • A key created before an operation existed does not see its tool. Offers and the balance came after the first keys: an agent sees createOffer or getBalance only with a key created with their scopes.
  • The tools of test mode only appear for a test key, and ask it for the same scope as their operations, charges:write.

Calling a tool that is not in the list of the key answers like calling a tool that does not exist. To give an agent fewer tools, give it a key with fewer scopes.

Errors

When the operation refuses the call, the result is marked as an error (isError) and its text is the same problem that /v1 answers. Read code, as in Errors: invalid_request lists each argument that the contract refuses, by the name of the argument.

A tool call spends the rate limit of the key, from the same bucket as the requests to /v1. Over the limit the result is the rate_limited error, and a second text block says in how many seconds to try again, as Retry-After: 4.

When you retry createCharge or createRefund, send the same Idempotency-Key: the call returns what the first one created. createOffer has no Idempotency-Key, and every call creates another offer: after a call that did not answer, call listOffers before trying again.

What to give an agent

  • Start with a test key. The whole path runs in test mode: createCharge and simulatePayment with charges:write, getCharge with charges:read, createRefund with refunds:write, createOffer and archiveOffer with offers:write, and getBalance with balance:read.
  • Give the agent the key with the fewest scopes that does the job. An agent that only answers questions needs the read scopes and nothing else. A key without refunds:write cannot refund, whatever the agent is told.
  • Text typed by a buyer reaches the model. The customer of a charge carries the name and the e-mail address the buyer typed at the checkout, and that text can be written as an instruction. An agent that holds a key with refunds:write can be talked into a refund. The damage has a ceiling: a refund only sends back to the payer what the payer paid, once.
  • Keep the confirmation of your client on. The tools that only read are marked as read-only, and every other tool is marked as destructive, which is what a client uses to ask before calling it. The mark is a hint to the client, not a control of the platform.

On this page