To fingerprint an MCP server, POST a JSON-RPC server/discover request with the MCP-Protocol-Version and Mcp-Method headers; a modern server answers with a DiscoverResult, or with a modern JSON-RPC error that still identifies it as MCP. If the reply is an empty or unrecognized error, fall back to initialize for 2025-era servers, then a GET that opens an SSE stream with an endpoint event for the deprecated HTTP+SSE transport.
I work at Solo.io, which makes agentgateway.
The fingerprint is not the 200. Most probes only recognize a successful handshake. Under the 2026-07-28 spec, a modern server also identifies itself through the way it says no. This page is how to read those replies. Why shadow MCP servers are hard to track is the hub, and find shadow MCP servers in your environment is the walk across the places you look.
Request shapes and status codes below come from the 2026-07-28 discover spec and the Streamable HTTP transport spec, re-checked November 15, 2026. Rows in the table are labeled as the spec states them. I did not re-run the scanner lab for this page, so nothing below is an observed lab result.
Why can’t you identify an MCP server by its port?
There is no standard port. You identify a server by asking a question only MCP answers. The port question, and the rest of the find walk, is on find shadow MCP servers in your environment.
What does a server/discover probe look like?
Streamable HTTP requires MCP-Protocol-Version and Mcp-Method on every POST. The header must match the body, or a compliant server returns 400 and a HeaderMismatch JSON-RPC error (code -32020). Version and client identity go in _meta:
POST /mcp
MCP-Protocol-Version: 2026-07-28
Mcp-Method: server/discover
Content-Type: application/json
{
"jsonrpc": "2.0",
"id": "discover-1",
"method": "server/discover",
"params": {
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientInfo": {
"name": "ExampleClient",
"version": "1.0.0"
},
"io.modelcontextprotocol/clientCapabilities": {}
}
}
}
A modern server MUST implement server/discover. A successful reply is a DiscoverResult: supportedVersions, capabilities, optional instructions, and serverInfo in _meta. The instructions field is just a field in that response. The injection risk around it is on MCP discovery prompt injection.
How do you read each response?
The 200 is only one row. Read the status and the body together. Every row below is per the 2026-07-28 Streamable HTTP or discover spec, not observed in the lab for this page.
| Probe | Reply | What it means |
|---|---|---|
| POST server/discover | 200, result has supportedVersions and capabilities | Modern MCP server. serverInfo is self-reported; log it, do not trust it. |
| POST server/discover | 400, JSON-RPC UnsupportedProtocolVersionError listing supported versions | Modern MCP server that does not speak the version you sent. Retry with one it lists. |
| POST server/discover | 400, JSON-RPC error -32020 HeaderMismatch | Modern MCP server. Your probe’s headers and body disagree. Fix the probe. |
| POST server/discover | 404 with JSON-RPC -32601 Method not found | Answers like a modern server that lacks the method. Discover is a MUST, so this is either non-conforming or not MCP at all (see the false positive section). |
| POST server/discover | 400, 404, or 405 with an empty or non-MCP body | Not a recognized modern JSON-RPC error. Fall back to initialize, then to a GET for HTTP+SSE. |
| POST server/discover | 401 | Protected. The hub section on the 401 that tells you nothing covers the WWW-Authenticate metadata the authorization spec requires. |
| POST initialize | 200 with protocolVersion and serverInfo, maybe an Mcp-Session-Id header | 2025-era Streamable HTTP server (2025-03-26 to 2025-11-25). |
| GET the MCP endpoint | 405 | A modern-only server SHOULD return 405 on GET or DELETE. Absence of 405 proves nothing, because that response is a SHOULD. |
| GET the URL | text/event-stream whose first event is endpoint | HTTP+SSE, 2024-11-05, deprecated since 2025-03-26. Still an MCP server. |
The fallback rule is in the transport spec. On 400, inspect the body before you give up on the modern era. If the body is a recognized modern JSON-RPC error, the server already told you it is modern: retry with a version it listed, or fix the headers, rather than falling back. If the body is empty or unrecognized, send initialize and stay on the legacy version for later requests. If initialize also fails with 400, 404, or 405 and the body is still not a recognized modern error, issue a GET and look for that first endpoint event.
What does the Origin header tell you?
The spec says a server MUST validate the Origin header on incoming connections, to stop DNS rebinding, and MUST return 403 when that header is present and invalid. A probe with a foreign Origin, such as https://probe.invalid, is a second check you can add for free. A local or internal server that answers 200 while that header is present is missing a MUST. That is the spec rule and the check. I do not have a lab result for it on this page.
When running locally, the same spec says servers SHOULD bind only to 127.0.0.1 rather than all interfaces.
Can a non-MCP service look like an MCP server?
Yes. -32601 is the generic JSON-RPC “Method not found” code, so any JSON-RPC service can return it. Treat a -32601 alone as JSON-RPC, maybe MCP, and confirm with initialize or a tools/list. A 200 DiscoverResult, an UnsupportedProtocolVersionError, or a HeaderMismatch is a much stronger modern-MCP signal than a lone method-not-found.
How do you fingerprint a stdio MCP server?
The discover spec says a client that supports both eras SHOULD send server/discover first on stdio, then fall back. Do not launch an unknown command to fingerprint it. That is running untrusted code. Read the config instead, on see which MCP servers run on employee machines and every MCP client’s config path, and fingerprint only the commands already approved.
What changes when the endpoint is agentgateway?
Start with standalone, then Kubernetes. This is released behavior from the current 1.7.x standalone docs, re-checked November 15, 2026. Nothing below is from a nightly or from a lab run through the gateway.
In standalone, agentgateway sits between a client and one or more upstream MCP servers and negotiates the protocol version. A server/discover from a modern client to a modern server is forwarded and answered directly. When the server behind it is older, the older server rejects the modern request and the client falls back to initialize; agentgateway handles that fallback. When it federates several targets, the versions it offers are the intersection of what every target supports, so the client only negotiates a version every target can serve. A fingerprint of a gateway endpoint describes the federation, not any one server behind it.
The 2026-07-28 revision adds caching controls on responses such as server/discover and tools/list. agentgateway can apply policies that make a response specific to one caller, so it cannot safely tell clients that a proxied response is cacheable. The docs say it disables caching on the responses it proxies. I did not run a discover through the gateway and through the server directly to show a side-by-side body, so that documented sentence is the whole claim.
Kubernetes uses the same data plane behavior. Point at the Kubernetes spec compatibility doc and the static and virtual MCP docs for how those backends are declared. I am not adding claims beyond those docs.
For traffic that already goes through the gateway, standalone agentgateway logs mcp.method.name and mcp.target on every MCP request, and the mcp_requests_total metric carries server, method, resource, and resource_type labels. Compare the server values you see against a registry of record.
The gateway only fingerprints traffic that goes through it. A server an agent reaches directly is invisible here unless egress forces that traffic through the gateway. That caveat is the reason how to stop shadow MCP servers and agentgateway as an egress proxy exist. If traffic is already supposed to go through the gateway and still looks unblocked, why your MCP gateway is not blocking shadow servers is the diagnosis.
What does the probe order look like in code?
This is the spec order from the table, written as pseudocode. It is not a paste from the scanner repo, and I have not executed this block as a harness for this page.
send POST server/discover with matching MCP-Protocol-Version and Mcp-Method headers
if status is 200 and the body is a DiscoverResult:
modern MCP; log serverInfo; do not trust it
else if status is 400 and the body is a recognized modern JSON-RPC error:
modern MCP; retry with a listed version, or fix the headers
else if status is 401:
protected; read WWW-Authenticate, do not treat it as "not MCP"
else:
send POST initialize
if it returns protocolVersion and serverInfo:
2025-era Streamable HTTP
else if a GET to the URL returns text/event-stream with a first event of endpoint:
deprecated HTTP+SSE
else:
not identified as MCP by these probes
One more spec curiosity, not a fingerprint. The Streamable HTTP spec says MCP servers SHOULD send X-Accel-Buffering: no on SSE responses, a header that exists to switch off buffering in nginx. So an MCP server that has never been near nginx can still carry an nginx header. It is a SHOULD, which makes it a weak hint and never proof of anything. I did not check whether any reference server sends it.