mcp-client

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Universal 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.py

Configuration

配置

The script looks for config in this order:
  1. MCP_CONFIG_PATH
    env var (custom path)
  2. references/mcp-config.json
    (this skill's config - recommended)
  3. .mcp.json
    in project root
  4. ~/.claude.json
Your config file:
.claude/skills/mcp-client/references/mcp-config.json
Edit this file to add your API keys. The example file (
example-mcp-config.json
) is kept as a reference template.
If the user hasn't provided their Zapier API key yet, ask them for it.
脚本按以下顺序查找配置:
  1. MCP_CONFIG_PATH
    环境变量(自定义路径)
  2. references/mcp-config.json
    (本Skill的配置文件——推荐使用)
  3. 项目根目录下的
    .mcp.json
  4. ~/.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.py
:
bash
undefined
所有命令均使用以下脚本:
.claude/skills/mcp-client/scripts/mcp_client.py
bash
undefined

List 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"}'
undefined
python .claude/skills/mcp-client/scripts/mcp_client.py call <server> <tool> '{"arg": "value"}'
undefined

Workflow

工作流程

  1. Check config exists - Run
    servers
    command. If error, create
    .mcp.json
  2. List servers - See what MCP servers are configured
  3. List tools - Get tool schemas from a specific server
  4. Call tool - Execute a tool with arguments
  1. 检查配置是否存在 - 运行
    servers
    命令。若报错,创建
    .mcp.json
  2. 列出服务器 - 查看已配置的MCP服务器
  3. 列出工具 - 获取特定服务器的工具schema
  4. 调用工具 - 使用参数执行工具

Commands Reference

命令参考

CommandDescription
servers
List all configured MCP servers
tools <server>
List tools with full parameter schemas
call <server> <tool> '<json>'
Execute a tool with arguments
命令描述
servers
列出所有已配置的MCP服务器
tools <server>
列出包含完整参数schema的工具
call <server> <tool> '<json>'
使用参数执行工具

Example: Zapier

示例:Zapier

bash
undefined
bash
undefined

1. 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"}'
undefined
python .claude/skills/mcp-client/scripts/mcp_client.py call zapier <tool_name> '{"param": "value"}'
undefined

Example: Sequential Thinking

示例:Sequential Thinking

bash
undefined
bash
undefined

1. 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}'
undefined
python .claude/skills/mcp-client/scripts/mcp_client.py call sequential-thinking sequentialthinking '{"thought": "Breaking down the problem...", "thoughtNumber": 1, "totalThoughts": 5, "nextThoughtNeeded": true}'
undefined

Config Format

配置格式

Config file format (
references/mcp-config.json
):
json
{
  "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
    +
    api_key
    → FastMCP with Bearer auth (Zapier)
  • command
    +
    args
    → stdio (local servers like sequential-thinking)
  • url
    ending in
    /sse
    → SSE transport
  • url
    ending in
    /mcp
    → Streamable HTTP
配置文件格式(
references/mcp-config.json
):
json
{
  "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
    +
    api_key
    → 带Bearer认证的FastMCP(Zapier)
  • command
    +
    args
    → stdio(如sequential-thinking等本地服务器)
  • /sse
    结尾的
    url
    → SSE传输
  • /mcp
    结尾的
    url
    → 可流式HTTP

Error Handling

错误处理

Errors return JSON:
json
{"error": "message", "type": "configuration|validation|connection"}
  • configuration
    - Config file not found. Create
    .mcp.json
  • validation
    - Invalid server or tool name
  • connection
    - Failed to connect to server
错误将返回JSON格式:
json
{"error": "message", "type": "configuration|validation|connection"}
  • configuration
    - 未找到配置文件。请创建
    .mcp.json
  • validation
    - 无效的服务器或工具名称
  • connection
    - 连接服务器失败

Dependencies

依赖

bash
pip install mcp fastmcp
bash
pip install mcp fastmcp

References

参考资料

  • references/example-mcp-config.json
    - Template config file
  • references/mcp-servers.md
    - Common server configurations
  • references/python-mcp-sdk.md
    - Python SDK documentation
  • references/example-mcp-config.json
    - 配置文件模板
  • references/mcp-servers.md
    - 常见服务器配置
  • references/python-mcp-sdk.md
    - Python SDK 文档