Skip to main content

HTTP API

The MCP Gateway exposes an HTTP endpoint for AI clients to connect to. All communication follows the MCP specification (JSON-RPC 2.0).

Endpoint

PropertyValue
URLhttp://localhost:8989/mcp
MethodPOST
Content-Typeapplication/json
AuthNone required for localhost (see Configuration)

Request Format

All requests follow JSON-RPC 2.0:

{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "context7_search",
"arguments": {
"query": "React useEffect"
}
},
"id": 1
}

Context Parameter

Include workspace context to enable proper server scoping and credential resolution:

{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "supabase_query",
"arguments": { "table": "users" },
"_context": {
"cwd": "/home/user/my-project"
}
},
"id": 1
}

The _context.cwd field tells the gateway which workspace the request is from, enabling proper credential resolution for workspace-scoped servers.

Supported Methods

MethodDescription
tools/listList all available tools from configured servers
tools/callExecute a tool on a backend server
resources/listList available resources
resources/readRead resource content
prompts/listList available prompts
prompts/getGet prompt with arguments
pingKeepalive (returns empty object)

Response Format

Success

{
"jsonrpc": "2.0",
"result": {
"tools": [
{
"name": "context7_search",
"description": "Search library documentation",
"inputSchema": { ... }
}
]
},
"id": 1
}

Error

{
"jsonrpc": "2.0",
"error": {
"code": -32600,
"message": "Server 'context7' not available"
},
"id": 1
}

Health & Status

Health Check

GET http://localhost:8989/health

{
"status": "healthy",
"version": "1.0.0",
"uptime_seconds": 3600
}

Status

GET http://localhost:8989/status

{
"gateway": {
"version": "1.0.0",
"uptime_seconds": 7200,
"port": 8989
},
"servers": {
"context7": { "status": "running", "memory_mb": 48 },
"supabase": { "status": "running", "memory_mb": 52 },
"github": { "status": "idle" }
},
"connections": {
"active": 3,
"total_requests": 1547
}
}

Error Codes

CodeMeaning
-32700Parse error (invalid JSON)
-32600Invalid request
-32601Method not found
-32602Invalid params
-32603Internal error
-32001Server unavailable
-32002Tool not found
-32003Missing credentials

Examples

List Tools

curl -X POST http://localhost:8989/mcp   -H "Content-Type: application/json"   -d '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 1
}'

Call a Tool

curl -X POST http://localhost:8989/mcp   -H "Content-Type: application/json"   -d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "context7_search",
"arguments": { "query": "useState hook" },
"_context": { "cwd": "/home/user/my-app" }
},
"id": 2
}'