ADR 0005: rmcp 3.1.1 integration — findings
Context
Before writing config.rs/server.rs, three open questions needed answers:
whether serve() works over an in-process tokio::io::duplex pair (needed
for an e2e test harness), which ProtocolVersion ServerInfo::new()
defaults to, and whether enabling rmcp’s own reqwest feature alongside
redmine-client’s reqwest dependency would cause a rustls-provider
conflict.
Verified against the actual rmcp 3.1.1 crate contents (downloaded from
static.crates.io, not just its main branch) and the rust-sdk
repository’s examples/ and tests/ on 2026-08-06.
Findings
serve()overtokio::io::duplexworks, no extra feature needed.rmcp’s own integration tests (tests/test_tool_macros.rs,tests/test_server_initialization.rs, etc.) callserver.serve(server_transport)/client_handler.serve(client_transport)directly ontokio::io::duplex(4096)halves. This goes through the(R, W): IntoTransportimpl gated bytransport-async-rw, which theserverfeature already pulls in —transport-io(which addstokio/io-stdfor real stdin/stdout) is not required for an in-process duplex harness. The e2e test harness needs no extra dev feature beyondclientonrmcp.- Default protocol version is
ProtocolVersion::LATEST(V_2025_11_25in this SDK snapshot), viaimpl Default for ProtocolVersion.ServerInfo::new()/InitializeResult::new()rely on this default rather than pinningV_2024_11_05as the upstream counter example does. We do not call.with_protocol_version(...)inserver.rs. - No rustls provider conflict.
ruprogress-mcpdoes not enable rmcp’s ownreqwestfeature (rmcp/reqwest) — onlyserver,macros,transport-io, and (dev)client. All Redmine HTTP traffic goes throughredmine-client’s ownreqwestdependency (rustlsfeature, no rmcp involvement). There is therefore no secondreqwest/rustls provider in the dependency graph from rmcp’s side;cargo tree -dafter adding the dependency shows a singlereqwestresolution.
Verified rmcp 3.1.1 API shape
Confirmed against the actual 3.1.1 crate contents:
#[tool_handler]takes only an optionalmeta = ...; identity/instructions come fromServerHandler::get_info() -> ServerInfo.ToolRouter::{remove_route, disable_route, has_route, list_all}all exist;remove_routedeletes the entry entirely (self.map.remove(name)), so bothtools/listandtools/call(“tool not found”,invalid_params) are affected — one choke point for read-only mode.ContentBlock::text(...)andCallToolResult::success(...)match the upstream counter example.Implementation::from_build_env()is the defaultserver_infoonInitializeResult::new.
One subtlety not obvious from the docs, found while implementing graceful
shutdown: ServiceExt::serve() for a server blocks until the client sends
initialize (serve_server_with_ct_inner loops on expect_next_message
before returning a RunningService). A signal handler installed only after
.awaiting serve() — e.g. via RunningService::cancellation_token(), the
first approach tried here — never sees a SIGTERM that arrives before a
client connects, and the process dies to the default signal disposition
instead of exiting cleanly. Worse, once a handler is installed, the same
SIGTERM can independently interrupt the blocking OS thread underneath
tokio::io::stdin()’s read, nondeterministically finishing serve()’s
future with a spurious “connection closed” transport error in a race with
the signal future — flipping the exit code between 0 and 1 from one run to
the next.
main.rs avoids both failure modes by tokio::spawn-ing the serve-and-wait
sequence and racing the JoinHandle (not the bare future) against
wait_for_shutdown_signal() in a tokio::select!, aborting the handle on
the signal branch. This makes the outcome depend only on which of “signal
arrived” vs. “server task naturally finished” happened first, independent of
whichever thread the same OS signal also happened to interrupt.
Decision
Use rmcp = "=3.1.1", features server, macros, transport-io (binary),
dev-feature client (tests only, via Cargo’s per-target feature unification
under resolver = "3"). No workaround or version bump needed.
Addition: src/lib.rs
The e2e test harness (tests/support/mod.rs) needs to construct Config,
RedmineMcp, etc. from outside the crate. A tests/ integration test can
only do that against a library target — a main.rs-only binary crate
exposes nothing to import. Adding src/lib.rs (pub mod config; pub mod server; ...) with main.rs reduced to a thin CLI/bootstrap wrapper resolves
this; it is the standard bin+lib pattern and does not add a new external
dependency or public API surface (nothing publishes this crate).