{
 "schema_version": 1,
 "generated": "2026-10-31",
 "id": "prefecthq-fastmcp--script-calls-to-any-mcp-server",
 "repo": "PrefectHQ/fastmcp",
 "repo_url": "https://github.com/PrefectHQ/fastmcp",
 "repo_slug": "prefecthq-fastmcp",
 "title": "Call any MCP server from your own Python code",
 "page_title": "How to call any MCP server from your own Python code with Fastmcp",
 "summary": "Use the FastMCP client to connect to a local or remote server by URL and call its tools programmatically.",
 "who": "An engineer testing an MCP server or building an app that uses tools from other MCP servers.",
 "problem": "Talking to MCP servers directly means handling transports, auth and protocol lifecycle yourself.",
 "outcome": "A Python script that connects to any MCP server and calls its tools, with transport negotiation managed for you.",
 "steps": [
  "Install with `uv add fastmcp`",
  "Read the Clients guide at gofastmcp.com",
  "Point a FastMCP client at the server URL; transport negotiation, authentication and protocol lifecycle are handled",
  "List the server's tools and call them from your script or tests",
  "Use the CLI option from the Clients docs for quick one-off checks"
 ],
 "agent_prompt": "Using PrefectHQ/fastmcp's client, write a Python script that connects to <MCP server URL>, lists its tools, and calls <tool> with <arguments>. Use it as a smoke test I can run in CI.",
 "agents": [
  "claude-code",
  "codex",
  "cursor"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "The README describes the client but shows no client code, so use the Clients guide for the exact API.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Python and uv (recommended) for installation",
  "An MCP client to connect your server to, such as an AI assistant or coding agent",
  "For TypeScript projects: the separate fastmcp-ts package"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/prefecthq-fastmcp/script-calls-to-any-mcp-server/",
 "md": "https://dedupedai.com/use-cases/prefecthq-fastmcp/script-calls-to-any-mcp-server/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/prefecthq-fastmcp--script-calls-to-any-mcp-server.json",
 "api_version": "v1"
}
