Back to blog

Context7 MCP: How It Works, Setup, and Pricing in 2026

Share article:

Context7 MCP is an MCP server from Upstash that brings up-to-date, version-specific library documentation and code examples into AI coding agents such as Cursor and Claude Code. Instead of answering library questions from model knowledge alone, the agent can pull relevant documentation at request time. This guide covers how that works, setup, pricing, and where Context7 stops being useful.

Three diagonal squares connected by two curved, non-touching lines from the center square. Enclosed in a rounded square with a wavy line extending from the lower left.

TL;DR

  • Context7 MCP retrieves current, version-specific library documentation and code examples and puts the relevant material into your coding agent's context before it answers.
  • Run npx ctx7 setup to configure Context7, then choose between a native MCP server or CLI + Skills mode.
  • The Free plan includes 1,000 API calls per month, plus 20 bonus calls per day after you hit the limit. Pro currently costs $10 per seat per month and includes 5,000 calls per seat.
  • Context7 is built for indexed library and framework documentation, not general-purpose live web retrieval, so an agent that also needs current page data still needs a separate web-access layer.

What is Context7 MCP?

Context7 MCP is a server built by Upstash that gives AI coding agents access to current library documentation and code examples. It uses the Model Context Protocol, an open standard for connecting AI applications to external tools and data sources, so an agent can retrieve relevant docs while it works.

The MCP server itself is MIT-licensed and open source, while the services that index, parse, and serve the documentation remain private. Context7 organizes those sources under library IDs such as /vercel/next.js, giving the agent a specific set of documentation to query.

Why Context7 exists: the outdated docs problem

AI coding assistants can be very good at explaining a library and still give you code that no longer works. Their answers are shaped by the versions, examples, and API patterns they saw during training or have available in the current context window. 

If a library has changed since then, the model can suggest a deprecated API, mix patterns from different versions, or hallucinate a method that was never part of the library in the first place. Context7 is built around that failure mode.

Rather than expecting the model to know the latest API from memory, it retrieves the relevant documentation when the question is asked and adds it to the context before the model answers. The idea is similar to retrieval-augmented generation, where you bring in a more relevant external source at request time instead of depending entirely on what the model learned during training.

You can trigger that lookup manually with use context7, or configure a rule or skill to do it automatically for library questions. If your project depends on a specific version, you can mention it in the prompt or provide the exact library ID. That helps keep the agent anchored to the docs you actually need instead of mixing patterns from multiple versions.

The same applies to the amount of documentation retrieved. More context is not always better, so focused questions tend to work better than broad requests that pull in too much at once.

How Context7 works: the request flow

Once Context7 is available to your coding agent, a documentation lookup usually happens in two tool calls: resolve-library-id and query-docs. Here's how the full flow works:

  1. You ask a library question. The request might happen because you added use context7 to the prompt, or because a rule or skill recognizes that the question needs documentation.
  2. Context7 identifies the right library. The agent calls resolve-library-id with the library name and your question. Context7 then returns matching library IDs, such as /vercel/next.js, ranked using signals like relevance, source reputation, documentation coverage, and benchmark score.
  3. The agent fetches the relevant docs. Once it has the right ID, it calls query-docs with that library ID and your question. Context7 then returns the most relevant documentation snippets and code examples for the agent to use.
  4. The model answers with those docs in context. At that point, the response is grounded in the retrieved documentation rather than relying only on what the model already knows.

If you already know the exact library ID, you can skip the first lookup. A prompt that names /vercel/next.js can go straight to query-docs, while a version-specific ID such as /vercel/next.js/v15.1.8 can pin the lookup to a particular release.

The lookup is also fairly narrow from a privacy perspective. Context7 receives the documentation query and library name or ID, not your full prompt, source code, or conversation history. Its MCP tools also tell the agent not to include credentials, personal data, or proprietary code in those queries.

Context7 MCP tools and CLI commands

Context7 keeps its MCP surface small. resolve-library-id finds the right library, and query-docs retrieves the relevant documentation once that ID is known.

Tool

Arguments

Returns

When it runs

resolve-library-id

libraryName, query

Ranked library IDs

When the library ID isn't already known

query-docs

libraryId, query

Relevant documentation and code examples

Once the library ID is known

The ctx7 CLI mirrors the same flow. ctx7 library <name> <query> searches for the right library ID, while ctx7 docs <libraryId> <query> retrieves the documentation itself. Both can also return JSON if you want to pass the results into another script or tool.

If you're following an older Context7 guide, you may still see get-library-docs. Context7 replaced it with query-docs in version 2.0. Because the toolset is so focused, Context7 can also sit alongside other MCP servers when your agent needs capabilities beyond documentation.

Context7 skills: the alternative to running an MCP server

Context7 doesn't have to run through MCP. Its second setup mode, CLI + Skills, installs a skill file that teaches the coding agent to fetch documentation with the ctx7 CLI instead. The agent uses ctx7 library to find the source and ctx7 docs to retrieve the documentation, so there's no MCP server connection to maintain.

The difference is mostly in how the agent reaches Context7. In MCP mode, Context7 exposes resolve-library-id and query-docs as tools the coding agent can call directly, while CLI + Skills tells the agent when to run the equivalent terminal commands. That's a practical example of how skills and MCP differ.

Mode

What it adds

How docs are fetched

Best fit

MCP

Context7 MCP configuration

Native MCP tool calls

Clients with MCP support

CLI + Skills

A Context7 skill

ctx7 CLI commands

Skill-enabled agents or terminal-first workflows

If your client supports MCP and you want native tool calls, use MCP mode. CLI + Skills makes more sense for a lighter setup or an agent without MCP support. Both can trigger automatically for library questions, so you don't have to keep adding use context7 to every prompt.

The ctx7 CLI beyond docs lookups

The CLI also handles the setup around Context7. ctx7 setup configures an agent, while ctx7 loginctx7 whoami, and ctx7 logout handle authentication. If you want to undo the configuration later, ctx7 remove removes what the setup command added.

You can provide a key through the CONTEXT7_API_KEY environment variable, which is useful in CI or other environments where an interactive login isn't practical.

How to install Context7 MCP

The easiest way to install Context7 is through its setup CLI. You'll need Node.js 18 or newer to run it, along with a coding client that supports MCP. If Node.js isn't already installed, download the current LTS release from the official Node.js website. The Context7 CLI currently requires Node.js 18+, while running the local MCP package directly requires Node.js 20.18.1 or newer.

Once Node.js is installed, open your terminal and check that nodenpm, and npx are available:

node -v
npm -v
npx -v

If all three return version numbers, you're ready to start the Context7 setup:

npx ctx7 setup

That starts an interactive setup where you choose your coding agent and whether you want MCP or CLI + Skills mode. Since we're installing Context7 MCP here, select MCP server.

Setup with MCP server selected for Context7 installation.

The CLI then handles the client-specific setup for you, including the Context7 configuration and authentication flow. 

If you prefer to manage the MCP server yourself, the hosted endpoint is:

https://mcp.context7.com/mcp

Authenticated connections pass your Context7 API key through an Authorization header:

Authorization: Bearer YOUR_API_KEY

If you later want to remove the configuration added by the setup CLI, run:

npx ctx7 remove

The exact setup differs slightly by client, so Cursor and Claude Code are useful examples of what that looks like in practice.

Installing Context7 MCP in Cursor

If you use Cursor, you can skip the general agent-selection step and target it directly:

npx ctx7 setup --cursor

In MCP mode, Context7 adds the server configuration, rule, and skill Cursor needs for documentation lookups. You can also configure it manually from Cursor Settings → Tools & MCP → New MCP Server or by editing ~/.cursor/mcp.json:

{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}

A project-level .cursor/mcp.json keeps Context7 limited to that project rather than enabling it globally. That can be useful when you're building a scraper inside Cursor or working with dependencies that only matter to one codebase.

Installing Context7 MCP in Claude Code

Claude Code has the same one-command setup:

npx ctx7 setup --claude

That runs Context7's authentication flow and lets you choose MCP or CLI + Skills mode. If you prefer to add the remote MCP server manually, use:

claude mcp add --scope user \
--header "Authorization: Bearer YOUR_API_KEY" \
--transport http \
context7 https://mcp.context7.com/mcp

The --scope user flag makes Context7 available across your Claude Code projects rather than limiting it to the current one.

Claude Code also has a fuller Context7 plugin. Inside Claude Code, add the marketplace and install it with:

/plugin marketplace add upstash/context7
/plugin install context7@context7-marketplace

The plugin bundles the MCP integration with its documentation skill, a docs-researcher agent, and the /context7:docs command. That keeps documentation lookup inside the same workflow when you're already using Claude for coding or data extraction.

Getting a Context7 API key

Context7 works anonymously on lower shared limits, but an API key ties requests to your account and plan. 

Create one from the Context7 dashboard, then store it in CONTEXT7_API_KEY for local setups rather than hardcoding it into a project:

export CONTEXT7_API_KEY="YOUR_API_KEY"

Hosted MCP connections normally pass the same key through Authorization: Bearer YOUR_API_KEY. If the key is ever exposed, you can revoke it from the Context7 dashboard.

Which editors and platforms Context7 MCP supports

Context7 works with any client that supports MCP, so you're not limited to Cursor or Claude Code. Its current documentation also covers VS Code, OpenCode, Cline, Roo Code, Windsurf, Claude Desktop, and others.

Most can connect to the hosted Context7 endpoint over HTTP, while some also support the local package over stdio.

Client

Typical setup

Connection

Cursor

npx ctx7 setup --cursor or mcp.json

Remote or local

Claude Code

npx ctx7 setup --claude or claude mcp add

Remote or local

VS Code

Context7 extension or mcp.json

Remote or local

OpenCode

MCP config or ctx7 setup --opencode

Remote or local

Cline

MCP marketplace or manual config

Remote

Because client support changes quickly, check Context7's current client documentation for the latest setup route rather than treating this as a permanent compatibility list.

Context7 pricing: What the free tier actually covers

Context7 does have a free tier, but it's metered. As of September 2026, the Free plan includes 1,000 API calls per month. Once you hit that limit, regular access is blocked until the month resets, although Context7 gives you 20 bonus calls per day in the meantime.

Pro costs $10 per seat per month and includes 5,000 API calls per seat. You can keep using Context7 after that allowance, with additional calls billed at $10 per 1,000. Pro also adds private repositories and team collaboration, while parsing private repositories costs $5 per million tokens processed when they're added or refreshed. 

You can also use some Context7 clients anonymously without an API key, but those requests run on lower shared limits. Creating a key ties usage to your own plan and makes the higher allowance available to the client.

What developers use Context7 MCP for

Context7 is most useful when the right answer depends on documentation that changes faster than a model's training data. That includes fast-moving frameworks, cloud SDKs, version-specific APIs, and migrations where both old and new approaches still appear in the model's memory.

It also helps when you're working with an unfamiliar dependency and want the relevant docs inside your AI coding assistant instead of constantly moving between the editor and a browser. Pinning the lookup to a library or version gives the agent a narrower source to work from.

Its scope is intentionally smaller than a general coding assistant. Context7 is built around documentation for libraries, frameworks, SDKs, APIs, CLI tools, and similar dependencies, rather than general programming questions, code review, or application-specific business logic.

When Context7 isn't enough: Docs vs. live web data

Context7 is useful when the question is about how a library, framework, or SDK works. What it doesn't do is fetch an arbitrary webpage on demand because you need to know what's on that page right now.

That distinction matters when an agent needs both documentation and live information. You might use Context7 to check the current API for a library, then use Decodo's MCP Server to retrieve a product page, search result, or other live web content through the same MCP-based workflow.

For workflows that collect web data outside the editor, the Web Scraping API handles that retrieval layer through a regular API. The two tools therefore solve different parts of the stack rather than competing with each other.

Give your agent access to live web data

Context7 handles current documentation. Decodo's MCP Server gives the same agent access to live web pages through MCP, with scraping and retrieval handled for you.

Troubleshooting common Context7 MCP problems

Most Context7 problems come down to configuration, authentication, or the library lookup itself. The symptom usually gives you a good indication of where to start.

Problem

Likely cause

Likely cause

Context7 never gets called

No rule or skill is triggering it

Add a rule in your client or rerun ctx7 setup so Context7 is invoked for library questions

You keep hitting rate limits

You're using anonymous access or have exhausted your plan allowance

Add a Context7 API key, then restart the client. A 429 response includes a Retry-After value telling you when to try again

get-library-docs isn't found

You're following an older guide

Use query-docs. Context7 replaced get-library-docs when it moved to the newer query-based tool flow

The wrong library is returned

The package name matched a similarly named project

Pass the exact Context7 library ID, such as /vercel/next.js, instead of letting the agent resolve it again

The docs are for the wrong version

No version was specified

Mention the version in the prompt or use a version-specific library ID

You get a 401 error

The API key is missing or invalid

Check that the key starts with ctx7sk- and is being passed as Authorization: Bearer YOUR_API_KEY

A library can't be found

The library ID is wrong or the project isn't indexed

Search for it with resolve-library-id and confirm the library exists on Context7

Documentation, support, and community

Context7's official docs are the best place to check current client setup, CLI behavior, API usage, and troubleshooting, while its GitHub repository tracks the MCP server source, issues, and releases. Because indexed libraries are community-contributed and Context7 changes quickly, it's worth checking the underlying source or current docs when something looks wrong, or an older guide no longer matches your setup.

Final thoughts

Context7 MCP is useful for a fairly specific problem: giving coding agents current documentation at the moment they need it instead of asking them to work entirely from what they already know.

That becomes especially valuable with fast-moving libraries, version-specific APIs, and migrations where older patterns are still common enough to confuse the answer.

You can run it through MCP or CLI + Skills, and the one-command setup makes either route fairly lightweight. Just remember that Context7 itself moves quickly, so when an old configuration stops working, the current docs and changelog should be the first place you check.

Add live web access to your MCP stack

Use Decodo's MCP Server when your agent needs current web data alongside library documentation, without building the retrieval layer yourself.

Share article:

About the author

Justinas Tamasevicius

Director of Engineering

Justinas Tamaševičius is Director of Engineering with over two decades of expertise in software development. What started as a self-taught passion during his school years has evolved into a distinguished career spanning backend engineering, system architecture, and infrastructure development.

Connect with Justinas via LinkedIn.

All information on Decodo Blog is provided on an as is basis and for informational purposes only. We make no representation and disclaim all liability with respect to your use of any information contained on Decodo Blog or any third-party websites that may belinked therein.

Frequently asked questions

What does Context7 MCP do?

Context7 MCP gives AI coding agents access to current library documentation and code examples while they work. It uses resolve-library-id to identify the right library, then query-docs to retrieve the documentation most relevant to the question.

Is Context7 MCP free?

Yes, but the free plan is metered. It currently includes 1,000 API calls per month, with 20 bonus calls per day after you hit the monthly limit. Pro costs $10 per seat per month and includes 5,000 calls per seat, with additional usage billed separately.

Is there a Context7 MCP plugin for Claude Code?

Yes. Context7 has a Claude Code plugin that bundles the MCP server with automatic documentation lookups, a docs-researcher agent, and the /context7:docs command. You can install it from the Context7 marketplace inside Claude Code.

What are Context7 Skills?

Context7 Skills are instruction files that tell a coding agent when and how to retrieve documentation with the ctx7 CLI instead of relying on an MCP server. The skill can trigger automatically when you ask about libraries, while commands such as ctx7 library and ctx7 docs handle the actual lookup.

10 Best MCP Servers for AI Workflows in 2026

Choosing the best MCP servers matters even more now that MCP has shifted from niche adoption to widespread use, with OpenAI, Microsoft, and Google supporting it natively. This guide covers what MCP is, why it matters for real-world AI agents, which 10 MCP servers are currently most useful, and how to safely choose and combine MCPs for your setup.

Claude Skills vs. MCP: What's the Difference and When To Use Each

Claude Skills and MCP both extend what Claude can do, but they solve different problems. A Skill packages knowledge and procedure into a folder Claude reads when a task calls for it. MCP is a protocol that connects Claude to live tools and data. This guide gives you plain definitions, an honest comparison, and a working example of both on the same task.

OpenAI and GitHub logos centered among other AI tool logos floating over a dark dotted tech background

Best AI Tools for Coding in 2026

With all the buzz about AI taking over our jobs, why not flip the script and employ AI to help you write efficient code and boost your productivity instead? In 2026, the best AI tools for coding are designed to be your new sidekick, helping you code smarter, faster, and with less stress. Let's explore how you can make AI work for you before the inevitable machine world domination.

© 2018-2026 decodo.com (formerly smartproxy.com). All Rights Reserved