mcp-client
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUniversal MCP Client
通用MCP Client
Connect to any MCP server with progressive disclosure - load tool schemas on-demand instead of dumping thousands of tokens into context upfront.
支持渐进式披露连接任意MCP服务器——按需加载工具 schema,无需预先向上下文注入数千个token。
Skill Location
Skill 位置
This skill is located at:
.claude/skills/mcp-client/Script path:
.claude/skills/mcp-client/scripts/mcp_client.py该Skill位于:
.claude/skills/mcp-client/脚本路径:
.claude/skills/mcp-client/scripts/mcp_client.pyConfiguration
配置
The script looks for config in this order:
- env var (custom path)
MCP_CONFIG_PATH - (this skill's config - recommended)
references/mcp-config.json - in project root
.mcp.json ~/.claude.json
Your config file:
.claude/skills/mcp-client/references/mcp-config.jsonEdit this file to add your API keys. The example file () is kept as a reference template.
example-mcp-config.jsonIf the user hasn't provided their Zapier API key yet, ask them for it.
脚本按以下顺序查找配置:
- 环境变量(自定义路径)
MCP_CONFIG_PATH - (本Skill的配置文件——推荐使用)
references/mcp-config.json - 项目根目录下的
.mcp.json ~/.claude.json
你的配置文件:
.claude/skills/mcp-client/references/mcp-config.json编辑此文件添加你的API密钥。示例文件()可作为参考模板。
example-mcp-config.json如果用户尚未提供Zapier API密钥,请向其索要。
Running Commands
运行命令
All commands use the script at :
.claude/skills/mcp-client/scripts/mcp_client.pybash
undefined所有命令均使用以下脚本:
.claude/skills/mcp-client/scripts/mcp_client.pybash
undefinedList configured servers
列出已配置的服务器
python .claude/skills/mcp-client/scripts/mcp_client.py servers
python .claude/skills/mcp-client/scripts/mcp_client.py servers
List tools from a server
列出某服务器的工具
python .claude/skills/mcp-client/scripts/mcp_client.py tools <server_name>
python .claude/skills/mcp-client/scripts/mcp_client.py tools <server_name>
Call a tool
调用工具
python .claude/skills/mcp-client/scripts/mcp_client.py call <server> <tool> '{"arg": "value"}'
undefinedpython .claude/skills/mcp-client/scripts/mcp_client.py call <server> <tool> '{"arg": "value"}'
undefinedWorkflow
工作流程
- Check config exists - Run command. If error, create
servers.mcp.json - List servers - See what MCP servers are configured
- List tools - Get tool schemas from a specific server
- Call tool - Execute a tool with arguments
- 检查配置是否存在 - 运行命令。若报错,创建
servers.mcp.json - 列出服务器 - 查看已配置的MCP服务器
- 列出工具 - 获取特定服务器的工具schema
- 调用工具 - 使用参数执行工具
Commands Reference
命令参考
| Command | Description |
|---|---|
| List all configured MCP servers |
| List tools with full parameter schemas |
| Execute a tool with arguments |
| 命令 | 描述 |
|---|---|
| 列出所有已配置的MCP服务器 |
| 列出包含完整参数schema的工具 |
| 使用参数执行工具 |
Example: Zapier
示例:Zapier
bash
undefinedbash
undefined1. List servers to confirm Zapier is configured
1. 列出服务器确认Zapier已配置
python .claude/skills/mcp-client/scripts/mcp_client.py servers
python .claude/skills/mcp-client/scripts/mcp_client.py servers
2. List Zapier tools
2. 列出Zapier工具
python .claude/skills/mcp-client/scripts/mcp_client.py tools zapier
python .claude/skills/mcp-client/scripts/mcp_client.py tools zapier
3. Call a Zapier tool
3. 调用Zapier工具
python .claude/skills/mcp-client/scripts/mcp_client.py call zapier <tool_name> '{"param": "value"}'
undefinedpython .claude/skills/mcp-client/scripts/mcp_client.py call zapier <tool_name> '{"param": "value"}'
undefinedExample: Sequential Thinking
示例:Sequential Thinking
bash
undefinedbash
undefined1. List tools
1. 列出工具
python .claude/skills/mcp-client/scripts/mcp_client.py tools sequential-thinking
python .claude/skills/mcp-client/scripts/mcp_client.py tools sequential-thinking
2. Use sequential thinking
2. 使用Sequential Thinking
python .claude/skills/mcp-client/scripts/mcp_client.py call sequential-thinking sequentialthinking '{"thought": "Breaking down the problem...", "thoughtNumber": 1, "totalThoughts": 5, "nextThoughtNeeded": true}'
undefinedpython .claude/skills/mcp-client/scripts/mcp_client.py call sequential-thinking sequentialthinking '{"thought": "Breaking down the problem...", "thoughtNumber": 1, "totalThoughts": 5, "nextThoughtNeeded": true}'
undefinedConfig Format
配置格式
Config file format ():
references/mcp-config.jsonjson
{
"mcpServers": {
"zapier": {
"url": "https://mcp.zapier.com/api/v1/connect",
"api_key": "your-api-key"
},
"sequential-thinking": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
}
}
}Transport detection:
- +
url→ FastMCP with Bearer auth (Zapier)api_key - +
command→ stdio (local servers like sequential-thinking)args - ending in
url→ SSE transport/sse - ending in
url→ Streamable HTTP/mcp
配置文件格式():
references/mcp-config.jsonjson
{
"mcpServers": {
"zapier": {
"url": "https://mcp.zapier.com/api/v1/connect",
"api_key": "your-api-key"
},
"sequential-thinking": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
}
}
}传输方式检测:
- +
url→ 带Bearer认证的FastMCP(Zapier)api_key - +
command→ stdio(如sequential-thinking等本地服务器)args - 以结尾的
/sse→ SSE传输url - 以结尾的
/mcp→ 可流式HTTPurl
Error Handling
错误处理
Errors return JSON:
json
{"error": "message", "type": "configuration|validation|connection"}- - Config file not found. Create
configuration.mcp.json - - Invalid server or tool name
validation - - Failed to connect to server
connection
错误将返回JSON格式:
json
{"error": "message", "type": "configuration|validation|connection"}- - 未找到配置文件。请创建
configuration.mcp.json - - 无效的服务器或工具名称
validation - - 连接服务器失败
connection
Dependencies
依赖
bash
pip install mcp fastmcpbash
pip install mcp fastmcpReferences
参考资料
- - Template config file
references/example-mcp-config.json - - Common server configurations
references/mcp-servers.md - - Python SDK documentation
references/python-mcp-sdk.md
- - 配置文件模板
references/example-mcp-config.json - - 常见服务器配置
references/mcp-servers.md - - Python SDK 文档
references/python-mcp-sdk.md