npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

observability-analyzer

v1.1.0

Published

Production-ready MCP Server for intelligent Loki/Tempo observability dashboard analysis and generation

Readme

Observability Dashboard Analyzer

Production-ready MCP Server for intelligent Loki log analysis and Grafana dashboard generation based on industry-standard monitoring methodologies (RED Method).

🎯 Key Features

  • Smart Analysis: Analyzes Loki logs to recommend optimal dashboard configurations
  • RED Method Implementation: Industry-standard Rate, Errors, Duration monitoring dashboards
  • Service Discovery: Automatic detection of services from log data
  • Query Optimization: Performance optimization suggestions for LogQL queries
  • Production Ready: Handles authentication, errors, and enterprise deployment scenarios

🚀 Quick Start

Installation

npm install -g observability-dashboard-analyzer

Configuration

The tool uses multi-tier configuration (environment variables > config file > defaults):

  1. Environment Variables (highest priority):

    export LOKI_URL=http://localhost:3100
    export LOKI_USERNAME=your-username
    export LOKI_PASSWORD=your-password
  2. Config File (medium priority): Edit ~/.observability-analyzer/config.json:

    {
      "loki": {
        "url": "http://localhost:3100",
        "auth": {
          "type": "basic",
          "username": "your-username",
          "password": "your-password"
        }
      }
    }

Usage with Claude Desktop

Add to your Claude Desktop MCP configuration:

{
  "mcpServers": {
    "observability-analyzer": {
      "command": "npx",
      "args": ["observability-dashboard-analyzer"]
    }
  }
}

🔧 MCP Tools

Core Analysis Tools

analyze_loki_stack

Analyzes your Loki setup and discovers services with log structure analysis.

// Example usage in Claude
"Analyze my Loki logs for the last 24 hours"

Returns:

  • Service discovery from log data
  • Log structure quality assessment
  • Available labels and error patterns
  • Dashboard recommendations based on data structure

generate_loki_dashboard

Creates production-ready Loki monitoring dashboard with service-specific panels.

"Generate a dashboard for my payment-api and user-service"

Features:

  • Log volume monitoring by service
  • Error rate tracking with thresholds
  • Log level distribution analysis
  • Service health overview
  • Error pattern detection

validate_loki_queries

Tests LogQL queries against real Loki API to validate query performance.

"Validate these LogQL queries for performance"

Features:

  • Query syntax validation
  • Performance optimization suggestions
  • Success rate analysis
  • Query execution testing

export_loki_dashboard

Exports Loki dashboard to Grafana-compatible JSON file.

"Export dashboard for my services to a JSON file"

Features:

  • Grafana-compatible JSON export
  • Service-specific configurations
  • Optimized LogQL queries
  • Production-ready dashboard structure

🏗️ Architecture

Research-Driven Design

The tool implements monitoring methodologies based on industry research:

  • RED Method (Request rate, Error rate, Duration) - Universal microservices standard
  • Service Discovery - Automatic detection from log labels and content
  • Log Structure Analysis - Quality assessment for dashboard feasibility

Log Analysis Algorithm

Dashboards are recommended based on log data analysis:

  • Service Discovery: Automatic detection from service labels and JSON content
  • Log Structure Quality: Assessment of structured logs and error patterns
  • Volume Analysis: Log throughput and service activity measurement

Query Optimization

The tool provides performance optimization suggestions:

  • LogQL Optimization: Avoid regex wildcards, use exact string matching first
  • Label Filtering: Use specific label selectors for better performance
  • Query Patterns: Efficient time-based and service-based queries

🔒 Security & Authentication

Supports authentication methods:

  • Basic Auth: Username/password authentication (most common)
  • No Auth: For local development setups

📊 Dashboard Features

Generated Dashboard Includes:

  1. Log Volume Monitoring

    • Service-based log volume tracking
    • Request rate analysis from log data
    • Time-based volume patterns
  2. Error Rate Tracking

    • Error detection from log patterns
    • Industry-standard thresholds (1% yellow, 5% red)
    • Error pattern analysis
  3. Service Health Overview

    • Multi-service comparison
    • Log level distribution
    • Service activity monitoring

🧪 Testing

Run the comprehensive test suite:

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Run specific test suites
npm test -- red-method.test.ts

Test Coverage:

  • Unit tests for dashboard generators
  • Integration tests with mocked Loki APIs
  • Query validation and optimization testing
  • Configuration and authentication testing

🚀 Development

Project Structure

src/
├── index.ts                    # MCP server entry point
├── config/
│   ├── ConfigManager.ts       # Multi-tier configuration
│   └── AuthHandler.ts         # Authentication handling
├── analyzers/
│   └── LokiAnalyzer.ts        # LogQL query generation & analysis
├── dashboards/
│   ├── REDMethodGenerator.ts   # RED method dashboards
│   └── GrafanaExporter.ts     # Dashboard export utilities
├── types/
│   ├── loki-api.ts            # Loki API types
│   ├── grafana-config.ts      # Grafana dashboard types
│   ├── monitoring-methods.ts  # Monitoring methodology types
│   └── config.ts              # Configuration types
└── __tests__/                 # Test suite

Building

npm run build      # TypeScript compilation
npm run lint       # ESLint checking
npm run typecheck  # TypeScript type checking

📈 Success Metrics

  • Functional: Generates working dashboards for common Loki setups
  • Performance: Analyzes Loki logs in <30 seconds
  • Usability: npm install -g → working in Claude within 5 minutes
  • Professional: 90%+ test coverage + comprehensive TypeScript types

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Run tests: npm test
  4. Commit changes: git commit -m 'Add amazing feature'
  5. Push to branch: git push origin feature/amazing-feature
  6. Open a Pull Request

📄 License

MIT License - see LICENSE file for details.

🔗 Links


Built for production observability teams who need immediate value from their Loki setup. 🚀