Skip to content

Let operators set the instructions an MCP endpoint returns #7279

Done

Description

@aron-muon

Problem

An MCP server can return instructions in its initialize result, and in its server/discover result under the 2026-07-28 revision. Clients such as Claude Code, Claude Desktop and LibreChat add those instructions to the model's context while the server is connected.

An operator who runs a server through ToolHive often needs to add guidance of their own: a policy the model should follow when it uses the server, or usage notes for a third-party server they cannot change. ToolHive has no way to do this. MCPToolConfig rewrites tool names and descriptions only, and mutating webhooks transform requests, not responses. Today the operator has to rebuild or patch the server image.

Proposal

Add an optional instructions field with the same shape to MCPServer, MCPRemoteProxy and VirtualMCPServer:

spec:
  instructions:
    mode: append   # replace | append | prepend; default append
    value: |
      Text the model should see while this server is connected.
  • replace: clients receive value.
  • append: clients receive the server's instructions, a blank line, then value.
  • prepend: clients receive value, a blank line, then the server's instructions.

When the server returns no instructions, every mode returns value.

The proxy runner applies the field as a middleware, the way it applies tool filters and overrides. The middleware sets the instructions of successful initialize and server/discover results and passes every other response through unchanged. It reads JSON and event-stream bodies, and covers the legacy SSE transport, where the result arrives on the stream a GET opened. vMCP applies the same middleware to its own endpoint, on top of whatever instructions it produces. thv run gets --instructions-file and --instructions-mode, next to --tools-override.

I plan to submit a PR for this.

Activity

  1. added
    needs-triage
    on Nov 24, 2026
  2. removed
    needs-triage
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions