MCP server and tools
The remote MCP server (OAuth 2.1, Streamable HTTP), the local package, and every tool's input and output.
The Model Context Protocol is how most agents will meet ndStill. An MCP client (Claude, Cursor, VS Code, ChatGPT, or your own agent built on an agents SDK) connects to the ndStill server and gets a small set of payment tools. The agent asks to pay; ndStill decides under the rules a person set, and answers with an approval, a hold or a decline with reasons.
The tools never hand the model a card number or a provider key. When a payment is approved, the agent gets a scoped credential for that one purchase, and every tool result is written so the model can read it as plain text.
Two ways to connect#
| Remote server | Local package | |
|---|---|---|
| Address | https://mcp.ndstill.com/mcp | npx -y @ndstill/mcp (stdio) |
| Transport | Streamable HTTP | Standard input and output |
| Sign-in | OAuth 2.1 with PKCE and a consent screen | An agent-scoped API key in NDSTILL_API_KEY |
| Best for | Clients that support remote servers, and people who connect their own assistant | Clients without remote MCP, CI, and agents you run on your own machines |
| Test mode | https://mcp.ndstill.com/mcp?mode=test | A nds_test_… key |
Both expose the same tools with the same inputs and outputs. The remote server is the default: there's nothing to install or update, and the person connecting sets the agent's allowance themselves.
OAuth and the consent screen#
When a client connects to the remote server for the first time, it discovers ndStill's authorization server from the metadata document:
https://mcp.ndstill.com/.well-known/oauth-authorization-serverThe client registers itself, opens the ndStill sign-in page and uses PKCE, so no client secret sits on anyone's laptop. After signing in, the person sees the consent screen:
- Which agent this client acts as: an existing agent, or a new one created from this connection.
- The allowance: a budget and window (for example $200 a month) and a per-payment limit. These become the agent's policy, under any org, team or tree policy above it.
- The scopes the client asked for, such as
pay,check_budgetandrequest_approval. People-only scopes are shown separately and are never granted to an agent token.
The token the client receives is scoped to that one agent. Revoking the grant in the console, under Developers, OAuth apps, cuts the client off immediately; freezing the agent does too.
API keys with the local package#
For clients that only run local servers, the @ndstill/mcp package speaks stdio and calls the API with an agent-scoped key. Create the key in the console under Developers, API keys, attach it to one agent, and give it only the scopes the agent needs (usually payments:write and budgets:read). Keys never leave the machine's environment.
Connect a client#
Pick your client. The remote server with OAuth is shown first where the client supports it.
claude mcp add --transport http ndstill https://mcp.ndstill.com/mcp
# Then run /mcp in Claude Code, choose ndstill and sign in.- Cursor reads
~/.cursor/mcp.json(all projects) or.cursor/mcp.json(one project), then shows ndstill under MCP with a Login button. - VS Code reads
.vscode/mcp.json; start the server from the MCP view and sign in when asked. - Windsurf reads
~/.codeium/windsurf/mcp_config.json. - ChatGPT connects with OAuth only: in Settings, Apps and connectors, turn on developer mode, create a connector and paste the server URL.
- Claude Desktop can add the remote server as a custom connector (Settings, Connectors), or run the local package as above.
The console's Developers, MCP and SDKs page builds these snippets for you, with your server name and the test URL if you want it. MCP in 2 minutes walks through the first payment.
How holds and approvals reach the agent#
A payment that needs a person is not a failure. pay returns status: "held" with an approval_id and the reason in plain words, and then:
- Progress notifications. If the client sent a progress token with the call, the server keeps the request open for a short while and sends progress updates as the approval moves (notified, viewed, decided). Clients that show progress let the model wait instead of guessing.
- Elicitation. Where the client supports MCP elicitation,
request_approvalcan ask the person at the keyboard to confirm, but only when the policy allows a lower assurance level for that payment. Payments that need a passkey always go to the approver's own device, never into the agent's conversation. - Polling.
get_approvalreturns the current state. Agents that run unattended usually call it on their next turn.
When an approval resolves, the pipeline runs again before any credential is minted, so an approval never skips a freeze, a spent budget or a changed policy.
Tool reference#
These are the tools the server exposes, with each tool's input and output. Tools in the Admin group need a token issued to a person (with approvals:write or agents:freeze) and are never listed for agent tokens.
- paydestructiveHint: true, idempotentHint: true
Pay a counterparty within the agent's policy and allowance. Returns approved, held (with an approval ID) or declined with reasons.
Input and output (6 arguments)
- amount{ amount: integer (minor units), asset: "USD" | "USDC" | … }required
What to pay, in minor units (cents for USD, 6 decimals for USDC).
- counterpartystringrequired
Who is being paid: a merchant name, domain, API host or payTo address.
- purposestringrequired
One sentence the approver and the evidence record will see.
- rail_preferenceRail[]
Rails to try in order. ndStill picks from what the seller accepts and the owner allows.
- mandate_idstring
The signed instruction this payment fulfils. Without one, policy decides whether a mandate is needed.
- idempotency_keystring
Reuse it on retries so a payment never happens twice. The server makes one when omitted.
Returns: The payment intent: status approved, held (with approval_id) or declined (with reasons[]), the gate marks, and a credential reference when approved.
Example call{ "tool": "pay", "arguments": { "amount": { "amount": 4200, "asset": "USD" }, "counterparty": "Delta Air Lines", "purpose": "Flight SFO to JFK for the offsite" }, "result": { "id": "pi_01JC…", "status": "held", "approval_id": "apr_01JC…", "reason_summary": "$420.00 is above the $250.00 approval line" } } - simulate_paymentreadOnlyHint: true
Dry-run a payment through the pipeline. No money moves.
Input and output (4 arguments)
- amount{ amount: integer (minor units), asset: "USD" | "USDC" | … }required
The amount to test.
- counterpartystringrequired
Who would be paid.
- railRail
Force a rail for the test.
- mandate_idstring
Test against a mandate.
Returns: would_outcome (approve, hold or decline), reasons[] and the full 11-stage trace. No money moves and nothing is reserved.
- get_paymentreadOnlyHint: true
One payment with its status and trace.
Input and output (1 argument)
- payment_idstringrequired
A pi_ ID.
Returns: The payment with status, decision reasons and receipt reference.
- list_paymentsreadOnlyHint: true
The agent's recent payments.
Input and output (3 arguments)
- statusPaymentStatus
Filter: requested, held, approved, declined, authorized, settled, refunded, disputed, frozen, expired, failed.
- limitinteger
1–50, default 10.
- cursorstring
next_cursor from the previous page.
Returns: The calling agent's payments, newest first.
- request_refund
Ask the seller for a refund on a payment.
Input and output (3 arguments)
- payment_idstringrequired
The payment to refund.
- reasonstringrequired
Why, in a sentence the seller will read.
- amount{ amount: integer (minor units), asset: "USD" | "USDC" | … }
A partial refund. Omit for the full amount.
Returns: The payment with its refund request. Refunds re-credit the agent's budget windows when they post.
- cancel_subscription
Stop a tracked subscription.
Input and output (1 argument)
- subscription_idstringrequired
A tracked subscription.
Returns: The subscription with cancel_method and status.
- check_budgetreadOnlyHint: true
What's left in each budget before paying.
Input and output (1 argument)
- amount{ amount: integer (minor units), asset: "USD" | "USDC" | … }
Optional: would this amount fit?
Returns: Every budget in scope (agent, tree, team, org) with limit, spent, reserved and what is left, plus fits: true or false when an amount is given.
- get_policyreadOnlyHint: true
The agent's effective policy (read-only to agents).
Input and output
Returns: The agent's effective policy: each rule with the policy it comes from. Read-only: agents can never change their own policy.
- request_approval
Ask a person to approve; uses MCP elicitation where the client supports it.
Input and output (2 arguments)
- payment_idstringrequired
A held payment.
- notestring
Context for the approver.
Returns: The approval. Where the client supports MCP elicitation, the person is asked in their own client; otherwise by push, Slack, Teams or email.
- get_approvalreadOnlyHint: true
Status of a held payment.
Input and output (1 argument)
- approval_idstringrequired
An apr_ ID.
Returns: Status pending, approved, rejected or expired, with who decided and why.
- get_credential
A scoped credential for an approved payment (never a raw card number).
Input and output (1 argument)
- payment_idstringrequired
An approved payment.
Returns: A scoped credential for the rail: a network token, a checkout token, an x402 payment approval token, or a secure-fill handle for a single-use card. Never a raw card number.
- get_receiptreadOnlyHint: true
The signed receipt for a payment.
Input and output (1 argument)
- payment_idstringrequired
A settled payment.
Returns: The signed receipt (buyer, seller and ndStill signatures where present).
- pay_402
Pass an HTTP 402 challenge (x402 or MPP) to ndStill for a decision.
Input and output (3 arguments)
- challengeobjectrequired
The JSON body of the HTTP 402 response (x402 accepts[] or an MPP challenge).
- resourcestringrequired
The URL that answered 402.
- purposestring
Why the agent wants the resource.
Returns: A decision. When approved, a payment approval token bound to amount, payTo, resource and a nonce, valid for 60 seconds, for the wallet to sign against.
- quotereadOnlyHint: true
Which rails a counterparty takes, and what each costs.
Input and output (2 arguments)
- counterpartystringrequired
Who would be paid.
- amount{ amount: integer (minor units), asset: "USD" | "USDC" | … }
For fee estimates.
Returns: The rails the counterparty accepts that the owner allows, with cost and control level for each.
- freeze_agenthuman-scoped tokens only
Freeze an agent and everything under it.
Input and output (2 arguments)
- agent_idstringrequired
The agent to freeze (and everything under it).
- reasonstringrequired
Recorded in evidence.
Returns: The freeze with per-connector progress and measured stop times.
- list_approvalshuman-scoped tokens onlyreadOnlyHint: true
Held payments waiting on you.
Input and output (1 argument)
- limitinteger
Default 20.
Returns: Held payments waiting on the signed-in person.
- approvehuman-scoped tokens only
Approve a held payment (with your passkey when the policy asks).
Input and output (2 arguments)
- approval_idstringrequired
The approval to decide.
- passkey_assertionstring
Required when the policy asks for passkey assurance; the client opens the ndStill approval page to collect it.
Returns: The approval. The pipeline runs again before money moves.
- rejecthuman-scoped tokens only
Reject a held payment with a reason.
Input and output (2 arguments)
- approval_idstringrequired
The approval to decide.
- reasonstringrequired
The agent receives it.
Returns: The approval, rejected.
Writing good tool calls#
- Always send a purpose. It lands in the approval request, the evidence record and the books, and it is what a person reads when deciding.
- Check the budget before big purchases.
check_budgetis cheap and stops an agent from planning around money it doesn't have. - Quote before choosing a rail.
quotetells the agent which rails a seller takes and what each costs, so it can prefer the one its owner allows. - Use
simulate_paymentin planning. It runs the full pipeline with no money moving, so an agent can find out it would be held before it commits to a plan. - Pass 402 challenges through untouched.
pay_402takes the seller's challenge as received; ndStill reads the amount, asset, payTo and resource itself. See x402 and USDC.
Test mode#
Point the client at https://mcp.ndstill.com/mcp?mode=test, or use a nds_test_… key with the local package. Every tool behaves the same, but pay runs as a simulation: you get the would-be outcome and the full trace, no credential is minted and no money moves. Results carry test_mode: true so the model and your logs can tell. Test mode, simulation and replay explains what a simulation covers.
Security model#
- The server holds no long-lived secrets for your providers; it calls the ndStill API with the client's token like any other caller.
- Tool results never include raw card numbers, bank details or provider keys.
get_credentialreturns a scoped credential reference, a network or checkout token, or a secure-fill handle for browser agents. - Every call is attributed to the agent and the grant, appears in the request log, and every payment step is written to evidence.
- Prompt injection can make a model ask to pay the wrong seller, but it can't change the policy or the mandate. Mismatches are held at the mandate stage of the decision pipeline.