Skip to content

Event Schema

mcpr emits newline-delimited JSON events when started with --events. Each event has a type field and common metadata.

Every event includes:

FieldTypeDescription
tsstringISO 8601 timestamp
typestringEvent type (see below)
sessionstringMCP session ID
upstreamstringUpstream server URL
csp_appliedbooleanWhether CSP headers were injected

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
}
FieldTypeDescription
methodstringJSON-RPC method (tools/call)
toolstringTool name
latency_msnumberTotal round-trip time in milliseconds
statusstringok or error
userstring | nullAuthenticated user (when OAuth is enabled)
error_codenumberJSON-RPC error code (present if status is error)
error_messagestringError description (present if status is error)

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

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

Emitted when a session closes.

{
"ts": "2026-04-02T10:20:00.000Z",
"type": "session_end",
"session": "sess_abc123",
"upstream": "http://localhost:9000"
}

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
}

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"
}
FieldTypeDescription
blocked_uristringThe URI that was blocked by CSP
directivestringThe CSP directive that caused the violation