Repository navigation
feat(#381): MCP Streamable HTTP transport + protocol version bump - #397
Merged
Merged
Conversation
Protocol: - Bump protocolVersion from 2024-11-05 to 2025-06-18 (current spec) Architecture: - Extract MCP handler into uteke_mcp library crate (lib.rs) - main.rs simplified to just stdio transport loop delegating to lib - uteke-server gains POST /mcp endpoint that calls the shared handler HTTP endpoint: - POST /mcp accepts JSON-RPC body (initialize, tools/list, tools/call) - Returns application/json with MCP-Protocol-Version header - Uses existing Mutex<Uteke> from uteke-server (thread-safe) - Enables remote MCP clients without subprocess spawning Closes #381
🔍 Cora AI Code Review❌ Blocked — critical issues found. 🔴 Error (3)
Review powered by cora-cli · BYOK · MIT |
CodeCora #397: 1. exec_remember now passes --type to remember_typed (was dropped in refactor). 2. exec_recall now accepts tags filter and min_score (were hardcoded to None and 0.0). 3. exec_list now accepts offset for pagination (was hardcoded to 0). 4. POST /mcp enforces 1 MiB body size limit via .take() to prevent memory exhaustion from unbounded reads. Also: updated tool schemas to document the restored parameters.
CodeCora #397 r2: the refactor dropped room and author parameters from the MCP remember tool. Clients using collaborative memory (room mode) would silently lose room linkage. Fix: restore room/author handling with remember_in_room() when room is provided, plus add them to the tool schema.
CodeCora #397 r3: 1. exec_list used &m.id[..8] which panics if ID < 8 bytes. Fix: use m.id.get(..8).unwrap_or(&m.id) for safe slicing. 2. POST /mcp used .take(MAX_MCP_BODY) which silently truncated oversized bodies, processing a partial JSON-RPC message as if valid. Fix: check Content-Length header first and return 413 if > 1 MiB.
| return ctx.error_response_for(req, 413, "Payload too large"); | ||
| } | ||
| let mut body = String::new(); | ||
| if let Err(e) = req.as_reader().take(MAX_MCP_BODY).read_to_string(&mut body) { |
| error: Some(JsonRpcError { | ||
| code: -32700, | ||
| message: format!("Parse error: {e}"), | ||
| }), |
| const MAX_MCP_BODY: u64 = 1024 * 1024; | ||
| // Check Content-Length and reject oversized requests. | ||
| let content_length = req | ||
| .headers() |
ajianaz
added a commit
that referenced
this pull request
Aug 13, 2026
* feat(#381): MCP Streamable HTTP transport + protocol version bump Protocol: - Bump protocolVersion from 2024-11-05 to 2025-06-18 (current spec) Architecture: - Extract MCP handler into uteke_mcp library crate (lib.rs) - main.rs simplified to just stdio transport loop delegating to lib - uteke-server gains POST /mcp endpoint that calls the shared handler HTTP endpoint: - POST /mcp accepts JSON-RPC body (initialize, tools/list, tools/call) - Returns application/json with MCP-Protocol-Version header - Uses existing Mutex<Uteke> from uteke-server (thread-safe) - Enables remote MCP clients without subprocess spawning Closes #381 * fix(#381): restore dropped params + body size limit CodeCora #397: 1. exec_remember now passes --type to remember_typed (was dropped in refactor). 2. exec_recall now accepts tags filter and min_score (were hardcoded to None and 0.0). 3. exec_list now accepts offset for pagination (was hardcoded to 0). 4. POST /mcp enforces 1 MiB body size limit via .take() to prevent memory exhaustion from unbounded reads. Also: updated tool schemas to document the restored parameters. * fix(#381): restore room/author params in exec_remember CodeCora #397 r2: the refactor dropped room and author parameters from the MCP remember tool. Clients using collaborative memory (room mode) would silently lose room linkage. Fix: restore room/author handling with remember_in_room() when room is provided, plus add them to the tool schema. * fix(#381): safe ID slicing + reject oversized MCP bodies CodeCora #397 r3: 1. exec_list used &m.id[..8] which panics if ID < 8 bytes. Fix: use m.id.get(..8).unwrap_or(&m.id) for safe slicing. 2. POST /mcp used .take(MAX_MCP_BODY) which silently truncated oversized bodies, processing a partial JSON-RPC message as if valid. Fix: check Content-Length header first and return 413 if > 1 MiB. * chore: retrigger CI (flaky env test on previous run)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #381.
283 tests pass, clippy clean.