Skip to main content
Glama
mcp_bridge.py665 B
# integration/mcp_bridge.py from fastapi import FastAPI from pydantic import BaseModel from registry.agent_registry import AGENT_REGISTRY app = FastAPI() class TaskPayload(BaseModel): agent: str input: str @app.post("/handle_task") async def handle_task_request(payload: TaskPayload): agent_name = payload.agent input_text = payload.input agent = AGENT_REGISTRY.get(agent_name) if agent: result = agent.run(input_text) return {"status": "success", "agent_output": result} else: return {"status": "error", "message": f"Agent '{agent_name}' not found."} # Document this API using FastAPI's automatic Swagger UI

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tensorwhiz141/MCP2'

If you have feedback or need assistance with the MCP directory API, please join our Discord server