feat: add MCP server plugin - #4633
Conversation
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds a configurable MCP HTTP server with validated YouTube Music tools. Adds video and playlist playback plus request-correlated search, library-playlist, and queue handling across song controls and the renderer. Adds playlist parsing and MCP configuration controls. ChangesMCP server integration
Estimated code review effort: 4 (Complex) | ~60 minutes Mergeability Score: ⚪ Minimal · up to The MCP server plugin adds music-control and playlist API capabilities, and no actionable merge-blocking risk remains based on the supplied evidence. Sequence Diagram(s)sequenceDiagram
participant MCPClient
participant HonoApp
participant MCPServer
participant SongControls
participant Renderer
participant YouTubeMusicApp
MCPClient->>HonoApp: POST /api/mcp request
HonoApp->>MCPServer: Forward request through streamable HTTP transport
MCPServer->>SongControls: Execute validated YouTube Music tool
SongControls->>Renderer: Send playback, search, playlist, or queue IPC request
Renderer->>YouTubeMusicApp: Navigate or fetch YouTube Music data
YouTubeMusicApp-->>Renderer: Return result or error
Renderer-->>SongControls: Return correlated response
SongControls-->>MCPServer: Return MCP tool result
MCPServer-->>MCPClient: Return MCP response
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai resume |
✅ Action performedReviews resumed. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/plugins/api-server/backend/routes/mcp.ts`:
- Around line 38-53: Update getQueue and the
requestQueueInformation/peard:get-queue-response IPC contract to generate and
propagate a unique request ID for each queue request. Include that ID in the
response payload and have the listener resolve only when the response ID matches
its request, while preserving the existing timeout cleanup behavior.
- Around line 67-79: Update getQueueItems to safely handle missing renderer
metadata by guarding title, shortBylineText, lengthText, and each runs array
before mapping; preserve valid text joining when present and return undefined or
the existing fallback when metadata is absent so music_get_queue continues
listing queue items.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f33dd517-c200-4a66-9df1-f36d959d8498
📒 Files selected for processing (4)
src/plugins/api-server/backend/routes/control.tssrc/plugins/api-server/backend/routes/mcp.tssrc/plugins/api-server/backend/routes/queue.tssrc/providers/play-video.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/providers/play-video.ts
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/plugins/api-server/backend/routes/control.ts`:
- Around line 768-780: Update the queue response handling around
getQueueResponse to check info.items rather than info itself for an absent
queue. Return status 204 with a null body when items is undefined, and preserve
the existing 200 JSON response for queues with items.
- Around line 585-598: Update getQueueResponse to use a bounded timeout
alongside its IPC listener: clear the timer and remove the listener when a
matching queue response arrives, and on timeout remove the listener and settle
with the established no-response result or HTTP error. Ensure both queue
endpoints awaiting getQueueResponse handle that timeout outcome without leaving
the HTTP request or listener hanging.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5863b898-0fa4-4a15-b21a-24665b38ab72
📒 Files selected for processing (5)
src/plugins/api-server/backend/routes/control.tssrc/plugins/api-server/backend/routes/mcp.tssrc/providers/song-controls.tssrc/renderer.tssrc/types/music-player-desktop-internal.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer.ts
- src/plugins/api-server/backend/routes/mcp.ts
|
@coderabbitai review |
|
|
@coderabbitai resolve |
✅ Action performedComments resolved. Approval is disabled; enable |
• # Add MCP Server
Added an MCP server to the API Server plugin.
The following tools are supported:
Summary by CodeRabbit