Open app

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

mcp.json
{
  "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

VariableRequiredDefaultValue
AYO_AGENT_KEYyesnoneThe agent's base58 32-byte seed, from the done screen. Read lazily on the first tool call
AYO_STORE_DIRno~/.ayo/mcpFolder 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:

FieldTypeRequiredDescription
urlstringyesHTTP or HTTPS URL to request
method'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD'noHTTP method. Defaults to 'GET'
headersRecord<string, string>noExtra request headers. Do not set Ayo-Voucher or Ayo-Settle
bodystringnoRequest body for POST, PUT or PATCH. Ignored on GET and HEAD

Returns one text content item containing formatted JSON:

FieldTypeDescription
urlstringFinal response URL, or the requested URL if empty
statusnumberHTTP status code
statusTextstringHTTP status text
contentTypestring | nullValue of the content-type response header
bodystringResponse body as text

Errors are returned as tool results with isError: true and the error message as text. In addition to what fetch throws:

MessageCause
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:

FieldTypeRequiredDescription
mintstringnoSolana 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:

FieldTypeDescription
agentstringAgent PDA address
signingKeystringAgent's Ed25519 signing key address
ringAddressstringAgent's Privacy Rings receiving address
balancesRecord<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:

embed.ts
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())
ExportTypeDescription
createMcpServer(options?)(options?: AyoMcpOptions) => AyoMcpHandleCreates 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
AyoMcpOptionsAgentOptions & { agentKey?: string }All agent options, plus an optional agentKey override for AYO_AGENT_KEY
AyoMcpHandle{ server: McpServer; shutdown(): Promise<void> }Return type of createMcpServer