FastMCP
High-level Python & TypeScript framework for building MCP servers
FastMCP provides clean decorators and microframework patterns to write production-ready MCP tools in under 10 lines of code.
Quickstart Execution
server.py
Get started with FastMCP in your project.
from fastmcp import FastMCP
mcp = FastMCP("My Danish Agent Tools")
@mcp.tool()
def search_cvr(cvr_number: str) -> str:
"""Look up a Danish company by its 8-digit CVR number."""
return f"Company info for CVR {cvr_number}"
if __name__ == "__main__":
mcp.run()About FastMCP
FastMCP by Prefect/Jonathan Lowin is the FastAPI of the Model Context Protocol ecosystem. It abstracts away protocol handshakes, transport framing, and schema definitions. Decorate any Python function with `@mcp.tool()` and FastMCP automatically inspects type annotations and docstrings to generate complete JSON Schema tool definitions for LLMs.
Danish Product & Data Recipes
How developers and agents use FastMCP to connect with Danish digital infrastructure.
Build a 10-line DMI Weather MCP Server
DMI Open DataConnect to the Danish Meteorological Institute (DMI) Open Data API to provide Claude with live radar, precipitation, and sea level data across Denmark.
from fastmcp import FastMCP
import httpx
mcp = FastMCP("DMI Weather Denmark")
@mcp.tool()
async def get_copenhagen_temp() -> float:
"""Fetch current temperature in Copenhagen from DMI."""
async with httpx.AsyncClient() as client:
r = await client.get("https://dmigw.govcloud.dk/v2/metObs/data/...")
return r.json()["temp"]