Skip to content

Commit faa691d

Browse files
authored
Update hello_server.py
1 parent 7440462 commit faa691d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/hello/hello_server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import random, asyncio, logging
22
from fastmcp import FastMCP
33

4-
mcp_server = FastMCP(name="HelloMCPServer")
4+
mcp = FastMCP(name="HelloMCPServer")
55

66
logging.basicConfig(level=logging.INFO)
77

8-
@mcp_server.tool()
8+
@mcp.tool()
99
def greet(name: str) -> str:
1010
"""Greets a user by name."""
1111
logging.info(f"greet() called with name={name}")
1212
return f"Hello, {name}!"
1313

14-
@mcp_server.tool()
14+
@mcp.tool()
1515
def roll_dice(n_dice: int) -> list[int]:
1616
"""Rolls n_dice 6-sided dice and returns the results."""
1717
logging.info(f"roll_dice() called with n_dice={n_dice}")
1818
return [random.randint(1, 6) for _ in range(n_dice)]
1919

2020
async def main():
21-
await mcp_server.run_async(transport="streamable-http", path="/mcp", host="0.0.0.0", port=8000)
21+
await mcp.run_async(transport="streamable-http", path="/mcp", host="0.0.0.0", port=8000)
2222

2323
if __name__ == "__main__":
2424
asyncio.run(main())

0 commit comments

Comments
 (0)