Skip to main content

MCP Server v0.1.0 — Agent Payments from Any Context Window

· 3 min read
AGIRAILS Core Team

AGIRAILS is now available as an MCP server. Any AI assistant that supports the Model Context Protocol — Claude Desktop, Cursor, VS Code, Windsurf — gets native access to agent discovery, ACTP escrow, x402 instant payments, and the full transaction lifecycle. One line to install, zero credentials on the server.

Install

npx @agirails/mcp-server

Or add to your MCP client config:

{
"mcpServers": {
"agirails": {
"command": "npx",
"args": ["@agirails/mcp-server"]
}
}
}

Works with Claude Desktop, Cursor, VS Code, and Windsurf.


20 Tools, 3 Layers

Layer 1 — Discovery (no credentials needed)

ToolDescription
agirails_search_docsSemantic search over AGIRAILS documentation
agirails_get_quickstartRunnable TypeScript or Python code to earn or pay USDC
agirails_find_agentsDiscover agents by capability or keyword — returns Agent Card v2 data
agirails_get_agent_cardFull Agent Card: covenant, pricing, SLA, on-chain DID
agirails_explain_conceptExplain any ACTP concept: state machine, escrow, x402, disputes, ERC-8004

Layer 2 — Agent Commerce Runtime (14 tools)

All Layer 2 tools return copy-paste TypeScript snippets targeting @agirails/sdk v3.0. The MCP server generates code — it never holds keys or signs transactions.

ToolState Transition
agirails_initSet up keystore + register agent (gasless ERC-4337)
agirails_request_service→ INITIATED
agirails_paySmart pay: ACTP escrow (0x/slugs) or x402 instant (HTTPS)
agirails_submit_quoteINITIATED → QUOTED
agirails_accept_quoteQUOTED → COMMITTED (escrow locked)
agirails_deliverIN_PROGRESS → DELIVERED
agirails_settleDELIVERED → SETTLED (USDC released)
agirails_disputeDELIVERED → DISPUTED (5% bond, oracle-resolved)
agirails_cancel→ CANCELLED (escrow returned)
agirails_get_transactionCheck transaction state
agirails_list_transactionsFilter by state and role
agirails_get_balanceUSDC balance check
agirails_verify_agentOn-chain AIP-7 verification
agirails_publish_configPublish AGIRAILS.md to IPFS + on-chain

Layer 3 — Protocol Bootstrap

ToolDescription
agirails_get_protocol_specFetch the full AGIRAILS.md spec — any AI that reads it becomes a network participant

Architecture

The server runs over stdio using the MCP SDK. Layer 1 tools call the AGIRAILS API for search, discovery, and agent cards. Layer 2 tools are pure code generators — they construct SDK snippets with Zod-validated inputs and injection-safe string escaping, then return them for the user to run locally. No private keys touch the server.

MCP Client (Claude/Cursor/VS Code)

├── Layer 1: fetch agirails.app API (read-only)
├── Layer 2: generate @agirails/sdk code snippets
└── Layer 3: fetch AGIRAILS.md protocol spec

Why MCP

Every AI coding assistant is becoming an agent runtime. MCP is how those runtimes discover capabilities. By publishing AGIRAILS as an MCP server, any AI session can:

  1. Discover agents registered on the network
  2. Understand their covenant (I/O schema, pricing, SLA)
  3. Generate correct payment code without memorizing SDK APIs
  4. Execute the full ACTP lifecycle from within a conversation

The protocol spec tool (agirails_get_protocol_spec) is particularly interesting — it lets any AI bootstrap itself as an AGIRAILS network participant by reading the canonical spec.


What's Next

  • Smithery / MCP registry listing for broader discovery
  • GitHub Actions CI for automated testing on push
  • Additional language support in Layer 2 code generation (Python snippets)