Context7

Up-to-date, version-specific library documentation directly in the prompt – against outdated or hallucinated APIs in AI-generated code.

Description

Context7 gives AI coding assistants up-to-date, version-specific documentation for libraries and frameworks directly in the prompt, instead of relying on the model's (often outdated) training knowledge. The service is operated by Upstash.

The server runs as a hosted remote MCP endpoint at mcp.context7.com – no local server installation is needed, only client configuration.

The recommended setup uses the bundled CLI, which connects the client with a generated API key automatically:

Code
npx ctx7 setup

For Claude Code, the target can be specified directly:

Code
npx ctx7 setup --claude

Alternatively, configure it manually in the client's MCP configuration:

json
{
  "mcpServers": {
    "context7": {
      "url": "https://mcp.context7.com/mcp",
      "env": {
        "CONTEXT7_API_KEY": "YOUR-API-KEY"
      }
    }
  }
}

Without an API key the service works with lower rate limits; a free API key for higher limits can be generated at context7.com/dashboard.

Why up-to-date documentation in the prompt matters

AI language models are trained up to a cutoff date and don't know about library versions released afterward, or they mix up APIs from different versions because both appeared during training. The result is often plausible-looking but incorrect function calls, outdated parameters, or invented methods — a well-known problem with AI-generated code. Context7 addresses this by feeding current, version-specific documentation directly into the prompt on every request, instead of relying on frozen training knowledge. The model no longer has to guess the correct API; it's supplied directly.

How Context7 fits into a workflow

In practice, a simple prompt hint like "use context7" is enough for a compatible coding agent to automatically pull in the matching library documentation before suggesting or changing code. This is especially useful for fast-moving frameworks whose APIs differ significantly between major versions, as well as for less common libraries with little example code in the training material. For teams working with multiple versions of the same dependency, version specificity helps prevent the agent from accidentally suggesting code for a different version than the one actually installed.

Limits and context

Context7 doesn't replace your own quality assurance: the documentation it delivers comes from publicly available sources and should still be reviewed for security-critical code. As a purely remote service, Context7 also depends on the availability of Upstash's infrastructure; if the service goes down, documentation enrichment stops and the agent falls back to working with its training knowledge alone.

Tools and Invocation

Context7 provides two MCP tools. With resolve-library-id you find the matching ID from a library name and a question. With query-docs you fetch the documentation for an ID and a question, optionally with a language. Library IDs have the form /supabase/supabase or /mongodb/docs. The lookup is triggered by writing use context7 in the prompt or by naming the desired version, such as Next.js 16. The remote server is at https://mcp.context7.com/mcp. Setup runs with npx ctx7 setup and requires Node.js 22.13 or newer. According to the provider, a free API key raises the rate limits.

Frequently asked questions

Do I need an API key to use Context7? No, the service also works without one, though with lower rate limits. Does Context7 run locally or only remotely? Exclusively remotely via mcp.context7.com; a local server installation is not offered. Which libraries have documentation available? Per the provider, a growing number of common frameworks and libraries, though coverage detail can vary by project.

Requirements

An MCP client with remote MCP support. For the CLI setup (npx ctx7 setup), also Node.js 18 or newer.

Installation instructions

Context7 gives AI coding assistants up-to-date library documentation directly in the prompt. The server runs remotely at mcp.context7.com – no local installation needed, only client setup.

Step 1: Setting up Context7 automatically

The fastest way is the bundled CLI. It authenticates via OAuth, generates an API key, and configures the client automatically:

Code
npx ctx7 setup

For Claude Code, the target can be specified directly:

Code
npx ctx7 setup --claude

Step 2: Configuring Context7 manually

Alternatively, enter the remote URL directly into the client's MCP configuration:

json
{
  "mcpServers": {
    "context7": {
      "url": "https://mcp.context7.com/mcp",
      "env": {
        "CONTEXT7_API_KEY": "YOUR-API-KEY"
      }
    }
  }
}

Step 3: Generating an API key

A free API key for higher rate limits can be generated at context7.com/dashboard. The service also works without a key, but with lower limits.

Step 4: Verifying the setup

After configuring, restart the client and test with a concrete library question, such as "Use Context7 and show me the current API for React useEffect." If the agent responds with version-specific details instead of general training knowledge, the setup succeeded. If the answer stays generic, check whether the MCP server actually shows as connected in the client — many clients display this in their own tools or server overview.

Common pitfalls

A frequent issue is an outdated or incorrectly copied API key in the configuration file; a freshly generated key from the dashboard usually fixes this. With manual JSON configuration, a missing comma or wrong indentation quickly causes the client to ignore the entire MCP configuration — running a JSON validator before restarting helps catch such mistakes early. Anyone running multiple MCP servers at once should also check that the server name (here "context7") doesn't collide with one already in use.

When an API key pays off

For occasional use, the service without a key is usually enough. Anyone using Context7 regularly across a team or sending many parallel requests should generate a key to avoid hitting the lower default limits. The key can be revoked and regenerated at any time in the dashboard if it was accidentally shared.

Integrating Context7 into existing workflows

For teams that already use other MCP servers such as Filesystem or Fetch, Context7 runs alongside them without issue — the configuration entries in the MCP file are independent and can be combined freely. A useful pattern is to leave Context7 active by default and remind the agent in project-specific instructions (such as a CLAUDE.md) to check Context7 first for questions about library APIs, instead of relying on potentially outdated training knowledge.

This small addition to project instructions often pays off quickly, since it turns an optional tool into a habit the agent follows consistently across sessions.

Source: github.com/upstash/context7, checked on 2026-09-04.

npx ctx7 setup

Authentication

Optional but recommended: a free API key (environment variable CONTEXT7_API_KEY) for higher rate limits, generated via OAuth through the CLI or manually in the dashboard.

Required access permissions

The client sends library names or identifiers to the remote endpoint and receives documentation excerpts back. No access to local files or your own code unless the client itself includes such content.

Transmitted or stored data

Requests (library names, search terms) pass through Upstash/Context7 servers. With an API key, requests are attributable to that account. Storage details are governed by the provider's privacy policy, which was not separately reviewed at the time of this check.

Security risks

As a remote service outside your own control: availability and response content depend on the provider. The API key should be treated as a secret (environment variable, not in version control). Since documentation content flows into the model's context, it should be treated like any external text, not as trusted instructions.

License and costs

License
MIT
Cost
free

Free to use, even without an API key (with lower rate limits). A free API key for higher limits is available through the dashboard.

Alternatives

Not recorded yet.

At a glance

Provider
Upstash
Status
Official server
Deployment
Remote
Current version
Not recorded yet.
GitHub stars
64,882
Last reviewed
07.09.2026

Repository and documentation

Categories

Supported clients