Existing OpenAPI to an MCP Server Using FastMCP

In this brief tutorial, we’ll use FastMCP to transform an existing TODO application (which exposes an OpenAPI spec) into a MCP server and link it to CoPilot for organic task interactions. Step 1: The TODO App Your TODO app should already be running at: http://localhost:8000 And exposing its OpenAPI spec at: http://localhost:8000/openapi.json Step 2: Create the MCP Server Create a file todo_mcp_server.py: import httpx from fastmcp import FastMCP client = httpx.AsyncClient(base_url="http://localhost:8000") spec = httpx.get("http://localhost:8000/openapi.json").json() mcp = FastMCP.from_openapi(openapi_spec=spec, client=client) if __name__ == "__main__": mcp.run( transport="http", host="localhost", port=4200, path="/todo-mcp/http", log_level="debug", ) Run it: ...

August 3, 2025 · 2 min · 295 words · PandaC

Hello, How are you today?


Please share your details below

Start a Conversation

Expect delay in response

Hello, How are you today? !


Expect delay in response

powered by PandaC