返回市场
安装-mcp

安装-mcp

作者:supermemoryai127 星标更新:2025-11-08

项目介绍

安装 MCP CLI

一个用于安装和管理 MCP 服务器的命令行工具。

安装 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

远程 URL(自动命名)

npx install-mcp https://mcp.example.com/server --client claude

该工具会自动:

  • 将简单包名转换为 npx package-name
  • 保留完整的命令不变
  • 根据包名或 URL 推断服务器名称(例如,mcp.example.commcp-example-com
  • 处理远程服务器的 OAuth 认证

Supermemory 项目支持

当安装托管在 https://api.supermemory.ai/* 的服务器时,可以通过 --project 传递项目名称。这是添加头部 x-sm-project: <value> 的便捷别名。

规则:

  • 仅适用于目标为 https://api.supermemory.ai/* 的 URL 安装。
  • 值不能包含空格。
  • 如果在这些 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"

远程服务器的 OAuth 认证

当安装远程服务器(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

如果您回答是,则认证流程:

  • 在安装前自动运行
  • 在后台无缝处理 OAuth 流程
  • 认证状态全局共享 —— 一旦您对某个服务器进行了认证,该认证将自动对所有 MCP 客户端可用
  • 使用同一服务器的不同客户端无需重新认证
# 输出:正在为 https://api.example.com/mcp 进行认证

如果认证失败,您会看到:

认证失败。请使用客户端进行认证。

如果服务器不使用 OAuth(您回答否),则安装将直接进行,无需认证。

这确保了对远程服务器的安全访问,同时保持了对不需要 OAuth 的服务器的灵活性。

支持的客户端

--client 标志指定了您要为其安装的 MCP 客户端:

  • claude
  • cline
  • roo-cline
  • windsurf
  • witsy
  • enconvo
  • cursor
  • vscode
  • gemini-cli
  • claude-code
  • goose
  • zed
  • warp(输出配置以复制/粘贴到 Warp 的基于云的设置中)
  • codex(OpenAI 的 Codex CLI 工具)

许可证

MIT