Support tool exposure modes (direct / deferred / codemode) and client-side aggregation.
Les mainteneurs répondent en général sous 3 jours
@jamadeo y travaille déjà.
Depuis le 7/11/2026.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
Is your feature request related to a problem? Please describe.
rmcp sends every tool from every connected server through to the host, and there is no way to say how a tool should be exposed. This works fine with small servers, but it breaks down in three ways:
- Schemas are re-sent every turn. Anthropic measured ~77K tokens before the first user message with 50+ MCP tools (Advanced tool use). Servers with big tool surfaces already work around this alone: ghidra-mcp (209 tools) implements its own lazy loading (
search_tools/load_tool_group) because hosts don't do it. - Tool results always round-trip through the model, even when they're just input for the next tool call. Anthropic measured 150K → 2K tokens for exactly this pattern (Code execution with MCP).
- Server authors can't declare intent ("these tools only make sense scripted together", "search, don't preload"). Every host invents its own policy, so no convention exists across hosts, and nothing in the SDK carries it.
The ecosystem has already converged on the fix. pi ships a codemode tool (docs) and OpenCode 2.0 makes code mode the default for all MCP servers (release notes, packages/codemode); Codex reserves the same three states in its exposure enum (ToolExposure::Direct | Deferred | CodeModeOnly, codex-rs/tools/src/tool_executor.rs) and Anthropic standardizes deferred discovery (Tool Search Tool). The Rust SDK can't express any of it.
Describe the solution you'd like
Two primitives:
A client-side aggregation interface. rmcp's client role connects to N upstream servers, but composing them into one logical server (merged tools/list with namespaces, routed tools/call) is up to each implementer today. A trait covering "connect upstreams → aggregated registry → dispatch" gives third-party crates one shape to build on.
Per-server exposure metadata. A standard way to declare a server's tools as:
direct— intools/listevery turn (today's behavior)deferred— discoverable via a search primitive, schema fetched on demandcodemode— callable only from a script sandbox; never in the model's tool list, results pipe between tools
Sketch (semantics follow pi's codemode — MCP tools deferred by default inside the sandbox, BM25 searchTools for discovery; naming mirrors Codex's enum so the convention reads the same everywhere):
pub enum ToolExposure {
/// In tools/list every turn (current behavior).
Direct,
/// Discoverable via search; schema fetched on demand.
Deferred,
/// Callable only from a script sandbox.
CodeModeOnly,
}
Describe alternatives you've considered
- Leave exposure to hosts. Every host implements its own policy, server authors keep writing host-specific workarounds, and Rust-built hosts/aggregators reinvent the same layer each time.
- Wait for the MCP spec. Slower than the ecosystem is moving. pi's ecosystem already ran this curve: a third-party extension (
mcp-adapter'smcpScript, January 2026) proved demand, then the host built it in (codemode, later in 2026). An SDK-level convention can be validated now and feed a spec proposal later. - Third-party crates with no SDK support. Aggregators can be built today — I'm building one — but without an agreed interface for upstream composition and exposure, every aggregator invents its own shape and none interoperate.
Additional context
I'm starting a third-party crate, rmcp-codemode, as a reference implementation: a client-side aggregator that exposes upstream servers' tools to any host as a codemode script tool — QuickJS sandbox (rquickjs), BM25 tool search, upstream MCP tools as namespaced JS functions. The semantics follow pi's shipped design (tools deferred inside the sandbox by default, discovery via search) rather than a new proposal; OpenCode's packages/codemode is the second reference for the aggregation side, and Cloudflare's Code Mode proves the same architecture works as a standalone layer (their MCP portal demoed 300+ tools → 3 from the host's view).
It stays out of this workspace on purpose: QuickJS can't meet the dependency policy, and exposure logic belongs to hosts anyway. The PoC's job is to find out which parts make sense as SDK primitives, so the crate is the input, not the ask.
Questions:
Does the SDK already provide anything for aggregating multiple upstream servers into one logical server? If not, is there anything in the current client API that would make a third-party aggregator fight the design?
Host-side discussions: zed#66626 (the same feature for the Zed agent, host-level argument) and zed#64004 (deferred tool discovery, the step codemode builds on). Server-author case for the result-cost problem: zed-mcp-server-markitdown — one tool, convert_to_markdown(uri), and a PDF dumps the whole document into context.
- Langage dominant
- Rust
- Étoiles
- 4.1k
- Forks
- 694
- Merge moyen
- 4 j 9 h
- PR mergées (30 j)
- 41
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de modelcontextprotocol/rust-sdk
-
Return MergedList<T> from list_all_* and drop the _with_cache_hint variantsPeut-être pris @DaleSeo l’a pris il y a 4 jours. Ouverteenhancement P3 ready for work T-service v4
modelcontextprotocol/rust-sdk#1430 · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
-
Server logs a fabricated 'initialize' (with synthesized rmcp/3.8.0 peer identity) for no-initialize SEP-2567 requests, ignoring clientInfo from _metaPeut-être pris @jamadeo l’a pris il y a 4 jours. Ouvertebug P2 ready for work T-service T-transport
modelcontextprotocol/rust-sdk#1425 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
-
OAuth discovery drops explicit default ports from advertised issuer identifiersPeut-être pris @gocamille l’a pris il y a 7 jours. Ouvertebug P1 ready for work T-security T-transport
modelcontextprotocol/rust-sdk#1420 · 4 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
-
`register_client` drops `client_secret_expires_at` from the registration responsePeut-être pris @gocamille l’a pris il y a 8 jours. Ouvertebug P2 ready for work T-security
modelcontextprotocol/rust-sdk#1416 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
-
Typed client calls drop the parse error when a reply misses a required fieldPeut-être pris @gocamille l’a pris il y a 8 jours. Ouverteenhancement P2 ready for work T-core T-service
modelcontextprotocol/rust-sdk#1415 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de modelcontextprotocol/rust-sdk
Issues similaires
-
bug priority: low
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
storytold/photocraft#12183 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
-
area:render needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
bherbruck/solvecraft#13138 ·
-
testing
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
ratatui/ratatui-textarea#39 ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
transit-audio/transit#369 ·