返回市场
客户端

客户端

作者:smithery-ai438 星标更新:2025-11-17

项目介绍

Smithery CLI NPM 版本 NPM 下载量

Smithery 注册表安装程序和管理器,适用于模型上下文协议(MCP)服务器,设计为与客户端无关。

要求

  • NodeJS 版本 20 或以上

安装

全局安装以方便使用:

npm install -g @smithery/cli

使用方法

smithery <命令>

或者无需安装直接运行:

npx @smithery/cli <命令>

可用命令

  • install <服务器> - 安装服务器(交互式客户端选择)
    • --client <名称> - 指定 AI 客户端(跳过选择)
    • --config <json> - 提供 JSON 格式的配置数据(跳过提示)
  • uninstall <服务器> - 卸载服务器(交互式客户端选择)
    • --client <名称> - 指定 AI 客户端(跳过选择)
  • inspect <服务器ID> - 交互式检查服务器
  • run <服务器ID> - 运行服务器
    • --config <json> - 提供服务器配置
  • list - 列出已安装的服务器(交互式客户端选择)
    • --client <名称> - 指定 AI 客户端(跳过选择)
  • search [术语] - 在 Smithery 注册表中搜索服务器(交互式)
  • login - 使用 API 密钥登录(交互式)
  • dev [入口文件] - 启动具有热重载和隧道的开发服务器
    • --port <端口> - 运行服务器的端口(默认:8081)
    • --key <apikey> - 提供 API 密钥
    • --no-open - 不自动打开游乐场
    • --prompt <提示> - 开始游乐场时的初始消息
    • -c, --config <路径> - 配置文件路径(默认:自动检测 smithery.config.js)
  • build [入口文件] - 构建 MCP 服务器用于生产
    • -o, --out <输出文件> - 输出文件路径(默认:.smithery/index.cjs)
    • --transport <类型> - 传输类型:shttp 或 stdio(默认:shttp)
    • -c, --config <路径> - 配置文件路径(默认:自动检测 smith smithery.config.js)
  • playground - 在浏览器中打开 MCP 游乐场
    • --port <端口> - 暴露的端口(默认:8081)
    • --key <apikey> - 提供 API 密钥
    • 可在 -- 分隔符后传递命令
  • --help - 显示帮助信息
  • --verbose - 显示详细的日志用于调试

示例

# 安装服务器(交互式客户端选择)
smithery install exa

# 为特定客户端安装服务器(跳过选择)
smithery install exa --client claude

# 使用预配置的数据安装服务器(跳过提示)
smithery install exa --client claude --config '{"exaApiKey":"your_api_key"}'

# 卸载服务器(交互式客户端选择)
smithery uninstall exa

# 从特定客户端卸载服务器(跳过选择)
smithery uninstall exa --client claude

# 列出已安装的服务器(交互式)
smithery list

# 列出 claude 的已安装服务器
smithery list --client claude

# 在注册表中搜索服务器
smithery search "web search"

# 交互式搜索(提示输入术语)
smithery search

# 检查 Smithery 注册表中的特定服务器
smithery inspect exa

# 使用配置运行服务器
smithery run exa --config '{"key":"value"}'

# 登录并设置 API 密钥
smithery login

# 启动具有热重载的开发服务器
smithery dev
smithery dev server.ts --port 3000

# 构建用于生产的服务器
smithery build
smithery build server.ts --out dist/server.cjs --transport stdio

# 在浏览器中打开游乐场
smithery playground
smithery playground --port 3001 -- node dist/server.js

# 显示帮助菜单
smithery --help

# 使用详细日志进行调试安装
smithery install mcp-obsidian --client claude --verbose

重要注意事项

  • 使用 login 命令设置您的 Smithery API 密钥(某些操作需要)
  • 记得在安装或卸载服务器后重启您的 AI 客户端
  • 使用 inspect 命令进行交互式服务器测试
  • 无参数运行以查看帮助菜单
  • 使用 --verbose 标志进行故障排除时显示详细日志
  • dev 命令为 MCP 服务器开发提供热重载
  • 使用 playground 在交互式 Web 接口中测试您的 MCP 服务器

开发

本指南将帮助您开始开发 @smithery/cli。

开始步骤

  1. 克隆仓库:

    git clone https://github.com/smithery-ai/cli
    cd cli
    
  2. 安装依赖项:

    npm install
    
  3. 构建项目:

    npm run build
    

开发命令

# 列出已安装的服务器
npx . list --client claude

# 搜索服务器
npx . search obsidian

# 检查特定服务器
npx . inspect <服务器ID>

# 安装服务器
npx . install <服务器名称> --client <客户端名称>

# 使用详细日志运行
npx . <命令> --verbose

贡献

欢迎贡献!请随时提交拉取请求。