关于 Install MCP CLI
Install MCP CLI 是一个命令行工具,用于将 MCP 服务安装到多种客户端的配置中。它支持包名、完整命令和远程 URL 三种输入方式,并可自动推断服务名称。
主要功能
- 01支持包名、完整命令和远程 URL 输入
- 02自动推断服务名称
- 03支持自定义请求头
- 04支持 OAuth 认证流程
- 05可为十余种客户端生成配置
适用场景
- 01为 Claude Desktop 或 Cursor 快速添加 MCP 服务
- 02为远程 MCP 服务完成 OAuth 认证后安装
- 03在 Warp 中生成可粘贴的配置
MCP 相关
该工具是安装器而非 MCP 客户端,负责将 MCP 服务写入各客户端的配置文件,并处理远程服务的认证。
详细介绍
安装 MCP CLI
用于安装和管理 MCP 服务的 CLI 工具。
安装 MCP 服务非常麻烦,所以我制作了一个 CLI 工具来简化这一过程。
用法
CLI 现在支持多种安装方式,并会自动检测:
简单的软件包名称
npx install-mcp mcp-package-name --client claude-desktop
带作用域的软件包
npx install-mcp @org/mcp-server --client claude-desktop
完整命令(用于自定义参数)
npx install-mcp 'npx some-mcp-server --custom-args' --client claude-desktop
远程 URL(自动命名)
npx install-mcp https://mcp.example.com/server --client claude-desktop
该工具会自动:
- 将简单的软件包名称转换为
npx package-name - 保留完整命令,不做修改
- 根据软件包名称或 URL 推断服务名称(例如,
mcp.example.com→mcp-example-com) - 处理远程服务的 OAuth 身份验证
Supermemory 项目支持
安装托管在 https://api.supermemory.ai/* 上的服务时,可以通过 --project 传入项目名称。这是添加请求头 x-sm-project: <value> 的便捷别名。
规则:
- 仅适用于目标为
https://api.supermemory.ai/*的 URL 安装。 - 值中不得包含空格。
- 如果安装这些 URL 时省略
--project,系统会提示你输入。按 Enter 将使用default。 - 该值会作为请求头注入,与任何
--header标志一同生效。
示例:
# Explicit project
npx install-mcp https://api.supermemory.ai/servers/my-server \
--client cursor \
--project myproj
# Prompted for project (Enter defaults to "default")
npx install-mcp https://api.supermemory.ai/servers/my-server --client cursor
Warp 用户:安装 Supermemory URL 时,生成的配置会在 args 数组中包含 --header "x-sm-project: <value>"。
请求头支持
你可以使用 --header 标志传入请求头,用于身份验证或其他用途:
# Single header
npx install-mcp https://api.example.com/mcp --client claude-desktop --header "Authorization: Bearer token123"
# Multiple headers
npx install-mcp https://api.example.com/mcp --client claude-desktop \
--header "Authorization: Bearer token123" \
--header "X-API-Key: secret-key"
远程服务的 OAuth 身份验证
安装远程服务(URL)时,CLI 会询问该服务是否使用 OAuth 身份验证:
npx install-mcp https://api.example.com/mcp --client claude-desktop
# Output: Does this server use OAuth authentication? (Y/n)
你可以使用 --oauth 标志跳过此提示:
# Automatically run OAuth authentication
npx install-mcp https://api.example.com/mcp --client claude-desktop --oauth yes
# Skip OAuth authentication entirely
npx install-mcp https://api.example.com/mcp --client claude-desktop --oauth no
如果你回答是,身份验证流程会:
- 在安装前自动运行
- 在后台无缝处理 OAuth 流程
- 全局共享身份验证状态——在某个服务上完成身份验证后,所有 MCP 客户端都会自动使用该身份验证
- 在不同客户端中使用同一服务时,无需重新进行身份验证
# Output: Running authentication for https://api.example.com/mcp
如果身份验证失败,你会看到:
Authentication failed. Use the client to authenticate.
如果服务不使用 OAuth(你回答否),安装会直接继续,无需身份验证。
这样既能确保安全访问远程服务,也能灵活支持不需要 OAuth 的服务。
支持的客户端
--client 标志用于指定要安装到哪个 MCP 客户端:
claude-desktopclineroo-clinewindsurfwitsyenconvocursorvscodegemini-cliclaude-codegoosezedopencodewarp(输出配置,供复制并粘贴到 Warp 的云端设置中)codex(OpenAI 的 Codex CLI 工具)droid(Factory.AI 的 Droid CLI 工具)aider(AI 结对编程工具)aider-desk(aider 的桌面版)
许可证
MIT
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。