Use this file to discover all available pages before exploring further.
Let’s create a simple calculator MCP server that provides basic math operations.
from fastmcp import FastMCPmcp = FastMCP("Calculator MCP Server")@mcp.tooldef add(a: int, b: int) -> int: """Add two numbers""" return a + b@mcp.tooldef subtract(a: int, b: int) -> int: """Subtract two numbers""" return a - b@mcp.tooldef multiply(a: int, b: int) -> int: """Multiply two numbers""" return a * b@mcp.tooldef divide(a: float, b: float) -> float: """Divide two numbers""" if b == 0: raise ValueError("Cannot divide by zero") return a / b@mcp.tooldef power(a: int, b: int) -> int: """Raise a number to the power of another number""" return a ** bif __name__ == "__main__": mcp.run(transport="http", host="0.0.0.0", port=8000, path="/mcp")