Context7 MCP
Add Context7 to Claude Code for version-aware library and framework docs inside the agent, remote HTTP or local npx, with an API key.
Context7 (from Upstash) is an MCP server that pulls up-to-date, version-specific documentation for libraries and frameworks into your agent session. Use it when training data is stale or you want API shapes, config flags, and examples that match the version you actually depend on.
Remote endpoint: https://mcp.context7.com/mcp
Auth: pass Authorization: Bearer YOUR_API_KEY to the remote server, or --api-key to the local npx server. Anonymous access has lower limits; private repositories require a key.
Why use it in a workshop
- Framework homework: "What's the current way to do X in Next.js / Prisma / Tailwind?" without pasting whole doc sites into chat.
- Safer codegen: The model can ground suggestions in retrieved doc snippets instead of inventing deprecated APIs.
- Pairs with skills: You still use project skills for your conventions; Context7 supplies vendor docs.
Option A, Guided setup (recommended)
Context7’s current setup CLI authenticates with OAuth, creates an API key, and installs either MCP or CLI + Skills mode:
npx ctx7 setup --claudeFor Cursor, use npx ctx7 setup --cursor. Add --api-key YOUR_API_KEY to use an existing key, or --oauth for an MCP OAuth flow.
Option B, Remote HTTP
Replace YOUR_API_KEY with your key (or use an env var, see .mcp.json below).
Personal (all projects), user scope:
claude mcp add --scope user --header "Authorization: Bearer YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcpThis repo only (team-friendly pattern, commit config, not the secret):
claude mcp add --transport http context7 --scope project https://mcp.context7.com/mcp --header "Authorization: Bearer YOUR_API_KEY"Prefer ${CONTEXT7_API_KEY} in .mcp.json so the key stays in your shell environment or secret store.
Set the variable before starting Claude Code:
export CONTEXT7_API_KEY="YOUR_API_KEY"export CONTEXT7_API_KEY="YOUR_API_KEY"PowerShell:
$env:CONTEXT7_API_KEY = "YOUR_API_KEY"cmd:
set CONTEXT7_API_KEY=YOUR_API_KEY.mcp.json (project root, merged with other servers)
{
"mcpServers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"headers": {
"Authorization": "Bearer ${CONTEXT7_API_KEY}"
}
}
}
}Set CONTEXT7_API_KEY in your environment (see tabs above) before starting Claude Code, then run /mcp and confirm context7 is connected.
Option C, Local server (stdio via npx)
Runs the MCP transport as a small Node process on your machine. The package still retrieves documentation from Context7’s hosted service; stdio only changes the connection between Claude Code and the local MCP package.
claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEYUsing it in chat
Ask for library id + version explicitly when it matters, then a narrow question.
Use Context7: resolve docs for Next.js (App Router) for the version we use in this repo's package.json, then answer: how should we define a loading.tsx boundary in the app directory?Context7: Prisma, show the current recommended pattern for interactive transactions in TypeScript and link to the concept names you used.Context7: Tailwind CSS v4, how do we configure custom fonts in @theme? Keep the answer to bullet steps only.If the model picks the wrong package, name the npm package and version in the prompt.
Workshop checklist
Create or load a Context7 API key and set CONTEXT7_API_KEY in your environment (export on macOS/Linux, $env:... in PowerShell, see above) or paste once for a local demo only, do not commit keys.
Add context7 (remote or local) and verify in /mcp.
Run two prompts: one resolve + explain, one small API detail for a dependency in your demo repo.
Compare: answer with Context7 tools vs without (same question), note hallucination-prone areas.
See also
Dometrain MCP
Wire Claude Code to the public Dometrain MCP server, search courses, learning paths, and blog posts without an API key.
Playwright MCP (Microsoft)
Add Microsoft’s Playwright MCP so the agent can drive a real browser, navigate pages, snapshot structure, and interact via accessibility trees.