Spaces:
Running
Running
# server.py | |
from fastmcp import FastMCP | |
mcp = FastMCP("Demo 🚀") | |
def hello(name: str) -> str: | |
return f"Hello, {name}!" | |
def multiply(a: float, b: float) -> float: | |
"""Multiplies two numbers.""" | |
return a * b | |
# Static resource | |
def get_version(): | |
return "2.0.1" | |
# Dynamic resource template | |
def get_profile(user_id: int): | |
# Fetch profile for user_id... | |
return {"name": f"User {user_id}", "status": "active"} | |
def summarize_request(text: str) -> str: | |
"""Generate a prompt asking for a summary.""" | |
return f"Please summarize the following text:\n\n{text}" | |
if __name__ == "__main__": | |
mcp.run(transport="sse", host="0.0.0.0", port=7860) |