Skip to content

Proxy MCP completion requests through Rust gateway - #41

Merged
lucarlig merged 4 commits into
mainfrom
user/luca/mcp-complete-pass-through
Jul 7, 2026
Merged

Proxy MCP completion requests through Rust gateway#41
lucarlig merged 4 commits into
mainfrom
user/luca/mcp-complete-pass-through

Conversation

@lucarlig

Copy link
Copy Markdown
Contributor

Proxy MCP completion/complete through the Rust gateway, replacing the fixed local completion values.

  • complete now 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 backend CompleteResult is returned directly, preserving the argument, context, and pagination metadata. Mirrors read_resource/get_prompt.
  • Removes the fixed Alice/Bob/Charlie and 1/2/3 values.
  • Adds integration tests for prompt and resource argument completion, plus an unrouted-reference routing error. The mock backend only recognizes its own backend-local references, so a successful completion proves the prefix was stripped.

Implements IBM/mcp-context-forge#5254

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
lucarlig marked this pull request as ready for review June 23, 2026 09:53
@lucarlig
lucarlig requested a review from dawid-nowak 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>
@lucarlig lucarlig self-assigned this Jun 25, 2026
lucarlig added 2 commits June 29, 2026 16:06
…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>
@lucarlig
lucarlig merged commit 9b61016 into main Jul 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants