Saturday, June 14, 2025

AI: FastMCP: OpenAPI Integration

 OpenAPI Integration - FastMCP (//gofastmcp.com/)

FastMCP can automatically generate an MCP server from an OpenAPI specification. Users only need to provide an OpenAPI specification (3.0 or 3.1) and an API client.

jlowin/fastmcp: 🚀 The fast, Pythonic way to build MCP servers and clients @GitHub (V2.0)

official MCP Python SDK was based on FastMCP 1.0.

The Model Context Protocol (MCP) is a new, standardized way to provide context and tools to your LLMs, and FastMCP makes building MCP servers and clients simple and intuitive. Create tools, expose resources, define prompts, and connect components with clean, Pythonic code.

# server.py
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()

Run the server locally:

fastmcp run server.py