Skip to main content
Glama
middleware.py•963 B
import json import base64 from urllib.parse import parse_qs, unquote class SmitheryConfigMiddleware: def __init__(self, app): self.app = app async def __call__(self, scope, receive, send): if scope.get('type') == 'http': query = scope.get('query_string', b'').decode() if 'config=' in query: try: config_b64 = unquote(parse_qs(query)['config'][0]) config = json.loads(base64.b64decode(config_b64)) # Inject full config into request scope for per-request access scope['smithery_config'] = config except Exception as e: print(f"SmitheryConfigMiddleware: Error parsing config: {e}") scope['smithery_config'] = {} else: scope['smithery_config'] = {} await self.app(scope, receive, send)

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/SmartManoj/Telegram-Bot-MCP'

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