docs/publishing/guides/py-fastmcp.mdx
Python's FastMCP is a popular open source MCP server framework for Python.
fastmcp packageuv add fastmcp
pip install fastmcp
from fastmcp import FastMCP
mcp = FastMCP("Demo 🚀")
@mcp.tool
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
if __name__ == "__main__":
mcp.run(transport="http", host="127.0.0.1", port=8000, path="/mcp")
Deploy your server publicly or use a tool like ngrok to expose it to the internet.
<Warning> Tools like `ngrok` expose your unauthenticated server to the internet. Only run this command in a safe environment if you understand the risks. </Warning>We recommend deploying your server to a cloud provider like render, platform.sh, porter, or fly.io. Or one of the big boys AWS, GCP, or Azure.
Now that you have a publicly available MCP server, you can follow the existing MCP server guide to deploy it to Agentic.