Console MCP Server
Bridge external console processes with Copilot by searching through JSON log files.
Console MCP Server
An MCP (Model Context Protocol) server that provides a bridge between external console processes and Copilot through SQLite-based log storage and search capabilities.
π Key Features
High-Performance SQLite Storage
- 10-100x faster searches with indexed queries and FTS5 full-text search
- Reduced memory usage with streaming results instead of loading entire files
- Better concurrency with SQLite WAL mode for simultaneous read/write operations
- Scalable architecture handles large log volumes efficiently
Console Logger
- Wraps any command and captures stdout/stderr to structured SQLite database
- Real-time log storage with proper indexing
- Automatic log level detection (info, warn, error, debug)
- Process lifecycle tracking with start/end times and exit codes
MCP Server Tools
search_logs
- Full-text search through all console logs using FTS5get_recent_errors
- Get recent error messages from all processeslist_processes
- List all processes with their status and activitytail_process_logs
- Get latest entries from a specific processget_log_summary
- Get aggregated statistics across all processesprune_old_logs
- Remove old console logs to free up space (with dry-run support)get_log_statistics
- Get database statistics including size and age information
π Installation
There are several ways to install and use the Console MCP tools:
Option 1: Global npm Installation (Recommended)
Install globally to use console-logger
and console-mcp
from any directory:
# Clone the repository
git clone <repository-url>
cd console_mcp
# Install dependencies and build
npm install
npm run build
# Install globally
npm install -g .
# Verify installation
console-logger --help
console-mcp --help
After global installation, you can use the tools from any terminal session:
# Use from any directory
cd ~/my-project
console-logger "my-app" npm start
Option 2: Local Installation with PATH
Add the built binaries to your PATH for the current session or permanently:
# Clone and build
git clone <repository-url>
cd console_mcp
npm install && npm run build
# Add to PATH for current session
export PATH="$PATH:$(pwd)/build"
# Or add permanently to your shell profile (~/.zshrc, ~/.bashrc, etc.)
echo 'export PATH="$PATH:/path/to/console_mcp/build"' >> ~/.zshrc
source ~/.zshrc
Option 3: Shell Aliases
Create convenient shell aliases for the tools:
# Add to ~/.zshrc or ~/.bashrc
alias console-logger='/path/to/console_mcp/build/logger.js'
alias console-mcp='/path/to/console_mcp/build/index.js'
# Reload shell configuration
source ~/.zshrc
Option 4: Local Development
For development or testing without global installation:
# Clone and build
git clone <repository-url>
cd console_mcp
npm install
npm run build
# Use with full paths
./build/logger.js "my-process" npm start
./build/index.js # Start MCP server
Quick Setup Script
For the fastest setup, you can use this one-liner:
# Clone, build, and install globally in one command
git clone <repository-url> console_mcp && cd console_mcp && npm install && npm run build && npm install -g . && echo "β
Console MCP installed globally!"
Or create a setup script:
#!/bin/bash
# setup-console-mcp.sh
set -e
echo "π Setting up Console MCP..."
# Clone repository
if [ ! -d "console_mcp" ]; then
git clone <repository-url> console_mcp
fi
cd console_mcp
# Install dependencies and build
echo "π¦ Installing dependencies..."
npm install
echo "π¨ Building project..."
npm run build
# Install globally
echo "π Installing globally..."
npm install -g .
echo "β
Console MCP setup complete!"
echo ""
echo "You can now use:"
echo " console-logger \"my-app\" npm start"
echo " console-mcp"
echo ""
echo "Logs will be stored in ~/.console-logs/"
Make it executable and run:
chmod +x setup-console-mcp.sh
./setup-console-mcp.sh
Verification
Test that the installation works:
# Test console logger
console-logger "test" echo "Hello World"
# Check that logs are created
ls ~/.console-logs/
# Test MCP server (in another terminal)
console-mcp
π Updating
Updating Global Installation
If you have the Console MCP installed globally and want to update to the latest version:
# Navigate to your Console MCP directory
cd /path/to/console_mcp
# Pull latest changes (if using git)
git pull
# Update global installation
npm run update-global
Or use the full command:
cd /path/to/console_mcp
npm install && npm run build && npm install -g .
Quick Update Script
You can also use the convenience script added to package.json:
# Either of these will work:
npm run install-global
npm run update-global
Both scripts do the same thing: build the project and install it globally.
Verifying the Update
After updating, verify the new version is active:
# Check for new features in help
console-logger --help
# Test with a complex command (new shell mode feature)
console-logger "test-update" "echo 'step1' && echo 'step2'"
# Should show: π Using shell mode for complex command
Automatic Update Detection
The console-logger includes automatic update detection that warns when a newer version is available:
β οΈ UPDATE AVAILABLE!
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β π A newer version of console-logger is available β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Current: 6/18/2025, 6:55:00 PM β
β Latest: 6/18/2025, 6:59:00 PM β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β To update: β
β cd /Users/username/projects/console_mcp β
β npm run update-global β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
How it works:
- Compares build timestamps between your global installation and local project
- Only shows warnings when genuinely outdated (not during development)
- Provides clear update instructions
- Never blocks operation - warnings are informational only
Update detection triggers when:
- You have a global installation that's older than your local build
- You're working on console_mcp improvements and haven't updated globally
- Someone else updated the project and you need to pull + update
Dependencies
better-sqlite3
- High-performance SQLite3 bindings@modelcontextprotocol/sdk
- MCP protocol implementation
π Usage
1. Start Console Logger
Wrap any command to capture its output to the SQLite database:
Simple Commands
# Start a web server with logging
console-logger "my-server" npm start
# Monitor a build process
console-logger "webpack-build" npx webpack --watch
# Log a Python application
console-logger "python-app" python app.py
# Follow Docker container logs
console-logger "docker-container" docker logs -f container-name
# Any command with arguments
console-logger "my-process" command arg1 arg2
Complex Commands with Shell Operators
The console-logger automatically detects and supports complex shell commands:
# Deployment pipeline with multiple steps
console-logger "deploy" "cd ios && eval \"$(rbenv init -)\" && bundle install && bundle exec fastlane ios testflightdeploy"
# Build and test pipeline
console-logger "ci-pipeline" "npm run build && npm test && echo 'All tests passed!'"
# Environment setup and server start
console-logger "prod-server" "export NODE_ENV=production && node server.js"
# Directory navigation with operations
console-logger "file-ops" "cd src && find . -name '*.js' | head -10 && echo 'File listing complete'"
# Using pipes and redirects
console-logger "log-analysis" "tail -f app.log | grep ERROR | head -20"
# Conditional operations
console-logger "conditional" "test -f config.json && echo 'Config exists' || echo 'Config missing'"
Shell Mode Features:
- π Auto-detection: Automatically detects shell operators (
&&
,||
,;
,|
,eval
,cd
, etc.) - π Environment preservation: Maintains all environment variables and shell features
- π Full logging: Captures output from all commands in the pipeline
- β‘ Efficient: Simple commands still use direct execution for better performance
Help and Options
Get help for either tool:
# Console logger help
console-logger --help
console-logger
# MCP server help
console-mcp --help
Environment Variables
CONSOLE_LOG_DIR
- Directory for SQLite database (default:~/.console-logs
)CONSOLE_LOG_MAX_AGE_HOURS
- Auto-prune logs older than this many hours (default: 336 = 2 weeks)
Example:
# Use custom log directory and auto-prune logs older than 1 week (168 hours)
export CONSOLE_LOG_DIR="/path/to/my/logs"
export CONSOLE_LOG_MAX_AGE_HOURS=168
console-logger "my-app" npm start
2. Use MCP Server
The MCP server provides tools to search and analyze the captured logs:
# Start the MCP server
console-mcp
Log File Structure
Each log entry is a JSON object:
{
"timestamp": "2025-06-16T20:30:45.123Z",
"level": "error",
"message": "Connection failed to database",
"process": "my-server",
"command": "npm start",
"pid": 12345,
"source": "stderr"
}
Using the MCP Server
The MCP server provides tools that Copilot can use to search and analyze your logs:
- Search logs: Find specific text across all log files
- Get recent errors: Quickly identify recent error messages
- List processes: See all processes that have logs
- Tail logs: Get the latest entries from a specific process
- Get summary: Overview of log activity across all processes
Configuration
Environment Variables
CONSOLE_LOG_DIR
- Directory to store log files (default:./console_logs
)
π Session Summaries
The Console MCP server now includes powerful session summary capabilities that allow Copilot sessions to store and search context across different VS Code instances and sessions.
Creating Session Summaries
Session summaries capture important information about your development sessions:
// Example: Creating a session summary
{
title: "Implemented User Authentication",
description: `# Authentication Feature Implementation
## What was accomplished:
- Added JWT token validation
- Implemented login/logout endpoints
- Created user session middleware
## Key changes:
- Modified auth.ts to include bcrypt hashing
- Updated API routes for security
- Added environment variables for JWT secrets`,
tags: ["authentication", "security", "api-endpoints"],
project: "my-webapp", // Auto-detected from git/package.json
llm_model: "claude-3.5-sonnet",
files_changed: ["src/auth.ts", "api/login.ts", ".env.example"] // Auto-detected from git
}
Auto-Detection Features
The session summary system automatically detects:
- Project name from
package.json
or git repository name - Changed files from git status (unstaged, staged, and recent commits)
- Git repository context for better organization
Searching Session Summaries
Use the MCP tools to find relevant context from previous sessions:
search_session_summaries
- Full-text search across titles, descriptions, and tagsget_session_summaries_by_project
- Find all summaries for a specific projectget_session_summaries_by_tags
- Filter by specific tags like "bug-fix" or "feature"get_recent_session_summaries
- Get recent development activity
Use Cases
- Cross-Session Context: When starting work on a project, search for related summaries to understand recent changes
- Team Collaboration: Share development insights and lessons learned
- Project Documentation: Maintain a searchable history of development decisions
- Debugging: Find similar issues and solutions from previous sessions
MCP Configuration
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"console-mcp": {
"command": "node",
"args": ["/absolute/path/to/console_mcp/build/index.js"]
}
}
}
Examples
Example 1: Monitor a Development Server
# Start your dev server with logging
console-logger "next-dev" npm run dev
# Now you can ask Copilot:
# "Are there any errors in my Next.js development server?"
# "Show me the latest logs from next-dev"
# "What warnings have occurred in the last hour?"
Example 2: Debug Multiple Services
# Terminal 1: API server
console-logger "api-server" npm run start:api
# Terminal 2: Frontend
console-logger "frontend" npm run dev
# Terminal 3: Database
console-logger "postgres" docker logs -f postgres-container
# Now ask Copilot:
# "Which service has the most errors?"
# "Show me a summary of all service activity"
# "Are there any database connection errors?"
Example 3: Build Process Monitoring
# Monitor a build process
console-logger "webpack-build" npx webpack --watch
# Ask Copilot:
# "Did the webpack build succeed?"
# "What compilation errors occurred?"
# "Show me the build timeline"
Development
Building
npm run build
Running the MCP Server
npm start
Running the Console Logger
npm run logger -- "process-name" command args
Architecture
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Your Command βββββΆβ Console Logger βββββΆβ JSON Logs β
β (any process) β β (captures I/O) β β (structured) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Copilot ββββββ MCP Server ββββββ Log Reader β
β (AI Assistant) β β (search tools) β β (file parser) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
Benefits
- Non-intrusive: Your existing commands work exactly the same
- Real-time: See output immediately while logging in background
- Structured: Searchable JSON format with metadata
- AI-powered: Ask Copilot natural language questions about your logs
- Multi-process: Monitor multiple services simultaneously
- Persistent: Logs are saved and can be analyzed later
Troubleshooting
Permissions
If you get permission errors, make sure the scripts are executable:
chmod +x build/index.js build/logger.js
Log Directory
If logs aren't being created, check that the log directory is writable:
mkdir -p ./console_logs
ls -la ./console_logs
MCP Connection
If the MCP server isn't connecting to Claude Desktop:
- Check the absolute path in your MCP configuration
- Ensure the project is built (
npm run build
) - Restart Claude Desktop after configuration changes
π§ Troubleshooting
Global Installation Issues
If console-logger
or console-mcp
commands are not found after global installation:
-
Check npm global bin directory:
npm config get prefix npm bin -g
-
Ensure global bin directory is in PATH:
echo $PATH # Should include your npm global bin directory
-
Add npm global bin to PATH if missing:
# Add to ~/.zshrc or ~/.bashrc export PATH="$PATH:$(npm bin -g)" source ~/.zshrc
-
Alternative: Use npx (no global install needed):
npx /path/to/console_mcp/build/logger.js "my-app" npm start
Permission Issues
If you get permission errors during global installation:
# Option 1: Use sudo (not recommended)
sudo npm install -g .
# Option 2: Configure npm to use different directory (recommended)
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH="$PATH:~/.npm-global/bin"
Database Location
By default, logs are stored in ~/.console-logs/
. To check or change:
# Check current location
echo $CONSOLE_LOG_DIR
# Set custom location
export CONSOLE_LOG_DIR="/path/to/logs"
mkdir -p "$CONSOLE_LOG_DIR"
Shell Integration Tips
For an even better experience, consider these shell enhancements:
-
Create shell functions for common patterns:
# Add to ~/.zshrc or ~/.bashrc # Function to easily start dev servers with logging dev-with-logs() { local name="${1:-dev-server}" shift console-logger "$name" "$@" } # Function to tail logs for a process logs() { local process="$1" console-mcp tail_process_logs --process="$process" } # Function to search recent logs search-logs() { console-mcp search_logs --query="$1" --limit=20 }
-
Quick aliases for common commands:
alias clog='console-logger' alias cmcp='console-mcp' alias show-logs='ls -la ~/.console-logs/'
-
Usage examples with shell functions:
# Start development server with logging dev-with-logs "my-app" npm run dev # Search for errors search-logs "error" # View logs for specific process logs "my-app"
License
ISC
Related Servers
Brave Search
An MCP server for the Brave Search API, providing web and local search capabilities via a streaming SSE interface.
Tavily
A comprehensive search API for real-time web search, data extraction, and crawling, requiring a Tavily API key.
Amazon Product Advertising API
Integrate with the Amazon Product Advertising API to search for products and access product information.
Reexpress
Enable Similarity-Distance-Magnitude statistical verification for your search, software, and data science workflows
YouTube Data MCP
High-efficiency YouTube MCP server providing token-optimized, structured data for LLMs.
Scientific Paper Harvester
Harvests scientific papers from arXiv and OpenAlex, providing real-time access to metadata and full text.
TMDB MCP Server
Access movie information, search, and recommendations from The Movie Database (TMDB) API.
OpenSearch MCP Server
An MCP server for interacting with OpenSearch clusters.
Tavily
Search engine for AI agents (search + extract) powered by Tavily
Panda3D Docs
Search and retrieve documentation for the Panda3D game engine.