# 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.

## Overview

- **Website**: https://github.com/jlowin/fastmcp
- **Docs**: https://github.com/jlowin/fastmcp#readme
- **GitHub**: https://github.com/jlowin/fastmcp
- **License / Pricing**: Open Source
- **Directory Entry**: https://agentaccess.dk/enablers/fastmcp

## About

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.

## Key Features

- Simple @mcp.tool() decorator syntax
- Automatic JSON Schema generation from Python type hints
- Built-in stdio, SSE, and HTTP streaming transports
- Supports image, audio, and binary prompt artifacts
- Native async support with httpx integration

## Danish System Application Recipes

### Build a 10-line DMI Weather MCP Server
Connect to the Danish Meteorological Institute (DMI) Open Data API to provide Claude with live radar, precipitation, and sea level data across Denmark.

```bash
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"]
```

## Quickstart

```python
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()
```

---
Source: [AgentAccess Enablers](https://agentaccess.dk/enablers/fastmcp)