← What is MCP? | Next: Setting Up Supabase →
System Architecture
How MCP Communication Works
MCP uses JSON-RPC 2.0 over HTTP. Here is the request/response flow:
1. Tool Discovery -- The AI agent asks what tools are available:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}2. Tool Call -- The agent invokes a specific tool:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "search_products",
"arguments": {
"category": "Electronics",
"max_price": 500
}
}
}3. Response -- The server returns results via Server-Sent Events (SSE):
event: message
data: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"[{\"id\":1,\"name\":\"Wireless Mouse\",...}]"}]}}The transport layer used on Supabase Edge Functions is WebStandardStreamableHTTPServerTransport, which implements the MCP Streamable HTTP specification -- an HTTP-based transport that supports both request/response and server-initiated streaming via SSE.