Skip to content

feat: expose cost analysis, drift detection, and AI review as MCP tools #1

@cschanhniem

Description

@cschanhniem

The MCP server at src/thothctl/mcp/server.py and src/thothctl/services/mcp/service.py currently exposes a subset of ThothCTL commands (init, list, scan, inventory, generate, document, check environment/project).

But three of the most differentiated IDP features are not available as MCP tools:

  1. Cost analysis (thothctl check --cost) — src/thothctl/services/check/project/cost/cost_analyzer.py
  2. Drift detection (thothctl check --drift) — src/thothctl/services/check/project/drift/
  3. AI review (thothctl ai-review) — src/thothctl/services/ai_review/

Adding these as MCP tools would let AI coding assistants (Claude Code, Copilot, etc.) call them directly during development workflows — e.g., "check costs before I add this resource" or "drift-check my current branch."

The implementation pattern already exists in _handle_execute_request in server.py — each new tool would follow the same subprocess-based pattern used by the scan and inventory tools.

Suggested approach:

  • Add thothctl_cost_analyze, thothctl_drift_detect, thothctl_ai_review tool definitions in _get_available_tools()
  • Add corresponding execution branches in _handle_execute_request()
  • Add to both server.py (HTTP) and service.py (stdio/MCP SDK) to keep them in sync

Evidence: Both server files already follow the same pattern. The scan tool at server.py lines 80-95 shows the established subprocess wiring pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions