Event Schema
mcpr emits newline-delimited JSON events when started with --events. Each event has a type field and common metadata.
Common fields
Section titled “Common fields”Every event includes:
| Field | Type | Description |
|---|---|---|
ts | string | ISO 8601 timestamp |
type | string | Event type (see below) |
session | string | MCP session ID |
upstream | string | Upstream server URL |
csp_applied | boolean | Whether CSP headers were injected |
tool_call
Section titled “tool_call”Emitted when an MCP tool is called.
{ "ts": "2026-04-02T10:15:30.142Z", "type": "tool_call", "method": "tools/call", "tool": "search_products", "session": "sess_abc123", "user": null, "latency_ms": 142, "status": "ok", "upstream": "http://localhost:9000", "csp_applied": true}| Field | Type | Description |
|---|---|---|
method | string | JSON-RPC method (tools/call) |
tool | string | Tool name |
latency_ms | number | Total round-trip time in milliseconds |
status | string | ok or error |
user | string | null | Authenticated user (when OAuth is enabled) |
error_code | number | JSON-RPC error code (present if status is error) |
error_message | string | Error description (present if status is error) |
tool_list
Section titled “tool_list”Emitted when a client requests the tool list.
{ "ts": "2026-04-02T10:15:30.000Z", "type": "tool_list", "method": "tools/list", "session": "sess_abc123", "latency_ms": 11, "status": "ok", "upstream": "http://localhost:9000"}session_start
Section titled “session_start”Emitted when a new MCP session is initialized.
{ "ts": "2026-04-02T10:15:29.500Z", "type": "session_start", "session": "sess_abc123", "upstream": "http://localhost:9000"}session_end
Section titled “session_end”Emitted when a session closes.
{ "ts": "2026-04-02T10:20:00.000Z", "type": "session_end", "session": "sess_abc123", "upstream": "http://localhost:9000"}widget_serve
Section titled “widget_serve”Emitted when widget HTML is served through the proxy.
{ "ts": "2026-04-02T10:15:31.000Z", "type": "widget_serve", "path": "/widget/clock.html", "session": "sess_abc123", "upstream": "http://localhost:4444", "csp_applied": true}csp_violation
Section titled “csp_violation”Emitted when a Content Security Policy violation is detected.
{ "ts": "2026-04-02T10:15:32.000Z", "type": "csp_violation", "blocked_uri": "https://cdn.example.com/script.js", "directive": "script-src", "session": "sess_abc123", "upstream": "http://localhost:9000"}| Field | Type | Description |
|---|---|---|
blocked_uri | string | The URI that was blocked by CSP |
directive | string | The CSP directive that caused the violation |
