Summary
Create a new Logs page to provide visibility into MCP tool executions and system logs. This feature enhances transparency, helps users identify potential security issues (like prompt injection), and assists with debugging.
Requirements
1. MCP Tool Calls Monitor (All Users)
Real-time monitoring of MCP tool executions:
interface MCPToolCall {
id: string;
serverId: string;
serverName: string;
toolName: string;
arguments: Record<string, unknown>;
result?: unknown;
error?: string;
status: 'pending' | 'success' | 'error';
duration_ms: number;
timestamp: Date;
sessionId?: string;
messageId?: string;
}
UI Components:
- Server selector (filter by MCP server)
- Tool calls timeline/list with expandable details
- Status indicators (success/error/pending)
- Search and filter by tool name
- Clear history button
Security Features:
- Highlight potentially dangerous tool calls (file writes, shell commands)
- Flag unusual patterns (rapid repeated calls, large payloads)
- Visual indicators for tools with sensitive permissions
2. System Logs Viewer (Developer Mode Only)
File: ~/levante/levante.log
Features:
- Real-time log streaming (tail -f style)
- Log level filters (debug, info, warn, error)
- Category filters (ai-sdk, mcp, database, ipc, preferences, core)
- Search/grep functionality
- Line highlighting for errors/warnings
- Clear log file button (with confirmation)
- Download/export logs
- Auto-scroll toggle
Access Control:
- Only visible when "Developer Mode" is enabled in Settings
- Add
developerMode flag to user preferences
3. Page Structure
/logs
├── Tab: MCP Tool Calls (all users)
│ ├── Server Filter Dropdown
│ ├── Tool Calls List/Timeline
│ │ ├── Timestamp
│ │ ├── Server Name
│ │ ├── Tool Name
│ │ ├── Status Badge
│ │ ├── Duration
│ │ └── Expandable: Arguments & Result
│ └── Actions: Clear, Export
│
└── Tab: System Logs (developer mode only)
├── Level Filter (debug/info/warn/error)
├── Category Filter
├── Search Input
├── Log Viewer (virtualized for performance)
└── Actions: Clear File, Download, Refresh
4. Database Schema (Optional - for persistence)
-- MCP tool call history (optional, for analytics)
CREATE TABLE mcp_tool_calls (
id INTEGER PRIMARY KEY AUTOINCREMENT,
server_id TEXT NOT NULL,
server_name TEXT NOT NULL,
tool_name TEXT NOT NULL,
arguments TEXT, -- JSON string
result TEXT, -- JSON string (truncated)
error TEXT,
status TEXT NOT NULL,
duration_ms INTEGER,
session_id TEXT,
message_id TEXT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_mcp_tool_calls_server ON mcp_tool_calls(server_id);
CREATE INDEX idx_mcp_tool_calls_created ON mcp_tool_calls(created_at);
Security Monitoring Features
Prompt Injection Detection
- Flag tool calls with suspicious patterns in arguments
- Highlight calls that bypass expected workflows
- Alert on unusual argument lengths or encoded content
Audit Trail
- Track which model/session triggered each tool call
- Correlate tool calls with chat messages
- Export audit logs for security review
Suggestions
Phase 1 (MVP)
Phase 2 (Enhanced)
Phase 3 (Security & Analytics)
Phase 4 (Advanced)
Technical Considerations
MCP Tool Call Capture
- Hook into
MCPUseService and MCPLegacyService tool execution
- Emit events via IPC for renderer consumption
- Use Zustand store for real-time state
Log File Handling
- Use
fs.watch or chokidar for file changes
- Implement chunked reading for large files
- Virtual scrolling for performance (react-window)
- Consider log rotation (max file size)
Performance
- Limit in-memory tool call history (last 1000)
- Paginate database queries
- Debounce log file reads
- Lazy load expanded details
UI/UX Suggestions
- Add logs indicator in status bar (error count badge)
- Quick access from MCP server cards in Settings
- Toast notifications for tool errors
- Keyboard shortcuts for navigation (j/k for up/down)
- Syntax highlighting for JSON arguments/results
- Copy button for tool call details
Related Files
src/main/services/mcp/mcpUseService.ts - Tool execution
src/main/services/logging/ - Logging system
src/renderer/stores/ - Add logsStore
~/levante/levante.log - Log file location
Labels: enhancement, feature, security, developer-experience
Summary
Create a new Logs page to provide visibility into MCP tool executions and system logs. This feature enhances transparency, helps users identify potential security issues (like prompt injection), and assists with debugging.
Requirements
1. MCP Tool Calls Monitor (All Users)
Real-time monitoring of MCP tool executions:
UI Components:
Security Features:
2. System Logs Viewer (Developer Mode Only)
File:
~/levante/levante.logFeatures:
Access Control:
developerModeflag to user preferences3. Page Structure
4. Database Schema (Optional - for persistence)
Security Monitoring Features
Prompt Injection Detection
Audit Trail
Suggestions
Phase 1 (MVP)
Phase 2 (Enhanced)
Phase 3 (Security & Analytics)
Phase 4 (Advanced)
Technical Considerations
MCP Tool Call Capture
MCPUseServiceandMCPLegacyServicetool executionLog File Handling
fs.watchorchokidarfor file changesPerformance
UI/UX Suggestions
Related Files
src/main/services/mcp/mcpUseService.ts- Tool executionsrc/main/services/logging/- Logging systemsrc/renderer/stores/- Add logsStore~/levante/levante.log- Log file locationLabels:
enhancement,feature,security,developer-experience