Spaces:
Runtime error
Runtime error
Download arithmetic_server.py from Entz/mcp-stock-math: direct link, hf CLI and curl.
- Browser
- Download file 720 Bytes
-
https://huggingface.co/spaces/Entz/mcp-stock-math/resolve/main/arithmetic_server.py
- Command line
-
hf download hf://spaces/Entz/mcp-stock-math/arithmetic_server.py
-
curl -L -o arithmetic_server.py https://huggingface.co/spaces/Entz/mcp-stock-math/resolve/main/arithmetic_server.py
720 Bytes
| from mcp.server.fastmcp import FastMCP | |
| # Creates a server named "Arithmetic" | |
| mcp = FastMCP("Arithmetic") | |
| def add(a: int, b: int) -> int: | |
| """Add two numbers""" | |
| return a + b | |
| def multiply(a: int, b: int) -> int: | |
| """Multiply two numbers""" | |
| return a * b | |
| def minus(a: int, b: int) -> int: | |
| """Subtract two numbers (a - b)""" | |
| return a - b | |
| def divide(a: int, b: int) -> float: | |
| """Divide two numbers (a / b). Returns a float. Raises ValueError on division by zero.""" | |
| if b == 0: | |
| raise ValueError("Division by zero is not allowed.") | |
| return a / b | |
| if __name__ == "__main__": | |
| mcp.run(transport="stdio") |