Skip to content
Skip to article
Docs Agent Access (MCP)
View as Markdown

Agent access over MCP

Connect an agent to DodoRouter's MCP server to inspect request logs, look up a session's spend or benchmark a candidate model on your traffic. The server is at /mcp on your DodoRouter instance. Sign in with OAuth and choose the permissions the agent can use. To send the coding client's own model calls through DodoRouter, configure its proxy connection separately. Coding client integrations.

Connect an agent

One command:

claude mcp add --transport http dodorouter https://api.dodorouter.com/mcp

Then use it once (/mcp in Claude Code, or just ask it to list your routers). Claude Code opens your browser, you sign in with your usual magic link if you are not already, and a consent screen asks what this agent may do. Approve, and it is connected.

What happened under the hood, in case you are debugging it:

  1. The agent discovered the server from /.well-known/oauth-protected-resource/mcp and /.well-known/oauth-authorization-server.
  2. It registered itself (RFC 7591) — nobody can pre-register a desktop agent, because its loopback callback port is not known until it starts.
  3. It sent you to /oauth/authorize, which rendered the consent screen against the DodoRouter session you already had.
  4. Your approval minted a short-lived access token, audience-bound to this MCP endpoint.

Registering grants nothing on its own. A client gets no token until a signed-in user approves it, and the token it gets carries only the permissions ticked on that screen.

Any MCP client that speaks OAuth works — the endpoint is not Claude Code specific. Point it at the same URL.

Claude web and desktop

Add a custom connector with URL https://api.dodorouter.com/mcp. Choose Sign in now for authentication and Register automatically for the OAuth client. Leave request headers empty. Claude registers its client, then opens DodoRouter's sign-in and consent flow; no manually supplied client ID or proxy API key is needed.

DodoRouter supports client_secret_post and client_secret_basic for hosted connectors, and none with PKCE for public clients such as Claude Code. The server advertises the same methods it accepts at registration and token exchange. Claude's Use Claude's published identity option requires Client ID Metadata Documents (CIMD), which this DodoRouter configuration does not enable.

What you are approving

Review the requested permissions on the consent screen. Clear any permissions the agent doesn't need before approving.

Permission What the agent can do
logs:read Inspect request metadata, token usage, cost, latency and status.
logs:read_bodies Read stored prompts and responses with get_log when paired with logs:read. It also unlocks candidate output previews in evaluation results.
evals:read List candidate models and prices, and read evaluation setups, scores, rankings and judge feedback.
evals:write Create, run, retry and cancel evaluations. Running or retrying a benchmark calls providers and can incur charges.

For a spend report, grant logs:read. To compare models on a logged request, add evals:read and evals:write. Grant logs:read_bodies when the agent also needs to inspect the text your application sent or received.

These permissions are independent. The tool list names any permission a connected agent still needs.

Which routers

Below the permissions, the same screen decides which routers they apply to. The default is every router your account has — including ones you create later, which is why it is an explicit choice rather than a silent default. Pick "Only the routers ticked below" to limit the agent to specific routers: an agent working on one product then cannot read another product's traffic, however its permissions are set.

The limit travels with the connection — reconnecting or refreshing keeps it, and the consent screen shows the previous selection when an agent asks again. Tools answer honestly from inside the limit: list_routers shows only what the connection reaches, and a router granted to an agent but later deleted or transferred simply stops being reachable.

The tools

Tool What it does Needs
get_guide The full evaluation workflow, in prose. An agent should read this first. —
list_routers Every router this connection reaches —
list_logs Recent requests, with evaluable per row; filters by end user, session, recording, model, provider and time window logs:read
list_sessions Sessions with per-session cost, tokens and latency logs:read
get_session One session's aggregates — "this question cost $1.40" logs:read
get_spend Spend grouped by served model or application user over a window logs:read
get_cache_stats Prompt-cache hit rate and token volumes over a window logs:read
list_recordings Capture windows of real traffic; benchmark one via create_eval logs:read
get_recording One capture window's aggregates logs:read
get_log One request by log ID or its x-request-id response header logs:read (+ logs:read_bodies for text)
list_eval_targets Your provider keys × the models each can serve, with list prices and per-key health (exclude any key not "valid" before planning runs) evals:read
list_evals Evaluations created against this router's logs evals:read
get_eval Status, per-model rankings and judge feedback. Pass include: ["runs"] for individual scores and candidate output previews. evals:read (+ logs:read_bodies for previews)
create_eval Create an evaluation (optionally start it immediately) evals:write
run_eval Run or re-run the whole benchmark evals:write
retry_eval Re-run only the runs that failed evals:write
cancel_eval Stop a running benchmark; stored answers stay evals:write
send_feedback Send feedback about the agent surface to the DodoRouter team —

To see what one customer spent, send X-Dodo-User-Id: customer-42 on that customer's proxy requests. Then call get_spend with the following arguments on a connection with logs:read. Include router if the connection reaches multiple routers.

{"group_by": "end_user", "end_user_id": "customer-42", "hours": 24}

The result includes request count, tokens, actual cost and list-price cost. Use the same end_user_id with list_logs to inspect individual requests. An explicit null selects unattributed requests. Proxy request example.

create_eval accepts one request_log_id, a request_log_ids set, or a recording_id — with a set, every candidate answers every log and the ranking aggregates across them, so the score answers "on my traffic" rather than "on this one request". A recording is the strongest source: every replayable request captured during the window becomes a source log (evenly sampled across the capture when more than 20 are replayable), so the sample is production traffic nobody hand-picked. It also takes prompt_variants to hold the model constant and vary the request: a variant can replace the system prompt, or patch individual messages (message_patches) — swap a tool-result for a compressed version, say, and measure whether reasoning survives. Each variant patches the served request, and the ranking carries one row per model × variant under the same judge. For recorded agent traffic, comparison_mode: "next_action" turns the benchmark into a per-decision preference test: the judge compares each candidate's proposed next move against what production actually did over the same frozen history.

Most tools take an optional router slug. It is optional when your connection reaches exactly one router and required when it reaches several — rather than silently picking one.

Call get_guide before starting a benchmark. By default, create_eval adds the model that served each source when its key is available. Check the resulting candidates for a baseline, inspect rubric_feedback, and use list_cost_usd to compare subscription and metered keys. Walk through a model comparison.

Seeing what an agent did

Open Agent Activity in the sidebar. Under Connected agents, each client shows its call count, when it was last seen and how often it read prompt or response text. What agents did lists recent calls and their outcomes. Select Denied to investigate a missing permission.

This is not your router's API key

A router's API key sends traffic. It cannot read traffic back, and that is deliberate: if one credential did both, a leaked .env would stop being "someone is burning my tokens" and become "someone has every prompt my product ever sent".

So:

  • Your router key on /mcp → 401. Use the OAuth flow.
  • An agent connection on /r/{router}/v1/chat/completions → 401. Use the router key.

To test a prompt change on a stored request, supply prompt_variants to create_eval. To collect a new source request, send it from your application using the router API key.

Self-hosting

The OAuth server needs HTTPS. Both the issuer and the audience must be https:// URLs — there is no localhost exemption.

ATTESTO_ISSUER and ATTESTO_AUDIENCE are read at boot, not baked into the release — set them wherever you set the app's other runtime environment variables (e.g. ~/dodorouter/.env on the server) and restart:

ATTESTO_ISSUER=https://router.example.com
ATTESTO_AUDIENCE=https://router.example.com/mcp

If unset, the issuer defaults to https:// plus the endpoint's own public host (PHX_HOST), and the audience defaults to <issuer>/mcp — so a correctly configured PHX_HOST alone is often enough, and no release needs to be rebuilt just to change these.

Behind a TLS-terminating reverse proxy (Caddy, nginx, Traefik), the app itself receives plain HTTP, and the proxy's X-Forwarded-Proto: https header is the only evidence a request arrived over TLS. That header is believed only when it comes from a trusted peer — otherwise any plain-HTTP client could claim it. A proxy on the same machine (loopback) is trusted out of the box. A proxy that reaches the app across a network — a Docker bridge, a separate box — must be listed explicitly, as comma-separated IPs or CIDRs:

ATTESTO_TRUSTED_PROXIES=172.16.0.0/12

Get this wrong and every OAuth endpoint answers 400 with "the request must be made over TLS", even though your clients are connecting over HTTPS — registration fails, so no agent can connect at all.

For local development, mix attesto_phoenix.gen.dev_https (with mkcert installed) generates a locally-trusted certificate and the app serves TLS on port 4443 alongside the plain HTTP dashboard on 4000.

Troubleshooting

Claude says "Couldn't register with dodorouter's sign-in service". Earlier DodoRouter releases advertised client_secret_post but rejected that method at /oauth/register. They also failed to persist issued client secrets in the field used for token authentication. Update the server, then remove and re-add the connector using Sign in now and Register automatically. Re-registering issues fresh credentials; retrying an old broken registration cannot repair them. See OAuth registration troubleshooting.

Cache evidence without prompt access

get_log includes cache_diagnosis with logs:read, even when bodies are withheld. It contains observation (zero_read, cache_read, or unreported), cause, confidence, a human-readable message, first_change (component and one-based item index where available), and previous_log_id. Comparison is session scoped and computed when the row is written. New message appends are normal growth. Full fingerprints are not returned through MCP.

current and previous report provider/key identity, a router-scoped endpoint hash, resolved serving model, hashed prompt_cache_key when present, explicit requested retention, attempt start/end timestamps (Unix milliseconds), and other_in_flight_router_requests (other active requests on this DodoRouter node, across the router). changes names routing, cache-key, retention, tracked-header, and component differences; matched_messages and previous_message_count give the unchanged-prefix numerator and denominator. No raw header values, endpoint URLs, or cache-key text are exposed. Header comparison covers anthropic-beta, anthropic-version, openai-beta, chatgpt-account-id, session_id, conversation_id, and x-session-id; other headers are not compared. Actual provider shard/expiry are null. The previous request is selected by start time, among completed logs already available when the row is written.

prefix_changed is an observed structural difference, not proof of provider causality. Expiry is only likely and a concurrency race only possible. provider_no_hit reports zero reads with an unchanged shared prefix; provider eligibility, shard and actual expiry remain unknown. Existing rows without fingerprints return a null diagnosis. Use list_logs filtered by session_id, then get_log for individual explanations. See cache troubleshooting.

Every tool refuses with "no active subscription". Hosted service only: the account that owns the connection has no active subscription, so tools list but will not run — the same paywall that makes the proxy answer 402. The account owner subscribes on their billing page; the connection itself is fine and starts working the moment they do. Not applicable to self-hosted instances unless billing was enabled there.

The agent connects but every tool says "UNAVAILABLE". It is missing permissions. Reconnect and tick the ones it needs on the consent screen — the tool description names them.

Every OAuth request fails with "the request must be made over TLS", but the URL is https. TLS terminates at your reverse proxy, and the app is not trusting that proxy's X-Forwarded-Proto header. A loopback proxy is trusted by default; anything else must be listed in ATTESTO_TRUSTED_PROXIES — see Self-hosting above. Some MCP SDKs raise the same error on their side when the WWW-Authenticate challenge on /mcp advertises an http:// metadata URL — check that header with curl -si -X POST <base>/mcp; a current DodoRouter pins it to the configured https audience origin.

POST /mcp returns 401 with a WWW-Authenticate challenge. That is the flow working: the challenge points the client at the discovery document so it can start the OAuth exchange. If the client stops there, check that ATTESTO_ISSUER matches the URL actually being served.

The consent screen never appears. The agent must be able to reach /oauth/authorize in a browser on the same host you are signed in to. A mismatch between the issuer and the address you visit means you are signed in to one origin and consenting on another.

Consent works, then the token exchange returns a 500. The server has no signing key. Everything up to the callback runs unsigned, so a missing key surfaces only at the final step — set ATTESTO_SIGNING_KEY_PATH (see Self-hosting environment variables) and restart.

Nothing to evaluate. list_logs only shows requests your router actually served, and only some are replayable — evaluable and not_evaluable_because say which and why. A request whose stored body was truncated cannot be replayed.

Realtime rows report usage per voice turn and errors during connection setup. Filter list_logs by session_id and provider (google for Gemini Live, openai for OpenAI Realtime). With logs:read_bodies, get_log includes Gemini's turn status and reported usageMetadata. The replay blocker realtime_session means the log contains metadata and omits the original audio conversation. Gemini Live logs · OpenAI Realtime logs.