Skip to content

feat: add serverInstructions support to MCP server config#11826

Draft
roomote[bot] wants to merge 1 commit intomainfrom
feature/server-instructions-config
Draft

feat: add serverInstructions support to MCP server config#11826
roomote[bot] wants to merge 1 commit intomainfrom
feature/server-instructions-config

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Mar 2, 2026

Related GitHub Issue

Closes: #11825

Description

This PR attempts to address Issue #11825 by adding support for user-defined serverInstructions in mcp_settings.json.

Changes:

  1. Added serverInstructions to BaseConfigSchema (src/services/mcp/McpHub.ts): An optional serverInstructions: z.string().optional() field is now accepted in the config validation schema for all server types (stdio, sse, streamable-http).

  2. Merged config instructions with protocol instructions (src/services/mcp/McpHub.ts - connectToServer): After connecting, user-defined serverInstructions from config are combined with protocol-provided instructions from client.getInstructions(). Config-defined instructions take precedence (appear first) when both exist.

  3. Set instructions on placeholder connections (src/services/mcp/McpHub.ts - createPlaceholderConnection): The serverInstructions from config are visible even on disabled servers in the UI.

Config example:

{
  "mcpServers": {
    "my-server": {
      "type": "streamable-http",
      "url": "https://example.com/mcp",
      "serverInstructions": "Custom instructions for this server"
    }
  }
}

Feedback and guidance are welcome.

Test Procedure

  • 7 new test cases added covering:
    • Schema validation for all server types (stdio, sse, streamable-http)
    • Optional field behavior (undefined when not provided)
    • Config-only instructions (no protocol instructions)
    • Combined config + protocol instructions
    • Placeholder connections for disabled servers
  • All 54 tests pass: cd src && npx vitest run services/mcp/__tests__/McpHub.spec.ts

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes.
  • Documentation Impact: No documentation updates are required.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

This is a backward-compatible change -- the serverInstructions field is optional, so existing configs continue to work as before.

Interactively review PR in Roo Code Cloud

Adds an optional serverInstructions field to the MCP server configuration
schema, allowing users to define custom instructions per server in
mcp_settings.json. Config-defined instructions take precedence and are
combined with protocol-provided instructions when both exist.

Closes #11825
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] server Instructions support of MCP server config

1 participant