/ Directory / Playground / Context7
● Official upstash ⚡ Instant

Context7

by upstash · upstash/context7

Context7 injects fresh, version-specific docs for 30k+ libraries into your coding agent so it stops hallucinating APIs that don't exist.

Context7 is Upstash's docs-for-LLMs platform. The MCP server resolves a library name to a stable ID, then fetches the exact doc snippets your agent needs — pinned to the version in your lockfile. Free tier works out of the box; a free API key raises rate limits. Installed from a single npx command, it's one of the highest-ROI MCPs for any coding workflow that spans 2+ libraries.

Why use it

Key features

Live Demo

What it looks like in practice

context7.replay ▶ ready
0/0

Install

Pick your client

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp@latest"
      ]
    }
  }
}

Open Claude Desktop → Settings → Developer → Edit Config. Restart after saving.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp@latest"
      ]
    }
  }
}

Cursor uses the same mcpServers schema as Claude Desktop. Project config wins over global.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp@latest"
      ]
    }
  }
}

Click the MCP Servers icon in the Cline sidebar, then "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp@latest"
      ]
    }
  }
}

Same shape as Claude Desktop. Restart Windsurf to pick up changes.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "context7",
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp@latest"
      ]
    }
  ]
}

Continue uses an array of server objects rather than a map.

~/.config/zed/settings.json
{
  "context_servers": {
    "context7": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "@upstash/context7-mcp@latest"
        ]
      }
    }
  }
}

Add to context_servers. Zed hot-reloads on save.

claude mcp add context7 -- npx -y @upstash/context7-mcp@latest

One-liner. Verify with claude mcp list. Remove with claude mcp remove.

Use Cases

Real-world ways to use Context7

Stop your agent from hallucinating functions that don't exist

👤 Anyone using an AI coding assistant with a library newer than the model cutoff ⏱ ~5 min beginner

When to use: You're working with Next.js 15, Prisma 5, Drizzle, LangChain 0.3, or any fast-moving library and your agent keeps inventing functions that don't exist.

Prerequisites
  • Node 18+ — node -v
  • Context7 MCP installed — Paste the config block above into your Claude Desktop / Cursor / Windsurf settings
Flow
  1. Name the library explicitly
    Using Context7, pull the latest docs for prisma and show me the right way to do a transaction with nested relation writes.✓ Copied
    → Agent calls resolve-library-id then query-docs with a relevant query, not a Wikipedia-style summary
  2. Pin to a version if it matters
    I'm on [email protected]. Use Context7 to get the App Router streaming docs for that exact version.✓ Copied
    → Citation includes the version; code uses file-based conventions, not getServerSideProps
  3. Cross-check your own code
    Read the imports in src/lib/db.ts, then use Context7 to verify every function I imported actually exists in drizzle-orm 0.30.x.✓ Copied
    → Per-import ✓/✗ report with doc links

Outcome: Agent output uses real, current APIs — first try — instead of plausible-looking invented ones.

Pitfalls
  • Agent forgets to call Context7 on the second turn — Put 'always use Context7 for library questions' in your system prompt or CLAUDE.md
  • Library name ambiguous (e.g. 'supabase') — Let resolve-library-id return matches; pick the specific package (supabase-js vs @supabase/ssr)
Combine with: filesystem · github

Scaffold a new feature using the current idiomatic pattern

👤 Engineers starting a feature in an unfamiliar or newer version of a framework ⏱ ~15 min intermediate

When to use: You need to add auth to a Next.js 15 app and want to skip the stale blog posts.

Prerequisites
  • Target framework identified — package.json or pyproject.toml already lists it
Flow
  1. Ask for current idioms
    Using Context7, fetch the NextAuth v5 docs and scaffold a Credentials provider setup for me. I want the current beta, not v4.✓ Copied
    → Code uses the auth() function and Edge-compatible config from v5, not v4 getServerSession
  2. Verify migration notes
    Pull the 'upgrade from v4' section of NextAuth docs and list what I'd need to change in my current code.✓ Copied
    → Diff-style list of breaking changes

Outcome: Working v5 code on the first commit — not a half-migrated hybrid.

Pitfalls
  • Docs don't cover your edge case — Context7 is docs-only; for unreleased behavior, fall back to the source via GitHub MCP
Combine with: github · filesystem

Review a PR with real doc citations, not vibes

👤 Reviewers who want to back up comments with evidence ⏱ ~20 min intermediate

When to use: Reviewing a PR that uses a library API you're not 100% sure is correct.

Flow
  1. Read the diff
    Pull the diff from PR #482. For every library call, use Context7 to verify the signature and flag anything that looks off.✓ Copied
    → Per-call verdict with doc link and version
  2. Write citeable comments
    For each flagged call, draft a review comment that links the official doc via Context7.✓ Copied
    → Comments read like 'per the v15 docs <link>, X should be Y'

Outcome: Review comments with citations, not opinions.

Combine with: github

Migrate a codebase to a new major version of a library

👤 Engineers doing a major upgrade (React 18→19, Tailwind 3→4, etc.) ⏱ ~90 min advanced

When to use: You're bumping a major version and the upgrade guide is 40 pages of 'it depends'.

Prerequisites
  • Target version picked — Pick the exact version; don't do 'latest' on majors
Flow
  1. Pull the migration guide
    Use Context7 to grab the Tailwind v3→v4 migration doc. Summarize as a checklist.✓ Copied
    → Ordered checklist of breaking changes
  2. Scan the repo for each issue
    For every item on that checklist, use the filesystem MCP to find matching patterns in src/. Give me a per-file report.✓ Copied
    → Pattern → affected file list
  3. Patch in small commits
    Make each migration item a separate commit with a message referencing the doc section.✓ Copied
    → Clean commit log you can revert item by item

Outcome: A migration PR you can actually review, with each change tied back to a doc section.

Pitfalls
  • Taking on too many items in one commit — One breaking change → one commit; makes bisect easy if something breaks
Combine with: filesystem · git · github

Combinations

Pair with other MCPs for X10 leverage

context7 + filesystem

Read the package.json to pick the exact version, then query Context7 for matching docs

Read package.json, find the next version, and pull the matching docs from Context7 for Server Actions.✓ Copied
context7 + github

For PRs touching library APIs, annotate the review with doc citations

For every API call in PR #482, add a review comment citing Context7 docs.✓ Copied

Plan a migration step-by-step before touching code

Use sequential-thinking to plan the Prisma v4→v5 migration, pulling doc evidence from Context7 at each step.✓ Copied

Tools

What this MCP exposes

ToolInputsWhen to callCost
resolve-library-id libraryName: str First call — disambiguate the library name you care about 1 free request
query-docs libraryId: str, query: str, version?: str After resolve-library-id — ask the actual question 1 free request (higher rate limit with API key)

Cost & Limits

What this costs to run

API quota
Free tier is generous; free API key (context7.com/dashboard) raises rate limits
Tokens per call
~200–2000 per query depending on doc length
Monetary
Free
Tip
Scope queries — 'how to use X' is cheaper than 'give me everything about X'; the server already returns focused snippets

Security

Permissions, secrets, blast radius

Credential storage: Optional CONTEXT7_API_KEY env var for higher rate limits
Data egress: Queries go to api.context7.com; no code egress — only the library name and your query are sent

Troubleshooting

Common errors and fixes

Library not found by resolve-library-id

Try alternative names (e.g. 'nextjs' vs 'next.js' vs '@vercel/next'); Context7 indexes by common aliases but not every fork

Verify: Check context7.com/browse for the official slug
Docs look outdated

Include an explicit version arg; without it you get the library's latest indexed docs which may lag releases by hours

Verify: Compare the returned snippet URL to the official docs site
Rate limit hit on anonymous use

Get a free API key at context7.com/dashboard and set CONTEXT7_API_KEY in your MCP config's env block

Verify: Re-run the same query and check it succeeds

Alternatives

Context7 vs others

AlternativeWhen to use it insteadTradeoff
GitHub MCP (docs folder)You need source-level truth or unreleased behaviorPer-file latency is high; you have to navigate the repo manually
Ref ToolsYou want a different doc provider with its own indexDifferent library coverage
Direct web fetchThe doc isn't in any index — you have the URLNo version resolution; you do the URL work

More

Resources

📖 Read the official README on GitHub

🐙 Browse open issues

🔍 Browse all 400+ MCP servers and Skills