|
|
import asyncio |
|
|
from fastapi import Request |
|
|
from mcp.server.fastmcp import FastMCP |
|
|
|
|
|
|
|
|
class App01: |
|
|
def __init__(self): |
|
|
self.mcp = FastMCP(name="app01", stateless_http=True) |
|
|
self.register_endpoints() |
|
|
|
|
|
def register_endpoints(self): |
|
|
@self.mcp.resource("app01://info") |
|
|
def app01_info() -> str: |
|
|
"""Information about App01""" |
|
|
return "This is App01" |
|
|
|
|
|
@self.mcp.tool() |
|
|
def app01_echo(message: str) -> str: |
|
|
"""Echo a message in App01""" |
|
|
return f"App01 Echo: {message}" |
|
|
|
|
|
@self.mcp.tool() |
|
|
def app01_add_integers(num1: int, num2: int) -> int: |
|
|
"""Add two integers in App01""" |
|
|
return num1 + num2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|