Context7

by Upstash

Official Documentation 60k likes

Pipes up-to-date, version-specific library documentation straight into an agent's context, so generated code matches the API that actually exists instead of a model's stale training data.

Add to Claude Code

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

Source: https://github.com/upstash/context7

About

Context7 fetches current, version-matched documentation and code examples for a library at prompt time, ending the pattern where a model trained on an older API version confidently generates code that no longer exists.

It works via two tools: one resolves a library name to a Context7-specific ID, and the other pulls the relevant documentation for your question — in practice, most people just add "use context7" to a prompt and let the agent orchestrate both calls.

Key features

  • Version-matched documentation instead of stale training data
  • Covers thousands of popular libraries and frameworks
  • Community-extendable — submit any missing project
  • Free tier available, API key recommended for higher rate limits

Use cases

  • Generate code against the current version of a fast-moving framework like Next.js
  • Avoid hallucinated methods when working with a library the model was never trained on
  • Pull accurate usage examples for a less-common package

Available tools

resolve-library-id

Turns a library name (e.g. "supabase") into a Context7-specific documentation ID.

get-library-docs

Fetches version-matched documentation and examples for a resolved library ID.

Frequently asked questions

Do I need an API key?

A free key from context7.com/dashboard raises your rate limit, but the server works without one at a lower limit.

How do I actually use it in a prompt?

Append "use context7" to a prompt that involves a specific library, and the agent resolves the library ID and pulls its docs automatically.