Skip to content

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.

Every MCP request MCP Tower forwards to your server carries the header:

X-MCP-Tower-Agent: chatgpt; tier=verified; method=signature
X-MCP-Tower-Agent: claude; tier=declared; method=client_info; mismatch
X-MCP-Tower-Agent: other; tier=none; method=none

The 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 ;.

PartWhat it means
first itemThe agent id: chatgpt, claude, claude_code, cursor, vscode, codex, … other when unknown
tierHow far the id can be trusted: verified, strong, declared, inferred or none
methodHow the agent was recognized (below)
mismatchPresent 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.

TierMethodsWhat it means
verifiedsignature, certificateCryptographically proven: a signed request or a client certificate
strongoauth_clientThe OAuth client belongs to the agent and the call came from its network
declaredmeta, client_info, user_agent, or oauth_client from elsewhereThe client says so; a client can claim to be anyone
inferredip_range, asnOnly the network points to one agent
nonenoneNothing 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.

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
}
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)

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.