openhue-cli icon indicating copy to clipboard operation
openhue-cli copied to clipboard

MCP Server - stdio mode only

Open thibauult opened this issue 4 months ago • 1 comments

Summary by CodeRabbit

  • New Features

    • Introduced an AI command group in the CLI for organizing AI-related commands.
    • Added an MCP server subcommand to run a server that exposes a tool to list rooms from your Hue home.
  • Chores

    • Added MCP SDK dependency and updated indirect libraries for improved compatibility and stability.

thibauult avatar Sep 09 '25 13:09 thibauult

Walkthrough

Adds a new MCP server command exposing a “room_get” tool that lists Hue rooms, plus a simple “SayHi” tool. Wires the MCP server into the root CLI under an AI command group. Updates go.mod to include the MCP SDK and refreshes several indirect dependencies.

Changes

Cohort / File(s) Summary
MCP server command
cmd/mcp/server.go
Introduces an MCP server: defines HiParams, tools SayHi and ListRooms, and NewCmdMcpServer to run the server over stdio with OpenHUE context; registers tool room_get.
Root command wiring
cmd/root.go
Adds AI command group OpenHueCmdGroupAI; registers mcp.NewCmdMcpServer(ctx) as a subcommand; reorganizes imports.
Dependencies
go.mod
Adds github.com/modelcontextprotocol/go-sdk v0.2.0; adds github.com/yosida95/uritemplate/v3 indirectly; bumps several golang.org/x/* indirect dependencies.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    participant CLI as Cobra CLI
    participant MCP as MCP Server
    participant Tool as Tool: room_get
    participant OH as OpenHUE Context

    rect rgba(230,245,255,0.6)
    note over CLI: New AI group and mcp-server command
    User->>CLI: openhue mcp-server
    CLI->>MCP: Start over stdio (with OH in context)
    end

    rect rgba(235,255,235,0.6)
    note over MCP: Tool invocation flow
    User->>MCP: Call tool "room_get"
    MCP->>Tool: Invoke ListRooms(ctx)
    Tool->>OH: Get rooms
    alt Rooms found
        OH-->>Tool: [room list]
        Tool-->>MCP: Formatted room names
        MCP-->>User: Content: list of rooms
    else No rooms
        OH-->>Tool: []
        Tool-->>MCP: "No rooms found"
        MCP-->>User: Message: none
    else Context error
        Tool-->>MCP: error (no OpenHUE context)
        MCP-->>User: Error response
    end
    end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks (1 passed, 2 warnings)

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request currently has no description, so it fails to summarize or contextualize any of the changes made in the code and does not convey the intent or scope of the update. Please add a pull request description that summarizes the key functional additions—such as the new MCP server command, its stdio transport mode, and the introduced SayHi and ListRooms tools—to clearly communicate the scope and purpose of the changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title references a core aspect of the changeset by indicating the addition of an MCP server operating in stdio mode, which is directly related to the main functionality introduced and remains concise and specific.

Poem

I twitched my ears at the humming wire,
A new MCP server sparks to fire.
“room_get,” I hop—list rooms in sight,
With OpenHUE to guide the light.
Dependencies trimmed, commands aligned—
Carrot-ready, code refined.
Hippity-hop, ship it on time!

[!TIP]

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing Touches
  • [ ] 📝 Generate Docstrings
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Sep 09 '25 13:09 coderabbitai[bot]