mcp-gateway
mcp-gateway
The mcp-gateway command starts an HTTP/HTTPS server that bridges
Model Context Protocol (MCP) servers with
SignalWire SWAIG functions. It manages sessions, handles authentication, translates
between MCP tool calls and SWAIG format, and provides rate limiting and security headers.
-c, --config
Path to the JSON configuration file.
Configuration
The gateway is configured via a JSON file. All settings support environment variable
substitution using ${VAR_NAME|default} syntax via
ConfigLoader.
Minimal Configuration
Full Configuration Reference
Configuration Sections
server
server.host
Bind address for the gateway server.
server.port
Port for the gateway server.
server.auth_user
Username for HTTP Basic Authentication on all protected endpoints.
server.auth_password
Password for HTTP Basic Authentication.
server.auth_token
Bearer token for token-based authentication. If set, clients can authenticate
with Authorization: Bearer <token> as an alternative to Basic Auth.
services
Each key in the services object defines an MCP server that the gateway can spawn and manage.
services.<name>.command
The command and arguments to start the MCP server process.
services.<name>.description
Human-readable description of the service.
services.<name>.enabled
Whether the service is active. Disabled services are not started or listed.
services.<name>.sandbox_config
Sandbox configuration for process isolation. Controls resource limits and environment restrictions for the spawned MCP process.
session
session.default_timeout
Default session timeout in seconds. Sessions are cleaned up after this duration of inactivity.
session.max_sessions_per_service
Maximum concurrent sessions per MCP service.
session.cleanup_interval
Interval in seconds between session cleanup sweeps.
rate_limiting
rate_limiting.default_limits
Default rate limits applied to all endpoints.
rate_limiting.tools_limit
Rate limit for the tool listing endpoint.
rate_limiting.call_limit
Rate limit for tool call endpoints.
rate_limiting.session_delete_limit
Rate limit for session deletion endpoints.
rate_limiting.storage_uri
Storage backend for rate limit counters. Use memory:// for in-process
storage or a Redis URI for distributed deployments.
API Endpoints
The gateway exposes the following HTTP endpoints:
Calling a Tool
SSL Support
If a certificate file exists at certs/server.pem, the gateway automatically
enables HTTPS. The gateway also uses
SecurityConfig
for security headers (X-Content-Type-Options, X-Frame-Options, HSTS, etc.).