Chuyển đến nội dung
Skillpedia
Trình kết nối (MCP)28k · #9866

fastmcp-client-cli

Skill này làm gì

Skill này dùng dòng lệnh fastmcp để khám phá và chạy các công cụ trên máy chủ MCP. Nó dành cho người muốn kiểm tra máy chủ làm được gì hoặc dùng công cụ của nó trong một script.

Khi nào nên dùng

  • ✓Khi bạn muốn xem máy chủ MCP cung cấp những công cụ nào trước khi dùng.
  • ✓Khi bạn cần gọi một công cụ MCP từ dòng lệnh hoặc trong một quy trình làm việc.
  • ✓Khi bạn muốn đầu ra JSON có thể đọc bằng máy từ máy chủ MCP cho một script.

Liên kết skill

https://github.com/PrefectHQ/fastmcp/blob/main/docs/.mintlify/skills/fastmcp-client-cli/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/PrefectHQ/fastmcp/blob/main/docs/.mintlify/skills/fastmcp-client-cli/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Máy chủ MCP cục bộ của tôi cung cấp những công cụ nào, và bạn có thể gọi công cụ tìm kiếm với truy vấn hello không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent chạy fastmcp list để hiển thị các công cụ và chữ ký của chúng, rồi fastmcp call với các đối số được tự động chuyển sang đúng kiểu.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

FastMCP CLI: List and Call

Use fastmcp list and fastmcp call to interact with any MCP server from the command line.

Listing Tools

# Remote server
fastmcp list http://localhost:8000/mcp

# Local Python file (runs via fastmcp run automatically)
fastmcp list server.py

# MCPConfig with multiple servers
fastmcp list mcp.json

# Stdio command (npx, uvx, etc.)
fastmcp list --command 'npx -y @modelcontextprotocol/server-github'

# Include full input/output schemas
fastmcp list server.py --input-schema --output-schema

# Machine-readable 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.

Calling Tools

# Key=value arguments (auto-coerced to correct types)
fastmcp call server.py greet name=World
fastmcp call server.py add a=3 b=4

# Single JSON object for complex/nested args
fastmcp call server.py create_item '{"name": "Widget", "tags": ["a", "b"]}'

# --input-json with key=value overrides
fastmcp call server.py search --input-json '{"query": "hello", "limit": 5}' limit=10

# JSON output for scripting
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.

Server Targets

All commands accept the same server targets:

Target Example
HTTP/HTTPS URL http://localhost:8000/mcp
Python file server.py
MCPConfig JSON mcp.json (must have mcpServers key)
Stdio command --command 'npx -y @mcp/server'
Discovered name weather or source:name

Servers configured in editor configs (Claude Desktop, Claude Code, Cursor, Gemini CLI, Goose) or project-level mcp.json can be referenced by name. Use source:name (e.g. claude-code:my-server, cursor:weather) to target a specific source. Run fastmcp discover to see available names.

For SSE servers, pass --transport sse:

fastmcp list http://localhost:8000/mcp --transport sse

Auth

HTTP targets automatically use OAuth (no-ops if the server doesn't require auth). Disable with --auth none:

fastmcp call http://server/mcp tool --auth none

Discovering Configured Servers

# See all MCP servers in editor/project configs
fastmcp discover

# Filter by source
fastmcp discover --source claude-code

# JSON output
fastmcp discover --json

Scans Claude Desktop, Claude Code, Cursor, Gemini CLI, Goose, and ./mcp.json. Sources: claude-desktop, claude-code, cursor, gemini, goose, project.

Workflow Pattern

Discover tools first, then call them:

# 1. See what servers are configured
fastmcp discover

# 2. See what tools a server has
fastmcp list weather

# 3. Call a tool
fastmcp call weather get_forecast city=London

If you call a nonexistent tool, FastMCP suggests close matches.

Câu hỏi thường gặp

Nó hoạt động với những loại máy chủ nào?

Nó hoạt động với máy chủ từ xa qua URL, file Python cục bộ, file cấu hình có nhiều máy chủ và các lệnh khởi động một máy chủ.

Tôi có phải định dạng đối số dạng JSON không?

Không. Đối số key=value đơn giản hoạt động, và giá trị được chuyển sang đúng kiểu tự động.

Tôi có thể xem đầy đủ schema không?

Có. Thêm tùy chọn schema đầu vào và đầu ra sẽ đưa toàn bộ schema JSON vào danh sách.

Chi tiết

Mô tả gốc của tác giả

Query and invoke tools on MCP servers using fastmcp list and fastmcp call. Use when you need to discover what tools a server offers, call tools, or integrate MCP servers into workflows.

repo: PrefectHQ/fastmcp

Độ phổ biến

Sao GitHub
28k
Vị trí xếp hạng
#9866
Giấy phép
Apache-2.0
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự