MCP
The gateway serves an MCP endpoint at POST /mcp. Each capability the API key may call appears as a tool with the capability’s name, description, and input schema, so an AI agent works with named business operations instead of database or network access.
Connect a client
For clients that accept the mcpServers format:
{
"mcpServers": {
"onprest": {
"url": "https://gateway.example.com/mcp",
"headers": {
"Authorization": "Bearer <YOUR_ONPREST_API_KEY>"
}
}
}
}If your client asks for a transport, choose Streamable HTTP, not SSE. The endpoint uses stateless JSON-RPC over HTTP and answers with JSON, not an event stream. Supported protocol versions are 2025-03-26, 2025-06-18, and 2025-11-25. Clients negotiate the version during initialize and send it in the MCP-Protocol-Version header afterwards; a request without the header is treated as 2025-03-26.
Browser-based clients must run on an origin listed in GATEWAY_CORS_ALLOWED_ORIGINS.
Methods
| Method | Purpose |
|---|---|
initialize | Version negotiation |
ping | Liveness check |
tools/list | The capabilities this API key may call |
tools/call | Run a capability |
resources/read | Fetch a file returned by a tool |
resources/list | Always empty; returned files are not browsable |
Calling a tool
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_customer",
"arguments": { "customer_id": 1 }
}
}arguments is the capability’s input object. The tool result contains the same envelope as a REST response, as a text item and, on 2025-06-18 and later, also as structuredContent. On those versions, tools/list includes an outputSchema for each tool.
Files are sent inline in arguments and returned as links or embedded resources; see Files. Annotations set on a capability become the tool hints readOnlyHint, destructiveHint, idempotentHint, and openWorldHint. They describe the tool and do not change what it may do.
Errors
MCP clients see failures at three levels:
| Level | Examples | Shape |
|---|---|---|
| HTTP | Missing or invalid API key, capability not allowed, source IP rate limit, gateway busy | HTTP 401, 403, 429, or 503 with the REST error body |
| JSON-RPC | Malformed JSON, unknown method, invalid parameters, agent not connected during tools/list | HTTP 200 with a JSON-RPC error |
| Tool | Input validation, execution failures, unknown tool name, capability rate limit | HTTP 200 with isError: true and the error envelope |
A tool error carries the same code and outcome as REST; see Errors. The gateway’s JSON body limit (1 MiB by default) applies to every MCP request.