You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
565 B
25 lines
565 B
from fastmcp import FastMCP
|
|
from typing import Dict, Any, Optional
|
|
|
|
# Initialize MCP server
|
|
mcp = FastMCP("Math-Server")
|
|
|
|
@mcp.tool()
|
|
def add(a: int, b: int) -> int:
|
|
"""Add two numbers together"""
|
|
try:
|
|
return a + b
|
|
except Exception as e:
|
|
return {"error": str(e)}
|
|
|
|
@mcp.tool()
|
|
def multiply(a: int, b: int) -> int:
|
|
"""Multiply two numbers together"""
|
|
try:
|
|
return a * b
|
|
except Exception as e:
|
|
return {"error": str(e)}
|
|
|
|
if __name__ == "__main__":
|
|
print("Starting Math Server...")
|
|
mcp.run(transport="sse") |