‹ 首页

mcp-cli

@philschmid · 收录于 2 天前 · 上游提交 5 个月前

Interface for MCP (Model Context Protocol) servers via CLI. Use when you need to interact with external tools, APIs, or data sources through MCP servers.

适合你,如果你需要通过命令行使用MCP服务器连接外部服务。

/ 通过 npx 安装 校验哈希
npx oh-my-skill add philschmid/mcp-cli/mcp-cli
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- philschmid/mcp-cli/mcp-cli
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify philschmid/mcp-cli/mcp-cli
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
1235GitHub stars
~736最小装载
~4.7K含声明引用
~39K文本包总量
索引托管

怎么用

商店整理自技能原文 · 版本 d77672a · 表述以原文为准
它做什么

装上后,Claude 可以通过命令行与 MCP 服务器交互,连接到 GitHub、文件系统、数据库等外部工具和 API。它会执行 mcp-cli 命令来列出服务器、查看工具详情、调用工具并获取结果。

什么时候触发

当你需要访问外部系统(如 GitHub、文件系统、数据库)或调用其工具时触发,例如查询数据、读写文件或调用 API。

装好后可以这样说
Claude 会运行 mcp-cli 命令并显示列表。
技能原文 SKILL.md作者撰写 · MIT · d77672a

MCP-CLI

Access MCP servers through the command line. MCP enables interaction with external systems like GitHub, filesystems, databases, and APIs.

Commands

| Command | Output | |---------|--------| | mcp-cli | List all servers and tools | | mcp-cli info <server> | Show server tools and parameters | | mcp-cli info <server> <tool> | Get tool JSON schema | | mcp-cli grep "<pattern>" | Search tools by name | | mcp-cli call <server> <tool> | Call tool (reads JSON from stdin if no args) | | mcp-cli call <server> <tool> '<json>' | Call tool with arguments |

Both formats work: <server> <tool> or <server>/<tool>

Workflow
  1. Discover: mcp-cli → see available servers
  2. Explore: mcp-cli info <server> → see tools with parameters
  3. Inspect: mcp-cli info <server> <tool> → get full JSON schema
  4. Execute: mcp-cli call <server> <tool> '<json>' → run with arguments
Examples
# List all servers
mcp-cli

# With descriptions  
mcp-cli -d

# See server tools
mcp-cli info filesystem

# Get tool schema (both formats work)
mcp-cli info filesystem read_file
mcp-cli info filesystem/read_file

# Call tool
mcp-cli call filesystem read_file '{"path": "./README.md"}'

# Pipe from stdin (no '-' needed!)
cat args.json | mcp-cli call filesystem read_file

# Search for tools
mcp-cli grep "*file*"

# Output is raw text (pipe-friendly)
mcp-cli call filesystem read_file '{"path": "./file"}' | head -10
Advanced Chaining
# Chain: search files → read first match
mcp-cli call filesystem search_files '{"path": ".", "pattern": "*.md"}' \
  | head -1 \
  | xargs -I {} mcp-cli call filesystem read_file '{"path": "{}"}'

# Loop: process multiple files
mcp-cli call filesystem list_directory '{"path": "./src"}' \
  | while read f; do mcp-cli call filesystem read_file "{\"path\": \"$f\"}"; done

# Conditional: check before reading
mcp-cli call filesystem list_directory '{"path": "."}' \
  | grep -q "README" \
  && mcp-cli call filesystem read_file '{"path": "./README.md"}'

# Multi-server aggregation
{
  mcp-cli call github search_repositories '{"query": "mcp", "per_page": 3}'
  mcp-cli call filesystem list_directory '{"path": "."}'
}

# Save to file
mcp-cli call github get_file_contents '{"owner": "x", "repo": "y", "path": "z"}' > output.txt

Note: call outputs raw text content directly (no jq needed for text extraction)

Options

| Flag | Purpose | |------|---------| | -d | Include descriptions | | -c <path> | Specify config file |

Common Errors

| Wrong Command | Error | Fix | |---------------|-------|-----| | mcp-cli server tool | AMBIGUOUS_COMMAND | Use call server tool or info server tool | | mcp-cli run server tool | UNKNOWN_SUBCOMMAND | Use call instead of run | | mcp-cli list | UNKNOWN_SUBCOMMAND | Use info instead of list | | mcp-cli call server | MISSING_ARGUMENT | Add tool name | | mcp-cli call server tool {bad} | INVALID_JSON | Use valid JSON with quotes |

Exit Codes
  • 0: Success
  • 1: Client error (bad args, missing config)
  • 2: Server error (tool failed)
  • 3: Network error
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。