Repository navigation
Description
Hello All,
first of all, thank you very much for ToolHive and all the great work of all contributors. We run vMCP v0.58.0 in front of several MCP servers, and we noticed that the instructions text a backend sends in its initialize reply never reaches the client. The initialize reply of vMCP has no instructions key at all. Tool descriptions pass through correctly; only instructions is lost.
Here is a small test to reproduce it:
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("demo", instructions="Start with hello. Never call it twice.",
host="127.0.0.1", port=18765, stateless_http=True)
@mcp.tool()
def hello(name: str) -> str:
"""Say hello to one person."""
return f"hello {name}"
mcp.run(transport="streamable-http")A direct initialize request to http://127.0.0.1:18765/mcp returns "instructions": "Start with hello. Never call it twice.".
With vMCP in front of it (thv vmcp serve --config demo-vmcp.yaml --port 4483, one backend, anonymous incoming auth, unauthenticated outgoing auth), the same initialize request to http://127.0.0.1:4483/mcp returns:
{"jsonrpc":"2.0","id":1,"result":{"capabilities":{"completions":{},"logging":{},"prompts":{"listChanged":true},"resources":{"listChanged":true,"subscribe":true},"tools":{"listChanged":true}},"protocolVersion":"2025-06-18","serverInfo":{"name":"demo-vmcp","version":"dev"}}}If I read the code correctly, initializeClient keeps only Capabilities and ProtocolVersion and never reads result.Instructions (
toolhive/pkg/vmcp/client/client.go
Lines 903 to 924 in c0b163c
| func initializeClient(ctx context.Context, c *client.Client) (*mcp.ServerCapabilities, string, error) { | |
| result, err := c.Initialize(ctx, mcp.InitializeRequest{ | |
| Params: mcp.InitializeParams{ | |
| ProtocolVersion: mcp.LATEST_PROTOCOL_VERSION, | |
| ClientInfo: mcp.Implementation{ | |
| Name: "toolhive-vmcp", | |
| Version: versions.Version, | |
| }, | |
| Capabilities: mcp.ClientCapabilities{ | |
| // Virtual MCP acts as a client to backends | |
| Roots: &struct { | |
| ListChanged bool `json:"listChanged,omitempty"` | |
| }{ | |
| ListChanged: false, | |
| }, | |
| }, | |
| }, | |
| }) | |
| if err != nil { | |
| return nil, "", err | |
| } | |
| return &result.Capabilities, result.ProtocolVersion, nil |
toolhive/pkg/vmcp/server/serve.go
Lines 278 to 288 in c0b163c
| mcpServer := server.NewMCPServer( | |
| serveCfg.Name, | |
| serveCfg.Version, | |
| server.WithToolCapabilities(true), | |
| server.WithResourceCapabilities(true, true), | |
| server.WithPromptCapabilities(true), | |
| server.WithLogging(), | |
| server.WithHooks(hooks), | |
| server.WithCompletionHandler(completionHandler), | |
| server.WithSubscribeHandlers(subscribeHandler, unsubscribeHandler), | |
| ) |
grep -ri instructions pkg/vmcp gives 0 hits, also on main. Please correct me if I missed a configuration option.
Would you consider forwarding them? For example one block per backend, labelled with the backend name, behind an opt-in configuration option, only for the backends the caller is allowed to use, and with a size cap.
I found #5774, but it is about the remote proxy, so I opened a separate issue. I hope that is fine.
I would be happy to work on a PR if you agree with the idea.
Thank you for your time.
Activity
jhrozek commentedon Nov 3, 2026
Hey @Viphava280444 thanks for the issue, I assigned it to you and I'll be happy to review a PR.
Add server instructions options to mcpcompat
Forward backend instructions in vMCP
Viphava280444 commentedon Nov 3, 2026
Hello @jhrozek, thank you very much for the quick reply and for assigning the issue to me.
I have opened the two PRs:
WithInstructions/WithInstructionsFuncoption to the mcpcompat shim, since the initialize reply is built there and vMCP needs a different text per caller.go.modis pinned to the Add server instructions options to mcpcompat toolhive-core#453 commit so that CI can build. Once Add server instructions options to mcpcompat toolhive-core#453 is merged and released I will drop the pin and mark it ready.They are meant to be read together. If you would prefer a different split or any change, please tell me, I am happy to adjust.
Thank you for your time.