Ops MCP: ask the gateway from your IDE
Last updated:
On this page
The gateway ships with a built-in, read-only MCP server at /v1/mcp. It lets an AI
assistant in your IDE read the gateway's operational state and answer questions like
"why did p95 go up yesterday?", "which model is used most this week?" or "how many
errors per class did we have in the last 24 hours?". No SSH and no hand-written calls
against the admin API.
Who it is for
The ops MCP is built for on-prem and self-hosted installations of the staik gateway, where your own operators want to connect Claude Code, Cursor or GitHub Copilot to their gateway. It is included in every installation.
The ops MCP shows operations data for the whole installation, not just for its own user. Only give the analyst role to the people who operate the installation, never to individual users or teams on a gateway shared by several of them.
staik Cloud
The ops MCP is not available to customers on staik Cloud (api.staik.se), because it shows operations data for the whole installation, not per customer. It is only used internally by staik's operations.
Access: the analyst role
The MCP requires an API key with an operations role, set through the account's
account_tag:
| Role | Tag (default) | /v1/mcp | /v1/admin/* |
|---|---|---|---|
| Analyst | analyst (ANALYST_ACCOUNT_TAGS) | Yes, read-only | No (403) |
| Admin | admin (ADMIN_ACCOUNT_TAGS) | Yes, read-only | Yes |
| Regular user | none | No (403) | No (403) |
The analyst role is read-only: it reaches the MCP and no admin endpoints, neither reading nor writing. A missing or invalid key gets 401.
Create an analyst key
On an on-prem installation, create the key with staik-admin in the gateway container:
docker compose exec gateway staik-admin create-key --analyst --email bi@onprem.localThe key (sk-st-...) is printed once. Store it in a password manager or as an environment
variable. The examples below read it from STAIK_OPS_KEY:
export STAIK_OPS_KEY=sk-st-your-analyst-keyOne key per person
Create a separate analyst key for each person or assistant. You can then revoke one key without affecting anyone else, and the rate limit applies per key.
Where the data goes
Tool results go to the IDE's model
The MCP server sends its results to whichever model your IDE uses. If the IDE runs against
an external model (for example a cloud service outside your installation), the operations
data leaves the installation. The results are aggregates without prompt text, email
addresses or keys, but they still describe your operations: volumes, models, errors and
latency. Point the IDE at your own model if the data should stay with you. How to point
Claude Code at a staik gateway (with ANTHROPIC_BASE_URL) is covered in the
Claude Code guide.
Connect your IDE
The MCP uses the Streamable HTTP transport and authenticates with an
Authorization: Bearer header. Replace https://your-gateway with your gateway's address.
Use an environment variable for the key instead of writing it into the config file,
especially if the file is committed.
# Add the server (scope "project" writes .mcp.json in the repo)
claude mcp add --transport http --scope project staik-ops https://your-gateway/v1/mcp \
--header 'Authorization: Bearer ${STAIK_OPS_KEY}'
# Or write .mcp.json yourself:
# {
# "mcpServers": {
# "staik-ops": {
# "type": "http",
# "url": "https://your-gateway/v1/mcp",
# "headers": { "Authorization": "Bearer ${STAIK_OPS_KEY}" }
# }
# }
# }
# Check the connection
claude mcp listPer client:
- Claude Code expands
${STAIK_OPS_KEY}in.mcp.jsonwhen the server starts. With single quotes around the header inclaude mcp add, the reference, not the key, ends up in the file. - Cursor reads
.cursor/mcp.jsonin the project, or~/.cursor/mcp.jsonfor all projects, and uses the${env:NAME}syntax. Remote servers do not supportenvFile, so the variable must be set in the environment Cursor is started from. - GitHub Copilot in VS Code reads
.vscode/mcp.jsonin the workspace, withserversas the top-level key and${env:NAME}for environment variables. Newer versions of VS Code also read a.mcp.jsonin the workspace root in the same format as Claude Code (mcpServersand${NAME}). Start the server from the MCP view and use it in agent mode.
Tools
All tools are read-only (readOnlyHint: true), return aggregates and use UTC. Results come
both as structured data and as JSON text.
| Tool | Arguments | What it answers |
|---|---|---|
get_health | none | The state right now: status, database pool, per backend circuit breaker, error rate and p95, node liveness, queues and prompt cache |
get_error_summary | hours 1 to 168 (24) | Errors per HTTP status and reason, overall error rate |
get_latency_p95_history | hours 1 to 168 (24) | p95 latency per backend and hour, with circuit state |
get_gpu_throughput | hours 1 to 168 (24) | Decode throughput (completion tokens per second) per GPU group in 15-minute buckets, plus the peak over the last 7 days |
get_routing_overview | days 1 to 30 (7) | Routing decisions: how many requests a smaller model could have handled, share with images, tools and cache hits, reasons, latency per model and requests per client program (product name from the User-Agent) |
get_usage | hours 1 to 720 (24), group_by model, endpoint or node, bucket none, hour (max 168 hours) or day | Requests, tokens, cache hits, average and p95 duration and number of distinct users per group, optionally as a time series |
get_model_catalog | none | Active models with context window and capabilities, plus ongoing maintenance windows |
Example questions
- "Are all backends healthy right now? If not, which circuit breaker is open?"
(
get_health) - "Why did p95 go up yesterday afternoon? Compare the backends hour by hour."
(
get_latency_p95_history) - "Which model uses the most tokens this week, and how much of it comes from cache?"
(
get_usagewithgroup_by: model,hours: 168) - "How many 429s and 504s did we have in the last 24 hours, and why?"
(
get_error_summary) - "How many requests could a smaller model have handled last week?"
(
get_routing_overview)
Data protection
By default the tools only return aggregates per model, endpoint, node and time window. The following never leaves the gateway through the MCP: prompt and response text, email addresses, API keys and key prefixes, customer ids, request ids, IP hashes, internal backend and node addresses, and database errors.
If you want per-user detail, enable MCP_ALLOW_PER_USER. get_usage and
get_error_summary then include a list of the most active users, but only as a stable
pseudonym (user- followed by an HMAC of the customer id). The pseudonym requires a secret
salt in MCP_PSEUDONYM_SALT. With an empty salt only aggregates are returned and the
gateway logs an error.
Settings
Set as environment variables on the gateway.
| Variable | Default | Description |
|---|---|---|
ANALYST_ACCOUNT_TAGS | analyst | Comma-separated tags that grant the analyst role. create-key --analyst sets the first one |
ADMIN_ACCOUNT_TAGS | admin | Tags that grant the admin role, which also reaches the MCP |
MCP_ALLOW_PER_USER | false | Per-user rows in the results, always pseudonymised |
MCP_PSEUDONYM_SALT | empty | Secret salt for the pseudonyms. Required for per-user rows. Changing the salt changes every pseudonym |
MCP_RATE_LIMIT_PER_MINUTE | 60 | Max requests per minute and key. Above the limit you get 429 with Retry-After. 0 disables it |
CORS_ALLOWED_ORIGINS | empty | Allowed web origins. A request with an unknown Origin gets 403. IDEs send no Origin |
Protocol
POST /v1/mcpwith JSON-RPC 2.0:initialize,ping,tools/listandtools/call. Responses areapplication/json.- The server is stateless: no session and no SSE stream.
GETandDELETEreturn 405. - Protocol versions:
2024-11-05,2025-03-26,2025-06-18and2025-11-25. - Invalid arguments give a tool result with
isError: trueand an explanation, so the model can correct the call.
Test the connection without an IDE:
curl -s https://your-gateway/v1/mcp \
-H "Authorization: Bearer $STAIK_OPS_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'