[FEATURE]: Propagate backing MCP server `instructions` to clients
🧭 Type of Feature
Please select the most appropriate category:
- [x] Enhancement to existing functionality
- [ ] New feature or capability
- [ ] New MCP-compliant server
- [ ] New component or integration
- [ ] Developer tooling or test improvement
- [ ] Packaging, automation and deployment (ex: pypi, docker, quay.io, kubernetes, terraform)
- [ ] Other (please describe below)
🧭 Epic
Title: Expose backing-server instructions through the gateway's initialize response
Goal: Let LLM clients see the operational hints that each federated MCP server provides about how to use its tools, resources, and prompts. Today these hints are dropped at the gateway boundary.
Why now: Federated gateways become more useful as backing servers grow in number and complexity. The instructions channel is the place where upstream maintainers communicate non-obvious usage guidance (e.g. "always paginate", "tool descriptions reference the authenticated user's id", "use search before fetching"). Losing that information to the LLM degrades tool-use quality even when everything else (auth, tool list, schemas) is correctly federated.
Background — What instructions is
The MCP spec defines instructions as an optional string in the InitializeResult response. From the spec:
"Instructions describing how to use the server and its features. This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a 'hint' to the model. For example, this information MAY be added to the system prompt."
So it is a server's chance to give the LLM a system-prompt-level hint about how to use its capabilities. It is a separate channel from per-tool description.
Background — Current Context Forge behavior
When a client opens a session against the gateway, the initialize response Context Forge returns has a hardcoded literal in the instructions field — something like "ContextForge providing federated tools, resources and prompts. Use /admin interface for configuration." — regardless of what the backing servers actually advertise. Backing-server instructions are not captured, not stored, and not forwarded.
flowchart LR
C[Client / LLM] -- initialize --> G[ContextForge]
G -- initialize --> A[Backing server A]
G -- initialize --> B[Backing server B]
A -- instructions: 'use LIMIT on big tables' --> G
B -- instructions: 'page IDs are hierarchical' --> G
G -- "instructions: 'ContextForge providing federated tools...'" --> C
G -. dropped .-> X((upstream<br/>instructions))
🧑🏻💻 User Story 1
As a: an LLM-application developer using ContextForge to federate multiple MCP servers
I want: the operational guidance that each backing server provides via instructions to reach my model
So that: my agent makes better tool-use decisions without me re-typing or summarizing each server's hints into my own system prompt
✅ Acceptance Criteria
Scenario: Backing-server hints reach the client
Given a virtual server federates two backing MCP servers
And each backing server returns a non-empty `instructions` value at initialize
When a client opens a session against the gateway
Then the gateway's `initialize` response carries those instructions to the client
And the relationship between each instruction and its source server is recognizable
Scenario: Backing server has no instructions
Given a backing server returns no `instructions` field
When a client opens a session against the gateway
Then that backing server contributes nothing to the gateway's `instructions` value
And the gateway behaves as if that server's hints field is empty
🧑🏻💻 User Story 2
As a: ContextForge operator
I want: the gateway to keep something sensible in instructions even if backing servers don't supply one, and let me override the result if it doesn't read well in production
So that: I can curate the LLM-facing hint without having to fork the gateway
✅ Acceptance Criteria
Scenario: No backing server provides instructions
Given no backing server contributes an `instructions` value
When a client opens a session against the gateway
Then the gateway falls back to a reasonable default (today's hardcoded literal is fine as a default)
Scenario: Operator provides an override
Given an operator has explicitly set an instructions value for a virtual server
When a client opens a session against the gateway
Then the operator's value is returned instead of the auto-merged backing-server values
📐 Design Sketch (optional)
I'm intentionally not prescribing a specific implementation — the right shape (in-memory cache vs. DB column, merge format, override surface) seems like a maintainer call. Possible directions I've seen referenced or used elsewhere:
- Auto-merge: capture each backing server's instructions at federation time, concatenate with per-server labels at
initializetime (this is the shape LiteLLM's MCP gateway uses today) - Operator override: a per-virtual-server field that wins over the auto-merge when set
- Tool-description prefix: prepend each tool's description with its server's instructions (decentralized but can bloat context)
🔗 MCP Standards Check
- [x] Change adheres to current MCP specifications
- [x] No breaking changes to existing MCP-compliant integrations
- [ ] If deviations exist, please describe them below:
🔄 Alternatives Considered
- Leaving the current behavior as-is and asking each agent-application developer to manually summarize backing-server hints into their own system prompt. Works but does not scale as the number of federated servers grows.
- Tool-description prefix only (no
instructionsmerging). Works for tool-related hints but is repetitive and bypasses theinstructionschannel that the spec defines for exactly this purpose.
📓 Additional Context
- MCP spec —
InitializeResult.instructionsdefinition: https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle
Now-deprecated protocol. Will be addressed in dataplane construction.
Need to implement the instructions feature in MCP 2026-07-28. Necessary to analyze appropriate behaviors for different virtual server use cases (one upstream, multiple upstreams, etc.).
Multiphase implementation at virtual server level:
- Propagate instructions when tools are a subset (complete or strict) of a single server.
- Allow user-defined instructions for any server.
- (Future - not this issue) Build instructions based on the composite definition of the virtual server and upstream servers' instructions (LLM needed).
Live tests for phases 1 and 2 need an upstream server that returns instructions. Tracking issue for fast-time-server: https://github.com/IBM/contextforge-examples/issues/57
A use case for phase 2 (user-defined instructions). We expose one virtual server that combines tools from many upstream MCP servers, so phase 1 (propagate when the tools come from a single server) would not apply to us.
Two of our upstream servers carry guidance the model needs in instructions: consent and privacy rules before a write, how to search before calling a tool, and when not to retry. Because the gateway drops them, both servers moved this guidance into their tool descriptions. That makes every tools/list larger, and server-wide rules are duplicated per tool. User-defined instructions per virtual server would let us move this back to one place.