Skip to content

Migrate MCP server to the official rmcp SDK - #17

Merged
getappz merged 5 commits into
masterfrom
worktree-mcp-rmcp-migration
Jul 6, 2026
Merged

Migrate MCP server to the official rmcp SDK#17
getappz merged 5 commits into
masterfrom
worktree-mcp-rmcp-migration

Conversation

@getappz

@getappz getappz commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Replaces the hand-rolled JSON-RPC MCP stdio server with the official rmcp 0.16 crate (modelcontextprotocol/rust-sdk). Feature set is unchanged: 2 tools (get_routing_suggestion, check_session_health) and 2 resources (agentflare://sessions, agentflare://nudges), with all business logic reused verbatim from crate::optimize.

Implementation notes:

  • rmcp features [server, transport-io]; tokio kept minimal ([rt, macros, io-util, io-std]) with an isolated current-thread runtime scoped to the mcp subcommand only — every other subcommand stays fully synchronous.
  • Tools via #[tool_router]/#[tool] macros; resources via a #[tool_handler] impl ServerHandler with sync helpers (list_resources_sync/read_resource_sync) extracted for unit-testability.
  • serverInfo explicitly reports agentflare's own name/version (rmcp's Default would report rmcp/0.16.0).
  • Cargo.toml description updated: the crate is no longer zero-dependency.

Two intentional client-observable behavior changes:

  1. Unknown resource URIs now return a proper JSON-RPC resource_not_found error (old server returned a fake-successful text/plain placeholder).
  2. Invalid tool arguments (e.g. empty session_id, missing prompt) now surface as protocol-level invalid_params (-32602) errors instead of tool-result-level isError payloads; rmcp also schema-validates arguments.

Verification: 94 tests passing (cargo test -- --test-threads=1); manual end-to-end stdio session exercising initialize + handshake, both resources, a bogus URI, tools/list, and both tools (7/7 expected responses, confirmed serverInfo identity).

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@getappz
getappz merged commit 90aa248 into master Jul 6, 2026
7 checks passed
@getappz
getappz deleted the worktree-mcp-rmcp-migration branch July 6, 2026 12:01
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant