为编码智能体按需检索开源库的最新版本文档和代码示例,减少过时或虚构的 API 调用。
接入配置
选择客户端,复制配置,再按项目文档补齐环境变量。
本地运行
claude mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY~/.codex/config.toml
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
# codex mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY~/.cursor/mcp.json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp",
"--api-key",
"YOUR_API_KEY"
]
}
}
}.vscode/mcp.json
{
"servers": {
"context7": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp",
"--api-key",
"YOUR_API_KEY"
]
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp",
"--api-key",
"YOUR_API_KEY"
]
}
}
}claude_desktop_config.json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp",
"--api-key",
"YOUR_API_KEY"
]
}
}
}.trae/mcp.json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp",
"--api-key",
"YOUR_API_KEY"
]
}
}
}远程托管
claude mcp add --transport http context7 https://mcp.context7.com/mcp~/.codex/config.toml
[mcp_servers.context7]
url = "https://mcp.context7.com/mcp"
# codex mcp add context7 --url https://mcp.context7.com/mcp~/.cursor/mcp.json
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}.vscode/mcp.json
{
"servers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp"
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"context7": {
"httpUrl": "https://mcp.context7.com/mcp"
}
}
}claude_desktop_config.json · Customize › Connectors › Add custom connector
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://mcp.context7.com/mcp"
]
}
}
}.trae/mcp.json
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp"
}
}
}试试这个任务
查找我正在使用的这个库和版本的官方用法,给出一个最小示例,并标明文档来源与适用版本。
- 准备材料
- 库名、版本、当前代码和遇到的问题。
- 检查结果
- 确认示例对应实际版本,依赖和参数能从文档定位。