MCP Server

RelayCore includes an MCP (Model Context Protocol) server that exposes tools for AI agents to observe and control traffic interception programmatically.

Enabling MCP

# Via CLI
relay-core-cli run --mcp

# Via config.toml
[mcp]
enabled = true
port = 25519

Connect to MCP

Use any MCP-compatible client (Claude Desktop, Cursor, etc.):

# In your MCP client config
{
  "mcpServers": {
    "relay-core": {
      "command": "npx",
      "args": ["@relay-core/mcp"]
    }
  }
}

Tools

Observe

search_flows

Search and filter captured flows.

{
  "filter": "method:GET host:*.example.com",
  "limit": 10
}
get_flow

Get detailed flow information.

{
  "flow_id": "fld_01HX5K9P3Q8Y2Z7"
}
get_metrics

Get current proxy metrics.

Control

set_intercept

Create an interception breakpoint.

{
  "filter": {
    "method": "POST",
    "host": "api.example.com"
  },
  "pause_at": "request"
}
resume_flow

Resume a paused flow.

{
  "flow_id": "fld_01HX5K9P3Q8Y2Z7",
  "action": "resume"  # or "drop"
}
set_rule

Create or update a rule.

{
  "name": "Log API requests",
  "filter": { "path": "/api/*" },
  "action": { "type": "log" }
}
delete_rule

Delete a rule.

{
  "rule_id": "rul_01HX5K9P3Q8Y2Z7"
}

Analyze

export_har

Export flows as HAR format.

{
  "filter": "host:example.com",
  "format": "har"
}
replay_flow

Replay a captured flow.

{
  "flow_id": "fld_01HX5K9P3Q8Y2Z7",
  "modifications": {
    "headers": { "x-test": "value" }
  }
}

Policy

get_policy

Get current interception policy.

update_policy

Update interception policy.

Resources

MCP also exposes resources for read-only access:

  • relay://flows — List recent flows
  • relay://rules — Current rules
  • relay://metrics — Runtime metrics
  • relay://config — Current configuration

Use Cases

  • AI-powered API testing and debugging
  • Automated traffic analysis
  • Dynamic rule generation based on traffic patterns
  • Integration with CI/CD pipelines