Configure the Kilometers CLI to capture only the events you need with method whitelisting, risk-based filtering, and payload size controls.
Filtering helps you focus on relevant events, reduce bandwidth usage, and comply with data retention policies by capturing only what matters for your use case.
KM_METHOD_WHITELISTOnly capture specific MCP methods
KM_METHOD_WHITELIST="tools/call"Only monitor tool executions
KM_METHOD_WHITELIST="resources/read,resources/write"Monitor file operations only
KM_METHOD_WHITELIST="tools/*"All tool-related methods
KM_METHOD_WHITELIST="resources/*,prompts/get"All resources + prompt access
KM_HIGH_RISK_ONLYFilter events by security risk level
KM_HIGH_RISK_ONLY="true"Only capture high-risk events (75+ score)
KM_HIGH_RISK_ONLY="false"Capture all events regardless of risk
KM_PAYLOAD_SIZE_LIMITExclude events with large payloads
KM_PAYLOAD_SIZE_LIMIT="1024"Skip events larger than 1KB
KM_PAYLOAD_SIZE_LIMIT="10240"Skip events larger than 10KB
KM_PAYLOAD_SIZE_LIMIT="0"No size limit (default)
KM_EXCLUDE_PINGControl ping message monitoring
KM_EXCLUDE_PING="true"Exclude ping messages (default)
KM_EXCLUDE_PING="false"Include ping messages in monitoring
The method whitelist supports wildcards and multiple patterns for flexible filtering:
tools/callExact method matchtools/*All methods starting with 'tools/'*callAll methods ending with 'call'resources/read,tools/callMultiple specific methodstools/*,resources/listPattern and specific method combinedOnly capture high-risk operations for security analysis
Production environments where security is paramount
KM_ENABLE_RISK_DETECTION=true KM_HIGH_RISK_ONLY=true KM_METHOD_WHITELIST="resources/read,tools/call"
Capture all events except noisy ping messages
Local development and troubleshooting
KM_EXCLUDE_PING=true KM_DEBUG=true
Minimize data transfer with size and method limits
Environments with limited bandwidth or storage
KM_PAYLOAD_SIZE_LIMIT=5120 KM_METHOD_WHITELIST="tools/call,resources/write" KM_EXCLUDE_PING=true
Monitor only file system interactions
Tracking file access patterns and data movement
KM_METHOD_WHITELIST="resources/read,resources/write,resources/list" KM_PAYLOAD_SIZE_LIMIT=20480
The CLI provides filtering statistics when events are processed:
[km] Filtering statistics: [km] Total events: 1250 [km] Filtered events: 1100 (88.00%) [km] Captured events: 150 (12.00%) [km] Process completed successfully
This helps you understand how effective your filters are and tune them for optimal results.
Test your filtering configuration with debug mode enabled to see what gets captured:
KM_DEBUG=true KM_METHOD_WHITELIST="tools/call" KM_HIGH_RISK_ONLY=true km your-mcp-server