Blog / Test MCP servers with agents

See exactly what your agent sends to the model: wire-capturing Claude Code, Codex and Grok

Most of what we know about how agent apps load MCP tools came from looking at the actual requests. Here's the method, minus the scripts, and the traps that change what you see.

Leonid Bugaev · Published 21 Oct 2026

Why capture the wire

Agent apps change fast and their docs lag. The only reliable way to know what reaches the model is to look at the requests. That's how we found that Claude Code sends no MCP definitions up front, that Codex writes JavaScript to find tools, and that a lab flag had silently turned tool search off. See Claude Code tool search, seen from the wire.

The method

  1. Start an HTTPS proxy (we use mitmproxy) on a local port, with a fresh CA in a temporary config folder.
  2. Trust the CA only in the child process: set HTTPS_PROXY plus the app's CA variable (NODE_EXTRA_CA_CERTS for Node apps, SSL_CERT_FILE or the app's own setting for others) in that process's environment only.
  3. Run the app normally, with its usual login and endpoint, against your MCP server.
  4. Delete the CA when the process exits (a shell trap), so nothing stays trusted.
  5. Tokenize the saved bodies with a fixed tokenizer (we use o200k_base) and keep each provider's own usage for per-request input.
agent process + temp CAlocal proxy, bodies onlymodel API

Want to see what agents send with your server attached?

We capture each agent app's real requests with your MCP server and show what's loaded, searched, cut and resent.

Capture your MCP

Redaction

What the first requests contained

AppFirst requestTools in itMCP tools
Claude Code 2.1.30117,564 tokens13, incl. ToolSearch0 (113 names in a reminder)
Codex 0.161.015,383 tokensNamespaces: one code tool with a 6,471-token description0; found via ALL_TOOLS in code
Grok Build 1.0.6019,674 tokens28, incl. search_tool and use_tool0; server names and counts in a reminder

Same prompt and 99-tool server; all three called the right tool. Totals for the task: about 76k (Claude Code), 137k (Codex), 158k (Grok Build) input tokens.

Traps

Go deeper: How Codex finds MCP tools, How agents load MCP tools, Test against production read-only.

Back to testing MCP servers with agents.

How we measured

FAQ

How can I see what tools and context Claude Code or Codex sends to the model?

Run the app behind an HTTPS proxy scoped to that process, with a temporary CA trusted only by the child process, and record request bodies. Redact credentials before saving. Avoid changing the app's API base URL, which can change its behaviour.

Is it safe to MITM my own agent app?

It can be, if the CA is temporary, trusted only by that process, deleted afterwards, and every credential is redacted before anything is written. Never commit raw captures.

Does a capture change what the app does?

It can. With a custom ANTHROPIC_BASE_URL, Claude Code turned tool search off and sent all 99 tool definitions. With an HTTPS proxy and the normal endpoint, tool search stayed on.

Want to see what agents send with your server attached?

We capture each agent app's real requests with your MCP server and show what's loaded, searched, cut and resent.

Capture your MCP