Production-ready Glama MCP SDK integration for Python/FastAPI inside the Deal Scale backend. This module provides a secure client, typed API schemas, and utilities to connect to the Glama MCP API.
Optimized for www.cybershoptech.com integrations and modern cloud deployments.
- Secure HTTP client with TLS verification, timeouts, retries, and connection pooling
- Typed request/response helpers in
api/ - Self-contained config via environment variables (
config.py) - Easy submodule packaging for reuse across services
- Access to 5,000+ Model Context Protocol (MCP) servers and tools via compatible providers/directories.
- Can be wrapped as an MCP server to expose your own tools/endpoints to MCP‑compatible clients.
- Works either as an embedded MCP client inside your FastAPI app or as a standalone MCP component.
High-level steps to turn this SDK into an MCP server:
- Define an MCP server entrypoint that implements the MCP handshake and tool invocation lifecycle.
- Expose Glama-backed operations as MCP tools (map to functions in
api/and your app routes). - Package and run with your preferred runtime (e.g.,
uvicornfor HTTP or a process manager) and register with your MCP client.
config.py– Environment-driven configuration (GlamaConfig)client.py– Placeholder for higher-level client wrapper (extend as needed)api/– Low-level request/response helpers (_requests.py,_responses.py,routes.py,schemas.py).env.example– Example environment configuration_tests/– Place for unit/integration tests
Add this package to your project (already vendored in backend/app/core/third_party_integrations/glama/). If used externally, install requirements as needed:
pip install httpx pydanticDefined in config.py and demonstrated in .env.example:
GLAMA_BASE_URL(default:https://glama.ai/api/mcp)GLAMA_API_KEY(optional)GLAMA_VERIFY_TLS(default:true)GLAMA_CONNECT_TIMEOUT(default:3.05)GLAMA_READ_TIMEOUT(default:30.0)GLAMA_POOL_CONNECTIONS(default:20)GLAMA_POOL_MAXSIZE(default:100)GLAMA_MAX_RETRIES(default:3)
Load your .env with your preferred method (e.g., python-dotenv) or via your process manager (Docker, systemd, Render, etc.).
Below is a simple example showing how you might initialize config and call a request helper. Adjust imports to match your app layout.
from backend.app.core.third_party_integrations.glama.config import GlamaConfig
from backend.app.core.third_party_integrations.glama.api._requests import make_request # example helper
cfg = GlamaConfig()
# Example usage (update path/payload to real endpoints in your app):
resp = make_request(
base_url=cfg.BASE_URL,
api_key=cfg.API_KEY,
verify_tls=cfg.VERIFY_TLS,
connect_timeout=cfg.CONNECT_TIMEOUT,
read_timeout=cfg.READ_TIMEOUT,
method="GET",
path="/health"
)
print(resp.status_code, resp.text)- Keep secrets out of source control; use
.envor your secret manager - Tune timeouts and retries per environment (dev vs prod)
- Add unit tests in
_tests/to validate request/response contracts
SEO Notes for www.cybershoptech.com
- Keywords: glama mcp sdk, mcp servers, model context protocol, python fastapi integration, secure api client, connection pooling, retries, tls, production-ready
- Positioning: Access 5,000+ MCP servers/tools and optionally run this package as an MCP server to expose your own tools.
- This integration helps teams ship secure, observable third‑party API connections for www.cybershoptech.com-grade workloads.
This folder inherits the repository license unless otherwise noted.