from starlette.exceptions import HTTPException
from src.config import Config
# Middleware function to check API key authentication
def middleware(req_ctx):
scope = req_ctx.scope
headers = {k: v for k, v in scope.get("headers", {})} if scope is not None else {}
if headers.get("x-api-key") != Config.MCP_API_KEY.value:
raise HTTPException(status_code=401, detail="Unauthorized")
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/enso-labs/mcpserve'
If you have feedback or need assistance with the MCP directory API, please join our Discord server