context7 README

The project's README from github.com/upstash/context7. As one markdown file: README.md.

Cover

Install MCP Server

Context7 Platform - Up-to-date Code Docs For Any Prompt

Website NPM Version MIT licensed

繁體中文 简体中文 日本語 한국어 문서 Documentación en Español Documentation en Français Documentação em Português (Brasil) Documentazione in italiano Dokumentasi Bahasa Indonesia Dokumentation auf Deutsch Документация на русском языке Українська документація Türkçe Doküman Arabic Documentation Tiếng Việt

❌ Without Context7

LLMs rely on outdated or generic information about the libraries you use. You get:

✅ With Context7

Context7 pulls up-to-date, version-specific documentation and code examples straight from the source — and places them directly into your prompt.

Create a Next.js middleware that checks for a valid JWT in cookies
and redirects unauthenticated users to `/login`. use context7
Configure a Cloudflare Worker script to cache
JSON API responses for five minutes. use context7
Show me the Supabase auth API for email/password sign-up.

Context7 fetches up-to-date code examples and documentation right into your LLM's context. No tab-switching, no hallucinated APIs that don't exist, no outdated code generation.

Works in two modes:

Installation

[!NOTE] API Key Recommended: Get a free API key at context7.com/dashboard for higher rate limits.

Set up Context7 for your coding agents with a single command. The ctx7 CLI requires Node.js 18 or newer.

npx ctx7 setup

Authenticates via OAuth, generates an API key, and installs the appropriate skill. You can choose between CLI + Skills or MCP mode. Use --cursor, --claude, or --opencode to target a specific agent.

To remove the generated setup later, run npx ctx7 remove. If you globally installed the CLI with npm install -g ctx7, remove that package separately with npm uninstall -g ctx7.

To configure manually, use the Context7 server URL https://mcp.context7.com/mcp with your MCP client and pass your API key via the Authorization: Bearer YOUR_API_KEY header. See the link below for client-specific setup instructions.

Manual Installation / Other Clients →

Important Tips

Use Library Id

If you already know exactly which library you want to use, add its Context7 ID to your prompt. That way, Context7 can skip the library-matching step and directly retrieve docs.

Implement basic authentication with Supabase. use library /supabase/supabase for API and docs.

The slash syntax tells Context7 exactly which library to load docs for.

Specify a Version

To get documentation for a specific library version, just mention the version in your prompt:

How do I set up Next.js 14 middleware? use context7

Context7 will automatically match the appropriate version.

Add a Rule

If you installed via ctx7 setup, a skill is configured automatically that triggers Context7 for library-related questions. To set up a rule manually instead, add one to your coding agent:

Example rule:

Always use Context7 when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask.

Available Tools

CLI Commands

MCP Tools

More Documentation

Packages

Disclaimer

1- Context7 projects are community-contributed and while we strive to maintain high quality, we cannot guarantee the accuracy, completeness, or security of all library documentation. Projects listed in Context7 are developed and maintained by their respective owners, not by Context7. If you encounter any suspicious, inappropriate, or potentially harmful content, please use the "Report" button on the project page to notify us immediately. We take all reports seriously and will review flagged content promptly to maintain the integrity and safety of our platform. By using Context7, you acknowledge that you do so at your own discretion and risk.

2- This repository hosts the MCP server’s source code. The supporting components — API backend, parsing engine, and crawling engine — are private and not part of this repository.

🤝 Connect with Us

Stay updated and join our community:

📺 Context7 In Media

📄 License

MIT

context7 (upstash/context7)

Searching Database…

63.2K ·GitHub
这是什么?Context7 会获取你所用库的最新、与版本对应的文档和代码示例,并直接注入到你的 AI 编程智能体的提示词中,而不是依赖模型过时的训练数据。
这是 CLI、MCP 服务器,还是两者都是?它支持两种模式:ctx7 CLI 会安装一个技能,通过命令获取文档,无需 MCP;或者你也可以把 Context7 注册为 MCP 服务器,让智能体原生调用文档工具。
怎样为我的编程智能体设置?运行设置命令并带上对应智能体的参数,例如针对 Cursor、Claude Code 或 OpenCode;它会通过 OAuth 完成认证、生成 API 密钥,并自动安装正确的技能或 MCP 配置。
我需要先安装 Node.js 或拿到 API 密钥吗?运行 ctx7 CLI 需要 Node.js 18 或更高版本;建议使用 API 密钥(免费,可在 context7.com/dashboard 获取)以获得更高的速率限制,但并非必需。
我能完全相信 Context7 中每个库的文档吗?不能完全相信——文档条目由社区贡献,因此准确性和安全性无法保证;而真正驱动该服务的 API 后端、解析和爬取引擎是私有的,不包含在本仓库中。
开箱即用支持哪些编程智能体?设置 CLI 提供 Cursor、Claude Code 和 OpenCode 的参数(--cursor、--claude、--opencode),另外还为 30 多种其他客户端提供了手动配置 MCP 的说明。
MCP 服务器提供哪些工具?resolve-library-id 可将库名转换为 Context7 兼容的 ID,query-docs 则根据你的问题或任务,获取该 ID 对应的实际文档。
这个项目发布了哪些包?它发布 @upstash/context7-mcp(MCP 服务器)、ctx7(CLI)、@upstash/context7-sdk(TypeScript SDK)、@upstash/context7-tools-ai-sdk(Vercel AI SDK 工具)和 @upstash/context7-pi(pi.dev 扩展)。
我可以固定某个库的特定版本吗?可以——只需在提示词中提到版本,或使用类似 /vercel/next.js 的库 ID,Context7 就会匹配并获取该确切版本的文档。
Creator
upstash
Size
39 MB
Stars
63.2K
Age
1y
Commits · 90 Days