MCPGateway
MCPGateway is the main service class for the MCP-SWAIG gateway. It loads
configuration from a JSON file, initializes an
MCPManager and
SessionManager,
sets up authenticated HTTP routes, and runs a Flask server that translates
between MCP tool calls and SignalWire SWAIG requests.
The gateway supports Basic auth and Bearer token authentication, rate limiting, SSL/TLS, and automatic session cleanup.
Properties
app
The underlying Flask application instance.
config
The loaded and environment-variable-substituted configuration dictionary.
mcp_manager
The MCPManager instance
that manages MCP service definitions and client lifecycles.
session_manager
The SessionManager instance
that tracks active MCP sessions.
security
The SecurityConfig instance
for authentication and security headers.
HTTP Endpoints
The gateway exposes the following REST endpoints. All endpoints except /health
require authentication.
main Function
main() -> None
CLI entry point that parses command-line arguments and starts the gateway. Accepts
a -c / --config flag to specify the configuration file path (defaults to
config.json).
Use the mcp-gateway CLI command
to run the gateway from the command line without writing any Python code.