Skip to main content
Glama

MCP Logging Assistant

by mcpassistant

MCP Logs Assistant

Centralized logging and monitoring for the MCP ecosystem.

Overview

The Logs Assistant provides comprehensive logging and aggregation capabilities for all MCP services with integrated analytics.

Features

  • Log Collection: Aggregate logs from all services with in-memory indexing
  • Real-time Tail: Follow logs in real-time
  • Advanced Search: Query logs by service, level, time, correlation ID, or content
  • Time Aggregation: Aggregate logs by minute, hour, or day with statistics
  • Error Analysis: Analyze error patterns and trends across services
  • Service Health: Monitor service health based on log metrics
  • Anomaly Detection: Detect unusual patterns or spikes in log activity
  • Correlation Tracking: Trace requests across services with correlation IDs
  • Export: Export logs to JSON, CSV, or text formats
  • Rotation & Cleanup: Automatic log rotation and retention management

Installation

npm install

Usage

As MCP Server (Claude Desktop)

Configure in Claude Desktop settings:

{ "mcpServers": { "logs": { "command": "node", "args": ["/path/to/mcp-logs-assistant/index.js"] } } }

As HTTP Service

npm start

The service will be available at http://localhost:9103

Available Tools

tail_logs

Follow logs in real-time from specified services.

await client.callTool({ name: 'tail_logs', arguments: { service: 'mcp-gateway-assistant', // optional: specific service lines: 50 // number of recent lines to show } });

search_logs

Search through logs with advanced filtering.

await client.callTool({ name: 'search_logs', arguments: { query: 'error', service: 'mcp-gateway-assistant', // optional level: 'error', // optional: debug, info, warn, error correlationId: 'req-123', // optional: trace specific request startTime: '2024-01-01T00:00:00Z', // optional endTime: '2024-01-02T00:00:00Z', // optional limit: 100 } });

get_log_stats

Get statistics about logs.

await client.callTool({ name: 'get_log_stats', arguments: { service: 'mcp-gateway-assistant', // optional period: '1h' // 1h, 24h, 7d, 30d } });

rotate_logs

Manually trigger log rotation.

await client.callTool({ name: 'rotate_logs', arguments: { service: 'mcp-gateway-assistant' // optional: rotate specific service } });

get_errors

Get recent errors across services.

await client.callTool({ name: 'get_errors', arguments: { limit: 50, include_stack: true } });

clear_logs

Clear old logs based on retention policy.

await client.callTool({ name: 'clear_logs', arguments: { older_than_days: 30, dry_run: true // preview what would be deleted } });

Aggregation Tools

aggregate_logs

Aggregate logs by time period with statistics.

await client.callTool({ name: 'aggregate_logs', arguments: { period: 'hour', // minute, hour, day startTime: '2024-01-01T00:00:00Z', endTime: '2024-01-02T00:00:00Z', service: 'mcp-gateway-assistant' // optional } });

analyze_errors

Analyze error patterns and trends.

await client.callTool({ name: 'analyze_errors', arguments: { service: 'mcp-gateway-assistant', // optional timeRange: 86400000, // 24 hours in ms minOccurrences: 2 // minimum occurrences to report } });

get_log_statistics

Get comprehensive log statistics.

await client.callTool({ name: 'get_log_statistics', arguments: { service: 'mcp-gateway-assistant' // optional } });

find_correlated_logs

Find all logs with a specific correlation ID.

await client.callTool({ name: 'find_correlated_logs', arguments: { correlationId: 'req-123-abc' } });

export_logs

Export filtered logs to file.

await client.callTool({ name: 'export_logs', arguments: { format: 'json', // json, csv, text query: 'error', service: 'mcp-gateway-assistant', level: 'error', startTime: '2024-01-01T00:00:00Z', endTime: '2024-01-02T00:00:00Z', limit: 1000 } });

get_service_health

Analyze service health based on logs.

await client.callTool({ name: 'get_service_health', arguments: { service: 'mcp-gateway-assistant', timeRange: 3600000 // 1 hour in ms } });

detect_anomalies

Detect anomalies in log patterns.

await client.callTool({ name: 'detect_anomalies', arguments: { service: 'mcp-gateway-assistant', // optional sensitivity: 5 // 1-10, higher = more sensitive } });

cleanup_old_logs

Clean up logs older than retention period.

await client.callTool({ name: 'cleanup_old_logs', arguments: { dryRun: true // preview without deleting } });

Configuration

Aggregator Options

const aggregator = new LogAggregator({ logsDir: '/path/to/logs', aggregateDir: '/path/to/aggregated', maxMemoryLogs: 10000, // Max logs to keep in memory indexInterval: 60000, // Re-index every minute retentionDays: 30 // Keep logs for 30 days });

Environment Variables

LOG_DIR=~/Documents/mcp-assistant/logs RETENTION_DAYS=30 INDEX_INTERVAL=60000 MAX_MEMORY_LOGS=10000

Log Format

All services should use structured logging:

{ "timestamp": "2024-01-01T12:00:00Z", "level": "info", "service": "mcp-gateway-assistant", "message": "Request processed", "metadata": { "requestId": "abc123", "duration": 45, "statusCode": 200 } }

Data Storage

  • Service logs: ~/Documents/mcp-assistant/logs/[service-name]/
  • Aggregated data: ~/Documents/mcp-assistant/data/logs-assistant/aggregated/
  • Exported logs: ~/Documents/mcp-assistant/data/logs-assistant/aggregated/export-*.{json,csv,text}
  • In-memory indices: Service, Correlation ID, Error Type

Development

# Run tests npm test # Development mode npm run dev # CLI usage npm run tail -- --service gateway npm run search -- --query "error" --level error npm run stats -- --period 24h

Performance Features

Indexing

  • Builds indices on startup for fast queries
  • Updates indices incrementally every minute
  • Maintains separate indices for services, correlations, and errors
  • Limits in-memory cache to prevent memory issues

Query Optimization

  • Uses indexed lookups for common queries
  • Supports time-range filtering
  • Implements result pagination
  • Caches frequently accessed data

Use Cases

Troubleshooting Service Issues

// Find all errors for a service const errors = await analyze_errors({ service: 'mcp-gateway-assistant', timeRange: 3600000 // last hour }); // Check service health const health = await get_service_health({ service: 'mcp-gateway-assistant' });

Request Tracing

// Trace a request across services const trace = await find_correlated_logs({ correlationId: 'req-123' });

Performance Monitoring

// Get hourly aggregations const metrics = await aggregate_logs({ period: 'hour', startTime: '2024-01-01T00:00:00Z' }); // Detect anomalies const anomalies = await detect_anomalies({ sensitivity: 5 });

Troubleshooting

Slow Queries

  • Reduce time range
  • Add more specific filters
  • Increase cache size if memory allows

Missing Logs

  • Check if logs are in expected format
  • Verify log directory paths
  • Ensure services are writing logs correctly

High Memory Usage

  • Reduce maxMemoryLogs setting
  • Implement more aggressive retention policies
  • Use export and cleanup features regularly
-
security - not tested
F
license - not found
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

Provides comprehensive logging and monitoring capabilities for MCP services with real-time log tailing, advanced search, error analysis, and anomaly detection. Enables centralized log aggregation, correlation tracking, and health monitoring across all MCP ecosystem services.

  1. Overview
    1. Features
      1. Installation
        1. Usage
          1. As MCP Server (Claude Desktop)
          2. As HTTP Service
        2. Available Tools
          1. tail_logs
          2. search_logs
          3. get_log_stats
          4. rotate_logs
          5. get_errors
          6. clear_logs
        3. Aggregation Tools
          1. aggregate_logs
          2. analyze_errors
          3. get_log_statistics
          4. find_correlated_logs
          5. export_logs
          6. get_service_health
          7. detect_anomalies
          8. cleanup_old_logs
        4. Configuration
          1. Aggregator Options
          2. Environment Variables
        5. Log Format
          1. Data Storage
            1. Development
              1. Performance Features
                1. Indexing
                2. Query Optimization
              2. Use Cases
                1. Troubleshooting Service Issues
                2. Request Tracing
                3. Performance Monitoring
              3. Troubleshooting
                1. Slow Queries
                2. Missing Logs
                3. High Memory Usage

              Related MCP Servers

              • -
                security
                F
                license
                -
                quality
                An MCP server that allows AI assistants to access AWS CloudWatch logs by listing log groups and reading log entries.
                Last updated -
                25
              • A
                security
                A
                license
                A
                quality
                A specialized MCP server that helps analyze and debug Model Context Protocol logs by providing Claude with direct access to log files across multiple platforms.
                Last updated -
                1
                13
                MIT License
                • Apple
                • Linux
              • -
                security
                F
                license
                -
                quality
                A simplified MCP server that provides a streamlined way to interact with AWS CloudWatch resources (log groups, log queries, and alarms) through the MCP protocol.
                Last updated -
                4
                • Linux
                • Apple
              • -
                security
                F
                license
                -
                quality
                An MCP server that enables interaction with Google Cloud Logging API, allowing users to write, read, and manage log entries and configurations through natural language.
                Last updated -

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/mcpassistant/mcp-logging-assistant'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server