A [[FastApi]] inspired web framework to easily create [[MCP]] server. Check it out [here](https://pypi.org/project/fastmcp/).
```python
from fastmcp import FastMCP
mcp = FastMCP(name="MyAssistantServer")
@mcp.tool
def multiply(a: float, b: float) -> float:
"""Multiplies two numbers."""
return a * b
@mcp.prompt
def summarize_request(text: str) -> str:
"""Generate a prompt asking for a summary."""
return f"Please summarize the following text:\n\n{text}"
@mcp.resource("users://{user_id}/profile")
def get_profile(user_id: int):
# Fetch profile for user_id...
return {"name": f"User {user_id}", "status": "active"}
```
It can also be mounted into a [[FastApi]] app in a sub route because its built on top of [[Starlette]].