python

A minimal FastMCP tool

Type hints become the schema and the docstring becomes the description — a complete MCP tool in a handful of lines.

  • python
  • fastmcp
  • tools
python
from mcp.server.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()
← All tech bits