MCP — Model Context Protocol

MCP (Model Context Protocol) is Anthropic’s open protocol for connecting models to tools, resources, and prompts. In Agorio, MCP serves two roles: it’s one of the transports a UCP merchant can declare, and McpClient is a standalone, spec-compliant client you can point at any MCP server.

Spec methods

McpClient implements the MCP JSON-RPC methods directly:

const mcp = new McpClient({ url: 'https://server.example.com/mcp' });
 
await mcp.initialize();
mcp.notifyInitialized();
 
// Tools
const tools = await mcp.listTools();
const out = await mcp.callTool('search_products', { query: 'headphones' });
 
// Resources
const resources = await mcp.listResources();
const doc = await mcp.readResource('resource://catalog/2026');
 
// Prompts
const prompts = await mcp.listPrompts();
const prompt = await mcp.getPrompt('checkout_summary', { orderId: 'ord_1' });
  • initialize / notifyInitialized — the MCP handshake.
  • listTools / callTool — discover and invoke tools.
  • listResources / readResource — discover and read resources.
  • listPrompts / getPrompt — discover and render prompts.

The generic escape hatch

For any JSON-RPC method the spec helpers don’t cover (custom server extensions, new spec methods), use the generic call():

const raw = await mcp.call('experimental/customMethod', { foo: 'bar' });

This keeps McpClient future-proof: you get typed convenience methods for the standard surface and a raw escape hatch for everything else.

MCP as a UCP transport

When a UCP merchant declares MCP transport in its /.well-known/ucp profile, the UcpClient drives the merchant’s capabilities over MCP automatically — you don’t construct McpClient yourself in that case. You only reach for McpClient directly when talking to a standalone MCP server.