Repository navigation
Description
MCP Server Fails to Compile - Axum 0.7 Handler Trait Errors
Summary
The MCP HTTP server in packages/core/src/mcp/server.rs has compilation errors that prevent the backend from building. This appears to be a pre-existing issue that affects main branch and was not introduced by recent PRs.
Error Details
error[E0277]: the trait bound `fn(...) -> ... {handle_streamable_http_request}: Handler<_, _>` is not satisfied
--> packages/core/src/mcp/server.rs:241:29
error[E0277]: the trait bound `fn(State<...>, ...) -> ... {handle_http_mcp_request}: Handler<_, _>` is not satisfied
--> packages/core/src/mcp/server.rs:243:37
Both handle_streamable_http_request and handle_http_mcp_request fail to satisfy Axum's Handler trait.
Impact
- Severity: High (prevents compilation)
- Scope: MCP server only (doesn't affect desktop app)
- Status: Likely not caught in CI (MCP module may not be tested)
Root Cause Analysis
The handlers use Axum 0.7 extractors but the trait bounds aren't satisfied. Possible causes:
-
Extractor ordering issue: Axum 0.7 has strict requirements for extractor order
- Tried:
State, HeaderMap, String❌ - Tried:
HeaderMap, State, String❌ - Tried:
State, HeaderMap, Bytes❌
- Tried:
-
State type mismatch: The tuple state type may not be compatible
- Current:
State<(Arc<McpServices>, Option<ResponseCallback>, Arc<ServerState>)>
- Current:
-
Missing trait imports: May need additional Axum trait imports
-
Return type issue:
Result<Response, StatusCode>may not implementIntoResponsecorrectly
Investigation Done
- Verified issue exists in main branch (commit d1a9854)
- Verified issue exists in last known "working" commit (5b288cf)
- Tried multiple extractor orderings per Axum 0.7 docs
- Tried
#[axum::debug_handler]attribute (no additional info) - Checked Axum version: 0.7.9
Recommendations
- Verify if MCP is actually used: Check if any code paths call the MCP server
- Add to CI: Ensure
cargo check --libruns in CI to catch this - Consult Rust/Axum expert: This requires deep Axum trait knowledge
- Consider refactoring: May need to redesign handler signatures for Axum 0.7 compatibility
Acceptance Criteria
-
cargo check --libcompiles without errors - Both handlers satisfy
Handler<_, _>trait bound - MCP server integration tests pass (if they exist)
- Add CI check to prevent regression
Related Files
packages/core/src/mcp/server.rs- Main file with errors (lines 241, 243, 281, 467)packages/core/Cargo.toml- Axum dependency version
Labels
backend, mcp, bug, compilation-error, needs-rust-expert
Priority
Medium - Blocks backend compilation but doesn't affect core desktop app functionality. Should be fixed but not blocking current sprint work.
Activity
malibio commentedon Nov 17, 2025
Update: False Alarm - MCP Compiles Successfully
After further investigation, the MCP HTTP server compiles and works correctly when built as part of the workspace or Tauri app.
What works:
cargo build(full workspace) - compiles successfullycd packages/desktop-app && cargo check- compiles successfullyWhat fails:
cd packages/core && cargo check --lib- fails with Handler trait errorsRoot Cause:
The Axum handler compilation errors only occur when checking
packages/coreas an isolated library. This is likely due to how Cargo resolves dependencies and features differently between workspace builds vs isolated library checks.Impact:
None - this was a false alarm. The MCP server works correctly.
Recommendation:
Close this issue as invalid. The apparent compilation errors were due to incorrect testing methodology (checking library in isolation vs full workspace build).