Repository navigation
Description
Summary
The published type declarations use extensionless relative import specifiers (e.g. import { ProtocolWithEvents } from "./events"; in dist/src/app-bridge.d.ts). Under TypeScript's Node16/NodeNext module resolution, relative specifiers must carry an explicit extension, so these imports do not resolve. As a result, any type that transitively depends on one loses its members. Most visibly, the recommended bridge.addEventListener("sandboxready", …) API (which AppBridge/App inherit from ProtocolWithEvents via ./events) is invisible to consumers, producing TS2339.
This is types-only — runtime JavaScript is unaffected (the .js bundles are produced by Bun.build, which inlines relative modules, so no extensionless relative import survives at runtime).
Environment
@modelcontextprotocol/ext-apps1.7.4 (currentlatest); the same specifiers are present onmain.- TypeScript with
"module"/"moduleResolution"=NodeNext(orNode16).
Reproduction
tsconfig.json:
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noEmit": true,
"skipLibCheck": true
},
"include": ["index.ts"]
}index.ts:
import { AppBridge } from "@modelcontextprotocol/ext-apps/app-bridge";
declare const bridge: AppBridge;
bridge.addEventListener("sandboxready", () => {}); // recommended API
bridge.onsandboxready = () => {}; // declared directly on AppBridgeRun tsc --noEmit.
Actual
index.ts:6:8 - error TS2339: Property 'addEventListener' does not exist on type 'AppBridge'.
onsandboxready (declared directly on AppBridge) compiles fine — only members inherited through the unresolved ./events import disappear. skipLibCheck suppresses the error inside the .d.ts itself, but not the TS2339 it causes in consumer code.
Expected
addEventListener / removeEventListener and the other AppBridgeEventMap events resolve for NodeNext/Node16 consumers, matching the documentation (the onsandboxready / onsizechange / … setters are @deprecated in favor of addEventListener(...)).
Root cause
tsconfig.json uses "moduleResolution": "bundler", which permits extensionless relative specifiers, and the src files write relative imports without extensions (e.g. src/app-bridge.ts → import { ProtocolWithEvents } from "./events";). tsc (emitDeclarationOnly) copies specifiers verbatim into the emitted .d.ts, so the extensionless form ships. Because the project's own type-check runs under bundler resolution, the failure is never observed in-repo; it only surfaces for downstream Node16/NodeNext consumers. External SDK imports already use explicit .js (e.g. @modelcontextprotocol/sdk/shared/protocol.js) — only the relative imports are inconsistent. Affected export subpaths include ., ./app-bridge, ./react, and ./server.
Suggested fix
Add explicit .js extensions to relative imports across src (e.g. from "./events.js", from "../app.js"). This is standard ESM/NodeNext hygiene, matches the existing SDK-import style, and is compatible with both the bundler-mode type-check and the Bun.build bundling (both resolve ./x.js → ./x.ts). Happy to open a PR.
Activity
docs(mcp-server): README — a TypeScript-build section for NodeNext co…
gustavoignis commentedon Sep 5, 2026
Receipt from a downstream consumer (ggui —
@ggui-ai/protocolre-exportsMcpUiDisplayMode,McpUiHostContext,McpUiHostCapabilitiesfrom this package):@modelcontextprotocol/ext-apps1.7.5, TypeScript 5.9.3, fresh"type": "module"project,module/moduleResolution: NodeNext, consuming the published@ggui-ai/protocol0.15.0 (npm, 2026-09-05) — whose own declarations carry explicit.jsextensions and resolve under NodeNext (0.14.0's did not; that was our defect, fixed in 0.15.0, and is not what this report is about).tsc→ 13 errors;tsc --skipLibCheck→ 0. Same 13 / 0 under TypeScript 7.0.2.dist/src/app.d.ts:TS2834 Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'atapp.d.ts(3,56),(4,36),(6,496)… plus oneTS2339 Property 'setRequestHandler' does not exist on type 'App'that follows from the unresolved imports.TS2305 Module '"@modelcontextprotocol/ext-apps"' has no exported member 'McpUiDisplayMode'andTS2460 'McpUiHostContext' / 'McpUiHostCapabilities' declares … locally, but it is exported as 'ProtocolWithEvents'— the names live inspec.types.d.ts(clean), but the only public routes to them (.→app.d.ts,./app-bridge) carry the extensionless imports, so under NodeNext they never arrive.Repro:
mkdir p && cd p && npm init -y && npm pkg set type=module && npm i @modelcontextprotocol/[email protected] typescript@5 && printf 'import { McpUiDisplayMode } from "@modelcontextprotocol/ext-apps"; export const x: McpUiDisplayMode | undefined = undefined;\n' > a.ts && npx tsc --module NodeNext --moduleResolution NodeNext --noEmit a.ts— Gustavo Ignis (agent), directed by @wanseob
Finish .js import extensions and drop the zod 3 fallback test
fix: add explicit .js extensions to relative imports so declarations …
Finish .js import extensions and drop the zod 3 fallback test
Add explicit .js extensions to relative imports for NodeNext consumers (