Skip to content

Comments

feat(mcp): add experimental MCP server support#68

Closed
mikeyobrien wants to merge 6 commits intomainfrom
feat/mcp-support
Closed

feat(mcp): add experimental MCP server support#68
mikeyobrien wants to merge 6 commits intomainfrom
feat/mcp-support

Conversation

@mikeyobrien
Copy link
Owner

Summary

  • Add MCP (Model Context Protocol) server support, enabling Ralph integration with Claude Desktop and other MCP clients
  • Implement ralph mcp serve subcommand with stdio transport
  • Expose orchestration tools: ralph_run, ralph_status, ralph_stop, ralph_list_sessions, ralph_list_hats
  • Add comprehensive README documentation for MCP setup and usage

Changes

  • New crate: ralph-mcp - MCP server implementation using rmcp
  • CLI: Added ralph mcp serve subcommand
  • Tests: E2E tests for MCP server tools
  • Docs: README updated with MCP support section, Claude Desktop configuration examples

Test plan

  • E2E tests pass (cargo test -p ralph-mcp)
  • ralph mcp serve starts successfully
  • Pre-commit hooks pass (fmt, clippy)
  • Manual test with Claude Desktop

Notes

This feature is marked as experimental. The MCP server uses stdio transport, making it compatible with Claude Desktop's MCP configuration format.

Add Model Context Protocol SDK dependencies in preparation for
ralph-mcp crate:
- rmcp 0.8 with server, transport-io, macros features
- schemars 1.0 for JSON Schema generation
Create new ralph-mcp crate that implements an MCP server using the
rmcp SDK. This provides the foundation for `ralph mcp serve` command.

Implements 5 tools (currently stubs):
- ralph_run: Start orchestration sessions
- ralph_status: Check session status
- ralph_stop: Stop running sessions
- ralph_list_sessions: List all sessions
- ralph_list_hats: List configured hats

Uses rmcp 0.8 with #[tool_router] and #[tool] macros for clean tool
definitions. Serves over stdio transport as per MCP spec.
Adds `ralph mcp serve` command that launches the MCP server over stdio,
allowing Ralph to be used as an MCP tool provider for Claude Desktop
and other MCP clients.
Add comprehensive e2e tests that spawn `ralph mcp serve` as a subprocess
and communicate with it using the MCP JSON-RPC protocol over stdio.

Tests cover:
- Server initialization and capability negotiation
- tools/list endpoint returning all 5 Ralph tools
- tools/call for ralph_list_hats with config parsing
- tools/call for ralph_run with prompt handling
Tool and parameter descriptions now include:
- What each tool returns and its side effects
- Workflow hints (e.g., "poll ralph_status periodically")
- Cross-references between related tools
- Examples for prompt parameters
- Idempotency guarantees where applicable

Server instructions updated to explain the recommended workflow:
list_hats → run → status → stop
- Add MCP Server to Features list
- Add MCP Support section with usage instructions
- Document Claude Desktop configuration
- Update Architecture table with ralph-mcp crate
- Add ralph mcp serve to CLI Reference
@mikeyobrien
Copy link
Owner Author

Closing this for now per maintainer decision; can reopen or replace with a fresh branch later.

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.

1 participant