Skip to main content

Configuration File Location

The Secure MCP Gateway uses a JSON configuration file stored at:

Configuration Structure

The configuration file has five main sections:
  1. admin_apikey - Administrative API key for REST API
  2. common_mcp_gateway_config - Global gateway settings
  3. plugins - Plugin configurations (auth, guardrails, telemetry)
  4. mcp_configs - MCP server configurations
  5. projects - Project definitions
  6. users - User definitions
  7. apikeys - API key mappings

Full Configuration Schema

Location: src/secure_mcp_gateway/example_enkrypt_mcp_config.json

Section Details

1. Admin API Key

Purpose: Secures the REST API endpoints for administrative operations.
Details:
  • Automatically generated during secure-mcp-gateway generate-config
  • 256 characters long for maximum security
  • Used for all /api/v1/* endpoints (except /health)
  • Required in Authorization: Bearer <admin_apikey> header
Usage:

2. Common Gateway Config

Location: common_mcp_gateway_config

Logging Settings

Options: DEBUG, INFO, WARNING, ERROR Source: src/secure_mcp_gateway/gateway.py:161
Setting DEBUG level will output sensitive information in logs. Only use for troubleshooting.

Remote Config Settings

Details:
  • enkrypt_use_remote_mcp_config: Load config from Enkrypt cloud (future feature)
  • enkrypt_remote_mcp_gateway_name: Gateway identifier in Enkrypt
  • enkrypt_remote_mcp_gateway_version: Config version
Remote config is not yet available. Current version loads from local file.

Cache Settings

Location: src/secure_mcp_gateway/client.py:31
Cache Types: Cache Strategy:
  1. Local cache (default): In-memory dictionary, lost on restart
  2. External cache: Redis/KeyDB, shared across instances
For production with multiple gateway instances, use external cache to share discovered tools and configs.

Async Guardrails

Details:
  • true: Run guardrails asynchronously (don’t block request)
  • false: Run guardrails synchronously (block until checked)
Async guardrails reduce latency but may allow unsafe requests through before blocking takes effect.

Timeout Settings

Location: src/secure_mcp_gateway/services/timeout/timeout_manager.py
Timeout Types: Escalation Policies:
  • warn_threshold (0.8): Log warning at 80% of timeout
  • timeout_threshold (1.0): Timeout at 100% of configured time
  • fail_threshold (1.2): Hard failure at 120% of timeout

3. Plugins Configuration

Auth Plugin

Location: src/secure_mcp_gateway/plugins/auth/
Available Providers: Example - Enkrypt Provider:

Guardrails Plugin

Location: src/secure_mcp_gateway/plugins/guardrails/
Available Providers: Example - Custom Keyword Provider:

Telemetry Plugin

Location: src/secure_mcp_gateway/plugins/telemetry/
Available Providers: OpenTelemetry Config:

4. MCP Configs

Location: mcp_configs.<config_id>.mcp_config[] Defines the MCP servers that the gateway will proxy to.

Server Entry Structure

Server Config

Required fields:
Examples:

OAuth Configuration

Location: src/secure_mcp_gateway/services/oauth/ Full OAuth 2.0/2.1 configuration for server authentication:
Key OAuth Settings:
For detailed OAuth setup, see the OAuth Authentication Guide.

Tools Configuration

Option 1: Empty (Tool Discovery)
Gateway will discover tools automatically via list_tools() and cache them. Option 2: Explicit Tool Definition
Gateway will only expose explicitly defined tools (no discovery).
Use explicit tool definition to restrict which tools are accessible through the gateway.

Guardrails Policies

Tool Guardrails: Applied before tool name validation:
Input Guardrails: Applied before sending request to MCP server:
Output Guardrails: Applied after receiving response from MCP server:
Block Conditions: Additional Config:
Enabling PII redaction will replace detected PII with anonymized tokens. The gateway automatically de-anonymizes the response.

5. Projects

Purpose: Group users with shared MCP configurations.
Fields:

6. Users

Purpose: Define gateway users.
Fields:

7. API Keys

Purpose: Map API keys to project/user combinations.
Fields: API Key Format: Generated by secure_mcp_gateway.utils.generate_custom_id():
  • 34 random alphanumeric characters
  • URL-safe (uses _ and -)
  • Example: 2W8UupCkazk4SsOcSu_1hAbiOgPdv0g-nN9Ntf

Configuration Loading

Location: src/secure_mcp_gateway/utils.py:190 Priority order:
  1. Docker config path (if is_docker() returns True)
    • /app/.enkrypt/docker/enkrypt_mcp_config.json
  2. User config path
    • ~/.enkrypt/enkrypt_mcp_config.json
  3. Example config path (from package)
    • site-packages/secure_mcp_gateway/example_enkrypt_mcp_config.json
  4. Default config (hardcoded in consts.py)

Configuration Management

CLI Commands

See CLI Commands Reference for complete list. Common operations:

REST API

Endpoint: /api/v1/configs Authentication: Admin API key required

Best Practices

For multi-instance deployments, enable external cache (Redis/KeyDB) to share tool discoveries and configs:
Never hardcode secrets in config. Use environment variable references:
Only enable guardrails on sensitive servers to minimize latency:
Schedule automatic backups of your configuration:
For production, explicitly define allowed tools instead of relying on discovery:
This prevents new tools from being auto-discovered and exposed.

Next Steps

Authentication

Learn about API keys, projects, and users

Guardrails

Configure input and output protection

CLI Reference

Complete CLI commands documentation

API Reference

REST API endpoint documentation