33 lines
766 B
Python
33 lines
766 B
Python
from pathlib import Path
|
|
import json
|
|
from mcp.server.fastmcp import FastMCP
|
|
|
|
MCP_ROOT = Path("mcp")
|
|
|
|
mcp = FastMCP("aetoskia-mail-intake-docs")
|
|
|
|
def read_json(path: Path):
|
|
if not path.exists():
|
|
return {"error": "not_found", "path": str(path)}
|
|
return json.loads(path.read_text())
|
|
|
|
@mcp.resource("docs://index")
|
|
def index():
|
|
return read_json(MCP_ROOT / "index.json")
|
|
|
|
@mcp.resource("docs://nav")
|
|
def nav():
|
|
return read_json(MCP_ROOT / "nav.json")
|
|
|
|
@mcp.resource("docs://{module}")
|
|
def module(module: str):
|
|
return read_json(MCP_ROOT / "modules" / f"{module}.json")
|
|
|
|
@mcp.tool()
|
|
def ping() -> str:
|
|
return "Pong! (fake tool executed)"
|
|
|
|
if __name__ == "__main__":
|
|
# FastMCP owns the HTTP server
|
|
mcp.run(transport="streamable-http")
|