Where to Find Audit Logs for Desktop Commander MCP: Complete File Guide
Desktop Commander MCP records every tool call in a setup.log file located in the project root, with automatic 10 MiB rotation and a helper script at scripts/view-fuzzy-logs.js for quick inspection.
Desktop Commander MCP by wonderwhy-er maintains comprehensive audit logging for every AI-driven operation. If you need to track tool executions or debug interactions, understanding where to find audit logs for Desktop Commander MCP is essential for monitoring system activity. The logging infrastructure is implemented across several key files in the repository.
Audit Log Location and File Structure
The audit trail lives in a single file at the project root. According to the source code in setup-claude-server.js, the constant LOG_FILE is defined as join(__dirname, 'setup.log'), placing it beside package.json.
Default Log File Path
- Filename:
setup.log - Location: Root directory of the MCP project (same folder containing
package.json) - Creation: Generated automatically when the MCP transport isn't ready or during setup/uninstall operations
How Audit Logging Works Internally
The logging mechanism in src/utils/logger.ts serves as the central routing point for all audit events, handling both live transport and fallback scenarios.
Central Logging Utility
In src/utils/logger.ts, the logger implementation forwards messages to Claude via JSON-RPC when the MCP transport is available. When the transport isn't ready, it falls back to writing JSON-RPC-formatted lines directly to setup.log.
Setup and Uninstall Logging
Both setup-claude-server.js and uninstall-claude-server.js implement the logToFile helper function that writes timestamped entries to the same setup.log file. This ensures audit coverage spans the entire installation lifecycle, from server configuration through removal.
Log Rotation and Storage Management
The audit system implements automatic log rotation to prevent unbounded disk usage. Once setup.log reaches 10 MiB, the system starts a new file, maintaining a manageable audit trail without requiring manual intervention.
Viewing and Accessing Audit Logs
You can inspect the audit trail either programmatically or via the provided convenience script.
Using the Helper Script
The repository includes scripts/view-fuzzy-logs.js specifically for log inspection. Run this from the project root:
node scripts/view-fuzzy-logs.js
This script reads setup.log and prints the most recent entries to the console.
Programmatic Access
To read the audit log programmatically in your own monitoring tools:
import { readFileSync } from 'fs';
import { join } from 'path';
const LOG_PATH = join(__dirname, 'setup.log');
const auditLog = readFileSync(LOG_PATH, 'utf8');
console.log('--- Desktop Commander MCP audit log ---\n', auditLog);
Custom Logger Implementation
If extending the audit functionality, follow the pattern established in setup-claude-server.js:
import { appendFileSync } from 'fs';
import { join } from 'path';
export function logToFile(message: string, isError = false) {
const timestamp = new Date().toISOString();
const line = `${timestamp} - ${isError ? 'ERROR: ' : ''}${message}\n`;
const LOG_FILE = join(__dirname, 'setup.log');
appendFileSync(LOG_FILE, line);
}
Summary
- Audit logs for Desktop Commander MCP are stored in
setup.logat the project root (alongsidepackage.json) - Central logging is handled by
src/utils/logger.ts, which routes to JSON-RPC when available or falls back to file output - Automatic rotation triggers when log files exceed 10 MiB
- Helper script at
scripts/view-fuzzy-logs.jsprovides quick command-line access to recent entries - Lifecycle coverage in
setup-claude-server.jsanduninstall-claude-server.jsensures complete audit trails across installation states
Frequently Asked Questions
What is the exact filename for Desktop Commander MCP audit logs?
The audit log is always named setup.log and resides in the root directory of the MCP project, as explicitly defined in setup-claude-server.js using join(__dirname, 'setup.log').
Does Desktop Commander MCP delete old audit logs automatically?
The system implements log rotation based on file size rather than time. When setup.log reaches 10 MiB, a new log file is started. The retention policy for older rotated files depends on your system configuration.
Can I view audit logs while the MCP server is running?
Yes. The scripts/view-fuzzy-logs.js utility reads the file independently of the running server process. Since src/utils/logger.ts appends to setup.log using standard file operations, you can read and monitor the audit trail in real-time without interrupting service.
How are error messages formatted differently in the audit logs?
The logToFile implementation in setup-claude-server.js accepts an isError boolean parameter that prefixes error entries with "ERROR: ", making them easily distinguishable from standard informational entries in the JSON-RPC-formatted log lines.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →