Feed Claude Code current docs with Context7
Claude used a function from version 2 of a library that is on version 5. This guide plugs current docs into Claude Code.
The fix
Context7 is an MCP server that pulls current, version-specific docs into the chat. Add it once for all your projects. Its README recommends a free API key from context7.com/dashboard for higher rate limits. One-command alternative: npx ctx7 setup --claude (needs Node.js 22.13 or newer).
claude mcp add --transport http context7 \
https://mcp.context7.com/mcp \
--header "Authorization: Bearer YOUR_API_KEY" \
--scope userUse it
Add "use context7" to the prompt and say the version you run. If you know the library, give its ID to skip the lookup.
How do I set up a Next.js 16 proxy? use context7
Implement basic authentication with Supabase.
use library /supabase/supabase for API and docs.Check it worked
The server should show as connected. Then make Claude prove where an answer came from.
claude mcp list
# inside Claude Code:
/mcp
Name the doc page for every function you used.
If you cannot, say so.Pro tip: stop typing it, stop the prompts
Add this rule to CLAUDE.md so Claude reaches for Context7 on its own: "Always use Context7 when I need library/API documentation, code generation, setup or configuration steps." Then allow the server's tools in .claude/settings.json so each lookup does not ask. The rule name is mcp__ plus the server name, here context7.
{
"permissions": {
"allow": ["mcp__context7__*"]
}
}Pro tip: docs you already have
Type @ and a path to put a local file in the conversation, for example @docs/api.md. It is included when it fits the Read tool limit of 25,000 tokens; a text file over 256KB is not. For a web page, paste the URL and ask Claude to read it: Claude Code fetches pages with WebFetch and asks first, except for a built-in set of documentation domains.
Common mistake
Not saying the version. Context7 matches the version you mention, so write the one in your package.json. A prompt with no version leaves Claude free to answer for the one it remembers.
Official docs
One fix of twenty: the whole Claude Code survival kit.
Follow @whyshouldaicareA new disaster and its fix every day. Comment the word under a reel to get its guide.