Skip to main content

Module gateway

Module gateway 

Source
Expand description

MCP Tool-Catalog Gateway (#210).

Turns lean-ctx into a gateway in front of any number of downstream MCP servers. Instead of injecting every downstream tool schema into the system prompt (the “more tools → less adoption” tax), the gateway:

  1. aggregates the downstream catalogs (catalog) behind a TTL cache,
  2. ranks them per query with BM25 (router) into a top-N ChoiceCard shortlist, and
  3. proxies the actual call to the owning server (client).

Net effect: unlimited downstream tools at (roughly) constant context cost. Fully no-op until gateway.enabled = true.

Re-exports§

pub use catalog::Catalog;
pub use config::GatewayConfig;
pub use config::GatewayServer;
pub use config::ResolvedTransport;
pub use config::TransportKind;
pub use router::ScoredTool;

Modules§

adapters
L4 typed adapters (deeper addon integration, #1096–#1101).
catalog
Aggregated downstream tool catalog (#210) with a TTL cache.
client
Downstream MCP client (#210).
config
Gateway configuration (#210): downstream MCP servers + routing knobs.
pool
Persistent downstream MCP session pool (#1078).
postprocess
Gateway output post-processor (deeper addon integration).
router
Query router (#210): rank the aggregated catalog against a query.

Structs§

FindOutcome
Outcome of a find query: the ranked shortlist plus catalog context.

Functions§

find
Rank the downstream catalog against query and return the top-N shortlist.
proxy
Proxy a server::tool call to its owning downstream server.
render_cards
Render a FindOutcome as compact ChoiceCards for the model.
servers_overview
Per-server tool counts (for ctx_tools list).