feat: add serverInstructions support to MCP server config#11826
Draft
roomote[bot] wants to merge 1 commit intomainfrom
Draft
feat: add serverInstructions support to MCP server config#11826roomote[bot] wants to merge 1 commit intomainfrom
roomote[bot] wants to merge 1 commit intomainfrom
Conversation
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
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #11825
Description
This PR attempts to address Issue #11825 by adding support for user-defined
serverInstructionsinmcp_settings.json.Changes:
Added
serverInstructionstoBaseConfigSchema(src/services/mcp/McpHub.ts): An optionalserverInstructions: z.string().optional()field is now accepted in the config validation schema for all server types (stdio, sse, streamable-http).Merged config instructions with protocol instructions (
src/services/mcp/McpHub.ts-connectToServer): After connecting, user-definedserverInstructionsfrom config are combined with protocol-provided instructions fromclient.getInstructions(). Config-defined instructions take precedence (appear first) when both exist.Set instructions on placeholder connections (
src/services/mcp/McpHub.ts-createPlaceholderConnection): TheserverInstructionsfrom 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
cd src && npx vitest run services/mcp/__tests__/McpHub.spec.tsPre-Submission Checklist
Documentation Updates
Additional Notes
This is a backward-compatible change -- the
serverInstructionsfield is optional, so existing configs continue to work as before.Interactively review PR in Roo Code Cloud