from fastmcp import FastMCP
mcp = FastMCP("Calculator MCP Server")
@mcp.tool
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
@mcp.tool
def subtract(a: int, b: int) -> int:
"""Subtract two numbers"""
return a - b
@mcp.tool
def multiply(a: int, b: int) -> int:
"""Multiply two numbers"""
return a * b
@mcp.tool
def divide(a: float, b: float) -> float:
"""Divide two numbers"""
if b == 0:
raise ValueError("Cannot divide by zero")
return a / b
@mcp.tool
def power(a: int, b: int) -> int:
"""Raise a number to the power of another number"""
return a ** b
if __name__ == "__main__":
mcp.run(transport="http", host="0.0.0.0", port=8000, path="/mcp")