{
 "schema_version": 1,
 "generated": "2026-10-31",
 "id": "prefecthq-fastmcp--turn-python-functions-into-mcp-tools",
 "repo": "PrefectHQ/fastmcp",
 "repo_url": "https://github.com/PrefectHQ/fastmcp",
 "repo_slug": "prefecthq-fastmcp",
 "title": "Turn your Python functions into MCP tools",
 "page_title": "How to turn your Python functions into MCP tools with Fastmcp",
 "summary": "Wrap existing functions with FastMCP so any AI assistant that speaks MCP can call them.",
 "who": "A developer with internal scripts who wants Claude or a coding agent to use them directly.",
 "problem": "Writing an MCP server by hand means schemas, validation and protocol handling before any real logic.",
 "outcome": "A working MCP server whose tools are plain Python functions, with schemas and docs generated for you.",
 "steps": [
  "Run `uv add fastmcp` in your project",
  "Create an instance with `mcp = FastMCP(\"Demo 🚀\")` and decorate each function with @mcp.tool",
  "Give each function type hints and a docstring; FastMCP builds the schema, validation and documentation from them",
  "Call mcp.run() under the main guard, as in the README example, and start the script",
  "Connect the server to your MCP client following the quickstart"
 ],
 "agent_prompt": "Using PrefectHQ/fastmcp, turn these Python functions into an MCP server: <list functions>. Add type hints and docstrings so the schemas are generated automatically, then connect it to my <MCP client> and test each tool.",
 "agents": [
  "claude-code",
  "codex",
  "cursor"
 ],
 "difficulty": "Beginner",
 "time": "20 minutes",
 "basis": "readme",
 "caveat": "A tool runs with your machine's permissions, so only expose functions you would be comfortable letting an AI call.",
 "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": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/prefecthq-fastmcp/turn-python-functions-into-mcp-tools/",
 "md": "https://dedupedai.com/use-cases/prefecthq-fastmcp/turn-python-functions-into-mcp-tools/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--turn-python-functions-into-mcp-tools.json",
 "api_version": "v1"
}
