|
|
from fastapi import FastAPI |
|
|
from pydantic import BaseModel |
|
|
|
|
|
app = FastAPI(title="Example MCP Server") |
|
|
|
|
|
|
|
|
class MCPRequest(BaseModel): |
|
|
metadata: str |
|
|
source_type: str |
|
|
viz_format: str |
|
|
|
|
|
|
|
|
@app.get("/") |
|
|
def root(): |
|
|
return {"status": "ok", "message": "Example MCP server running"} |
|
|
|
|
|
|
|
|
@app.post("/mcp") |
|
|
def mcp_endpoint(req: MCPRequest): |
|
|
"""Simple example endpoint that returns a sample mermaid diagram and summary. |
|
|
|
|
|
This is intentionally minimal — a real MCP server would run the agent pipeline and |
|
|
return an appropriate visualization and structured metadata. |
|
|
""" |
|
|
|
|
|
mermaid = f"graph TD\n A[{req.source_type}] --> B[Processed by Example MCP]" |
|
|
summary = f"Example MCP processed source_type={req.source_type}, viz_format={req.viz_format}" |
|
|
return {"mermaid": mermaid, "visualization": mermaid, "summary": summary} |
|
|
|
|
|
|
|
|
|