GuideBuilding with AIFree

Connect Context7 to Claude Code

One command gives Claude Code the current documentation for the libraries you use, so its answers match the version you have, not the one it remembers.

Tested with Claude Code 2.1.310, macOS 26.5, Context7 hosted server 4.4.3. Last verified .

Who it's for
Anyone who uses Claude Code to write or change code that depends on libraries and frameworks
What you'll have
Claude Code that looks up a library's current docs when you ask, and a check that proves it did
Time
5 minutes
Difficulty
Beginner
Before you start
  • Claude Code installed and signed in (claude --version prints a version)
  • A terminal
  • Internet access to mcp.context7.com (some company networks block it)

Claude Code knows a lot about popular libraries, but what it knows has a date on it. When a framework renames something (Next.js 16 renamed Middleware to Proxy), Claude can confidently write the old way. Context7 is an MCP server that fetches the current docs for a library, for the version you name, while Claude is answering. Adding it takes one command, and you don't need an account or a key.

Give this to Claude

Claude Code checks your version, makes sure Context7 isn't already set up, adds it for your user account and shows you the line that says it connected. It changes nothing else.

Paste it into Claude Code, opened in any folder.

Prompt for Claude Codetext
Connect the Context7 MCP server to Claude Code for my user account, then check it works.

1. Run `claude --version` and tell me the version.
2. Run `claude mcp list`. If a server called context7 is already listed, stop and tell me: don't add a second one.
3. Run this, exactly: claude mcp add --scope user --transport http context7 https://mcp.context7.com/mcp
4. Run `claude mcp list` again and show me the line for context7. It should end in "✔ Connected". If it says "Failed to connect", stop and tell me; that is usually a network or proxy problem, not the command.
5. Tell me to start a new Claude Code session so the new tools load, and give me one prompt to try in it: How do I set up a proxy in Next.js 16? use context7

Don't add an API key and don't change any other setting.

Steps

  1. Step 1: Check Claude Code is installed

    Open a terminal and run:

    Run in your terminalbash
    claude --version

    You should see a version number, like 2.1.310 (Claude Code). If you see "command not found", install Claude Code first and sign in.

  2. Step 2: See what is connected now

    Run in your terminalbash
    claude mcp list

    On a new setup this prints No MCP servers configured. If you already see a line with context7 in it, it is set up: skip to step 5.

  3. Step 3: Add Context7

    This adds the hosted Context7 server for your user account, so it works in every project on this computer:

    Run in your terminalbash
    claude mcp add --scope user --transport http context7 https://mcp.context7.com/mcp

    It answers:

    What you should seetext
    Added HTTP MCP server context7 with URL: https://mcp.context7.com/mcp to user config
    File modified: /Users/you/.claude.json

    The --scope user part is what makes it work everywhere. Leave it out and Claude Code adds it to the current folder only.

  4. Step 4: Check the connection

    Run in your terminalbash
    claude mcp list

    The line for Context7 should end in a tick:

    What you should seetext
    context7: https://mcp.context7.com/mcp (HTTP) - ✔ Connected

  5. Step 5: Check Claude Code uses it

    Start a new Claude Code session (the tools load when a session starts) and ask something whose answer changed recently. Add "use context7" so it knows to look:

    Paste into a new Claude Code sessiontext
    How do I set up a proxy in Next.js 16? use context7

    In the session you'll see two tool calls before the answer: resolve-library-id (Context7 finding the library) and query-docs (reading its docs). If both appear, it is working. On the clean run for this page (24 October 2026) the answer opened with "In Next.js 16, Middleware has been renamed to Proxy", which is the current behaviour.

If something goes wrong

"✘ Failed to connect"

The command was right; your computer couldn't reach mcp.context7.com. This is usually a company network, a VPN or a proxy. Try another network to confirm, then ask whoever runs your network to allow the address.

Context7 is already there under another name

claude mcp list may show claude.ai Context7 (a connector from your claude.ai account) or plugin:context7:context7 (from a Claude Code plugin). Either one already gives Claude Code Context7. Don't add a second one; use what you have. The plugin's entry may say "Needs authentication": type /mcp in a session and sign in from there.

"Pending approval" next to other servers

If you run claude mcp list inside a project that has its own .mcp.json, you'll see that project's servers too, marked "Pending approval" until you allow them. They aren't Context7 and don't affect it.

Claude answers without calling Context7

Check you started a new session after adding it, and that your prompt includes "use context7". To make it automatic, add one line to your project's CLAUDE.md: "Use Context7 when you need library or API documentation."

It works, then stops answering for a while

The free, keyless service has rate limits. If you use it heavily, create a free API key at context7.com and add it with the header option in Context7's own instructions. Paste the key into your terminal only, never into a chat.

Common mistakes

  • **Leaving out --scope user.** The server is then added for the folder you were in, and seems to vanish in every other project.
  • Testing in the same session. Tools load when a session starts. Start a new one after adding it.
  • Pasting an API key into Claude. You don't need one to start. If you add one later, type it in your own terminal.
  • **Running claude mcp get for a screenshot.** It prints the server's settings in full, including any key you added. Use claude mcp list instead.

Remove it

One command undoes it:

Run in your terminalbash
claude mcp remove --scope user context7

  • ToolWinning workFree

    The follow-up scorecard

    Fifteen questions on how your firm handles enquiries, follow-up and proposals. A score out of 45 and one fix for each part.

    5 minutesUpdated 22 Oct 2026

  • TemplateWinning workFree

    Follow-up schedule

    Ten follow-up steps for an enquiry, a first call and a sent proposal: when each one goes, and what it adds, so nothing reads as chasing.

    20 minutes to set upUpdated 24 Oct 2026

What to do next

Context7 helps Claude Code with other people's libraries. The follow-up schedule shows the same idea for your own work: write the rules down once, and let Claude apply them.