MCP Server

MCP is provided by the standalone adapter relay-core-probe (npm package @relay-core/mcp). It runs an embedded proxy and exposes MCP tools to AI agents. It is not relay-core-cli run --mcp.

Prerequisites

npx @relay-core/cli ca generate
npx @relay-core/cli ca install   # macOS helper; see ca status on other platforms

Configure your MCP client

In Cursor, Claude Desktop, or any MCP client:

{
  "mcpServers": {
    "relay-core": {
      "command": "npx",
      "args": ["-y", "@relay-core/mcp"]
    }
  }
}

@relay-core/mcp launches relay-core-probe with stdio transport by default and a local proxy on 127.0.0.1:8080. Point your browser or system proxy there.

probe CLI flags

The probe binary accepts a small set of flags and env vars:

FlagEnvDefaultDescription
--port <P>RELAY_PORT8080Embedded proxy listen port
--ca-cert <PATH>RELAY_CA_CERTdata dirCA certificate for HTTPS interception
--ca-key <PATH>RELAY_CA_KEYdata dirCA private key
--transport <MODE>RELAY_PROBE_TRANSPORTstdiostdio or sse
--probe-port <P>RELAY_PROBE_PORT3000SSE listen port (only when transport=sse)
--probe-bind <ADDR>RELAY_PROBE_BIND127.0.0.1SSE bind address

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"
}
get_pending_intercepts

List the currently pending intercepts (HTTP and WebSocket).

resume_flow

Resume a paused flow.

{
  "flow_id": "fld_01HX5K9P3Q8Y2Z7",
  "action": "resume",  // or "drop"
  "modifications": {
    "status_code": 418,
    "response_body": "I'm a teapot"
  }
}

Rules

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"
}
mock_url

Create a one-off MockResponse rule.

{
  "url_pattern": "api.example.com/v1/health",
  "status": 200,
  "body": "{\"ok\":true}",
  "content_type": "application/json"
}

Scripting

set_script

Hot-load a Deno script into the running engine.

{
  "script": "// deno-fmt-ignore\nexport default { onRequest(ctx) { /* ... */ } }"
}

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, including the redaction block.

update_policy

Replace the entire policy.

patch_policy

Apply a partial update — only the supplied keys are touched. Accepts the same { redaction?, upstream? } shape as the REST API.

{
  "redaction": {
    "enabled": true,
    "redact_bodies": true
  }
}

Resources

MCP also exposes read-only resources:

  • flows:// — Recent flows
  • rules:// — Active rules
  • proxy://status — Proxy status and metrics
  • audit://recent — Recent audit events
  • ca://install — CA install guide with default paths

Use Cases

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