Skip to content

Connecting to MCP

POST https://api.mety.ai/mcp
  • Streamable HTTP, stateless. No session id and no SSE stream: every request stands alone. GET and DELETE answer 405 (Allow: POST).
  • JSON responses. Send Accept: application/json, text/event-stream (the transport requires both) and Content-Type: application/json.
  • Auth on every request: Authorization: Bearer <API key or OAuth access token>. See API keys and OAuth.
  • Server name mety. Its instructions explain the model in five lines; good clients pass them to the model.
  • Same handlers, scopes, validation, audit (surface mcp), rate limits (20/s, 1 200/min) and plan limits as REST.
  • Optional Mety-Agent-Run: <run id> header, written to the audit log with every change.
  • Browser requests are refused (403 FORBIDDEN) unless their Origin is https://app.mety.ai. Call it from a server or a native client.
Terminal window
curl -s https://api.mety.ai/mcp \
-H "Authorization: Bearer $METY_KEY" -H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1"}}}'

A tool result carries structuredContent (the REST envelope { data, meta? }) and one text item with the same JSON:

{
"jsonrpc": "2.0", "id": 3,
"result": {
"content": [{ "type": "text", "text": "{\"data\":[…],\"meta\":{\"page\":1,\"perPage\":10,\"total\":27}}" }],
"structuredContent": { "data": [ … ], "meta": { "page": 1, "perPage": 10, "total": 27 } }
}
}

These come back as HTTP errors with the Mety error envelope, before any tool runs:

Status Code When
401 UNAUTHENTICATED No Bearer token. WWW-Authenticate points at the OAuth discovery
401 INVALID_API_KEY / INVALID_TOKEN Bad, revoked or expired key or token (error="invalid_token")
403 FORBIDDEN A browser Origin other than the app
405 METHOD_NOT_ALLOWED Anything but POST
429 RATE_LIMITED With Retry-After

Everything else (validation, scopes, conflicts, plan limits) is a tool result with isError: true. See errors and results.

Client snippets for Claude Code, the Claude Agent SDK, Claude.ai, ChatGPT and Grok are on connecting clients.