Skip to main content
Glama

diagnostic-mcp

PyPI version Python 3.11+ License: MIT Tests

MCP server providing comprehensive diagnostic tools for monitoring and validating MCP infrastructure health and configuration.

Overview

diagnostic-mcp provides comprehensive diagnostic capabilities for monitoring and validating the health and configuration of all MCP servers in your system. It offers health probes, port consistency checks, configuration validation, and comprehensive diagnostic reports.

Related MCP server: troubleshooting-mcp-server

Features

Core Features

  • Session Token Authentication - Optional Bearer token authentication for production deployments

  • Health Probes - Kubernetes-style liveness, readiness, and startup probes

  • HTTP/SSE Transport - Full HTTP wrapper around MCP protocol

  • Diagnostic Tools - 5 comprehensive diagnostic tools for MCP infrastructure

5 Diagnostic Tools

  1. check_port_consistency - Port assignment validation

    • Detects port conflicts (multiple servers on same port)

    • Finds gaps in port sequence (5555-5582)

    • Identifies servers without port assignments

    • Flags ports outside expected range

  2. check_all_health - SSE endpoint health monitoring

    • Tests all MCP server SSE endpoints in parallel

    • Measures response times

    • Categorizes servers: online, offline, error

    • Configurable timeout (default: 5s)

  3. check_configurations - settings.json validation

    • Verifies use of supergateway

    • Checks args format consistency

    • Validates description fields

    • Reports configuration issues per server

  4. check_tool_availability - Tool inventory (limited)

    • Counts registered MCP servers

    • Notes: Full tool querying requires MCP protocol client

  5. run_full_diagnostic - Comprehensive report

    • Runs all 4 checks above

    • Aggregates results

    • Provides summary with total/critical issue counts

    • Generates actionable recommendations

Installation

pip install diagnostic-mcp

From Source (Development)

git clone https://github.com/latvian-lab/diagnostic-mcp.git
cd diagnostic-mcp
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Usage

Stdio Mode (Claude Code)

python -m diagnostic_mcp.server

SSE Mode (ContextForge Gateway)

python sse_server.py
# Default port: 5583
# Custom port: python sse_server.py --port 6583

Health Check

curl http://localhost:5583/health

Tool Examples

Check Port Consistency

# No parameters required
mcp__diagnostic-mcp__check_port_consistency()

# Returns:
# {
#   "port_map": {"server-name": 5555, ...},
#   "conflicts": [{"port": 5555, "servers": ["server1", "server2"]}],
#   "gaps": [5560, 5561],
#   "servers_without_ports": [],
#   "summary": {
#     "total_servers": 26,
#     "issues_found": 2
#   }
# }

Check All Health

# Default 5s timeout
mcp__diagnostic-mcp__check_all_health()

# Custom timeout
mcp__diagnostic-mcp__check_all_health(timeout=10)

# Returns:
# {
#   "servers_online": 24,
#   "servers_offline": 2,
#   "servers_error": 0,
#   "online_servers": [
#     {"name": "knowledge-mcp", "port": 5555, "status": "online", "response_time_ms": 45.2}
#   ],
#   "offline_servers": [...]
# }

Check Configurations

# No parameters required
mcp__diagnostic-mcp__check_configurations()

# Returns:
# {
#   "total_servers": 26,
#   "consistent_format": 24,
#   "servers_with_issues": 2,
#   "issues": [
#     {
#       "server": "old-mcp",
#       "issues": ["not using supergateway", "missing description"]
#     }
#   ]
# }

Run Full Diagnostic

# Comprehensive check
mcp__diagnostic-mcp__run_full_diagnostic()

# Returns:
# {
#   "timestamp": "2025-12-20T12:00:00Z",
#   "summary": {
#     "total_issues": 5,
#     "critical_issues": 2,
#     "status": "critical"
#   },
#   "port_check": {...},
#   "health_check": {...},
#   "config_check": {...},
#   "tool_check": {...},
#   "recommendations": [
#     "CRITICAL: Resolve port conflicts immediately",
#     "CRITICAL: Restart offline MCP servers"
#   ]
# }

Configuration

Environment Variables

Core Configuration

  • SENTRY_DSN - Optional Sentry error tracking

  • SENTRY_ENVIRONMENT - Environment name (default: development)

  • MCP_SSE_PORT - SSE server port (default: 5583)

  • MCP_SSE_HOST - SSE server host (default: 0.0.0.0)

Authentication (Optional)

  • AUTH_ENABLED - Enable session token authentication (default: false)

  • AUTH_ADMIN_TOKEN - Admin token for bootstrapping (required if AUTH_ENABLED=true)

  • AUTH_TOKEN_TTL - Token TTL in hours (default: 24)

  • AUTH_STORAGE - Storage backend: memory or supabase (default: memory)

  • SUPABASE_URL - Supabase project URL (required if AUTH_STORAGE=supabase)

  • SUPABASE_KEY - Supabase service role key (required if AUTH_STORAGE=supabase)

See AUTHENTICATION.md for complete authentication setup guide.

Settings Path

diagnostic-mcp reads from: ~/.claude/settings.json

Expected structure:

{
  "mcpServers": {
    "server-name": {
      "command": "npx",
      "args": ["-y", "supergateway", "--sse", "http://localhost:5555/sse"],
      "description": "Server description"
    }
  }
}

Port Range

Expected port range: 5555-5582 (28 ports)

Response Format

All tools return ResponseEnvelope format:

{
  "ok": true,
  "error": null,
  "message": "Check completed successfully",
  "data": { ... }
}

Logging

Logs written to: ./logs/diagnostic-mcp.log (or custom path via environment variable)

Integration

Claude Code (settings.json)

{
  "mcpServers": {
    "diagnostic-mcp": {
      "command": "npx",
      "args": ["-y", "supergateway", "--sse", "http://localhost:5583/sse"],
      "description": "MCP infrastructure diagnostics and health monitoring"
    }
  }
}

Use Cases

  1. Pre-deployment validation - Check configuration before deploying new MCP servers

  2. Health monitoring - Regular checks of all MCP server availability

  3. Troubleshooting - Diagnose port conflicts, offline servers, configuration issues

  4. Onboarding - Validate new server integrations

  5. Incident response - Quick overview of system health during outages

Limitations

  • check_tool_availability currently only counts servers

    • Full tool querying requires implementing MCP protocol client

    • Future enhancement to query each server's tool list

  • Health checks test HTTP accessibility only

    • Does not validate MCP protocol handshake

    • Does not test tool execution

Development

Running Tests

pytest tests/

Code Style

black src/

Contributing

Contributions welcome! Please see CONTRIBUTING.md for guidelines.

Version

Current version: 1.0.0

See CHANGELOG.md for version history.

Repository

License

MIT License - see LICENSE for details.

Copyright (c) 2025 Latvian Lab

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Provides comprehensive monitoring and observability for MCP server ecosystems with real-time health checks, performance metrics, distributed tracing, anomaly detection, and automated performance reports using OpenTelemetry and Prometheus.
      22
      1
      MIT
    • A
      license
      A
      quality
      F
      maintenance
      MCP server for monitoring health of MCP servers, GitHub Actions, GitLab pipelines, and HTTP endpoints with health history, TLS expiry, assertions, diagnostics, and alerts.
      22
      97 npm
      2
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables infrastructure health overviews, detailed host metrics, active alert retrieval, and optimization recommendations through MCP tools.
      MIT