Setting up Context7 in Claude Code

Connect Context7 via the npx CLI or manually as a remote MCP server – with or without an API key.

Published on 09.09.2026

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.

Setting up Context7 automatically

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

npx ctx7 setup

For Claude Code, the target can be specified directly:

npx ctx7 setup --claude

Configuring Context7 manually

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

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

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.

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.

Published on 09.09.2026

Categories

Frequently asked questions

Do I need my own server or a Docker container?

No. Context7 runs as a remote service hosted by Upstash; only the MCP client needs to be configured.

Is the API key required?

No, but recommended: without a key, lower rate limits apply. A free key from context7.com/dashboard raises them.

Which clients are supported?

Per the provider, among others Cursor, Claude Code, and OpenCode. Any MCP client with remote MCP support should work.

What does `ctx7 setup --claude` do?

The flag tells the CLI to configure Claude Code specifically as the target client, instead of asking interactively.