Skip to content

feat: Implement MCP server for Claude Desktop integration#9

Merged
nik-kale merged 1 commit intomainfrom
feat/mcp-server-implementation
Dec 27, 2025
Merged

feat: Implement MCP server for Claude Desktop integration#9
nik-kale merged 1 commit intomainfrom
feat/mcp-server-implementation

Conversation

@nik-kale
Copy link
Copy Markdown
Owner

Summary

This PR implements a full-featured MCP (Model Context Protocol) server that exposes AutoRCA-Core as tools for Claude Desktop, Claude Code, and other MCP-compatible clients. This enables AI assistants to perform root cause analysis directly.

Changes

  • Created autorca_core/mcp/ module with MCP server implementation
  • Implemented 4 MCP tools:
    • run_rca: Full RCA analysis with markdown/JSON output
    • analyze_logs: Log anomaly detection and summarization
    • get_service_graph: Service topology graph extraction
    • find_root_causes: Rule-based root cause candidate identification
  • Added autorca mcp-server CLI command
  • Created comprehensive MCP_INTEGRATION.md documentation
  • Added mcp optional dependency in pyproject.toml
  • Configured stdio transport for Claude Desktop compatibility

MCP Tools

1. run_rca

Comprehensive root cause analysis on observability data.

  • Input: logs path, symptom, optional metrics/traces/configs
  • Output: Detailed RCA report (markdown or JSON)
  • Use case: Full incident investigation

2. analyze_logs

Quick log analysis for anomalies and patterns.

  • Input: logs path, optional time range and service filter
  • Output: Summary with error counts, affected services
  • Use case: Initial triage and health checks

3. get_service_graph

Build service dependency graph from observability data.

  • Input: logs, optional traces and metrics
  • Output: JSON service topology with incidents
  • Use case: Understanding service relationships

4. find_root_causes

Apply rule-based heuristics to identify root causes.

  • Input: logs, optional metrics/traces, sensitivity level
  • Output: Ranked candidates with confidence scores
  • Use case: Pattern-based root cause detection

Type of Change

  • New feature (non-breaking change adding functionality)

Integration

Claude Desktop Configuration

{
  "mcpServers": {
    "autorca": {
      "command": "autorca",
      "args": ["mcp-server"]
    }
  }
}

Example Usage

User: "Please run RCA on /var/log/app for 'API timeouts'"
Claude: [Uses run_rca tool] Here's the root cause analysis...

User: "Show me the service dependencies"
Claude: [Uses get_service_graph tool] The topology shows...

Features

  • Async tool handlers for non-blocking execution
  • Comprehensive error handling and logging
  • Structured JSON responses
  • Support for all AutoRCA features via MCP
  • Configurable sensitivity levels
  • Time range filtering
  • Service-specific filtering

Documentation

  • Complete MCP_INTEGRATION.md guide
  • Claude Desktop setup instructions
  • Tool reference with examples
  • Troubleshooting section
  • Security considerations

Testing

Designed to work with:

  • Claude Desktop (primary target)
  • Claude Code
  • Any MCP-compatible client

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated
  • No new warnings introduced

Related Issues

Implements Feature #8 from feature roadmap

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@nik-kale nik-kale merged commit 8622eb0 into main Dec 27, 2025
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants