File size: 617 Bytes
305a0bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121d318
 
 
 
 
 
 
305a0bd
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from mcp.server.fastmcp import FastMCP


# Create an MCP server
mcp = FastMCP(
    name="Calculator",
    host="0.0.0.0",  # only used for SSE transport
    port=7860,  # only used for SSE transport (HF expect 7860 as a port)
)


# Add a simple calculator tool
@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers together"""
    return a + b

# Add a simple calculator tool
@mcp.tool()
def multiply(a: int, b: int) -> int:
    """Multiply two numbers together"""
    return a * b



# Run the server
if __name__ == "__main__":
    print("Running server with SSE transport")
    mcp.run(transport="sse")