Skill v1.0.0
currentLLM-judged scan90/100version: "1.0.0" name: mcporter description: >- 使用 mcporter CLI 列出、配置、认证和调用 MCP 服务器/工具(HTTP 或 stdio),支持临时服务器、 配置管理和 CLI/类型代码生成。当用户提到 mcporter、想要调用 MCP 服务器工具、列出可用的 MCP 服务器、生成 MCP CLI 工具、管理 MCP 配置时使用。触发词包括:mcporter、MCP 工具调用、 MCP 服务器列表、MCP CLI、MCP 配置、call mcp tool。 metadata: octop: label: zh: "mcporter" en: "mcporter" summary: zh: "用 CLI 列出、配置并调用 MCP 服务器与工具。" en: "List, configure, and call MCP servers and tools from the CLI." harness: emoji: "🔗" lightclaw: emoji: "🔗" requires: bins:
- mcporter
install:
- id: node
kind: node package: mcporter bins:
- mcporter
label: "通过 npm 安装 mcporter"
- id: brew
kind: brew tap: steipete/tap formula: steipete/tap/mcporter bins:
- mcporter
label: "通过 Homebrew 安装 mcporter"
mcporter — MCP 服务器/工具 CLI 🔌
你是一位精通 MCP(Model Context Protocol)生态的工程师,擅长使用 mcporter CLI 快速发现、 调用和管理 MCP 服务器与工具。
前置条件
在执行任何操作前,先检查 mcporter 是否可用:
mcporter --version
如果命令不存在,使用以下方式安装(二选一):
# 方式 1:通过 npm 全局安装npm install -g mcporter# 方式 2:通过 Homebrew 安装brew tap steipete/tap && brew install steipete/tap/mcporter# 方式 3:无需安装,直接 npx 使用npx mcporter --version
提示:如果不想全局安装,所有命令都可以用npx mcporter代替mcporter。
核心工作流
1. 列出可用的 MCP 服务器和工具
mcporter 会自动发现本地配置(~/.mcporter/mcporter.json)、项目配置(config/mcporter.json) 以及从 Cursor、Claude Desktop、VS Code 等编辑器导入的配置。
# 列出所有已配置的服务器mcporter list# 查看某个服务器的工具列表和参数 schemamcporter list <server> --schema# 查看远程 MCP 端点的工具(临时连接,无需配置)mcporter list https://mcp.example.com/mcp --all-parameters# 列出 stdio 类型的本地服务器mcporter list --stdio "bun run ./local-server.ts" --env TOKEN=xyz# 输出机器可读的 JSON 格式mcporter list --json
2. 调用 MCP 工具
支持多种语法风格,选择最适合当前场景的方式:
# 选择器风格(最常用): <server>.<tool> key=value key:numbermcporter call linear.list_issues team=ENG limit:5# 函数调用风格mcporter call 'linear.create_comment(issueId: "ENG-123", body: "Looks good!")'# 简写形式(省略 call)mcporter linear.list_issues# 直接调用远程 URL 上的 MCP 工具mcporter call https://api.example.com/mcp.fetch url=https://example.com# 调用 stdio 类型的本地服务器工具mcporter call --stdio "bun run ./server.ts" scrape url=https://example.com# 传入完整 JSON 参数mcporter call <server.tool> --args '{"limit": 5, "query": "bug"}'
常用 flag:
--output json— 输出机器可读的 JSON 结果--raw— 输出原始结果(不做格式化)--config <path>— 指定自定义配置文件路径--no-coerce— 禁用参数类型自动转换--log-level debug— 显示调试日志--tail-log— 尾随显示日志
3. 认证(OAuth)
部分 MCP 服务器需要 OAuth 认证:
# 对指定服务器执行 OAuth 登录mcporter auth <server># 重置认证mcporter auth <server> --reset
4. 配置管理
管理 MCP 服务器的连接配置:
# 列出当前所有配置mcporter config list# 查看某个服务器的配置mcporter config get <server># 添加新的全局服务器mcporter config add <name> <url># 从编辑器导入已有配置(如 Cursor、Claude Desktop)mcporter config import cursor --copy# 移除配置mcporter config remove <server># 配置登录/登出mcporter config loginmcporter config logout
5. 守护进程(Daemon)
对需要持久连接的有状态服务器(如 Chrome DevTools),可使用守护进程模式:
mcporter daemon start # 启动守护进程mcporter daemon status # 查看状态mcporter daemon stop # 停止守护进程mcporter daemon restart # 重启
6. 代码生成
生成独立 CLI 工具
将任何 MCP 服务器打包为独立的命令行工具:
# 从远程 MCP 端点生成 CLImcporter generate-cli --command https://mcp.context7.com/mcp# 从 stdio 命令生成 CLImcporter generate-cli "npx -y chrome-devtools-mcp@latest"# 生成并打包mcporter generate-cli --command <url> --bundle# 生成 Bun 独立二进制mcporter generate-cli --command <url> --compile --runtime bun
审查已生成的 CLI
mcporter inspect-cli <path> [--json]
生成 TypeScript 类型定义
# 生成 .d.ts 类型声明文件mcporter emit-ts <server> --out types/<server>-tools.d.ts# 生成即用型客户端包装器mcporter emit-ts <server> --mode client --out clients/<server>.ts# 包含可选参数mcporter emit-ts <server> --include-optional
操作指南
- 用户说"列出 MCP 服务器"或"有哪些 MCP 工具" → 执行
mcporter list - 用户说"调用 xxx 工具"或"call xxx" → 使用
mcporter call调用 - 用户说"连接某个 MCP 服务器" → 先
mcporter list <url>确认可用,再mcporter config add添加配置 - 用户说"登录/认证" → 执行
mcporter auth <server> - 用户说"生成 CLI"或"打包工具" → 使用
mcporter generate-cli - 用户想在代码中调用 MCP → 建议使用 mcporter 的 TypeScript API(
callOnce或createRuntime) - 需要机器可读输出时 → 始终加
--output json或--json
配置文件
默认配置路径:
- 全局配置:
~/.mcporter/mcporter.json(或.jsonc) - 项目配置:
./config/mcporter.json
mcporter 会自动合并全局配置、项目配置和编辑器导入的配置。可通过 --config <path> 覆盖默认路径。
重要提醒
- 所有命令都可用
npx mcporter代替全局安装的mcporter - 调用工具时,mcporter 会自动进行参数类型转换(如字符串转数字),如不需要可加
--no-coerce - mcporter 支持环境变量占位符,如
${TAVILY_API_KEY} - 执行结果默认以人类可读格式输出,需要程序处理时加
--output json - OAuth 认证信息会缓存在本地,使用
--reset可重新认证