mcp-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMCP-CLI
MCP-CLI
Access MCP servers through the command line. MCP enables interaction with external systems like GitHub, filesystems, databases, and APIs.
通过命令行访问MCP服务器。MCP支持与GitHub、文件系统、数据库和API等外部系统进行交互。
Commands
命令
| Command | Output |
|---|---|
| List all servers and tool names |
| Show tools with parameters |
| Get tool JSON schema |
| Call tool with arguments |
| Search tools by name |
Add to include descriptions (e.g., )
-dmcp-cli filesystem -d| 命令 | 输出 |
|---|---|
| 列出所有服务器和工具名称 |
| 显示带参数的工具 |
| 获取工具JSON架构 |
| 使用参数调用工具 |
| 按名称搜索工具 |
添加 以包含描述(例如:)
-dmcp-cli filesystem -dWorkflow
工作流程
- Discover: → see available servers and tools
mcp-cli - Explore: → see tools with parameters
mcp-cli <server> - Inspect: → get full JSON input schema
mcp-cli <server>/<tool> - Execute: → run with arguments
mcp-cli <server>/<tool> '<json>'
- 发现:→ 查看可用的服务器和工具
mcp-cli - 探索:→ 查看带参数的工具
mcp-cli <server> - 检查:→ 获取完整的JSON输入架构
mcp-cli <server>/<tool> - 执行:→ 使用参数运行工具
mcp-cli <server>/<tool> '<json>'
Examples
示例
bash
undefinedbash
undefinedList all servers and tool names
List all servers and tool names
mcp-cli
mcp-cli
See all tools with parameters
See all tools with parameters
mcp-cli filesystem
mcp-cli filesystem
With descriptions (more verbose)
With descriptions (more verbose)
mcp-cli filesystem -d
mcp-cli filesystem -d
Get JSON schema for specific tool
Get JSON schema for specific tool
mcp-cli filesystem/read_file
mcp-cli filesystem/read_file
Call the tool
Call the tool
mcp-cli filesystem/read_file '{"path": "./README.md"}'
mcp-cli filesystem/read_file '{"path": "./README.md"}'
Search for tools
Search for tools
mcp-cli grep "file"
mcp-cli grep "file"
JSON output for parsing
JSON output for parsing
mcp-cli filesystem/read_file '{"path": "./README.md"}' --json
mcp-cli filesystem/read_file '{"path": "./README.md"}' --json
Complex JSON with quotes (use heredoc or stdin)
Complex JSON with quotes (use heredoc or stdin)
mcp-cli server/tool <<EOF
{"content": "Text with 'quotes' inside"}
EOF
mcp-cli server/tool <<EOF
{"content": "Text with 'quotes' inside"}
EOF
Or pipe from a file/command
Or pipe from a file/command
cat args.json | mcp-cli server/tool
cat args.json | mcp-cli server/tool
Find all TypeScript files and read the first one
Find all TypeScript files and read the first one
mcp-cli filesystem/search_files '{"path": "src/", "pattern": "*.ts"}' --json | jq -r '.content[0].text' | head -1 | xargs -I {} sh -c 'mcp-cli filesystem/read_file "{"path": "{}"}"'
undefinedmcp-cli filesystem/search_files '{"path": "src/", "pattern": "*.ts"}' --json | jq -r '.content[0].text' | head -1 | xargs -I {} sh -c 'mcp-cli filesystem/read_file "{"path": "{}"}"'
undefinedOptions
选项
| Flag | Purpose |
|---|---|
| JSON output for scripting |
| Raw text content |
| Include descriptions |
| 标志 | 用途 |
|---|---|
| 输出JSON格式以便脚本处理 |
| 输出原始文本内容 |
| 包含工具描述 |
Exit Codes
退出码
- : Success
0 - : Client error (bad args, missing config)
1 - : Server error (tool failed)
2 - : Network error
3
- : 成功
0 - : 客户端错误(参数错误、配置缺失)
1 - : 服务器错误(工具执行失败)
2 - : 网络错误
3