context7
by upstash
MCP server that gives AI coding agents up-to-date library documentation while they work.
- Stars
- 65,422 stars
- Forks
- 3.3k forks
- Last push
- today
- Activity
- Active
# Set up Context7 for your coding agent$ npx ctx7 setupCommands from the project's README. Run them after installing (see below).
Overview
Understand context7 in 60 seconds
- What it does
- Context7 gives AI coding agents up-to-date, version-specific documentation and code examples for the libraries you use. It works as an MCP server or as a CLI plus skill, so agents like Claude Code and Cursor fetch current docs instead of relying on old training data.
- The problem it solves
- Coding agents often produce outdated examples or invent APIs that don't exist because their training data is old. Context7 pulls documentation from the source into the agent's context when you ask about a library.
- Why choose it
- Choose it to cut outdated and invented API suggestions from your coding agent with one setup command. A free API key is recommended for higher rate limits; the backend service is not open source.
- Who should use it
- Claude Code, Cursor and OpenCode users
- Developers using fast-changing libraries
- Teams tired of hallucinated APIs
- Library authors who want their docs available to agents
- Setup difficulty
You'll need:
- Node.js 22.13+ for the ctx7 CLI
- A coding agent or MCP client
- Recommended: a free Context7 API key
How context7 works
After setup, you add 'use context7' to a prompt, such as asking for a Next.js proxy that checks a JWT, and the agent fetches current docs and examples for that library. You can name a library ID like /supabase/supabase to skip matching, or mention a version to get version-specific docs.
It works in two modes: CLI plus skills, where a skill guides the agent to run ctx7 commands, or MCP, where the agent calls resolve-library-id and query-docs tools. npx ctx7 setup authenticates with OAuth, creates an API key and installs the right setup for Cursor, Claude Code or OpenCode.
This repository holds the MCP server source; the API backend, parsing and crawling engines are private. Library docs are community-contributed, and Upstash says it cannot guarantee their accuracy, completeness or security.
Features
Key features
Current docs
Version-specific documentation from the source.
Two modes
CLI plus skills, or an MCP server.
One-command setup
npx ctx7 setup configures your agent.
Library IDs
Point straight at a library like /vercel/next.js.
Version matching
Mention a version to get matching docs.
SDKs
TypeScript SDK and Vercel AI SDK tools.
Strengths
- Reduces outdated and invented APIs
- Easy setup
- Works with 30+ MCP clients
- MIT licensed MCP server
Limitations
- Backend is a hosted service and not open source
- Rate limits without an API key
- Community-contributed docs may be inaccurate
Practical use cases
Up-to-date framework code
Ask for Next.js 16 code with use context7.
Auth setup
Get the current Supabase auth API.
Always-on docs
Add a rule so your agent uses Context7 automatically.
Installation
Install context7
Commands come from Context7's README. AIRepoHub hasn't run them yet. View source
Prerequisites
- Node.js 22.13+
- A coding agent
Supported systems
- Windows
- macOS
- Linux
- 1
Run setup
Use --cursor, --claude or --opencode to target a specific agent.
Shellnpx ctx7 setup - 2
Choose CLI + Skills or MCP mode
- 1
Add the remote server
Use https://mcp.context7.com/mcp with an Authorization: Bearer YOUR_API_KEY header in your MCP client.
Configuration and API keys
| Setting | What it's for |
|---|
First run
- 1
Ask with Context7
TextCreate a Next.js proxy that checks for a valid JWT in cookies and redirects unauthenticated users to /login. use context7
context7's documentation doesn't include sample output, so we don't show any. Expect the results in your terminal.
Your first project
Give your coding agent current library docs
Set up Context7 and use it in a prompt.
Before you start
- Node.js 22.13+
- Claude Code, Cursor or OpenCode
- 1
Run setup
Shellnpx ctx7 setup --claude - 2
Ask a library question
TextImplement basic authentication with Supabase. use library /supabase/supabase for API and docs. - 3
Optional: add a rule
In CLAUDE.md: Always use Context7 when I need library/API documentation, code generation, setup or configuration steps.
What to expect
The agent fetches current Supabase docs and writes code using today's API.
Next steps
- Look up IDs with ctx7 library
- Fetch docs directly with ctx7 docs
- Submit your own library to Context7
Costs and requirements
What it costs to run
- License
- MIT for the MCP server.Free
- API key
- Free key available for higher rate limits.Free
Troubleshooting
Common setup issues
Rate limited
Get a free API key at context7.com/dashboard.
Want to undo setup
Run npx ctx7 remove; uninstall a global CLI with npm uninstall -g ctx7.
Docs look wrong
Library docs are community-contributed; report issues or check the source.
Alternatives
Similar AI repositories
orca
stablyai
App for running and managing several AI coding agents like Claude Code and Codex on desktop, mobile or a remote machine.
claude-mem
thedotmack
Memory add-on for AI coding agents that saves what happened in past sessions and brings the useful parts back later.
paperclip
paperclipai
Open-source app for organizing and managing teams of AI agents that do work for your business.
Understand-Anything
Egonex-AI
Tool that turns any codebase into an interactive knowledge graph you can explore, search and ask questions about.