Download math_server.py from Jofthomas/Multiple_mcp_fastapi_template: direct link, hf CLI and curl.
- Browser
- Download file 687 Bytes
-
https://huggingface.co/spaces/Jofthomas/Multiple_mcp_fastapi_template/resolve/main/math_server.py
- Command line
-
hf download hf://spaces/Jofthomas/Multiple_mcp_fastapi_template/math_server.py
-
curl -L -o math_server.py https://huggingface.co/spaces/Jofthomas/Multiple_mcp_fastapi_template/resolve/main/math_server.py
687 Bytes
| from mcp.server.fastmcp import FastMCP | |
| from typing import List | |
| import math | |
| import statistics | |
| mcp = FastMCP(name="MathServer", stateless_http=True) | |
| def add_two(a: int, b: int) -> int: | |
| return a + b | |
| def subtract_two(a: int, b: int) -> int: | |
| return a - b | |
| def multiply(a: int, b: int) -> int: | |
| return a * b | |
| def divide(a: float, b: float) -> float: | |
| if b == 0: | |
| raise ValueError("Division by zero is not allowed") | |
| return a / b | |