Spaces:
Sleeping
Sleeping
Upload server.py
Browse files
server.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from mcp.server.fastmcp import FastMCP
|
| 2 |
+
|
| 3 |
+
mcp = FastMCP(
|
| 4 |
+
name = 'Calculator tool',
|
| 5 |
+
host='0.0.0.0',
|
| 6 |
+
port='8080'
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
@mcp.tool()
|
| 11 |
+
def addTool(a:int,b:int)->int:
|
| 12 |
+
return a+b
|
| 13 |
+
|
| 14 |
+
@mcp.prompt()
|
| 15 |
+
def greetingPrompt(style :str,userName:str)->str:
|
| 16 |
+
context = f"""
|
| 17 |
+
The user called : {userName}
|
| 18 |
+
answer with a greeting respecting this style : {style}
|
| 19 |
+
don't add any additional explinations.
|
| 20 |
+
"""
|
| 21 |
+
return context
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
mcp.run('sse')
|