mcp-cli
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 oh-my-skill add philschmid/mcp-cli/mcp-clicurl -fsSL https://oh-my-skill.com/install.sh | bash -s -- philschmid/mcp-cli/mcp-clinpx oh-my-skill verify philschmid/mcp-cli/mcp-cli怎么用
商店整理自技能原文 · 版本 d77672a · 表述以原文为准装上后,Claude 可以通过命令行与 MCP 服务器交互,连接到 GitHub、文件系统、数据库等外部工具和 API。它会执行 mcp-cli 命令来列出服务器、查看工具详情、调用工具并获取结果。
当你需要访问外部系统(如 GitHub、文件系统、数据库)或调用其工具时触发,例如查询数据、读写文件或调用 API。
技能原文 SKILL.md
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
- Discover:
mcp-cli→ see available servers - Explore:
mcp-cli info <server>→ see tools with parameters - Inspect:
mcp-cli info <server> <tool>→ get full JSON schema - 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: Success1: Client error (bad args, missing config)2: Server error (tool failed)3: Network error