Skip to content

Refactor MCP gateway into focused modules#59

Merged
dawid-nowak merged 2 commits into
mainfrom
user/luca/refactor-gateway-modules
Jul 16, 2026
Merged

Refactor MCP gateway into focused modules#59
dawid-nowak merged 2 commits into
mainfrom
user/luca/refactor-gateway-modules

Conversation

@lucarlig

@lucarlig lucarlig commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • rename mcp_gateway.rs to mcp_service.rs so the filename matches its primary responsibility
  • keep mcp_service.rs as a thin McpService definition and RMCP ServerHandler adapter
  • group method implementations under mcp_service/ by capability: initialization, tools, resources, prompts, and completion
  • extract backend transport state into backend_transports.rs
  • extract identifier namespacing and backend resolution into identifier_routing.rs
  • extract list fan-out and result merging into list_aggregation.rs
  • move unit tests beside the routing and aggregation logic they cover
  • update the gateway book source-path reference

Why

The original module mixed RMCP server handling, session-scoped backend transport storage, identifier routing, list aggregation, and tests in one file. Separating those concerns makes the hot path easier to navigate while retaining one clear adapter for the RMCP trait.

Impact

This is a behavior-preserving internal refactor. MCP handler bodies now live behind thin ServerHandler delegations, with no intended protocol or runtime behavior changes.

Validation

  • cargo fmt --all --check
  • cargo clippy --locked --workspace --all-targets -- -D warnings
  • cargo nextest run --locked --workspace (68 passed)
  • mdbook build docs/book
  • mdbook test docs/book
  • git diff --check

lucarlig added 2 commits July 15, 2026 13:36
Signed-off-by: lucarlig <luca.carlig@ibm.com>
Signed-off-by: lucarlig <luca.carlig@ibm.com>
@lucarlig
lucarlig marked this pull request as ready for review July 15, 2026 12:51
@dawid-nowak
dawid-nowak merged commit 5ae56fb into main Jul 16, 2026
9 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