Build This Now
Build This Now
Keyboard ShortcutsStatus Line Guide
MCP BasicsMCP Tool SearchContext7 MCP50+ MCP Servers for Claude CodeCursor MCP ServersClaude Code SearchBrowser Automation MCP for Claude CodeSocial Media Automation with Claude CodeBuild Your Own MCP Server for Claude Code
Get Build This Now
speedy_devvkoen_salo
Blog/Toolkit/MCP/Context7 MCP

Context7 MCP

Add the Context7 MCP server to Claude Code so every session pulls current library docs at query time rather than guessing from stale training data.

Problem: A model's training data has a cutoff date. Ask about React 19, Next.js 15, or any library that shipped a major release in the last few months, and the answer comes back wrong. Stale patterns. Invented APIs. Functions that got renamed two versions ago.

Quick Win: Add Context7 to your MCP config and suffix any prompt with use context7. Docs get pulled before any code is written.

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp@latest"]
    }
  }
}

What Context7 MCP Actually Is

Here is the short version. Context7 is an MCP server. Its one job: pull current, version-pinned documentation and examples straight from the library's own source, not from a months-old weights file.

The flow is simple. Official docs are indexed into library IDs. When you name a library in a prompt, the server resolves the name, grabs the right sections, and slips that material into the conversation before the model responds.

Why It Matters for Claude Code

Hallucinated APIs are the core pain. Models suggest functions that were renamed, deprecated, or never existed in the first place. The cause is always the same: training data lives behind the actual release timeline.

With this server loaded, you get:

  • Docs at query time rather than whatever shipped in the weights
  • Version-matched examples tied to the release named in your prompt
  • Working patterns lifted from official docs that compile on the first try
  • Fewer hallucinations because real APIs replace invented ones

Ask for Next.js 15 app router patterns. Context7 fetches the Next.js 15 docs on the spot. Your code comes back referencing what exists today, not what existed when Next.js 13 was the latest release in the training set.

Installation and Setup

Node.js 18 or newer is required. The package is @upstash/context7-mcp.

Claude Code CLI

One command usually does the trick:

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

Or drop it directly into .mcp.json at the project root:

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp@latest"]
    }
  }
}

Claude Desktop

macOS users should edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp@latest"]
    }
  }
}

The equivalent file on Windows lives at %APPDATA%\Claude\claude_desktop_config.json.

Alternative: Bun Runtime

Bun user? Swap the command:

{
  "mcpServers": {
    "context7": {
      "command": "bunx",
      "args": ["-y", "@upstash/context7-mcp@latest"]
    }
  }
}

Restart Claude Code once the config lands.

Using It in Practice

Two tools ship with the server:

resolve-library-id: Maps a plain library name to a Context7-compatible identifier. Claude reaches for this whenever a library comes up by name.

query-docs: Pulls the actual docs for one library. Back come current documentation, examples, and API references.

Basic Usage

Stick use context7 on any prompt that needs fresh docs:

Create a Next.js 15 middleware that handles authentication. use context7

Three things happen:

  1. The name "Next.js" resolves to the library ID /vercel/next.js
  2. Middleware docs come back from a query
  3. Code gets written against current API shapes

Version-Specific Queries

A version number dropped into the prompt is picked up automatically:

How do I configure Prisma 6 with PostgreSQL? use context7

Documentation returned will match the exact release named.

Common Library IDs

The ID format is /organization/repository. Eight you will hit often:

LibraryContext7 ID
Next.js/vercel/next.js
React/facebook/react
Prisma/prisma/prisma
Supabase/supabase/supabase
Drizzle/drizzle-team/drizzle-orm
tRPC/trpc/trpc
Tailwind/tailwindlabs/tailwindcss
Zod/colinhacks/zod

Skip resolution entirely by passing the ID yourself:

use library /supabase/supabase for API and docs

Supported Libraries

Thousands of libraries live in the index. The main categories:

Frontend: React, Vue, Svelte, Angular, Solid, Qwik

Meta-frameworks: Next.js, Nuxt, SvelteKit, Astro, Remix

Backend: Express, Fastify, Hono, NestJS, Koa

Databases: Prisma, Drizzle, Mongoose, TypeORM, Supabase

Utilities: Zod, tRPC, React Query, SWR, Zustand, Jotai

Testing: Vitest, Jest, Playwright, Cypress

Any library with public docs is probably covered. New versions get picked up on a rolling basis.

Pairing With MCP Tool Search

MCP Tool Search pairs cleanly with this server. Flip it on and the tools only load when the conversation calls for them, so session startup stays light.

Why it matters: you can stack this alongside other MCP servers without running into context limits:

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp@latest"]
    },
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
      "env": { "BRAVE_API_KEY": "your-key" }
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_TOKEN": "your-token" }
    }
  }
}

The server only wakes up when docs come up in the prompt or the trigger phrase shows up. Idle time costs zero tokens.

Troubleshooting

ERR_MODULE_NOT_FOUND: Swap npx for bunx. Some environments trip over npm's cache layer.

Library not found: Not every package is indexed. The server tells you plainly when it can't resolve a name. Reach for a web search MCP as a fallback.

Outdated results: Indexing runs on a schedule. Releases from the last few days may not be there yet. For bleeding-edge features, read the official docs directly.

Next Steps

A server like this flips Claude Code from a fixed snapshot into something that actively researches. Stack it with others for a fuller setup:

  • Read the MCP fundamentals if the protocol is still new
  • Browse a catalog of 50+ MCP servers for more capabilities
  • Add a web search MCP for research beyond libraries
  • Turn on MCP Tool Search to keep context usage tight

Wire Context7 in and the deprecated patterns stop showing up. use context7 becomes a reflex the first time the code quality difference lands.

More in this guide

  • Keyboard Shortcuts
    Configure custom keyboard shortcuts in Claude Code.
  • Status Line Guide
    Set up a custom Claude Code status line showing model name, git branch, cost, and context usage.
  • AI SEO and GEO Optimization
    A rundown of Generative Engine Optimization: how to get content cited inside ChatGPT, Claude, and Perplexity responses instead of just ranked on Google.
  • Claude Code vs Cursor in 2026
    A side-by-side look at Claude Code and Cursor in 2026: agent models, context windows, pricing tiers, and how each tool fits different developer workflows.
  • Claude Code VSCode Extension
    Anthropic's VS Code extension puts Claude Code inside the editor sidebar as a Spark-icon panel, with inline diffs, plan mode, subagents, and MCP support.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Get Build This Now

MCP Tool Search

Lazy loading for MCP tool definitions in Claude Code, gated by a 10% context-window threshold.

50+ MCP Servers for Claude Code

A curated catalog of MCP servers, editor integrations, usage monitors, orchestrators, and starter kits that plug into Claude Code.

On this page

What Context7 MCP Actually Is
Why It Matters for Claude Code
Installation and Setup
Claude Code CLI
Claude Desktop
Alternative: Bun Runtime
Using It in Practice
Basic Usage
Version-Specific Queries
Common Library IDs
Supported Libraries
Pairing With MCP Tool Search
Troubleshooting
Next Steps

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Get Build This Now