from fastmcp import FastMCP # Create a named server mcp = FastMCP("Math Operations Server") # Define mathematical operation tools @mcp.tool() def add(a: int, b: int) -> int: """Add two numbers together""" return a + b @mcp.tool() def subtract(a: int, b: int) -> int: """Subtract b from a""" return a - b @mcp.tool() def multiply(a: int, b: int) -> int: """Multiply two numbers together""" return a * b @mcp.tool() def divide(a: int, b: int) -> float: """Divide a by b""" if b == 0: raise ValueError("Division by zero is not allowed") return a / b # Start the server if __name__ == "__main__": mcp.run()