Know which agent is calling
MCP Tower works out which AI agent made each request: ChatGPT, Claude, Claude Code, Cursor and
others. It sends the result to your server in one request header, X-MCP-Tower-Agent, before your
server answers. Your server can use it to adapt its answers, for example to return a ChatGPT widget
only to ChatGPT, or just to log the agent. The same result appears in your dashboard.
What the header looks like
Section titled “What the header looks like”Every MCP request MCP Tower forwards to your server carries the header:
X-MCP-Tower-Agent: chatgpt; tier=verified; method=signatureX-MCP-Tower-Agent: claude; tier=declared; method=client_info; mismatchX-MCP-Tower-Agent: other; tier=none; method=noneThe value is an RFC 9651 structured field item, so any
structured fields library parses it. For a plain check you only need the part before the first ;.
| Part | What it means |
|---|---|
| first item | The agent id: chatgpt, claude, claude_code, cursor, vscode, codex, … other when unknown |
tier | How far the id can be trusted: verified, strong, declared, inferred or none |
method | How the agent was recognized (below) |
mismatch | Present only when what the client says and the network it called from disagree |
The parts always come in this order. The agent ids are the ones your dashboard shows in its agent
list. New agents are added there over time, so treat an id you don’t know like other.
The header is sent even when MCP Tower recognized nothing (other; tier=none; method=none), so
your server can tell “MCP Tower saw no agent” from “this request did not come through MCP Tower”.
Uptime checks and MCP Tower’s scans of your tools don’t carry it.
Tiers and methods
Section titled “Tiers and methods”| Tier | Methods | What it means |
|---|---|---|
verified | signature, certificate | Cryptographically proven: a signed request or a client certificate |
strong | oauth_client | The OAuth client belongs to the agent and the call came from its network |
declared | meta, client_info, user_agent, or oauth_client from elsewhere | The client says so; a client can claim to be anyone |
inferred | ip_range, asn | Only the network points to one agent |
none | none | Nothing matched; the agent is other |
declared is the most common tier: most agents identify themselves only by their client name or
user agent. other is normal for SDK clients, scripts and MCP inspectors.
Express
Section titled “Express”app.use("/mcp", (req, res, next) => { const header = req.get("x-mcp-tower-agent") ?? ""; const agent = header.split(";")[0].trim() || "other"; // "chatgpt", "claude", … const tier = / tier=([a-z]+)/.exec(header)?.[1] ?? "none";
req.agent = agent; // Require proof only where it matters, for example before a sensitive tool. req.agentTrusted = tier === "verified" || tier === "strong"; next();});
// Later, in a tool handler:if (req.agent === "chatgpt") { // return the ChatGPT widget} else if (req.agent === "claude") { // return plain text with markdown}FastAPI
Section titled “FastAPI”from fastapi import FastAPI, Request
app = FastAPI()
@app.middleware("http")async def agent_from_mcp_tower(request: Request, call_next): header = request.headers.get("x-mcp-tower-agent", "") parts = [p.strip() for p in header.split(";")] params = dict(p.split("=", 1) for p in parts[1:] if "=" in p)
request.state.agent = parts[0] or "other" # "chatgpt", "claude", … or "other" request.state.agent_trusted = params.get("tier") in ("verified", "strong") return await call_next(request)Trust it only with the origin secret
Section titled “Trust it only with the origin secret”MCP Tower removes any X-MCP-Tower-* header a client sends and sets its own, so the value your
server sees through MCP Tower always comes from MCP Tower. A client that calls your server directly,
around MCP Tower, can send any header it likes. The header is only meaningful when your server also
checks X-MCP-Tower-Origin-Secret and rejects requests without it: see
Protect your origin with the origin secret.
Even then, declared is the agent’s own claim. Use the id to shape answers, and require
tier=verified or tier=strong before you rely on it for anything that matters.
If your server or a proxy in front of it rejects requests with unknown headers, allow
X-MCP-Tower-Agent there.