MCP server
Every tool, environment variable and export of @ayo/mcp.
@ayo/mcp (0.1.0) is a stdio MCP server that wraps @ayo/sdk so any MCP client can read an agent's private balance and pay Ayo services. It runs on Node 22 and is served as a tarball from https://ayo.money/ayo-mcp-0.1.0.tgz.
Client configuration
{
"mcpServers": {
"ayo": {
"command": "npx",
"args": ["-y", "--package=https://ayo.money/ayo-mcp-0.1.0.tgz", "ayo-mcp"],
"env": {
"AYO_AGENT_KEY": "<your-agent-key>",
"AYO_RING": "spr",
"AYO_RPC_URL": "<your-helius-mainnet-rpc-url>",
"AYO_API_URL": "https://api.ayo.money"
}
}
}
}Environment
| Variable | Required | Default | Value |
|---|---|---|---|
AYO_AGENT_KEY | yes | none | The agent's base58 32-byte seed, from the done screen. Read lazily on the first tool call |
AYO_STORE_DIR | no | ~/.ayo/mcp | Folder for the open-tab journal |
@ayo/mcp passes the rest of the environment through to @ayo/sdk: AYO_RING, AYO_RPC_URL, AYO_API_URL, AYO_PROGRAM_ID, AYO_RING_PROGRAM_ID, HELIUS_API_KEY, SPR_INDEXER_URL and SPR_PROVER_URL. See SDK environment.
Tools
ayo_fetch
Fetches an HTTP or HTTPS URL through agent(key).fetch. If the endpoint answers 402 with Ayo-Hello, the server opens a tab, repeats the call with a signed voucher, and settles the tab confidentially. Free endpoints return as is.
Inputs:
| Field | Type | Required | Description |
|---|---|---|---|
url | string | yes | HTTP or HTTPS URL to request |
method | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | no | HTTP method. Defaults to 'GET' |
headers | Record<string, string> | no | Extra request headers. Do not set Ayo-Voucher or Ayo-Settle |
body | string | no | Request body for POST, PUT or PATCH. Ignored on GET and HEAD |
Returns one text content item containing formatted JSON:
| Field | Type | Description |
|---|---|---|
url | string | Final response URL, or the requested URL if empty |
status | number | HTTP status code |
statusText | string | HTTP status text |
contentType | string | null | Value of the content-type response header |
body | string | Response body as text |
Errors are returned as tool results with isError: true and the error message as text. In addition to what fetch throws:
| Message | Cause |
|---|---|
AYO_AGENT_KEY is required. Set it in your MCP server env configuration. | AYO_AGENT_KEY was not set and no agentKey option was passed |
Only http and https URLs are supported. | url uses a scheme other than http: or https: |
ayo_balance
Reads the agent's confidential balances in Privacy Rings and its public addresses.
Inputs:
| Field | Type | Required | Description |
|---|---|---|---|
mint | string | no | Solana mint address to filter by. Returns "0" if the agent holds none of that mint; omit to return all balances |
Returns one text content item containing formatted JSON:
| Field | Type | Description |
|---|---|---|
agent | string | Agent PDA address |
signingKey | string | Agent's Ed25519 signing key address |
ringAddress | string | Agent's Privacy Rings receiving address |
balances | Record<string, string> | Unspent shielded balances in base units, keyed by mint address |
Lifecycle and settlement
The ayo-mcp binary connects over stdio (StdioServerTransport) and installs handlers on SIGINT, SIGTERM and stdin end. When any of them fires, it calls shutdown() on the underlying agent client so every open tab settles before the process exits.
Open tabs are journaled under AYO_STORE_DIR (~/.ayo/mcp by default). If the process exits before settlement finishes, the next run loads the journal and resumes settling.
Programmatic API
@ayo/mcp also exports the server factory for embedding in your own Node process:
import { createMcpServer, MCP_VERSION, type AyoMcpOptions, type AyoMcpHandle } from '@ayo/mcp'
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
const { server, shutdown } = createMcpServer({
agentKey: process.env.AYO_AGENT_KEY,
})
await server.connect(new StdioServerTransport())| Export | Type | Description |
|---|---|---|
createMcpServer(options?) | (options?: AyoMcpOptions) => AyoMcpHandle | Creates an McpServer with ayo_fetch and ayo_balance registered, plus a shutdown() function that settles open tabs and closes the server |
MCP_VERSION | '0.1.0' | Server version string |
AyoMcpOptions | AgentOptions & { agentKey?: string } | All agent options, plus an optional agentKey override for AYO_AGENT_KEY |
AyoMcpHandle | { server: McpServer; shutdown(): Promise<void> } | Return type of createMcpServer |