upstash/context7 logo

upstash/context7

Free

Upstash 出品,为 LLM 和 AI 编辑器实时注入最新的库文档与代码示例,消除模型对过时 API 的幻觉。Cursor / Claude 等一键接入。

FreeFree tier
Type
Open Source
Company
Upstash

About upstash/context7

Context7 is an open-source platform by Upstash that provides up-to-date, version-specific code documentation and examples directly into the prompts of LLMs and AI code editors like Cursor and Claude. It eliminates hallucinations caused by outdated training data by fetching real-time documentation from official sources. Context7 supports two modes: CLI + Skills, which installs a skill that guides the agent to fetch docs using ctx7 CLI commands (no MCP required), and MCP mode, which registers a Context7 MCP server for native tool calls. Installation is a single command (npx ctx7 setup) and requires Node.js 18+. Users can specify library IDs and versions for precise results. A free API key is available for higher rate limits.

Key Features

Pulls up-to-date, version-specific documentation and code examples from official sources
Two operating modes: CLI + Skills (no MCP required) and MCP server for native integration
Simple one-command setup via npx ctx7 setup, with options for Cursor, Claude, or OpenCode
Supports library IDs and version specification for precise documentation retrieval
Free API key available at context7.com/dashboard for higher rate limits
Integrates directly into LLM prompts to provide context-aware, accurate code generation

Pros & Cons

Pros
  • Eliminates hallucinations by providing real-time, version-specific documentation
  • Supports both CLI and MCP modes for flexible integration with various AI tools
  • Simple one-command setup process requiring only Node.js 18+
  • Free tier available with optional API key for higher rate limits
  • Allows precise library and version targeting for accurate code generation
Cons
  • Requires Node.js 18+ which may not be available in all environments
  • Free tier may have rate limits without an API key
  • Primarily designed for LLM/code editor use cases, not a general-purpose documentation tool
  • Setup involves OAuth authentication which could be a minor friction point

Best For

Generating code with accurate APIs for libraries like Next.js, Supabase, or Cloudflare WorkersCreating middleware that checks for JWT and redirects unauthenticated usersConfiguring serverless functions with up-to-date runtime documentationObtaining version-specific documentation, e.g., Next.js 14 middleware setupIntegrating documentation into AI coding assistants (Cursor, Claude, OpenCode)

FAQ

How do I install Context7?
Run npx ctx7 setup in your terminal. It authenticates via OAuth, generates an API key, and installs the appropriate skill. You can target specific agents like Cursor, Claude, or OpenCode with the --cursor, --claude, or --opencode flags.
What are the modes of operation?
Context7 works in two modes: CLI + Skills (installs a skill that guides your agent to fetch docs using ctx7 CLI commands, no MCP required) and MCP (registers a Context7 MCP server so your agent can call documentation tools natively).
Is a free version available?
Yes, you can get a free API key at context7.com/dashboard for higher rate limits. Basic usage may be available without a key but with lower limits.
How can I specify a specific library or version?
Use the prefix 'use library /<vendor>/<library>' in your prompt to target a specific library. To specify a version, mention it in the prompt, e.g., 'Next.js 14 middleware' and Context7 will automatically match the appropriate version.