fastmcp.cli.client
Client-side CLI commands for querying and invoking MCP servers.
Functions
resolve_server_spec
Client() accepts.
Exactly one of server_spec or command should be provided.
Resolution order for server_spec:
- URLs (
http://,https://) — passed through as-is. If--transportissse, the URL is rewritten to end with/ssesoinfer_transportpicks the right transport. - Existing file paths, or strings ending in
.py/.js/.json. - Anything else — name-based resolution via
resolve_name.
command is provided, the string is shell-split into a
StdioTransport(command, args).
coerce_value
parse_tool_arguments
--input-json provides the base dict; key=value pairs override.
Values are coerced using the tool’s inputSchema.
format_tool_signature
name(param: type, ...) -> return_type from a tool’s JSON schemas.
list_command
call_command
:// it is treated as a resource URI. Pass --prompt
to treat it as a prompt name.
Arguments are passed as key=value pairs. Use —input-json for complex
or nested arguments.
Examples:
discover_command
fastmcp list
and fastmcp call instead of specifying a URL or file path.
Examples:
fastmcp discover
fastmcp discover —source claude-code
fastmcp discover —source cursor —source gemini —json
fastmcp list weather
fastmcp call cursor:weather get_forecast city=London
