MCP server · Documentation + context

OfficialHands-on VerifiedRead-onlyMITUpdated August 2026

Context7

Upstash's MCP server that puts current, version-specific library docs and code examples in the prompt so a coding agent stops guessing at APIs.

Quick verdict

Add it the first time your agent hallucinates an API. It costs one config entry and pays back on the next fast-moving framework you touch.

  • MaintainerUpstash (official)
  • Security scopeRead-only
  • Transportsstdio, streamable-http
  • Install channelnpm · @upstash/context7-mcp
  • EvidenceHands-on Verified · 1 configuration
  • LicenseMIT · Open source

Context7 is Upstash's documentation MCP server. It exposes two tools — resolve-library-id, which maps a library name to a Context7 library id, and query-docs, which returns up-to-date, version-specific documentation and code examples for that library — so a coding agent grounds its answers in what the library ships today rather than in its training snapshot. The npm package runs locally over stdio (npx -y @upstash/context7-mcp) and the same server is hosted at https://mcp.context7.com/mcp over streamable HTTP. Both call Upstash's hosted API: only the MCP shim is open source. An API key is optional and raises rate limits.

MCP security best practices

Install Context7

npx -y @upstash/context7-mcp

Config entry (mcpServers)
{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp"]
    }
  }
}

Node.js 20.18+ for the local server. The hosted endpoint https://mcp.context7.com/mcp (streamable HTTP; Authorization: Bearer <key> header) needs no local process. A Docker image mcp/context7 packages the shim only — the indexing backend is Upstash's hosted service.

Credentials

NameRequiredWhat it is for
CONTEXT7_API_KEYOptionalOptional. A free key from context7.com/dashboard raises rate limits and unlocks private repositories; pass it as the CONTEXT7_API_KEY env var or the --api-key flag. The server works without one at low rate limits.

Verified configurations

Each row is one client + runtime + OS combination that was actually run, with what was verified in that session.

ConfigurationInstallAuthDiscoveryExecutionReadWriteDestructiveErrors
Claude Code
claude-fable-5 · Windows · stdio · tested 2026-08-16
Claude Code CLI 2.1.228 on Windows 11 Pro 10.0.26200 with Node v24.16.0; server registered as `npx -y @upstash/context7-mcp` (stdio, no CONTEXT7_API_KEY set) and reported Connected by `claude mcp list` (2026-08-16); run by an agent session (Claude Fable 5, model id claude-fable-5) with genuine access to the client, the OS and the server — spec §7 / decision F3.
VerifiedNot testedVerifiedVerifiedVerifiedN/AN/AVerified
Evidence — Claude Code
  • Install: `claude mcp list` → `context7: npx -y @upstash/context7-mcp - ✔ Connected`: the package resolved through npx and Claude Code spawned the stdio process — the profile's exact config entry.
  • Auth: Ran keyless: the optional CONTEXT7_API_KEY was not set, so the keyed (higher-rate-limit / private-repo) path was not exercised.
  • Discovery: tools/list exposed 2 tools: resolve-library-id and query-docs — the 2.0 names (get-library-docs is gone, as the profile states).
  • Execution: `resolve-library-id` (libraryName 'Next.js', query about alternates.canonical in generateMetadata) → 5 candidates led by /vercel/next.js (6,136 code snippets, source reputation High, benchmark 90.97, 16 versions listed); `query-docs` (/vercel/next.js) → documentation excerpts from docs/01-app/03-api-reference/04-functions/generate-metadata.mdx (the generateMetadata signature and a root-layout example with metadataBase + alternates.canonical) — a real round trip to Upstash's hosted API through the local stdio server.
  • Read: Both tools are read-only lookups; the query-docs result carried source URLs for each excerpt.
  • Write: The server exposes no mutating capability.
  • Destructive: The server exposes no destructive capability.
  • Errors: `query-docs` with a nonexistent id (/opensourcesai/does-not-exist-9f3a) returned the clean error 'Library "/opensourcesai/does-not-exist-9f3a" not found. Please check the library ID or your access permissions.' without crashing or hanging.

Rate limits were not approached in this run (three calls). The remote streamable-HTTP endpoint (https://mcp.context7.com/mcp) was not exercised — this configuration is the local npm package over stdio.

Best for

Anyone whose coding agent keeps suggesting removed methods or outdated signatures for fast-moving libraries — Next.js, React, LangChain — and wants live docs in the prompt without building a RAG pipeline.

Why use it

It is the lowest-friction fix for API hallucination: one config entry, two tools, no local index to build. Docs are fetched per query and can be pinned to a library version, and it is documented for dozens of clients including Claude Code, Claude Desktop, Cursor and Cline. Smaller local models benefit most, because their training coverage of niche libraries is thinnest.

Tradeoffs

Every query goes to Upstash's hosted API — the local package is a thin shim and the backend is not open source, so it is not for air-gapped work. Coverage depends on the library being indexed; internal or private libraries need an API key and a private repo. It grounds documentation only: it does not run, lint or test code.

Upstream state

npm package published · repository active · in the official MCP Registry (active). Lifecycle is derived from a committed upstream snapshot at build time, never authored by hand.

Official MCP Registry name: io.github.upstash/context7

Editorial review

Reviewed byOpenSourcesAI EditorialLast updatedAugust 2026Sourcesupstash/context7 README — MCP tools, hosted endpoint, API key guidance, disclaimer that the backend is private; upstash/context7 packages/mcp README (the npm README) — local, remote and env-var config blocks, transports, Docker; npm: @upstash/context7-mcp; Official MCP Registry entry io.github.upstash/context7

Grade A — Hands-on Verified. Re-review is due by 2026-12-16. Config entries, credential names and package status can change upstream; verify against the source repository before granting an agent access.

Sources

Related guides

All MCP servers →