init repo

This commit is contained in:
Sun-ZhenXing
2025-06-11 11:21:12 +08:00
commit e1b112f401
14 changed files with 840 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
from operator import add, mul, sub, truediv
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("math")
@mcp.tool()
async def add_nums(a: float, b: float) -> float:
"""
Adds two numbers.
"""
return add(a, b)
@mcp.tool()
async def sub_nums(a: float, b: float) -> float:
"""
Subtracts the second number from the first.
"""
return sub(a, b)
@mcp.tool()
async def mul_nums(a: float, b: float) -> float:
"""
Multiplies two numbers.
"""
return mul(a, b)
@mcp.tool()
async def div_nums(a: float, b: float) -> float:
"""
Divides the first number by the second.
"""
return truediv(a, b)
if __name__ == "__main__":
mcp.run()