fastmcp-client-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFastMCP CLI: List and Call
FastMCP CLI: 列出与调用
Use and to interact with any MCP server from the command line.
fastmcp listfastmcp call使用和从命令行与任意MCP服务器进行交互。
fastmcp listfastmcp callListing Tools
列出工具
bash
undefinedbash
undefinedRemote server
远程服务器
fastmcp list http://localhost:8000/mcp
fastmcp list http://localhost:8000/mcp
Local Python file (runs via fastmcp run automatically)
本地Python文件(通过fastmcp run自动运行)
fastmcp list server.py
fastmcp list server.py
MCPConfig with multiple servers
包含多个服务器的MCPConfig配置文件
fastmcp list mcp.json
fastmcp list mcp.json
Stdio command (npx, uvx, etc.)
标准输入输出命令(npx、uvx等)
fastmcp list --command 'npx -y @modelcontextprotocol/server-github'
fastmcp list --command 'npx -y @modelcontextprotocol/server-github'
Include full input/output schemas
包含完整的输入/输出模式
fastmcp list server.py --input-schema --output-schema
fastmcp list server.py --input-schema --output-schema
Machine-readable JSON
机器可读的JSON格式输出
fastmcp list server.py --json
fastmcp list server.py --json
Include resources and prompts
包含资源与提示词
fastmcp list server.py --resources --prompts
Default output shows tool signatures and descriptions. Use `--input-schema` or `--output-schema` to include full JSON schemas, `--json` for structured output.fastmcp list server.py --resources --prompts
默认输出会显示工具签名和描述。使用`--input-schema`或`--output-schema`参数可包含完整的JSON模式,使用`--json`参数可获取结构化输出。Calling Tools
调用工具
bash
undefinedbash
undefinedKey=value arguments (auto-coerced to correct types)
键值对参数(自动转换为正确类型)
fastmcp call server.py greet name=World
fastmcp call server.py add a=3 b=4
fastmcp call server.py greet name=World
fastmcp call server.py add a=3 b=4
Single JSON object for complex/nested args
单个JSON对象用于复杂/嵌套参数
fastmcp call server.py create_item '{"name": "Widget", "tags": ["a", "b"]}'
fastmcp call server.py create_item '{"name": "Widget", "tags": ["a", "b"]}'
--input-json with key=value overrides
使用--input-json参数并通过键值对覆盖配置
fastmcp call server.py search --input-json '{"query": "hello", "limit": 5}' limit=10
fastmcp call server.py search --input-json '{"query": "hello", "limit": 5}' limit=10
JSON output for scripting
用于脚本的JSON格式输出
fastmcp call server.py add a=3 b=4 --json
Type coercion is automatic: `limit=5` becomes an integer, `verbose=true` becomes a boolean, based on the tool's input schema.fastmcp call server.py add a=3 b=4 --json
类型转换是自动的:基于工具的输入模式,`limit=5`会转换为整数,`verbose=true`会转换为布尔值。Server Targets
服务器目标
All commands accept the same server targets:
| Target | Example |
|---|---|
| HTTP/HTTPS URL | |
| Python file | |
| MCPConfig JSON | |
| Stdio command | |
| Discovered name | |
Servers configured in editor configs (Claude Desktop, Claude Code, Cursor, Gemini CLI, Goose) or project-level can be referenced by name. Use (e.g. , ) to target a specific source. Run to see available names.
mcp.jsonsource:nameclaude-code:my-servercursor:weatherfastmcp discoverFor SSE servers, pass :
--transport ssebash
fastmcp list http://localhost:8000/mcp --transport sse所有命令都支持以下服务器目标:
| 目标类型 | 示例 |
|---|---|
| HTTP/HTTPS URL | |
| Python文件 | |
| MCPConfig JSON配置 | |
| 标准输入输出命令 | |
| 已发现的名称 | |
编辑器配置(Claude Desktop、Claude Code、Cursor、Gemini CLI、Goose)或项目级中配置的服务器可以通过名称引用。使用格式(例如、)可指定特定来源的服务器。运行命令查看可用的服务器名称。
mcp.jsonsource:nameclaude-code:my-servercursor:weatherfastmcp discover对于SSE服务器,需传递参数:
--transport ssebash
fastmcp list http://localhost:8000/mcp --transport sseAuth
身份验证
HTTP targets automatically use OAuth (no-ops if the server doesn't require auth). Disable with :
--auth nonebash
fastmcp call http://server/mcp tool --auth noneHTTP目标会自动使用OAuth认证(如果服务器不需要认证则无操作)。可使用参数禁用认证:
--auth nonebash
fastmcp call http://server/mcp tool --auth noneDiscovering Configured Servers
发现已配置的服务器
bash
undefinedbash
undefinedSee all MCP servers in editor/project configs
查看编辑器/项目配置中的所有MCP服务器
fastmcp discover
fastmcp discover
Filter by source
按来源过滤
fastmcp discover --source claude-code
fastmcp discover --source claude-code
JSON output
JSON格式输出
fastmcp discover --json
Scans Claude Desktop, Claude Code, Cursor, Gemini CLI, Goose, and `./mcp.json`. Sources: `claude-desktop`, `claude-code`, `cursor`, `gemini`, `goose`, `project`.fastmcp discover --json
扫描范围包括Claude Desktop、Claude Code、Cursor、Gemini CLI、Goose以及`./mcp.json`文件。来源类型包括:`claude-desktop`、`claude-code`、`cursor`、`gemini`、`goose`、`project`。Workflow Pattern
工作流模式
Discover tools first, then call them:
bash
undefined先发现工具,再调用它们:
bash
undefined1. See what servers are configured
1. 查看已配置的服务器
fastmcp discover
fastmcp discover
2. See what tools a server has
2. 查看某服务器提供的工具
fastmcp list weather
fastmcp list weather
3. Call a tool
3. 调用工具
fastmcp call weather get_forecast city=London
If you call a nonexistent tool, FastMCP suggests close matches.fastmcp call weather get_forecast city=London
如果你调用了不存在的工具,FastMCP会提示相似的匹配项。