关于 mcporter
mcporter 是用于从命令行发现和调用 MCP 服务工具的 CLI,适合需要在终端检查服务与执行工具的开发者。它可读取工具签名,并支持直接连接未配置的端点。
主要功能
- 01发现已配置的 MCP 服务
- 02查看工具签名和参数
- 03以多种格式调用工具
- 04查看 JSON Schema 和元数据
- 05直接连接临时端点
适用场景
- 01检查配置服务的状态与工具
- 02按工具签名从终端调用功能
- 03试用无需写入配置的 MCP 端点
MCP 相关
mcporter 从配置或编辑器导入中发现 MCP 服务,并连接它们以列出和调用工具。也可直接指定端点或 stdio 命令。
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ zlliang/ skills --skill mcporter安装后在 Claude Code 中输入/mcporter确认已加载。
详细介绍
MCPorter(mcporter)
MCPorter 是一个用于操作 MCP 服务的 CLI。你可以用它发现已配置的服务、查看其工具签名,并直接在 shell 中调用工具。
最重要的两个命令是 list(发现并检查)和 call(调用)。务必先运行 list 再运行 call,以确保参数符合实际架构。
如需查看准确的标志,请运行 mcporter <command> --help。MCPorter 会从其配置中发现服务——全局配置 ~/.mcporter/mcporter.json、项目配置 ./config/mcporter.json 或显式指定的 --config <path>——以及编辑器导入项(Cursor、Claude Code、Codex 等)。运行 mcporter config list 或 mcporter list --verbose,即可查看各服务的来源。
工作流
# 1. See configured servers and their health
mcporter list
# 2. Read one server's tools as TypeScript-like signatures
mcporter list <server>
# 3. Call a tool using the signature from step 2
mcporter call '<server>.<tool>(arg: "value", count: 5)'
list — 发现并检查
mcporter list # All servers, with live status
mcporter list <server> # Tools for one server, as signatures
mcporter list <server> --schema # Raw JSON schema for each tool
mcporter list <server> --json # Machine-readable, full tool metadata
mcporter list <server> --all-parameters # Reveal hidden optional params
单个服务的输出类似 TypeScript 声明:每个工具都有一段文档注释,包含一个 function name(...) 签名(必需参数在前,可选参数标记为 ?),以及一个使用下文函数调用语法编写的 Examples: 示例区块。除非传入 --all-parameters 或 --schema,否则会隐藏前几个以外的可选参数。
function web_search_exa(query: string, numResults?: number);
call — 调用工具
推荐:使用函数调用语法。 该语法与 mcporter list 中的签名一致,便于自我说明,支持嵌套对象和数组,也可避免 shell 标志歧义。请用单引号括起整个参数。
mcporter call 'exa.web_search_exa(query: "best React state libraries", numResults: 5)'
mcporter call 'linear.create_comment(issueId: "ENG-123", body: "Looks good!")'
- 建议使用命名参数;未标注名称的值会按架构顺序映射。
- 对于结构化结果,请使用
--output json;连接、身份验证、离线或 HTTP 故障会输出{ server, tool, issue }封装,供脚本处理。
mcporter call 'exa.web_search_exa(query: "...")' --output json
其他参数格式(推荐格式不便使用时)
# Shell-friendly key/value pairs (good in scripts)
mcporter call linear.list_issues team=ENG limit:5
# Prebuilt JSON payload (or `--json -` to read from stdin)
mcporter call linear.create_issue --json '{"title":"Bug","team":"ENG"}'
# Read a long string argument from a file
mcporter call linear.create_comment issueId=LNR-123 [email protected]
临时服务(不在配置中)
可直接将端点传给 list/call,无需修改配置:
mcporter list https://mcp.linear.app/mcp
mcporter call 'https://www.shadcn.io/api/mcp.getComponent(component: "vortex")'
mcporter list --stdio "bun run ./server.ts" --env TOKEN=xyz
裸域名会默认使用 https://;纯 http:// 需要 --allow-http。使用 --persist <config> 保存已试用的端点,以便重复使用其短名称。
备注
- 通过环境变量传递密钥,例如
LINEAR_API_KEY=… mcporter call 'linear.search_documentation(query: "automations")'。 - 还有其他命令(
auth、config、resource、daemon、generate-cli、emit-ts);需要时请运行mcporter --help。