Skip to main content
Glama

Context7 MCP server

在 Claude Code 中安装 Context7 MCP server:

claude mcp add --scope user --transport http context7 https://mcp.context7.ai/mcp

重启 Claude Code,然后运行 claude mcp list。你要在列表中看到 context7。

同样的命令也可在 context7.ai 上使用。

安装

这条命令就是安装命令。--scope user 会把安装应用到每个项目;去掉该参数则只对当前仓库生效。

API 密钥是可选的(用于速率限制和私有仓库)。在 context7.ai/dashboard 创建一个,然后运行:

claude mcp add --scope user --header "Authorization: Bearer YOUR_API_KEY" --transport http context7 https://mcp.context7.ai/mcp

Claude Desktop, Cursor, VS Code, Windsurf

JSON 配置:在 mcpServers 下添加 context7,类型设为 http,url 设为 https://mcp.context7.ai/mcp。可不改直接使用的文件:examples/claude_desktop_config.json、examples/cursor.json、examples/vscode.json、examples/windsurf.json。

Claude Code 插件:plugins/claude/context7。技能:skills/context7-mcp/SKILL.md。MCP 注册清单:server.json。

远程 HTTP 与本地 npx:本页面讲的是远程方式。npx ctx7 setup 和 npx -y @upstash/context7-mcp 是本地/stdio 路径。我使用远程方式,所以不需要再启动一个 Node 进程。

Related MCP server: MCP Framework Documentation Server

用法

当你问某个特定库的问题时,在提示词中加上 use context7。

工具

一旦连接成功,你就能用上 Context7 的工具:resolve-library-id 和 query-docs。

故障排查

遇到 context7 mcp not connecting / context7 mcp server not found:运行 claude mcp list。如果列表里没有,说明添加未生效,或者你跳过了重启。如果列表里有但失去连接,通常是因为你在同一“名称下同时添加了 mcp.context7.ai 和 mcp.context7.com。

遇到 spawn context7-mcp ENOENT:这是本地 stdio 安装,找不到可执行文件。请使用上面的远程 HTTP 命令。

链接

许可证

MIT

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides up-to-date, version-specific documentation and code examples for software libraries directly to LLMs, enabling resolution of library identifiers and retrieval of relevant documentation with code snippets.
    -
  • A
    license
    A
    quality
    D
    maintenance
    Provides tools for AI agents to search, browse, and retrieve the full documentation for the mcp-framework. It enables agents to access documentation sections and page content directly within MCP-compatible environments like Claude Code and Cursor.
    3
    10 npm
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides MCP tools to list and search OpenAI Agents SDK documentation, enabling LLMs to retrieve documentation topics and content via natural language queries.
    MIT