mcplexer

Audit Logging

MCPlexer logs every tool call that flows through the gateway. Audit records capture the full lifecycle of each request — from routing to execution to response — with sensitive parameters automatically redacted.

What Gets Logged

Every tool call produces an audit record with the following fields:

NameTypeDefaultDescription
idstringUnique audit record ID
timestampdatetimeWhen the tool call was made
session_idstringClient session that made the call
client_typestringClient type (e.g., claude-desktop, cursor, api)
modelstringAI model that initiated the call
workspace_idstringWorkspace the call was routed through
workspace_namestringHuman-readable workspace name
subpathstringClient's working directory relative to workspace root
tool_namestringNamespaced tool name (e.g., github__list_repos)
params_redactedJSONTool arguments with sensitive values replaced by [REDACTED]
route_rule_idstringRoute rule that matched the call
downstream_server_idstringTarget downstream server
downstream_instance_idstringSpecific process instance that handled the call
auth_scope_idstringAuth scope used for credential injection
statusstringOutcome: success, error, or blocked
error_codestringError code if the call failed
error_messagestringError message if the call failed
latency_msintegerRound-trip time in milliseconds
response_sizeintegerResponse payload size in bytes
cache_hitbooleanWhether the response was served from cache

Parameter Redaction

MCPlexer automatically redacts sensitive parameters before writing them to the audit log. Redaction is controlled by auth scope hints — each auth scope can declare which parameter names contain secrets.

yaml
auth_scopes:
  - id: github-token
    redact_params:
      - token
      - authorization
      - password
      - secret

When a tool call uses this auth scope, any matching parameter names in the arguments will be replaced with [REDACTED] in the params_redacted field. The original values are never persisted.

Default redaction

Even without explicit hints, MCPlexer redacts common secret patterns like token, key, secret, password, and authorization by default.

Query API

Retrieve audit records with powerful filtering and pagination:

GET/api/v1/audit
Query audit records with filters. Returns paginated results ordered by timestamp descending.

Query parameters: session_id, workspace_id, tool_name, status, after, before, limit, offset

Filter Parameters

NameTypeDefaultDescription
session_idstringFilter by client session ID
workspace_idstringFilter by workspace
tool_namestringFilter by tool name (exact match)
statusstringFilter by outcome: success, error, or blocked
afterdatetimeOnly records after this timestamp (RFC 3339)
beforedatetimeOnly records before this timestamp (RFC 3339)
limitinteger50Maximum number of records to return
offsetinteger0Number of records to skip for pagination

Example

terminal
curl "http://localhost:8080/api/v1/audit?workspace_id=ws-prod&status=error&limit=10" # Returns recent errors in the production workspace

Real-Time Stream

Subscribe to audit events as they happen via Server-Sent Events:

GET/api/v1/audit/stream
SSE stream of audit events. Emits a new event for every tool call that completes.
terminal
curl -N "http://localhost:8080/api/v1/audit/stream" # data: {"id":"aud-abc123","tool_name":"github__list_repos","status":"success","latency_ms":142} # data: {"id":"aud-def456","tool_name":"slack__post_message","status":"error","error_code":"auth_failed"}

The SSE stream powers the dashboard's real-time activity feed and can be consumed by monitoring tools, alerting systems, or custom integrations.

Dashboard Metrics

The MCPlexer dashboard provides rich analytics built on top of audit data:

Time Series

A timeline chart showing tool call volume, error rates, and latency trends over configurable time windows (1h, 6h, 24h, 7d).

Tool Leaderboard

Ranked list of the most-called tools across all workspaces, with call counts, error rates, and average latency for each.

Server Health

Per-downstream-server breakdown showing uptime, error rates, average latency, and active instance counts.

Error Breakdown

Categorized view of errors by error code and downstream server, making it easy to spot patterns and recurring failures.

Cache Stats

Hit/miss rates for the tool call cache, showing how much traffic is being served from cache vs. forwarded to downstream servers.

Export audit data

Use the query API with wide time ranges and high limits to export audit data for external analysis. Combine with after and before filters for precise time windows.