How to Test Your MCP Server With Coding Agents
Direct answer
To test your MCP server with coding agents, confirm it connects and lists its tools in the MCP Inspector. Then install it in Claude Code, Codex and Cursor the way users do, give each agent real tasks that never name a tool, and run them unattended several times. Read the traces, fix and rerun until every agent passes.
An MCP eval is a real task a coding agent runs against your MCP server, graded on whether it finished and how. It measures agent usability, which is whether an agent can complete a real task with your product. Our numbers come from Devtool Arena, Lightsage's public leaderboard of how coding agents use 150+ developer tools.
How do I test MCP servers?
You test an MCP server at three layers: the protocol, the client install and sign-in, and the agent's behaviour with your tools. The MCP Inspector covers the protocol. The other two need a real coding agent, because the harness decides what the model sees of your server. Claude Code's tool search loads tool names and server instructions at session start and fetches full definitions on demand (Claude Code docs). Codex reads your server's instructions field and advises keeping its first 512 characters self-contained (Codex docs).
So the same server lands differently on each agent. By our count, 49 MCP servers scored above 30 on both Devtool Arena's Claude Code and Codex MCP boards (October 2026). Of those, 15 had task scores 10 or more points apart, and 14 were within 2 points. Claude Code ran Claude Sonnet 5 and Codex ran GPT-6 Sol. Our MCP compatibility guide goes deeper on the protocol layers.
1. Check the server connects and lists its tools
Run the MCP Inspector against your server, list its tools and call each one directly. The Inspector is the MCP project's reference testing tool and needs Node 22.19.0 or newer (MCP Inspector docs). It proves the server answers and says nothing about whether an agent picks the right tool.
npx @modelcontextprotocol/inspector --cli https://mcp.example.com/mcp \
--transport http --method tools/list
npx @modelcontextprotocol/inspector --cli https://mcp.example.com/mcp \
--transport http --method tools/call \
--tool-name search --tool-arg query="sodium-ion batteries"
Read the tools/list output the way an agent will. Claude Code leaves out any tool whose full name, mcp__<server>__<tool>, runs past 128 characters. It cuts server instructions and upfront tool descriptions at 4,096 characters (Claude Code docs). This step is done when every tool lists with a clear description and returns a valid result from one direct call.
2. Install it the way your users do in Claude Code, Codex and Cursor
Copy the install snippet from your own docs into each agent, because each client has its own format and a wrong one can fail quietly. Claude Code skips an --mcp-config entry that has a url but no type, and the run still exits cleanly (Claude Code headless docs).
Claude Code takes a command:
claude mcp add --transport http acme https://mcp.example.com/mcp \
--header "Authorization: Bearer $ACME_API_KEY"
claude mcp list # expect "✔ Connected"
Codex reads ~/.codex/config.toml, or .codex/config.toml in a trusted project. With required = true, codex exec exits with an error when the server fails to start (Codex non-interactive docs).
[mcp_servers.acme]
url = "https://mcp.example.com/mcp"
bearer_token_env_var = "ACME_API_KEY"
required = true
Cursor reads .cursor/mcp.json in the project or ~/.cursor/mcp.json globally (Cursor docs):
{
"mcpServers": {
"acme": {
"url": "https://mcp.example.com/mcp",
"headers": { "Authorization": "Bearer ${env:ACME_API_KEY}" }
}
}
}
Then check that claude mcp list, codex mcp list and Cursor's agent mcp list-tools acme all show the server and its tools (Cursor CLI docs).
3. Write real tasks and check tool selection
Write five to ten tasks in your users' words, never naming a tool, and check that the agent calls the expected tool first with the right arguments. A prompt that names the tool skips the choice you're testing. Give each task an expected first tool, key arguments and a checkable end state.
As an illustration, a search API like Exa, whose MCP server has web_search_exa and web_fetch_exa tools, might write:
| Task, as a user would type it | Expected first call |
|---|---|
| Find three recent articles on sodium-ion batteries and summarize the most relevant one from its full text | web_search_exa, then web_fetch_exa on a URL from the results |
| Get the full text of this article URL | web_fetch_exa alone |
| Rename the variables in utils.py | No MCP call |
Run each task headless and pull out the first MCP call:
TASK="Find three recent articles on sodium-ion batteries and summarize the most relevant one"
claude -p "$TASK" --allowedTools "mcp__acme__*" --output-format stream-json --verbose > cc.jsonl
codex exec --json "$TASK" > codex.jsonl
jq -c 'select(.type=="assistant") | .message.content[]? | select(.type=="tool_use") | {name, input}' cc.jsonl | grep mcp__ | head -1
jq -c 'select(.type=="item.started" and .item.type=="mcp_tool_call") | .item | {server, tool, arguments}' codex.jsonl | head -1
The JSON event names in each CLI's output can change between versions, so check a line of cc.jsonl and codex.jsonl before relying on these filters.
When the agent picks the wrong tool, rewrite that tool's name and description first. Claude Code's docs tell server authors to put the words Claude would search for near the start of each description. Move on once each task's first call matches in at least 4 of 5 runs, which is our own bar.
4. Test the auth path an unattended agent hits
Run the agents headless where nobody has signed in, and give them a credential that needs no browser. Browser OAuth works on your laptop, where tokens are saved, and can stall an agent in CI. Claude Code's docs say a claude -p run can't run the OAuth flow, so the server's tools stay unavailable until someone signs in interactively (Claude Code docs). Codex connects without authentication when no credential resolves, so the failure can surface at the first tool call.
The MCP specification makes authorization optional and tells stdio servers to read credentials from the environment (MCP authorization spec). We think remote servers should also accept an API key or bearer token header, shown in the step 2 snippet.
On both Devtool Arena MCP boards (October 2026), runs that stopped at credentials are listed as skipped. Their reasons read like "Missing MCP auth env vars", and there's no trace to learn from. The check: claude mcp list in a fresh container reports ✔ Connected, never ! Needs authentication.
5. Run several agents, several times
Run every task at least five times on at least two agents, and report each pass rate as X of N. One run can't separate a lucky pass from a reliable one, and one agent can't stand in for another. In one of our web search runs, the same MCP server scored 86 on Claude Code and 45 on Codex, because Codex's answer listed results its searches never returned. Even when both agents pass, they work differently, as on Devtool Arena's Claude Code MCP board and Codex MCP board (October 2026):
| MCP server | Claude Code | Codex | What differed |
|---|---|---|---|
| Exa | 82 (B) | 91 (A) | Both passed. Codex used 5 tool calls to Claude Code's 12 |
| Jina AI | 86 (B) | 85 (B) | Both passed |
| ElevenLabs | 89 (B) | 89 (B) | Both passed |
Devtool Arena has MCP boards for Claude Code and Codex alone, so add Cursor yourself with agent -p --approve-mcps. We think five runs per task is the least that shows variance. You're done when every task has a pass rate on every agent.
6. Read the traces before you read the score
Open the trace of every failed run and decide whether the server, the agent or the task caused it. A score alone can send you to fix the wrong thing. The web search run that scored 45 on Codex is an example. Its trace shows Codex calling the server's tools for every step, and the score fell because the final JSON listed URLs and titles the searches never returned.
Recovery from errors differs by agent too. In one of our communications API runs, both agents hit the provider's limit on calling unverified phone numbers. Claude Code then tried an SMS with the same To and From number and scored 41. Codex worked around the limit with a different kind of call recipient, created the call and scored 66.
In each trace, look for the first MCP call and its arguments, your server's error text, and any fallback to curl or an SDK. We think error messages that name the fix help agents recover. Every failure should end with a cause you can name.
7. Rerun after every change
Rerun the same tasks after each server release and each major agent update, and compare pass rates and tool calls with the last run. Both sides move. Claude Code raised its cut-off for upfront tool descriptions from 2,048 to 4,096 characters in v2.1.296, which changes how much of a long description the model reads (Claude Code docs).
Public scores move too. One cloud hosting MCP server gained 69 points on the Claude Code MCP board and 57 on the Codex MCP board between the May and October 2026 runs. We can't split that between the server and newer agents, which is why you rerun your own tasks. Put the rerun on your release checklist.
Common mistakes
- Naming the tool in the prompt. "Use the search tool to…" tests instruction-following. Write the task as a user would type it.
- Testing the model through its API alone. Promptfoo can assert on which MCP tools a model called through the Anthropic or OpenAI API, which helps test routing (checked October 2026). It skips Claude Code's tool search and Codex's instruction handling, so run the real CLI agents too.
- Reading a denied call as a server bug. A
claude -prun denies tool calls that need approval unless--allowedToolscovers them. An open Codex issue (October 2026) reports MCP calls incodex execfailing as "user cancelled MCP tool call" (openai/codex #16685).
How do I run MCP evals?
Run MCP evals as a fixed task set on a schedule. Use the step 3 tasks on every agent your users run, five or more times each, on every release and at least weekly. Track per agent the pass rate, the right-first-tool rate (both as X of N), median tool calls and time per passed run, and auth failures. Better means pass rates rise, or hold while tool calls fall, on the same tasks.
You can script this with claude -p, codex exec and agent -p. Lightsage Agent Usability is one option: it runs real coding agents on your tasks against your MCP server in sandboxes, with pass or fail, full traces, errors and per-agent scores. The Startup plan at $100/month covers Claude Code and Codex, and Growth adds Cursor and six more agents (pricing). If you only need protocol checks in CI, the free MCP Inspector CLI is enough.
For APIs and CLIs, see how to run agent evals. To compare tools, see best agent testing tools.
Frequently asked questions
Is there a tool that can test MCP servers?
Yes, at two levels. The MCP Inspector, the MCP project's reference tool, lists a server's tools and calls them directly, which tests the protocol. To test whether coding agents can use the server, script Claude Code, Codex and Cursor headless, or use a platform such as Lightsage Agent Usability that runs them in sandboxes and keeps traces.
How do I check tool selection on an MCP server?
Give a coding agent tasks in your users' words that never name a tool, then read the first MCP call and its arguments in the run's JSON output. Count how often the expected tool comes first over at least five runs, and include tasks where the server shouldn't be used.
How do I set up MCP evals?
Write five to ten real tasks with an expected first tool, key arguments and a checkable end state. Install your server in each agent with a credential that needs no browser, run each task at least five times per agent, and grade each run pass or fail on the end state.
As a CTO, how do I test MCP servers?
Ask for one number per agent: the pass rate on five to ten real customer tasks over repeated unattended runs, with failure traces attached. Don't accept one agent as proof. In one of our October 2026 web search runs on Devtool Arena, the same MCP server scored 86 on Claude Code and 45 on Codex.
How can an auth company check tool selection on its MCP server?
Write tasks that sit between overlapping tools, such as listing users versus listing organization members, and check the agent's first tool call and its arguments. An auth company like Descope, as an illustration, would also test a key-based path, because an agent in CI can't finish a browser OAuth sign-in.
Next step
To run your MCP tasks on Claude Code, Codex and Cursor in sandboxes with every trace kept, start a 7-day trial of Lightsage Agent Usability.