Raw JSON-RPC Requests
Every method, as a curl you can paste.
#Modern (2026-07-28)
Each request carries its own _meta and mirrored headers.
# Discover
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
-H 'mcp-protocol-version: 2026-07-28' \
-H 'mcp-method: server/discover' \
-d '{
"jsonrpc": "2.0", "id": 1,
"method": "server/discover",
"params": {
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientInfo": { "name": "my-client", "version": "1.0.0" },
"io.modelcontextprotocol/clientCapabilities": {}
}
}
}'
# Call a tool
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
-H 'mcp-protocol-version: 2026-07-28' \
-H 'mcp-method: tools/call' \
-H 'mcp-name: hello' \
-d '{
"jsonrpc": "2.0", "id": 2,
"method": "tools/call",
"params": {
"name": "hello",
"arguments": { "name": "world" },
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientCapabilities": {}
}
}
}'
# Call a tool with progress — the response is an SSE stream
curl -N -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
-H 'mcp-protocol-version: 2026-07-28' \
-H 'mcp-method: tools/call' \
-H 'mcp-name: import' \
-d '{
"jsonrpc": "2.0", "id": 3,
"method": "tools/call",
"params": {
"name": "import",
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientCapabilities": {},
"progressToken": "p1",
"io.modelcontextprotocol/logLevel": "info"
}
}
}'
# Open a notification stream
curl -N -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
-H 'mcp-protocol-version: 2026-07-28' \
-H 'mcp-method: subscriptions/listen' \
-d '{
"jsonrpc": "2.0", "id": 4,
"method": "subscriptions/listen",
"params": {
"notifications": { "toolsListChanged": true },
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientCapabilities": {}
}
}
}'Tip
mcp-method and mcp-name must agree with the body. If you edit the JSON, edit the headers too — a mismatch is 400 + -32020 by design.
#Legacy (≤2025-11-25)
Same endpoint, initialize handshake, no _meta.
# Initialize
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-d '{
"jsonrpc": "2.0", "id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"clientInfo": { "name": "my-client", "version": "1.0.0" },
"capabilities": {}
}
}'
# List tools
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-d '{ "jsonrpc": "2.0", "id": 2, "method": "tools/list" }'
# Call a tool
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-d '{
"jsonrpc": "2.0", "id": 3,
"method": "tools/call",
"params": { "name": "hello", "arguments": { "name": "world" } }
}'
# Read a resource
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-d '{
"jsonrpc": "2.0", "id": 4,
"method": "resources/read",
"params": { "uri": "app:///config.json" }
}'
# Get a prompt
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-d '{
"jsonrpc": "2.0", "id": 5,
"method": "prompts/get",
"params": { "name": "code-review", "arguments": { "code": "console.log(1)", "language": "js" } }
}'
# List resource templates
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-d '{ "jsonrpc": "2.0", "id": 6, "method": "resources/templates/list" }'
# Autocomplete a prompt argument
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-d '{
"jsonrpc": "2.0", "id": 7,
"method": "completion/complete",
"params": {
"ref": { "type": "ref/prompt", "name": "deploy" },
"argument": { "name": "environment", "value": "pro" }
}
}'
# Set log level
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-d '{
"jsonrpc": "2.0", "id": 8,
"method": "logging/setLevel",
"params": { "level": "warning" }
}'
# Subscribe to resource updates
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-d '{
"jsonrpc": "2.0", "id": 9,
"method": "resources/subscribe",
"params": { "uri": "app:///config.json" }
}'
# Paginated list (cursor-based)
curl -X POST http://localhost:3000/mcp \
-H 'content-type: application/json' \
-d '{
"jsonrpc": "2.0", "id": 10,
"method": "tools/list",
"params": { "cursor": "eyJvZmZzZXQiOjEwfQ==" }
}'
# Open the SSE stream (requires `onStream`)
curl -N http://localhost:3000/mcp -H 'accept: text/event-stream'
# Tear down a session
curl -X DELETE http://localhost:3000/mcp -H 'mcp-session-id: <id>'With sessions enabled, read mcp-session-id from the initialize response (curl -i) and send it on every subsequent request.