fix: isolate ext-apps from MCP role packages - #4
Draft
tonxxd wants to merge 1 commit into
Draft
Conversation
This was referenced Jul 20, 2026
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.
Summary
This isolates
@modelcontextprotocol/ext-appsfrom the v2 MCP role packages while preserving Andrew's v2 beta.4 migration.PR modelcontextprotocol#710 moved the SDK to the official v2
ClientandServer, but that made both role packages published peers. In addition, the./serverentry imported constants fromapp.ts, creating a server → app → client runtime path. A server-only consumer such asmcp-use/servertherefore installed and could bundle the client package.The Apps iframe channel now uses an ext-apps-owned, protocol-neutral JSON-RPC lifecycle built from public
@modelcontextprotocol/coreschemas. It keepsui/initialize/ui/notifications/initializedas the only Apps initialization sequence and does not add a standard MCP client/server handshake.Dependency graph
Before:
After:
Implementation
Client/Serverinheritance with a local transport, request correlation, handler, cancellation, timeout, error, close, and reconnect lifecycle.McpClientLikeandMcpServerLikecontracts; compile tests prove the official v2 beta.4 classes satisfy them../serverhas no edge toapp.ts.Compatibility impact
The supported Apps APIs and wire behavior are preserved.
AppandAppBridgeare no longer nominal subclasses of the official MCPClientandServer; code relying oninstanceofor unrelated inherited role APIs should use the Apps APIs instead. Official v2 clients can still be passed toAppBridge, and official v2McpServerinstances remain accepted by the server registration helpers through structural typing.Verification
npm test: 398 passed, 1 skipped, 0 failednpm run build: passed, including full TypeScript checking and production declarationsnpm run build:all: all examples and the reference host passednpm exec typedoc -- --treatValidationWarningsAsErrors --emit none: passednode scripts/check-dependency-isolation.mjs: passedThe broader integration-server E2E run passed 6 of 7 checks; only the golden screenshot comparison differed by 7% against a 6% threshold on this machine. All functional initialization and interaction checks passed, and no snapshot was updated.
This PR targets Andrew's migration branch and does not modify or merge PR modelcontextprotocol#710 directly.
Summary by cubic
Isolates
@modelcontextprotocol/ext-appsfrom MCP role packages by replacing role inheritance with a local, protocol‑neutral JSON‑RPC layer. Server‑only installs no longer pull the client, and app‑only installs no longer pull the server, while keeping v2 beta.4 compatibility via structural typing.Refactors
Protocollifecycle (request/notification routing, correlation, cancel, timeouts, close/reconnect).AppandAppBridgenow use this layer; only Apps handshake runs (ui/initialize→ui/notifications/initialized).mcp-typeswith structuralMcpClientLike/McpServerLike; official v2 classes satisfy them.McpServerLike; proxied tool/resource/prompt flows via provided client when present.RESOURCE_URI_META_KEYandRESOURCE_MIME_TYPEtosrc/constants; removed./server→app.tsimport edge.Dependencies
@modelcontextprotocol/clientand@modelcontextprotocol/serverfrom published peers; keep@modelcontextprotocol/coreandzod.scripts/check-dependency-isolation.mjs(+npm run test:dependency-isolation) to assert no client/server edges in published JS/d.ts and app‑only/server‑only bundles.tsc --noEmitplustsc -p tsconfig.build.json;build.bun.tscleansdistbefore emit.Written for commit 928dd83. Summary will update on new commits.