mcp: Avoid stopping servers for equivalent URI definitions - #333443
Merged
Connor Peet (connor4312) merged 1 commit intoAug 31, 2026
Merged
Conversation
Author
|
@microsoft-github-policy-service agree company="Microsoft" |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes MCP server restarts caused by URI lazy-cache differences during definition equality checks.
Changes:
- Adds URI-aware structural comparison for relevant definition fields.
- Adds equality and server lifecycle regression tests.
- Preserves detection of genuine definition changes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
mcpTypes.ts |
Adds URI-aware definition equality. |
mcpTypes.test.ts |
Covers URI cache and actual-value differences. |
mcpService.test.ts |
Covers server stop behavior after republishing definitions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Compare URI values semantically when evaluating MCP server definitions so lazy URI caches do not stop live servers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 02df8817-61e4-4a9f-8b74-f30a434897b0
Girish Konda (kondv)
force-pushed
the
dev/kondv/mcp-uri-definition-equality
branch
from
August 31, 2026 00:05
ddf3641 to
94c6cec
Compare
Connor Peet (connor4312)
approved these changes
Aug 31, 2026
Connor Peet (connor4312)
enabled auto-merge
August 31, 2026 15:21
roblourens
approved these changes
Aug 31, 2026
Anthony Kim (anthonykim1)
approved these changes
Aug 31, 2026
Girish Konda (kondv)
deleted the
dev/kondv/mcp-uri-definition-equality
branch
September 1, 2026 00:21
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.
Fixes #327970
Problem
McpServerDefinition.equalsuses generic structural equality for URI-bearing fields. AURIstores enumerable lazy caches such as_formattedand_fsPath, so equivalent definitions can compare unequal when only one URI instance has populated a cache.McpService.updateCollectedServers()then treats the equivalent definition as changed and stops the live server.Change
Compare nested
URIvalues by normalized resource identity while preserving the existing structural comparison behavior for arrays, objects, primitives, inherited enumerable properties, and missing versus explicitundefinedvalues.The change is scoped to the
launch,presentation, andvariableReplacementcomparisons inMcpServerDefinition.equals. Serialization, revival, hashing, and server lifecycle behavior are unchanged.This shares the URI-cache diagnosis from #329857, but is intentionally narrower. #329857 also changes serialization, revival, hashing, and malformed or cyclic value handling; this PR changes only the in-memory equality used by the reproduced stop path and adds service-level coverage for that path.
Validation
mcpTypes(20 passing),mcpService(3 passing)mcpTypes(19 passing),mcpService(2 passing)npm run typecheck-clientstopped because the definition changed.