It's already easy to expose a python function as an MCP server. From the fastmcp docs:
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()