Context7

Context7 is an Upstash-built MCP server that injects up-to-date, version-specific library documentation and code snippets into AI coding agents, reducing deprecated-API hallucinations for indexed frameworks and packages.

MCP serverdocumentation retrievalAI coding agentsversion-specific docsUpstashCursorClaude Codedeveloper toolsRAG
Context7 hero image
Overview

What is Context7?

Context7 is a documentation-retrieval service for AI coding agents, built and maintained by the Upstash team. It uses the Model Context Protocol to expose two tools—resolve-library-id and query-docs—that let a coding agent pull current, version-specific snippets from indexed library documentation before answering a question or generating code. The problem it targets is specific and well-documented: model training data goes stale, and libraries rename or remove APIs between releases. Without a retrieval layer, an agent may confidently produce code against an API that no longer exists. Context7 attempts to reduce that failure mode for the libraries it indexes, not to be a universal context layer or a replacement for live web access.

The MCP server is MIT-licensed and open source, while the indexing, parsing, and serving infrastructure behind the hosted service is proprietary. The company describes the service as "most of Context7 is free": the Free plan covers the MCP server, CLI, Search API, all public libraries, and limited Docs7 hosting. Paid tiers add private repository parsing, higher API call volumes, team features, and enterprise governance including SOC 2, SSO, and on-premise deployment.

Workflow

How does Context7 work?

A lookup normally involves two MCP tool calls. First, the agent calls resolve-library-id with a library name and a query describing the task. Context7 returns matching libraries with their IDs (in the format /org/project), snippet counts, source reputation, benchmark scores, and available version-specific IDs. Second, the agent calls query-docs with the chosen library ID and a focused question. Context7 returns a batch of relevant code snippets and, where indexed, explanatory text. The agent then uses those snippets to ground its answer.

The retrieval model is batch-oriented rather than iterative. The agent does not browse pages or selectively read sections; it selects a library and receives whatever snippet set the system determines is relevant. Version pinning is supported by appending a version to the library ID (e.g., /vercel/next.js/v16.2.9), which allows an agent to target the exact release in use rather than the latest or a generic version. Configuration is available through the ctx7 CLI, a remote HTTP MCP endpoint, or local stdio transport. OAuth 2.0 is supported for clients implementing the MCP OAuth specification.

Context7 also operates adjacent products beyond the MCP server: Context7 Ask provides an ask endpoint for up to three websites on the Free plan, and Docs7 offers hosted documentation sites with agent-readable endpoints and a limited Context7 Agent on Free. These are separate from the core library-documentation retrieval flow and have their own usage boundaries.

Use cases

Use Cases

  • Grounding coding-agent answers in current library documentation when the model's training data is likely to be stale, particularly for fast-moving JavaScript and Python frameworks
  • Pinning documentation retrieval to a specific library version during maintenance or migration work, avoiding patterns from a different major release
  • Enforcing a documented source hierarchy in agent rules so that library API questions are answered from Context7 snippets rather than model memory
  • Providing a consistent documentation-retrieval layer across multiple coding agents (Cursor, Claude Code, Codex, OpenCode) through the same MCP endpoint and library index
  • Using the CLI for terminal-based documentation lookup when a full agent integration is not necessary
Pricing

Pricing

Pricing model: Freemium

Plan Price Billing Included usage Notes
Free $0 — 1,000 API calls per month covering the MCP server, CLI, Search API, and REST API. Access to every public library, library owner tools, access-control policies, OAuth 2.0, Context7 Ask for up to three websites, and Docs7 Free for up to three hosted documentation sites. When the 1,000 calls are exhausted, requests stop until the next month, with 20 bonus calls granted per day in the interim. —
Pro $10 per seat per month 2,000 API calls per seat per month, private repository access, team collaboration, and teamspace rules. Additional API calls are billed at $5 per 1,000. Parsing private repositories is charged separately at $5 per 1M parsed tokens. Pro accounts are never blocked when included calls are exhausted; overages are billed. —
Enterprise Custom quoted Custom API call volumes, SOC 2 Type II compliance, SSO (SAML/OIDC), self-hosted on-premise deployment, dedicated support, and unlimited teamspace members. Enterprise teamspaces with up to 50 members can activate from the plans page; larger teamspaces and annual contracts require contacting Upstash. —
Free tier: A Free plan covers the MCP server, CLI, Search API, all public libraries, Context7 Ask, and Docs7 Free, limited to 1,000 API calls per month. Private repositories, team features, and higher usage require Pro or Enterprise.
Limitations

Common Limitations

  • Free-tier call quota · The Free plan provides 1,000 API calls per month across all surfaces (MCP, CLI, Search API, REST API). When exhausted, requests are blocked until the monthly reset, with only 20 bonus calls per day during the outage. Active development workflows that query documentation frequently can reach this ceiling quickly.
  • Public-library orientation · The Free and Pro plans are built around public library documentation. Private repository parsing requires a paid add-on ($5 per 1M tokens on Pro and Enterprise). PDF and file-upload ingestion is not part of the core MCP documentation lookup flow; a separate PDF upload endpoint exists but requires a teamspace and has a 50MB file-size limit. Teams whose documentation retrieval needs centre on internal PDFs, proprietary SDKs, or arbitrary file formats will find Context7's public-index-first design constraining.
  • Reliability and rate-limit variability · Community reports from early 2026 describe connection timeouts, server startup failures, and abrupt free-tier quota reductions as reasons for migrating to alternatives. The current Free tier is documented at 1,000 calls per month, but quota levels have changed before. Anonymous requests without an API key hit a separate rate limit that is lower and less predictable than authenticated usage. RateLimit-* and Retry-After headers are exposed for dynamic client handling, but the burden of implementing backoff falls on the integrator.
  • Not a general-purpose web search tool · Context7 retrieves snippets from indexed library documentation. It does not provide live web search, current page data, or general research retrieval. An agent that needs up-to-date information outside indexed libraries—such as release announcements, blog posts, or documentation for an unindexed tool—still requires a separate search or fetch layer.
  • Batch retrieval model · The MCP server exposes resolve-library-id and query-docs. The agent selects a library, and Context7 returns a pre-determined batch of snippets. This differs from iterative search-and-read patterns where the agent controls which pages to read and how much context to pull. For queries that require navigating across multiple documentation pages or reading explanatory prose rather than code snippets, the batch model can return less relevant material or miss context that a source-of-truth read would capture.
Features

Key Features

  • Two-tool MCP interface: resolve-library-id and query-docs
  • Version-pinned documentation via library IDs
  • Public library index covering major JavaScript and Python ecosystems
  • MCP client compatibility including Cursor, Claude Code, Codex, and OpenCode
  • CLI (ctx7) for terminal-based lookup and agent configuration
Comparison

Context7 vs. Ref.Tools and Exa

This comparison uses current official and vendor-published sources. It focuses on documented retrieval model, content scope, and pricing structure, not subjective judgments of output quality. Context7, Ref.Tools, and Exa address overlapping but distinct retrieval needs; they are not strict substitutes.

Tool Positioning Key differences Best fit Pricing note
Context7 Plans & Pricing About Context7 An Upstash-built MCP server for version-specific library documentation retrieval, aimed at reducing deprecated-API hallucinations in coding agents. Two-tool batch retrieval (resolve-library-id, query-docs) returns pre-processed code snippets from a curated public library index. Supports version pinning. Private repository parsing is a paid add-on; PDF and file-upload ingestion is not part of the core MCP flow. MCP server is MIT-licensed; the indexing infrastructure is proprietary. Coding agents working with public JavaScript and Python libraries who need version-anchored API snippets with low token overhead and a free starting tier. Free: $0 with 1,000 API calls/month. Pro: $10/seat/month with 2,000 calls/seat and private-repo parsing at $5/1M tokens. Enterprise: custom, with SSO and self-hosted options.
Ref.Tools Ref vs Context7 Ref pricing A token-lean documentation retrieval MCP server for AI coding agents, supporting both public docs and private sources with an iterative search-and-read model. Uses search-then-read tools rather than batch retrieval, allowing the agent to control which pages to read and adapt token usage per query. Supports any content type from documentation—prose, warnings, code—not only pre-extracted snippets. Includes private GitHub repos, PDF indexing, and file uploads in paid plans. Closed-source and commercially operated. Teams that need documentation retrieval across both public APIs and private repositories, PDFs, or proprietary SDKs, and prefer agent-controlled iterative retrieval over fixed batches. Free tier with 200 non-expiring credits. Paid plans start at $9/month for 1,000 credits; higher tiers at $50/month (6,000 credits) and $200/month (30,000 credits).
Exa Exa pricing Upstash benchmark An AI-native web search API for agents, providing live web retrieval and neural search across public pages rather than library-specific documentation. Performs general web search and returns live pages or highlights, not a curated library index. Published vendor benchmarks show faster latency than Context7 but substantially higher token usage per response and a higher share of stale-API results on version-specific coding queries. Exa is a broad retrieval layer, not a version-pinned documentation tool. Agents that need current information from the open web—release notes, blog posts, announcements, or documentation for tools not covered by a library index—and can tolerate higher token costs per query. Pay-as-you-go with no subscription. New accounts receive $20 in free credits; the Free tier adds $10 in credits monthly. Search pricing starts at $4 per 1,000 requests (Lite) and $7 per 1,000 (Auto/Fast).

Comparison checked against official product information on 2026-11-05. Features and pricing may change.

FAQ

Frequently Asked Questions

What problem does Context7 actually solve?

Context7 reduces the risk of coding agents generating code against deprecated or hallucinated library APIs by injecting current, version-specific documentation snippets into the agent's context at request time. It is aimed at library and framework documentation retrieval, not general web search or arbitrary file access.

Is Context7 free to use?

Yes, with limits. The Free plan provides 1,000 API calls per month across the MCP server, CLI, Search API, and REST API, plus access to all public libraries, Context7 Ask for three sites, and Docs7 Free for three documentation sites. Private repositories, higher call volumes, and enterprise governance features require Pro ($10 per seat per month) or Enterprise.

Does Context7 support private repositories and PDFs?

Private repository parsing is available as a paid add-on on Pro and Enterprise at $5 per 1M parsed tokens. PDF and file-upload ingestion is not part of the core MCP lookup flow. A separate PDF upload endpoint exists for teamspaces with a 50MB file-size limit, but the primary documentation-retrieval path is built around indexed public libraries. Teams whose needs centre on internal PDFs or proprietary file formats should evaluate whether that separate path meets their requirements.

What happens when the Free plan's 1,000 calls are exhausted?

Requests are blocked until the monthly reset. During the blocked period, the account receives 20 bonus calls per day. Pro accounts are not blocked when included calls are exhausted; overages are billed at $5 per 1,000 additional calls per seat.

How does Context7 differ from a web search tool like Exa?

Context7 retrieves from a curated index of library documentation and returns code-focused snippets pinned to library versions. Exa performs general web search and returns results from live pages. Exa is faster in published benchmarks and can surface information outside library docs, while Context7 is narrower but designed to return version-appropriate API-level code examples with substantially lower token overhead per response. They address different retrieval needs and can be used together in an agent stack.

Alternative Tools

Context7 hero image