All topics
Capability

MCP — Model Context Protocol

Give agents a real API, not a scraper target.

Model Context Protocol (MCP) is the USB-C of AI agents. Instead of teaching every model to scrape your site, you ship one JSON-RPC endpoint that exposes tools (functions), resources (data), and prompts. Any MCP-compatible client can then drive your product safely.

Anatomy of an MCP server

  • A POST endpoint (typically /mcp or /.well-known/mcp.json) that speaks JSON-RPC 2.0.
  • An initialize handshake declaring protocolVersion and serverInfo.
  • tools/list returning the functions agents can call.
  • tools/call executing those functions with validated arguments.
  • CORS headers so browser-based agents (Claude.ai, ChatGPT) can reach you.

Minimal handler

app.post('/mcp', express.json(), (req, res) => {
  const { id, method, params } = req.body;
  if (method === 'initialize') {
    return res.json({ jsonrpc: '2.0', id, result: {
      protocolVersion: '2024-11-05',
      capabilities: { tools: {} },
      serverInfo: { name: 'acme', version: '1.0.0' }
    }});
  }
  if (method === 'tools/list') {
    return res.json({ jsonrpc: '2.0', id, result: { tools: [
      { name: 'search', description: 'Search the catalog',
        inputSchema: { type: 'object', properties: { q: { type: 'string' } } }}
    ]}});
  }
  // ... tools/call
});

If you only ship one agent-facing endpoint this year, ship MCP.