docs: make Chinese README the default
This commit is contained in:
@@ -1,24 +1,30 @@
|
||||
<!-- WEHUB_ZH_README -->
|
||||
> [!NOTE]
|
||||
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
|
||||
> [English](./README.en.md) · [原始项目](https://github.com/upstash/context7) · [上游 README](https://github.com/upstash/context7/blob/HEAD/README.md)
|
||||
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
|
||||
|
||||

|
||||
|
||||
[](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)
|
||||
|
||||
# Context7 Platform - Up-to-date Code Docs For Any Prompt
|
||||
# Context7 平台 — 为任意提示提供最新代码文档
|
||||
|
||||
[](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp) [](https://www.npmjs.com/package/@upstash/context7-mcp) [](./LICENSE)
|
||||
|
||||
[](./i18n/README.zh-TW.md) [](./i18n/README.zh-CN.md) [](./i18n/README.ja.md) [](./i18n/README.ko.md) [](./i18n/README.es.md) [](./i18n/README.fr.md) [-purple>)](./i18n/README.pt-BR.md) [](./i18n/README.it.md) [](./i18n/README.id-ID.md) [](./i18n/README.de.md) [](./i18n/README.ru.md) [](./i18n/README.uk.md) [](./i18n/README.tr.md) [](./i18n/README.ar.md) [](./i18n/README.vi.md)
|
||||
|
||||
## ❌ Without Context7
|
||||
## ❌ 没有 Context7
|
||||
|
||||
LLMs rely on outdated or generic information about the libraries you use. You get:
|
||||
LLM 依赖的是关于你所用库的过时或通用信息。你会遇到:
|
||||
|
||||
- ❌ Code examples are outdated and based on year-old training data
|
||||
- ❌ Hallucinated APIs that don't even exist
|
||||
- ❌ Generic answers for old package versions
|
||||
- ❌ 代码示例已过时,基于一年前的训练数据
|
||||
- ❌ 臆造出根本不存在的 API
|
||||
- ❌ 针对旧版软件包的通用回答
|
||||
|
||||
## ✅ With Context7
|
||||
## ✅ 使用 Context7
|
||||
|
||||
Context7 pulls up-to-date, version-specific documentation and code examples straight from the source — and places them directly into your prompt.
|
||||
Context7 直接从源头拉取最新、特定版本的文档和代码示例,并将其直接放入你的提示中。
|
||||
|
||||
```txt
|
||||
Create a Next.js middleware that checks for a valid JWT in cookies
|
||||
@@ -34,130 +40,130 @@ 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.
|
||||
Context7 将最新的代码示例和文档直接获取到你的 LLM 上下文中。无需切换标签页,没有根本不存在的臆造 API,也不会生成过时代码。
|
||||
|
||||
Works in two modes:
|
||||
支持两种模式:
|
||||
|
||||
- **CLI + Skills** — installs a skill that guides your agent to fetch docs using `ctx7` CLI commands (no MCP required)
|
||||
- **MCP** — registers a Context7 MCP server so your agent can call documentation tools natively
|
||||
- **CLI + Skills** — 安装一项技能,引导你的智能体使用 `ctx7` CLI 命令获取文档(无需 MCP)
|
||||
- **MCP** — 注册 Context7 MCP 服务器,让你的智能体可以原生调用文档工具
|
||||
|
||||
## Installation
|
||||
## 安装
|
||||
|
||||
> [!NOTE]
|
||||
> **API Key Recommended**: Get a free API key at [context7.com/dashboard](https://context7.com/dashboard) for higher rate limits.
|
||||
> **建议使用 API Key**:在 [context7.com/dashboard](https://context7.com/dashboard) 获取免费 API key,以获得更高的速率限制。
|
||||
|
||||
Set up Context7 for your coding agents with a single command. The `ctx7` CLI requires Node.js 18 or newer.
|
||||
一条命令即可为你的编程智能体配置 Context7。`ctx7` CLI 需要 Node.js 18 或更高版本。
|
||||
|
||||
```bash
|
||||
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.
|
||||
通过 OAuth 进行身份验证,生成 API key,并安装相应的技能。你可以在 CLI + Skills 或 MCP 模式之间选择。使用 `--cursor`、`--claude` 或 `--opencode` 来指定目标智能体。
|
||||
|
||||
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`.
|
||||
若要稍后移除生成的配置,请运行 `npx ctx7 remove`。如果你曾使用 `npm install -g ctx7` 全局安装了 CLI,请使用 `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 `CONTEXT7_API_KEY` header. See the link below for client-specific setup instructions.
|
||||
若要手动配置,请在 MCP 客户端中使用 Context7 服务器 URL `https://mcp.context7.com/mcp`,并通过 `CONTEXT7_API_KEY` 请求头传入你的 API key。请参阅下方链接了解各客户端的具体配置说明。
|
||||
|
||||
**[Manual Installation / Other Clients →](https://context7.com/docs/resources/all-clients)**
|
||||
**[手动安装 / 其他客户端 →](https://context7.com/docs/resources/all-clients)**
|
||||
|
||||
## Important Tips
|
||||
## 重要提示
|
||||
|
||||
### Use Library Id
|
||||
### 使用库 ID(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.
|
||||
如果你已明确知道要使用哪个库,请在其提示中加入对应的 Context7 ID。这样 Context7 可以跳过库匹配步骤,直接检索文档。
|
||||
|
||||
```txt
|
||||
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.
|
||||
斜杠语法会明确告诉 Context7 要为哪个库加载文档。
|
||||
|
||||
### Specify a Version
|
||||
### 指定版本
|
||||
|
||||
To get documentation for a specific library version, just mention the version in your prompt:
|
||||
要获取特定库版本的文档,只需在提示中注明版本即可:
|
||||
|
||||
```txt
|
||||
How do I set up Next.js 14 middleware? use context7
|
||||
```
|
||||
|
||||
Context7 will automatically match the appropriate version.
|
||||
Context7 会自动匹配相应版本。
|
||||
|
||||
### 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:
|
||||
如果你通过 `ctx7 setup` 安装,系统会自动配置一项技能,在遇到与库相关的问题时触发 Context7。若要改为手动设置规则,请在你的编程智能体中添加一条规则:
|
||||
|
||||
- **Cursor**: `Cursor Settings > Rules`
|
||||
- **Claude Code**: `CLAUDE.md`
|
||||
- Or the equivalent in your coding agent
|
||||
- **Cursor**:`Cursor Settings > Rules`
|
||||
- **Claude Code**:`CLAUDE.md`
|
||||
- 或在你所用编程智能体中的等效配置
|
||||
|
||||
**Example rule:**
|
||||
**规则示例:**
|
||||
|
||||
```txt
|
||||
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
|
||||
### CLI 命令
|
||||
|
||||
- `ctx7 library <name> <query>`: Searches the Context7 index by library name and returns matching libraries with their IDs.
|
||||
- `ctx7 docs <libraryId> <query>`: Retrieves documentation for a library using a Context7-compatible library ID (e.g., `/mongodb/docs`, `/vercel/next.js`).
|
||||
- `ctx7 library <name> <query>`:按库名搜索 Context7 索引,并返回匹配的库及其 ID。
|
||||
- `ctx7 docs <libraryId> <query>`:使用 Context7 兼容的库 ID 检索库的文档(例如 `/mongodb/docs`、`/vercel/next.js`)。
|
||||
|
||||
### MCP Tools
|
||||
### MCP 工具
|
||||
|
||||
- `resolve-library-id`: Resolves a general library name into a Context7-compatible library ID.
|
||||
- `query` (required): The user's question or task (used to rank results by relevance)
|
||||
- `libraryName` (required): The name of the library to search for
|
||||
- `query-docs`: Retrieves documentation for a library using a Context7-compatible library ID.
|
||||
- `libraryId` (required): Exact Context7-compatible library ID (e.g., `/mongodb/docs`, `/vercel/next.js`)
|
||||
- `query` (required): The question or task to get relevant documentation for
|
||||
- `resolve-library-id`:将通用库名解析为 Context7 兼容的库 ID。
|
||||
- `query`(必填):用户的问题或任务(用于按相关性对结果排序)
|
||||
- `libraryName`(必填):要搜索的库名称
|
||||
- `query-docs`:使用 Context7 兼容的库 ID 检索库的文档。
|
||||
- `libraryId`(必填):精确的 Context7 兼容库 ID(例如 `/mongodb/docs`、`/vercel/next.js`)
|
||||
- `query`(必填):用于获取相关文档的问题或任务
|
||||
|
||||
## More Documentation
|
||||
## 更多文档
|
||||
|
||||
- [CLI Reference](https://context7.com/docs/clients/cli) - Full CLI documentation
|
||||
- [MCP Clients](https://context7.com/docs/resources/all-clients) - Manual MCP installation for 30+ clients
|
||||
- [Adding Libraries](https://context7.com/docs/adding-libraries) - Submit your library to Context7
|
||||
- [Troubleshooting](https://context7.com/docs/resources/troubleshooting) - Common issues and solutions
|
||||
- [API Reference](https://context7.com/docs/api-guide) - REST API documentation
|
||||
- [Developer Guide](https://context7.com/docs/resources/developer) - Run Context7 MCP locally
|
||||
- [CLI Reference](https://context7.com/docs/clients/cli) - 完整 CLI 文档
|
||||
- [MCP Clients](https://context7.com/docs/resources/all-clients) - 30 多个客户端的手动 MCP 安装
|
||||
- [Adding Libraries](https://context7.com/docs/adding-libraries) - 向 Context7 提交你的库
|
||||
- [Troubleshooting](https://context7.com/docs/resources/troubleshooting) - 常见问题与解决方案
|
||||
- [API Reference](https://context7.com/docs/api-guide) - REST API 文档
|
||||
- [Developer Guide](https://context7.com/docs/resources/developer) - 在本地运行 Context7 MCP
|
||||
|
||||
## Packages
|
||||
## 软件包
|
||||
|
||||
- [`@upstash/context7-mcp`](https://www.npmjs.com/package/@upstash/context7-mcp) - MCP server
|
||||
- [`@upstash/context7-mcp`](https://www.npmjs.com/package/@upstash/context7-mcp) - MCP 服务器
|
||||
- [`ctx7`](https://www.npmjs.com/package/ctx7) - CLI
|
||||
- [`@upstash/context7-sdk`](https://www.npmjs.com/package/@upstash/context7-sdk) - TypeScript SDK
|
||||
- [`@upstash/context7-tools-ai-sdk`](https://www.npmjs.com/package/@upstash/context7-tools-ai-sdk) - Vercel AI SDK tools
|
||||
- [`@upstash/context7-pi`](https://www.npmjs.com/package/@upstash/context7-pi) - pi.dev extension
|
||||
- [`@upstash/context7-tools-ai-sdk`](https://www.npmjs.com/package/@upstash/context7-tools-ai-sdk) - Vercel AI SDK 工具
|
||||
- [`@upstash/context7-pi`](https://www.npmjs.com/package/@upstash/context7-pi) - pi.dev 扩展
|
||||
|
||||
## 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.
|
||||
1- Context7 中的项目由社区贡献;我们虽力求保持高质量,但无法保证所有库文档的准确性、完整性或安全性。Context7 中列出的项目由其各自所有者开发与维护,而非 Context7。如遇到可疑、不当或可能有害的内容,请立即使用项目页面上的「Report」按钮通知我们。我们会认真对待每一份举报,并及时审查被标记的内容,以维护平台的完整性与安全。使用 Context7 即表示你确认自行酌情使用并承担相关风险。
|
||||
|
||||
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.
|
||||
2- 本仓库托管 MCP 服务器的源代码。配套组件——API 后端、解析引擎和爬取引擎——为私有,不在本仓库中。
|
||||
|
||||
## 🤝 Connect with Us
|
||||
## 🤝 与我们联系
|
||||
|
||||
Stay updated and join our community:
|
||||
获取最新动态并加入我们的社区:
|
||||
|
||||
- 📢 Follow us on [X](https://x.com/context7ai) for the latest news and updates
|
||||
- 🌐 Visit our [Website](https://context7.com)
|
||||
- 💬 Join our [Discord Community](https://upstash.com/discord)
|
||||
- 📢 在 [X](https://x.com/context7ai) 上关注我们,获取最新新闻与更新
|
||||
- 🌐 访问我们的[网站](https://context7.com)
|
||||
- 💬 加入我们的 [Discord 社区](https://upstash.com/discord)
|
||||
|
||||
## 📺 Context7 In Media
|
||||
## 📺 Context7 媒体报道
|
||||
|
||||
- [Better Stack: "Free Tool Makes Cursor 10x Smarter"](https://youtu.be/52FC3qObp9E)
|
||||
- [Cole Medin: "This is Hands Down the BEST MCP Server for AI Coding Assistants"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
|
||||
- [Income Stream Surfers: "Context7 + SequentialThinking MCPs: Is This AGI?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
|
||||
- [Julian Goldie SEO: "Context7: New MCP AI Agent Update"](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
||||
- [JeredBlu: "Context 7 MCP: Get Documentation Instantly + VS Code Setup"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
||||
- [Income Stream Surfers: "Context7: The New MCP Server That Will CHANGE AI Coding"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
||||
- [AICodeKing: "Context7 + Cline & RooCode: This MCP Server Makes CLINE 100X MORE EFFECTIVE!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
||||
- [Sean Kochel: "5 MCP Servers For Vibe Coding Glory (Just Plug-In & Go)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
||||
- [Better Stack: "免费工具让 Cursor 智能提升 10 倍"](https://youtu.be/52FC3qObp9E)
|
||||
- [Cole Medin: "毫无疑问,这是 AI 编程助手最佳 MCP 服务器"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)
|
||||
- [Income Stream Surfers: "Context7 + SequentialThinking MCP:这是 AGI 吗?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)
|
||||
- [Julian Goldie SEO: "Context7:MCP AI Agent 新更新"](https://www.youtube.com/watch?v=CTZm6fBYisc)
|
||||
- [JeredBlu: "Context 7 MCP:即时获取文档 + VS Code 配置"](https://www.youtube.com/watch?v=-ls0D-rtET4)
|
||||
- [Income Stream Surfers: "Context7:将改变 AI 编程的新 MCP 服务器"](https://www.youtube.com/watch?v=PS-2Azb-C3M)
|
||||
- [AICodeKing: "Context7 + Cline & RooCode:这款 MCP 服务器让 CLINE 效率提升 100 倍!"](https://www.youtube.com/watch?v=qZfENAPMnyo)
|
||||
- [Sean Kochel: "5 个助力 Vibe Coding 的 MCP 服务器(即插即用)"](https://www.youtube.com/watch?v=LqTQi8qexJM)
|
||||
|
||||
## ⭐ Star History
|
||||
## ⭐ Star 历史
|
||||
|
||||
[](https://www.star-history.com/#upstash/context7&Date)
|
||||
|
||||
## 📄 License
|
||||
## 📄 许可证
|
||||
|
||||
MIT
|
||||
|
||||
Reference in New Issue
Block a user