安装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身份验证
超级内存项目支持
安装托管在上的服务器时 https://api.supermemory.ai/*,您可以通过传递项目名称 --project。这是用于添加标头的方便别名 x-sm-project: .
规则:
- 仅适用于URL安装目标
https://api.supermemory.ai/*. - 值不得包含空格。
- 如果你忽略了
--project对于这些URL,系统会提示您。按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 cursorWarp用户:生成的配置将包括 --header "x-sm-project: " 在 args 安装超级内存URL时使用数组。
标头支持
您可以使用 --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 flag指定要为哪个MCP客户端安装:
claude-desktopclineroo-clinewindsurfwitsyenconvocursorvscodegemini-cliclaude-codegoosezedopencodewarp(输出配置以复制/粘贴到Warp的基于云的设置中)codex(OpenAI的Codex CLI工具)droid(Factory的Droid命令行界面工具)aider(AI配对编程工具)aider-desk(aider的桌面版)
许可证
麻省理工学院
