MCP server monitoring: uptime, handshake, tool drift and tool poisoning
MCP server monitoring with curl and jq - check the handshake on both protocol eras, fingerprint the tool list, catch tool poisoning.
Sandeep Sidhu · Founder, AlertKick
An HTTP 200 check confirms the server is listening. It does not verify the MCP handshake, protocol version, or tool surface. Agents trust the output from tools/list. Tool descriptions and server instructions enter the model’s context directly. A changed description is a changed instruction for every connected agent.
Servers break quietly. A spec revision or auth change can block new clients while logs show nothing wrong. An HTTP check sees a 200 or 401. It misses a broken handshake, a removed tool, or a new line in a description.
When a server updates its protocol version, legacy clients may fail to initialize and the HTTP check still passes. When a server removes a tool, the agent may fail mid-task. When a server changes a tool description, the agent receives new instructions.
You have two jobs. If you publish an MCP server, track uptime, the auth chain, the protocol version, and unexpected tool changes after a deploy. If you depend on someone else’s server, pin the approved tool surface and get paged when it changes.
The two protocol eras you must handle
The MCP specification changed shape with revision 2026-07-28. A monitor must handle both the legacy handshake era and the modern stateless era. A server that speaks only one will fail a check designed for the other.
The legacy era covers specification revisions up to 2025-11-25. These servers require an initialize handshake followed by a notifications/initialized notification. They may issue a session ID in the Mcp-Session-Id header, which the client must include on all subsequent requests. The protocol version is negotiated once and sent in the MCP-Protocol-Version header on later calls.
The modern era begins with revision 2026-07-28 (changelog). This revision removed the initialize handshake and protocol-level sessions. Every request now carries protocol version and client capabilities in the _meta object. Servers must implement server/discover to return supported versions, capabilities, and identity. The Mcp-Method and Mcp-Name headers are now required on Streamable HTTP POSTs.
A dual-era server speaks both. On 14 November 2026, DeepWiki, Cloudflare docs, and Context7 answered initialize with 2025-11-25 and server/discover with supportedVersions: ["2026-07-28"]. GitMCP answered initialize with 2025-03-26 and rejected server/discover with a 400 error.
A monitor that only speaks modern gets a 400 Bad Request from a legacy server. A monitor that only speaks legacy fails to connect to a modern-only server.
Your monitoring logic must attempt server/discover first. If it receives a 400 with a recognised modern error, such as UnsupportedProtocolVersionError, the server is modern: retry with a version from its supported list. If the 400 body is empty or not a modern error, treat the server as legacy and fall back to initialize. A server moving from one era to the other is a change you want to know about.
DIY checks for legacy and modern servers
Verify an MCP server’s health and protocol version with curl and jq. The approach differs for legacy handshakes (revision 2025-11-25 and earlier) and the modern stateless protocol (revision 2026-07-28 and later).
Legacy servers require a three-step handshake: initialize, send the initialized notification, and call tools/list. This process also reveals whether the server issues a session ID.
URL=https://mcp.example.com/mcp
curl -sS -D init.headers -o init.body "$URL" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{
"protocolVersion":"2025-11-25",
"capabilities":{},
"clientInfo":{"name":"curl-check","version":"1.0"}}}'
Read the negotiated version and any session ID from the response headers and body.
# the reply is plain JSON or an SSE stream: keep the JSON line
json() { sed -n -e 's/^data: //' -e '/^{/p'; }
VER=$(json < init.body | jq -r '.result.protocolVersion')
SID=$(grep -i '^mcp-session-id:' init.headers | cut -d' ' -f2 | tr -d '\r')
echo "protocol=$VER session=${SID:-none}"
Send the initialized notification and request the tool list. Include the session ID in the headers if one was issued, then delete the session when done. Against DeepWiki and GitMCP on 14 November 2026, both servers returned 202 to the notification and a tool list: 3 tools and no session ID from DeepWiki, 4 tools and a session ID from GitMCP.
H=(-H 'Content-Type: application/json'
-H 'Accept: application/json, text/event-stream'
-H "MCP-Protocol-Version: $VER")
[ -n "$SID" ] && H+=(-H "Mcp-Session-Id: $SID")
# tell the server the client is ready: expect 202
curl -sS -o /dev/null -w '%{http_code}\n' "${H[@]}" "$URL" \
-d '{"jsonrpc":"2.0","method":"notifications/initialized"}'
curl -sS "${H[@]}" "$URL" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | json > tools.json
# more pages? send tools/list again with "params":{"cursor":"<this value>"}
jq -r '.result.nextCursor // empty' tools.json
# end the session if the server issued one
[ -n "$SID" ] && curl -sS -o /dev/null -X DELETE "${H[@]}" "$URL"
Modern servers (Streamable HTTP, revision 2026-07-28) remove the handshake and session IDs. Every request carries _meta and specific headers like Mcp-Method. Use server/discover to check supported versions and capabilities, then tools/list to retrieve the tool surface.
curl -sS "$URL" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2026-07-28' \
-H 'Mcp-Method: server/discover' \
-d '{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{"_meta":{
"io.modelcontextprotocol/protocolVersion":"2026-07-28",
"io.modelcontextprotocol/clientInfo":{"name":"curl-check","version":"1.0"},
"io.modelcontextprotocol/clientCapabilities":{}}}}' \
| json | jq '.result.supportedVersions // .error'
curl -sS "$URL" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2026-07-28' \
-H 'Mcp-Method: tools/list' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{"_meta":{
"io.modelcontextprotocol/protocolVersion":"2026-07-28",
"io.modelcontextprotocol/clientInfo":{"name":"curl-check","version":"1.0"},
"io.modelcontextprotocol/clientCapabilities":{}}}}' \
| json > tools.json
An unsupported version returns HTTP 400 with UnsupportedProtocolVersionError (code -32022) listing the supported versions. Against DeepWiki, the discover call returned ["2026-07-28"], and the same tools/list request without the Mcp-Method header got HTTP 400.
Fingerprint tool lists and diff against baseline
Hashing the raw JSON response from tools/list is unreliable. The 2026-07-28 spec adds ttlMs, cacheScope, and _meta fields that are not part of the tool surface. Tool order may also vary between calls. You need a deterministic view of what the model sees.
Extract only the fields that matter to the agent: name, title, description, inputSchema, outputSchema, and annotations. Sort the tools by name and sort the keys within each object. This produces a canonical JSON blob that stays stable across runs.
jq -S '[.result.tools[]
| {name, title, description, inputSchema, outputSchema, annotations}]
| sort_by(.name)' tools.json > tools.canonical.json
sha256sum tools.canonical.json
On 14 November 2026, running this against DeepWiki twice a minute apart produced the same SHA-256 hash. The legacy handshake and the modern stateless check produced identical canonical hashes for the same server.
Store the approved baseline in tools.approved.json. A person must review this file and commit it to version control. Treat it like code.
# first run: a person reads tools.canonical.json and approves it
cp tools.canonical.json tools.approved.json
# every run after that
if ! cmp -s tools.approved.json tools.canonical.json; then
diff -u tools.approved.json tools.canonical.json
exit 1 # page someone: the tool surface changed
fi
Run this from cron or CI. A non-zero exit code triggers the alert. Do not auto-accept changes: a person updates tools.approved.json, nothing else does.
Hash the server instructions too. For legacy servers, extract them from the initialize result:
json < init.body | jq -r '.result.instructions // ""' | sha256sum
For modern servers, extract them from the server/discover result. Any change to instructions is a change to the context window for every connected agent.
What to alert on and why
| Signal | What to check | Alert on | Why |
|---|---|---|---|
| Reachability | Status and latency of the first POST | Timeout, TLS error, 5xx | Agents fail mid-task, often without a clear error to the user |
| Handshake | initialize result (legacy) or server/discover result (modern) | JSON-RPC error, no result, a 4xx where there used to be a 200 | The endpoint is up but no client can start |
| Protocol version | Negotiated protocolVersion or supportedVersions | Any change; anything older than 2025-06-18 | A server that drops the version your clients speak strands them |
| Tool names and count | Names in the canonical list | Tool added or removed | Removed tools break callers; added tools widen what an agent can do |
| Tool text | title and description | Any change | The description is an instruction the model reads |
| Schemas | inputSchema, outputSchema | Any change | Callers send arguments the server no longer accepts |
| Annotations | readOnlyHint, destructiveHint | Read-only tool no longer read-only; tool becomes destructive | The tool can now change your systems |
| Server instructions | Hash of instructions | Any change | Same channel as descriptions, server-wide |
| OAuth discovery | 401 -> resource metadata -> authorization-server metadata | Any broken step, issuer mismatch, no S256 | New clients cannot log in while clients holding tokens keep working |
Annotations are hints. Clients must treat them as untrusted unless the server is trusted. readOnlyHint defaults to false. destructiveHint defaults to true, but only when the tool is not read-only. The 2025-06-18 threshold matters because older revisions predate structured tool output and the OAuth resource-server split. GitMCP negotiated 2025-03-26 in the 14 November test.
Scanning for tool poisoning patterns
Invariant Labs (Luca Beurer-Kellner and Marc Fischer, 1 April 2025) defined tool poisoning as malicious instructions embedded in MCP tool descriptions. These instructions are invisible to users but visible to AI models. This is a specialized form of indirect prompt injection.
Their report shows how an add(a, b, sidenote) tool can start with a benign description like “Adds two numbers” and follow it with an <IMPORTANT> block. That block tells the model to read ~/.cursor/mcp.json and ~/.ssh/id_rsa, put the contents into the sidenote argument, and not mention the file read to the user.
The user sees a calculator. The model sees an exfiltration instruction. In their Cursor demonstration, the confirmation dialog did not show the full tool input, so the SSH key in sidenote stayed hidden.
A server can also change a tool description after a client has already approved it. This “rug pull” means initial trust does not protect you. A malicious server can shadow trusted tools too. In one example, a description changed how an agent used a trusted send_email tool on another server, redirecting all mail to an attacker address.
Invariant recommends showing users full tool descriptions, pinning server and tool versions, verifying descriptions with a hash or checksum before use, and putting boundaries between servers. The hash-and-diff above is that pinning, and it catches rug pulls. It does not help on day one. If the description was poisoned when you approved it, the hash is stable. A pattern scan catches that case.
Scan every title, description and the server instructions for these patterns:
- Hidden characters include zero-width, bidirectional control, invisible operator, byte-order mark, and Unicode tag characters (U+E0000-U+E007F). A model reads them; a person reviewing the list does not see them.
- Instruction markers include
<IMPORTANT>,<SYSTEM>, “ignore previous instructions”, “do not tell the user”, and “before using this tool, read…”. - Sensitive paths to flag are
~/.ssh,id_rsa,.env,.aws/credentials,mcp.json,.cursor/,.claude/,/etc/passwd,.npmrc,.git-credentials, and.kube/config. - Cross-tool steering looks for “when calling the X tool” where X is not a tool this server lists.
- Encoded blobs include base64-like runs over 200 characters and hex runs over 128.
- Oversized descriptions. AlertKick warns over 4 KB and fails over 16 KB.
These are heuristics. False positives happen. Each hit needs a person to read it. The grep below covers hidden characters, instruction markers and the common sensitive paths. It printed nothing for DeepWiki’s and GitMCP’s tool lists, and caught a test description with an <IMPORTANT> block and a zero-width space.
# instruction markers and sensitive paths in titles and descriptions
jq -r '.[] | "\(.name): \(.title // "") \(.description // "")"' tools.canonical.json \
| grep -n -i -E '<\s*/?\s*(important|system|instructions?)\s*>|ignore (all |any )?(previous|prior) instructions|do not (tell|mention)[^.]{0,40}user|~/\.ssh|id_rsa|\.aws/credentials|mcp\.json|\.cursor/|\.claude/|/etc/passwd'
# zero-width, bidi-control and Unicode tag characters (needs a UTF-8 locale)
jq -r '.[] | .name + ": " + (.description // "")' tools.canonical.json \
| grep -n -P '[\x{200B}-\x{200F}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{2069}\x{FEFF}\x{E0000}-\x{E007F}]'
Checking the OAuth discovery chain
For servers behind OAuth you cannot list tools without logging in, but you can check the chain a new client walks before it logs in.
An unauthenticated POST must get HTTP 401 with resource_metadata in WWW-Authenticate. The protected-resource metadata (RFC 9728) names at least one authorization server. The authorization-server metadata (RFC 8414, or OpenID configuration) must have an issuer that matches the authorization server URL (RFC 9207 mix-up defence). PKCE S256 must be in code_challenge_methods_supported (the spec says clients must refuse to proceed without it). Authorization and token endpoints must be present. A registration path must exist: Client ID Metadata Documents (client_id_metadata_document_supported: true) or dynamic client registration (registration_endpoint, deprecated in 2026-07-28).
Against a public OAuth-protected MCP server on 14 November 2026, the commands below returned a 401 with resource_metadata, a matching issuer, S256 in the list, and Client ID Metadata Documents supported.
# 1. no token: expect 401 with a resource_metadata URL
curl -sS -o /dev/null -D - -X POST "$URL" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' \
| grep -i -E '^HTTP|^www-authenticate'
# 2. protected-resource metadata (RFC 9728): which authorization server?
curl -sS "$PRM" | jq '{resource, authorization_servers}'
# 3. authorization-server metadata (RFC 8414), for an issuer with no path
curl -sS "$AS/.well-known/oauth-authorization-server" \
| jq '{issuer, code_challenge_methods_supported,
client_id_metadata_document_supported, registration_endpoint}'
Set PRM to the resource_metadata URL from step 1 and AS to the first entry of authorization_servers from step 2.
A broken step or issuer mismatch means new clients cannot log in while clients holding tokens keep working. Alert on any broken step or missing S256.
AlertKick MCP monitor limits and features
Add an MCP monitor from Monitors -> Add Monitor. Enter the endpoint URL, select the transport (Streamable HTTP is default, or legacy SSE), and configure auth. Options include none, fixed headers like Authorization or X-API-Key, or OAuth discovery chain only. Set the drift policy to alert on changes (default) or record changes only. Define expected tools and a max tool count. The default check interval is 10 minutes with a 20-second timeout.
Each check attempts server/discover first, falling back to initialize for older servers. It records the protocol version, server name and version, capabilities, and a hash of the instructions. The monitor warns when the negotiated version is older than 2025-06-18.
For tool listing, the monitor follows nextCursor up to 20 pages or 500 tools. Truncation triggers a warning. The monitor fingerprints each tool using canonical JSON of the name, title, description, input and output schema, and annotations. It calculates separate hashes for text, schema, and annotations so changes can be named, plus one digest for the whole surface.
Drift detection compares the current state against an approved baseline. The monitor fails by default if a tool is removed or added, schemas change, titles or descriptions change, instructions change, or hints shift (a read-only tool is no longer read-only, or a tool becomes destructive). Other annotation changes, server or protocol version changes, and OAuth metadata changes are recorded as events. Lint rules check for hidden unicode, instruction markers, sensitive paths, cross-tool steering, encoded blobs, and oversized descriptions.
The baseline is set by the first successful check. Findings on that first check are not auto-accepted. If a server was poisoned when added, the check fails. Drift keeps the check failing and the alert open until a person clicks Accept changes on the monitor page. Accepting is human-only: it requires a signed-in web session. The API refuses it for API keys and the MCP connector. No MCP tool can approve these changes. An agent must not approve the tool changes that steer it.
Tool text is treated as untrusted. Alerts, events, and AI triage carry tool names and change kinds only, never the description text. Metrics exposed include mcp_tool_count, mcp_init_ms, and mcp_list_ms. The monitor never calls a tool, only lists. It identifies as client alertkick-monitor with user agent AlertKick-MCP-Monitor/1.0.
This monitor does not log in with OAuth, so OAuth mode checks the discovery chain only and cannot list tools behind a login. It monitors remote servers only, not local stdio servers started by a desktop client. It cannot see per-user cloaking, where a server shows clean text to monitors but something else to specific users. Resources and prompts are not fingerprinted, only tools and server instructions.
Setup, settings and every event name are in the MCP server monitoring docs. Failures page through escalation policies like any other monitor; the other check types are on the monitors page. To let an assistant read your alerts over MCP, see running incident triage from your AI assistant.
Frequently asked questions
- Why is an HTTP 200 check not enough for MCP server monitoring?
- An HTTP 200 check only confirms the server is listening. It does not verify the protocol handshake, the tool surface, or the server instructions. Agents trust the output from tools/list, so a broken handshake or changed description can break agents even when the HTTP endpoint is up.
- How do I handle the two different MCP protocol eras in my checks?
- Legacy servers (revision 2025-11-25 and earlier) require an initialize handshake, while modern servers (revision 2026-07-28) are stateless and use server/discover. A monitor that handles both sends server/discover first and falls back to initialize when the 400 body is not a recognised modern error. Many public servers on 14 November 2026 answered both.
- What is tool poisoning and how can I detect it?
- Tool poisoning is a form of indirect prompt injection where malicious instructions are embedded in tool descriptions. These instructions are invisible to users but visible to AI models, allowing attackers to steer agent behavior. You can detect this by scanning tool descriptions for hidden characters, instruction markers like <IMPORTANT>, and sensitive file paths using grep patterns.
- How do I verify the OAuth discovery chain for a protected MCP server?
- You can verify the chain by sending an unauthenticated POST to get a 401 with resource_metadata, then fetching the protected-resource and authorization-server metadata. Check that the issuer matches the authorization server URL, S256 is present in code_challenge_methods_supported, and a registration path exists. A broken step or missing S256 prevents new clients from logging in.
- Why does AlertKick treat tool text as untrusted?
- Tool text is treated as untrusted because descriptions can contain malicious instructions or hidden characters that steer the agent. Alerts and events only carry tool names and change kinds, never the description text. That keeps a poisoned description from reaching an AI assistant through AlertKick.
- What are the limits of the AlertKick MCP monitor?
- The monitor does not log in with OAuth, so it checks the discovery chain only and cannot list tools behind a login. It monitors remote servers only, not local stdio servers, and cannot see per-user cloaking where a server shows different content to different users. Resources and prompts are not fingerprinted, only tools and server instructions.