安装 MCP 是一件非常麻烦的事情,所以我制作了一个命令行工具来简化这个过程。
该 CLI 现在支持多种安装方式,并且具有自动检测功能:
npx install-mcp mcp-package-name --client claude
npx install-mcp @org/mcp-server --client claude
npx install-mcp 'npx some-mcp-server --custom-args' --client claude
npx install-mcp https://mcp.example.com/server --client claude
该工具会自动:
npx package-namemcp.example.com → mcp-example-com)当安装托管在 https://api.supermemory.ai/* 的服务器时,可以通过 --project 传递项目名称。这是添加头部 x-sm-project: <value> 的便捷别名。
规则:
https://api.supermemory.ai/* 的 URL 安装。--project,将会提示输入。按 Enter 使用默认值 default。--header 标志一起注入。示例:
# 显式项目
npx install-mcp https://api.supermemory.ai/servers/my-server \
--client cursor \
--project myproj
# 提示项目(Enter 默认为 "default")
npx install-mcp https
://api.supermemory.ai/servers/my-server --client cursor
Warp 用户:生成的配置将在安装 Supermemory URL 时,在 args 数组中包含 --header "x-sm-project: <value>"。
您可以使用 --header 标志传递头部信息,用于认证或其他目的:
# 单个头部
npx install-mcp https://api.example.com/mcp --client claude --header "Authorization: Bearer token123"
# 多个头部
npx install-mcp https://api.example.com/mcp --client claude \
--header "Authorization: Bearer token123" \
--header "X-API-Key: secret-key"
当安装远程服务器(URL)时,CLI 会询问该服务器是否使用 OAuth 认证:
npx install-mcp https://api.example.com/mcp --client claude
# 输出:此服务器是否使用 OAuth 认证?(Y/n)
您可以通过 --oauth 标志绕过此提示:
# 自动运行 OAuth 认证
npx install-mcp https://api.example.com/mcp --client claude --oauth yes
# 完全跳过 OAuth 认证
npx install-mcp https://api.example.com/mcp --client claude --oauth no
如果您回答是,则认证流程:
# 输出:正在为 https://api.example.com/mcp 进行认证
如果认证失败,您会看到:
认证失败。请使用客户端进行认证。
如果服务器不使用 OAuth(您回答否),则安装将直接进行,无需认证。
这确保了对远程服务器的安全访问,同时保持了对不需要 OAuth 的服务器的灵活性。
--client 标志指定了您要为其安装的 MCP 客户端:
claudeclineroo-clinewindsurfwitsyenconvocursorvscodegemini-cliclaude-codegoosezedwarp(输出配置以复制/粘贴到 Warp 的基于云的设置中)codex(OpenAI 的 Codex CLI 工具)MIT