Proxy MCP completion requests through Rust gateway - #41
Merged
Conversation
Replace the fixed completion stub with real backend routing: complete now validates the request, reads the namespaced prompt name or resource URI from the reference, resolves the single owning backend, forwards the request with the prefix stripped, and returns the backend CompleteResult directly (preserving argument, context, and pagination metadata). Routing failures return a gateway routing error. The mock backend gains a complete handler that only recognizes its own backend-local references, and new integration tests cover prompt and resource argument completion plus an unrouted-reference error. Implements IBM/mcp-context-forge#5254 Signed-off-by: lucarlig <luca.carlig@ibm.com>
lucarlig
marked this pull request as ready for review
June 23, 2026 09:53
merge_capabilities omitted the completions capability, so spec-compliant clients never sent completion/complete and the new proxying was unreachable. Declare it alongside prompts/resources/tools and assert it in the prompt completion test. Signed-off-by: lucarlig <luca.carlig@ibm.com>
…e-pass-through Signed-off-by: lucarlig <luca.carlig@ibm.com> # Conflicts: # crates/contextforge-gateway-rs-lib/src/gateway/mcp_gateway.rs
Signed-off-by: lucarlig <luca.carlig@ibm.com>
dawid-nowak
approved these changes
Jul 7, 2026
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.
Proxy MCP
completion/completethrough the Rust gateway, replacing the fixed local completion values.completenow validates the request, reads the namespaced prompt name or resource URI from the reference, resolves the single owning backend (split_prefixed_name+resolve_backend), and forwards the request with the prefix stripped. The backendCompleteResultis returned directly, preserving the argument, context, and pagination metadata. Mirrorsread_resource/get_prompt.Implements IBM/mcp-context-forge#5254