MCP Gateway
Overview
coreX Manager includes a built-in Model Context Protocol (MCP) gateway that allows AI agents to interact with coreX Manager’s API using the MCP standard. This enables AI-powered automation, monitoring, and configuration management.
What is MCP?
The Model Context Protocol (MCP) is a standard protocol for connecting AI agents to external tools and data sources. coreX Manager’s MCP gateway exposes coreX Manager’s configuration and monitoring capabilities as MCP tools that AI agents can call.
Enabling the MCP Gateway
- Navigate to Management > MCP Gateway
- Toggle Enable MCP Gateway
- Configure the authentication settings
- Save
Authentication
The MCP gateway supports token-based authentication. Each MCP client uses an API token to authenticate:
- Navigate to Management > MCP Gateway > Tokens
- Click Generate Token
- Name the token (e.g.
my-ai-agent) - Copy the token (it won’t be shown again)
- Use the token in your MCP client configuration
MCP tokens grant API access to coreX Manager. Treat them like passwords — store them securely and rotate them regularly. Revoke tokens immediately if they are compromised.
Available Tools
The MCP gateway exposes coreX Manager’s capabilities as tools:
Configuration Tools
| Tool | Description |
|---|---|
list_listeners | List all listeners |
get_listener | Get a specific listener’s configuration |
create_listener | Create a new listener |
update_listener | Update a listener |
delete_listener | Delete a listener |
list_backends | List all backends |
get_backend | Get a specific backend |
create_backend | Create a new backend |
update_backend | Update a backend |
delete_backend | Delete a backend |
Security Tools
| Tool | Description |
|---|---|
list_security_rules | List security rules |
create_security_rule | Create a security rule |
list_security_lists | List security lists |
list_waf_rules | List WAF rules |
get_risk_score | Get current risk scoring configuration |
Monitoring Tools
| Tool | Description |
|---|---|
get_metrics | Get HAProxy metrics |
get_waf_metrics | Get WAF metrics |
get_access_logs | Get recent access logs |
get_audit_events | Get recent audit events |
Config Lifecycle Tools
| Tool | Description |
|---|---|
apply_config | Apply pending configuration changes |
revert_config | Revert to a previous snapshot |
list_snapshots | List config snapshots |
Connecting an AI Agent
Example: Claude Desktop
Add the following to your Claude Desktop configuration:
{
"mcpServers": {
"corex-manager": {
"url": "https://corex.example.com/mcp",
"headers": {
"Authorization": "Bearer <your-mcp-token>"
}
}
}
}
Example: Custom MCP Client
from mcp import Client
client = Client(
url="https://corex.example.com/mcp",
headers={"Authorization": "Bearer <your-mcp-token>"}
)
# List all listeners
listeners = await client.call_tool("list_listeners", {})
# Create a new backend
await client.call_tool("create_backend", {
"name": "new-backend",
"servers": [
{"name": "server1", "address": "10.0.0.1", "port": 8080}
],
"algorithm": "roundrobin"
})
# Apply changes
await client.call_tool("apply_config", {"comment": "Added new-backend via MCP"})
Use Cases
Automated Incident Response
An AI agent can:
- Monitor WAF metrics via
get_waf_metrics - Detect a spike in attacks
- Create a security rule to block the attacking IPs
- Apply the configuration
Configuration Auditing
An AI agent can:
- List all listeners and backends
- Check for misconfigurations (e.g. no TLS, no health checks)
- Suggest fixes
- Apply fixes after human approval
Traffic Analysis
An AI agent can:
- Fetch access logs
- Analyze traffic patterns
- Identify anomalies
- Recommend rate limit or security rule changes
For safety, configure your AI agent to require human approval before applying configuration changes. The agent can propose changes, and a human reviews and approves before apply_config is called.
Step-by-Step: Connect an AI Agent
-
Enable the MCP Gateway:
- Navigate to Management > MCP Gateway
- Toggle Enable MCP Gateway
- Save
-
Generate a token:
- Click Generate Token
- Name it (e.g.
ops-agent) - Copy the token
-
Configure your AI agent:
- Add the MCP server URL and token to your agent’s configuration
- URL:
https://your-corex-domain/mcp - Header:
Authorization: Bearer <token>
-
Test the connection:
- Ask your AI agent to list listeners
- Verify it can call
list_listenersand receive results
-
Try a configuration change:
- Ask the agent to create a test backend
- Verify the backend appears in the UI
- Have the agent apply the config
- Verify the config is applied
Verification
-
Check the MCP gateway is running:
curl -k https://localhost/mcp/healthExpect a 200 response.
-
Test authentication:
curl -k -H "Authorization: Bearer <token>" https://localhost/mcp/toolsExpect a list of available tools.
-
Test a tool call:
curl -k -X POST -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{"tool": "list_listeners", "args": {}}' \ https://localhost/mcp/call -
Check audit logs:
- MCP tool calls that modify configuration appear in the audit log
- Navigate to Observability > Audit Logs and filter for MCP-originated changes
Next Steps
- Users & Settings — Manage API tokens and user access
- Audit & Snapshots — Track MCP-originated changes
- Quick Start — Get started with coreX Manager