Kevin Meneses
โ† Back to articles

Context7 MCP Test: Claude Code With vs Without It

Claude CodeMcpAI AgentsPython
Context7 MCP test: Claude Code with vs without Context7

Does Context7 change what Claude Code actually writes, or is it one more MCP server you install and forget?

I measured it.

Same task, same model, same prompt, 12 runs, every script executed against the real OpenAI API. The only thing I changed was where the agent got its documentation.

The Short Answer

  • No docs: 0 of 3 scripts ran. All three crashed on import httpx.
  • Context7 MCP: 6 of 6 ran, with or without "use context7" in the prompt.
  • Web search: 3 of 3 ran, but took 70 seconds per run instead of 40 and cost $0.48 instead of $0.36.

The rest of this page shows how I got those numbers, so you can judge them yourself.

What Changed in openai 3.0

On August 12, 2026, OpenAI shipped version 3.0 of its Python SDK. The client now runs on HTTPX2, and the httpx package is no longer installed with it.

If you only call client.responses.create(), nothing changes. If your code builds its own HTTP client, for a proxy, a custom timeout, a transport or a test mock, the old code breaks on the first line.

That made it a good test case. The change is recent, it's specific, and it shows up in code that real teams write all the time.

Why Coding Agents Miss Changes Like This

A model learns an SDK once, at training time. The SDK keeps shipping.

So when a release lands after the model's cutoff, the agent writes the API it remembers. It does that with the same confidence as everything else, and nothing in its output tells you the code is out of date.

Even telling it the version doesn't help. My prompt pinned openai>=3.60,<4 and said "make sure the code is correct for this version". Without docs, Claude Code still wrote this three times out of three:

import httpx

http_client = httpx.Client(
    proxy=proxy,
    timeout=httpx.Timeout(30.0, connect=5.0),
)

On openai 3.60, that file never gets past line 6:

ModuleNotFoundError: No module named 'httpx'

Context7 in Two Tools

Context7 is Upstash's documentation service for coding agents. It keeps library docs and code examples indexed and hands the relevant parts to the agent while it writes.

Inside Claude Code it's an MCP server with two tools:

  • resolve-library-id finds the library, e.g. "openai python" becomes /openai/openai-python
  • query-docs returns the snippets that answer the agent's question for that library

You add it with one command:

npx ctx7 setup --claude

The free plan gives you 1,000 calls a month. In this test, one task used 3 to 5 calls.

A tip before you check whether your library is covered: look at the "Latest" docs, not the version menu. "Latest" follows the library itself. The menu only lists snapshots someone added at some point.

The Setup

  • Agent: Claude Code 2.1.216 with Claude Sonnet 5.5, run headless with claude -p
  • Task: a triage.py that classifies support tickets with the openai SDK (pinned to >=3.60,<4), routes all traffic through the proxy in CORP_PROXY, times out after 5 s to connect and 30 s to read, and uses structured output
  • Four setups, three runs each: no docs, Context7 MCP, Context7 MCP plus "use context7", and web search with no Context7
  • Pass condition: the script runs on openai 3.60, classifies all 6 tickets through the real OpenAI API (gpt-5.4-mini), and its traffic goes through the proxy

12 Runs, 4 Setups: The Numbers

SetupWorked on openai 3.60Avg timeAvg cost
No docs0 / 3 (ModuleNotFoundError: httpx)28 s$0.24
Context7 MCP3 / 338 s$0.37
Context7 + "use context7"3 / 343 s$0.34
Web search + fetch3 / 370 s$0.48

Cost and time as reported by Claude Code for each run.

This is the execution log from the real API run. A red line is a script that never reached OpenAI:

Context7 MCP test execution log: no-docs Claude Code scripts fail with ModuleNotFoundError httpx, Context7 and web search scripts classify all 6 tickets through the proxy

And the cost of each of the 12 Claude Code runs:

Claude Code cost per run with and without Context7 MCP, averaging $0.24 with no docs, $0.37 with Context7 and $0.48 with web search

The Context7 runs all landed on the current client:

import httpx2
from openai import OpenAI, DefaultHttpx2Client

TIMEOUT = httpx2.Timeout(connect=5.0, read=30.0, write=30.0, pool=30.0)

client = OpenAI(
    http_client=DefaultHttpx2Client(proxy=proxy, timeout=TIMEOUT),
    timeout=TIMEOUT,
)

Five Things the Logs Showed

The agent found the migration on its own. Each Context7 run started with resolve-library-id and then asked 2 to 4 query-docs questions. In one run, the second answer mentioned HTTPX2, so the third question was about the migration itself.

The magic phrase didn't matter. Runs without "use context7" called Context7 anyway and passed.

Web search worked, but it reads whole pages. It needed 4 to 7 searches and fetches per run, which is where the extra 30 seconds and the extra cost come from.

The no-docs code was one install away from working. With pip install httpx, all three no-docs scripts ran. But they ran on what OpenAI's migration guide calls a temporary escape hatch.

The timeouts held everywhere. I pointed the scripts at a server that takes 40 seconds to answer. Both the old and the new client style gave up at 30.2 seconds.

Why Context7 Came Out Ahead

It was the only setup that was both correct (6 of 6, first try) and efficient (40 s and $0.36 per run, against 70 s and $0.48 for web search). It also needed no change to how I prompt. Once the server was installed, Claude Code decided by itself when to use it.

Behind the Scenes: How I Built the Test

A few things I had to get right before the numbers meant anything:

  • A clean room for every run. Each run got its own empty folder outside my site's repo, with only tickets.csv and requirements.txt in it. That way no project notes or old code could leak into the agent's context. Skills were disabled with --disable-slash-commands, and each setup got its own MCP config through --strict-mcp-config.
  • The tool lists were the variable. The no-docs and Context7 runs had WebSearch and WebFetch blocked. The web-search runs had them allowed and Context7 absent.
  • My first batch was invalid. In headless mode, MCP tools need --allowedTools or they're silently denied. My first "with Context7" runs never got a single answer from it, so I threw them away and ran them again.
  • I checked the proxy, not just the output. CORP_PROXY pointed to a small proxy I wrote that logs every connection. A script only passed if its connection to api.openai.com showed up in that log.
  • The whole experiment cost $4.29 in Claude Code usage across the 12 runs, plus a few cents of OpenAI API calls.

Caveats

  • Three runs per setup and one SDK. That's a clear signal, not a benchmark.
  • I tested whether the code works, not how well it classifies. The nine working scripts agreed on five of the six tickets, and split on the ambiguous one.
  • Context7's coverage of a library depends on its "Latest" docs. Check those for your own stack.

Questions People Ask About Context7

What does Context7 MCP do?

It gives coding agents current library documentation while they write code. Claude Code, Cursor, Codex and VS Code call it through MCP instead of relying only on what the model learned in training.

How do I install Context7 in Claude Code?

Run npx ctx7 setup --claude. You can also add the hosted server at https://mcp.context7.com/mcp by hand, or install the Context7 plugin from inside Claude Code.

How much does Context7 cost?

There's a free plan with 1,000 API calls a month. Pro is $10 per seat per month with 2,000 calls per seat, plus private repositories.

Is Context7 better than web search for coding agents?

In this test both produced working code. Context7 did it in 40 seconds instead of 70 and for $0.36 instead of $0.48 per run, because it returns the relevant snippets instead of whole pages.

Bottom Line

Your coding agent doesn't need to be smarter about a new SDK. It needs the docs that came out after it stopped learning.

In this test, that was the difference between 0 of 3 and 6 of 6. If you use Claude Code on libraries that move fast, Context7 is worth the one-line install.


If you're a software or API company looking to explain your product through high-quality educational content (not marketing fluff), feel free to connect with me on LinkedIn.