You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`transport`: Transport type (`sse`, `streamable-http`, `http`)
405
+
-`response_size_bytes`: Response body size (when capturing response data)
406
+
-`data`: Captured request/response data (only present if enabled)
407
+
-`request`: Request body (parsed as JSON if possible, otherwise string)
408
+
-`response`: Response body (parsed as JSON if possible, otherwise string)
409
+
410
+
#### Virtual MCP Server Audit Logging
411
+
412
+
The Virtual MCP Server (vMCP) supports comprehensive audit logging with file-based output, making it ideal for compliance and security monitoring in Kubernetes environments.
413
+
414
+
**Kubernetes Configuration Example**:
415
+
416
+
```yaml
417
+
apiVersion: toolhive.stacklok.dev/v1alpha1
418
+
kind: VirtualMCPServer
419
+
metadata:
420
+
name: my-vmcp
421
+
spec:
422
+
groupRef:
423
+
name: my-group
424
+
incomingAuth:
425
+
type: anonymous
426
+
audit:
427
+
component: "vmcp-production"
428
+
logFile: "/var/log/audit/vmcp-audit.log"
429
+
includeRequestData: true
430
+
includeResponseData: true
431
+
maxDataSize: 8192
432
+
eventTypes:
433
+
- mcp_tool_call
434
+
- mcp_resource_read
435
+
excludeEventTypes:
436
+
- mcp_ping
437
+
```
438
+
439
+
**Volume Mounting for Log Persistence**:
440
+
441
+
To persist audit logs outside the container, mount a volume:
442
+
443
+
```yaml
444
+
apiVersion: toolhive.stacklok.dev/v1alpha1
445
+
kind: VirtualMCPServer
446
+
metadata:
447
+
name: my-vmcp
448
+
spec:
449
+
groupRef:
450
+
name: my-group
451
+
audit:
452
+
logFile: "/var/log/audit/vmcp-audit.log"
453
+
podTemplate:
454
+
spec:
455
+
volumes:
456
+
- name: audit-logs
457
+
persistentVolumeClaim:
458
+
claimName: vmcp-audit-logs
459
+
containers:
460
+
- name: vmcp-server
461
+
volumeMounts:
462
+
- name: audit-logs
463
+
mountPath: /var/log/audit
464
+
```
465
+
466
+
**Log Format**: vMCP audit logs use newline-delimited JSON (NDJSON), with one JSON object per line:
1.**File Permissions**: Audit log files are created with `0600` permissions (owner read/write only)
499
+
2.**Directory Permissions**: Parent directories are created with `0755` permissions if they don't exist
500
+
3.**Sensitive Data**: Request/response data may contain sensitive information - enable `include_request_data` and `include_response_data` only when necessary
501
+
4.**Log Rotation**: Implement log rotation using external tools (logrotate, Kubernetes CronJob) to prevent disk space exhaustion
502
+
5.**Access Control**: Restrict access to audit logs using Kubernetes RBAC and network policies
503
+
504
+
#### CLI Usage
505
+
506
+
**With audit configuration file**:
507
+
```bash
508
+
thv run --transport sse --name my-server --audit-config audit.json my-image:latest
509
+
```
510
+
511
+
**Minimal audit configuration (stdout)**:
512
+
```bash
513
+
thv run --transport sse --name my-server --audit-config <(echo '{"component":"my-service"}') my-image:latest
0 commit comments