From ee732d64b66440dcb455c6a179ef99eea9824358 Mon Sep 17 00:00:00 2001 From: Matt <77928207+mattzcarey@users.noreply.github.com> Date: Thu, 25 Jun 2026 12:49:17 +0200 Subject: [PATCH] chore: switch to module ESNext + moduleResolution bundler (#2095) --- CLAUDE.md | 2 +- common/eslint-config/eslint.config.mjs | 2 +- common/tsconfig/tsconfig.json | 4 +- docs/client-quickstart.md | 16 +- docs/server-quickstart.md | 7 +- examples/client-quickstart/package.json | 1 + examples/client-quickstart/src/index.ts | 8 +- examples/client-quickstart/tsconfig.json | 12 +- examples/client/package.json | 5 +- examples/client/src/elicitationUrlExample.ts | 2 +- examples/client/src/simpleOAuthClient.ts | 2 +- examples/server-quickstart/package.json | 1 + examples/server-quickstart/tsconfig.json | 11 +- examples/server/package.json | 5 +- examples/server/src/elicitationUrlExample.ts | 2 +- examples/server/src/simpleStreamableHttp.ts | 2 +- examples/server/src/ssePollingExample.ts | 2 +- examples/shared/package.json | 6 +- examples/shared/src/authServer.ts | 4 +- examples/shared/src/index.ts | 8 +- .../test/demoInMemoryOAuthProvider.test.ts | 4 +- packages/client/package.json | 5 +- packages/client/src/client/auth.examples.ts | 4 +- .../src/client/authExtensions.examples.ts | 4 +- packages/client/src/client/authExtensions.ts | 2 +- packages/client/src/client/client.examples.ts | 8 +- packages/client/src/client/crossAppAccess.ts | 4 +- .../client/src/client/middleware.examples.ts | 4 +- packages/client/src/client/middleware.ts | 4 +- packages/client/src/client/sse.ts | 4 +- .../src/client/streamableHttp.examples.ts | 2 +- packages/client/src/client/streamableHttp.ts | 4 +- packages/client/src/index.ts | 32 ++-- packages/client/src/stdio.ts | 4 +- packages/client/test/client/auth.test.ts | 6 +- .../client/test/client/authExtensions.test.ts | 4 +- .../client/test/client/crossAppAccess.test.ts | 2 +- .../client/test/client/crossSpawn.test.ts | 2 +- .../jsonSchemaValidatorOverride.test.ts | 4 +- .../client/test/client/middleware.test.ts | 10 +- packages/client/test/client/sse.test.ts | 6 +- packages/client/test/client/stdio.test.ts | 4 +- .../client/test/client/streamableHttp.test.ts | 14 +- .../client/test/client/tokenProvider.test.ts | 6 +- packages/codemod/src/bin/batchTest.ts | 6 +- packages/codemod/src/cli.ts | 8 +- packages/codemod/src/index.ts | 8 +- packages/codemod/src/migrations/index.ts | 4 +- .../codemod/src/migrations/v1-to-v2/index.ts | 4 +- .../v1-to-v2/transforms/contextTypes.ts | 10 +- .../v1-to-v2/transforms/expressMiddleware.ts | 6 +- .../transforms/handlerRegistration.ts | 8 +- .../v1-to-v2/transforms/importPaths.ts | 14 +- .../migrations/v1-to-v2/transforms/index.ts | 22 +-- .../v1-to-v2/transforms/mcpServerApi.ts | 6 +- .../v1-to-v2/transforms/mockPaths.ts | 12 +- .../v1-to-v2/transforms/removedApis.ts | 8 +- .../v1-to-v2/transforms/schemaParamRemoval.ts | 4 +- .../v1-to-v2/transforms/specSchemaAccess.ts | 10 +- .../v1-to-v2/transforms/symbolRenames.ts | 12 +- packages/codemod/src/runner.ts | 8 +- packages/codemod/src/utils/diagnostics.ts | 4 +- .../codemod/src/utils/packageJsonUpdater.ts | 6 +- packages/codemod/src/utils/projectAnalyzer.ts | 4 +- packages/codemod/test/cli.test.ts | 6 +- .../codemod/test/commentInsertion.test.ts | 6 +- packages/codemod/test/integration.test.ts | 8 +- .../codemod/test/packageJsonUpdater.test.ts | 2 +- packages/codemod/test/projectAnalyzer.test.ts | 2 +- .../v1-to-v2/transforms/contextTypes.test.ts | 4 +- .../transforms/expressMiddleware.test.ts | 4 +- .../transforms/handlerRegistration.test.ts | 4 +- .../v1-to-v2/transforms/importPaths.test.ts | 4 +- .../v1-to-v2/transforms/mcpServerApi.test.ts | 4 +- .../v1-to-v2/transforms/mockPaths.test.ts | 4 +- .../v1-to-v2/transforms/removedApis.test.ts | 6 +- .../transforms/schemaParamRemoval.test.ts | 4 +- .../transforms/specSchemaAccess.test.ts | 4 +- .../v1-to-v2/transforms/symbolRenames.test.ts | 4 +- packages/core/package.json | 5 +- packages/core/src/auth/errors.ts | 2 +- .../core/src/errors/sdkErrors.examples.ts | 2 +- packages/core/src/exports/public/index.ts | 50 +++--- packages/core/src/exports/types/index.ts | 2 +- packages/core/src/index.ts | 38 ++--- packages/core/src/shared/metadataUtils.ts | 2 +- packages/core/src/shared/protocol.examples.ts | 2 +- packages/core/src/shared/protocol.ts | 12 +- packages/core/src/shared/stdio.ts | 4 +- packages/core/src/shared/transport.ts | 2 +- packages/core/src/types/errors.ts | 4 +- packages/core/src/types/guards.ts | 4 +- packages/core/src/types/index.ts | 14 +- packages/core/src/types/schemas.ts | 4 +- .../core/src/types/specTypeSchema.examples.ts | 2 +- packages/core/src/types/specTypeSchema.ts | 6 +- packages/core/src/types/types.ts | 4 +- packages/core/src/util/inMemory.ts | 6 +- packages/core/src/util/zodCompat.ts | 4 +- .../src/validators/ajvProvider.examples.ts | 2 +- packages/core/src/validators/ajvProvider.ts | 2 +- .../validators/cfWorkerProvider.examples.ts | 2 +- .../core/src/validators/cfWorkerProvider.ts | 2 +- .../src/validators/fromJsonSchema.examples.ts | 4 +- .../core/src/validators/fromJsonSchema.ts | 4 +- .../core/src/validators/types.examples.ts | 2 +- .../core/test/errors/sdkHttpError.test.ts | 2 +- packages/core/test/inMemory.test.ts | 4 +- packages/core/test/shared/auth.test.ts | 2 +- packages/core/test/shared/authUtils.test.ts | 2 +- .../core/test/shared/customMethods.test.ts | 10 +- packages/core/test/shared/protocol.test.ts | 12 +- .../shared/protocolTransportHandling.test.ts | 8 +- packages/core/test/shared/stdio.test.ts | 4 +- .../test/shared/toolNameValidation.test.ts | 2 +- .../core/test/shared/traceContextMeta.test.ts | 8 +- packages/core/test/shared/transport.test.ts | 2 +- packages/core/test/shared/uriTemplate.test.ts | 2 +- packages/core/test/shared/wrapHandler.test.ts | 4 +- .../core/test/spec.types.2025-11-25.test.ts | 4 +- .../core/test/spec.types.2026-07-28.test.ts | 8 +- packages/core/test/types.capabilities.test.ts | 2 +- packages/core/test/types.test.ts | 2 +- packages/core/test/types/errors.test.ts | 4 +- packages/core/test/types/guards.test.ts | 4 +- .../core/test/types/specTypeSchema.test.ts | 10 +- .../core/test/util/standardSchema.test.ts | 2 +- .../util/standardSchema.zodFallback.test.ts | 2 +- packages/core/test/util/zodCompat.test.ts | 4 +- .../core/test/validators/validators.test.ts | 14 +- .../middleware/express/src/auth/bearerAuth.ts | 2 +- .../express/src/express.examples.ts | 2 +- packages/middleware/express/src/express.ts | 2 +- packages/middleware/express/src/index.ts | 14 +- .../hostHeaderValidation.examples.ts | 2 +- .../express/test/auth/resourceServer.test.ts | 6 +- .../middleware/express/test/express.test.ts | 4 +- .../fastify/src/fastify.examples.ts | 2 +- packages/middleware/fastify/src/fastify.ts | 2 +- packages/middleware/fastify/src/index.ts | 4 +- .../hostHeaderValidation.examples.ts | 2 +- .../middleware/fastify/test/fastify.test.ts | 4 +- packages/middleware/hono/src/hono.ts | 2 +- packages/middleware/hono/src/index.ts | 4 +- packages/middleware/hono/test/hono.test.ts | 4 +- packages/middleware/node/package.json | 5 +- packages/middleware/node/src/index.ts | 2 +- .../node/src/streamableHttp.examples.ts | 2 +- .../node/test/streamableHttp.test.ts | 2 +- .../src/auth/handlers/authorize.ts | 6 +- .../src/auth/handlers/metadata.ts | 2 +- .../src/auth/handlers/register.ts | 6 +- .../server-legacy/src/auth/handlers/revoke.ts | 8 +- .../server-legacy/src/auth/handlers/token.ts | 8 +- packages/server-legacy/src/auth/index.ts | 44 ++--- .../src/auth/middleware/allowedMethods.ts | 2 +- .../src/auth/middleware/bearerAuth.ts | 6 +- .../src/auth/middleware/clientAuth.ts | 4 +- packages/server-legacy/src/auth/provider.ts | 4 +- .../src/auth/providers/proxyProvider.ts | 8 +- packages/server-legacy/src/auth/router.ts | 20 +-- packages/server-legacy/src/index.ts | 4 +- packages/server-legacy/src/sse/index.ts | 2 +- .../test/auth/handlers/authorize.test.ts | 10 +- .../test/auth/handlers/metadata.test.ts | 2 +- .../test/auth/handlers/register.test.ts | 4 +- .../test/auth/handlers/revoke.test.ts | 10 +- .../test/auth/handlers/token.test.ts | 12 +- .../auth/middleware/allowedMethods.test.ts | 2 +- .../test/auth/middleware/bearerAuth.test.ts | 10 +- .../test/auth/middleware/clientAuth.test.ts | 4 +- .../test/auth/providers/proxyProvider.test.ts | 10 +- .../server-legacy/test/auth/router.test.ts | 10 +- packages/server-legacy/test/sse/sse.test.ts | 2 +- packages/server/package.json | 5 +- packages/server/src/index.ts | 22 +-- .../server/src/server/completable.examples.ts | 4 +- packages/server/src/server/mcp.examples.ts | 4 +- packages/server/src/server/mcp.ts | 6 +- .../hostHeaderValidation.examples.ts | 2 +- packages/server/src/server/stdio.examples.ts | 4 +- .../src/server/streamableHttp.examples.ts | 4 +- packages/server/src/stdio.ts | 2 +- .../server/test/server/completable.test.ts | 2 +- .../jsonSchemaValidatorOverride.test.ts | 4 +- .../server/test/server/mcp.compat.test.ts | 6 +- packages/server/test/server/mcp.icons.test.ts | 2 +- packages/server/test/server/server.test.ts | 2 +- packages/server/test/server/stdio.test.ts | 2 +- .../server/test/server/streamableHttp.test.ts | 6 +- .../streamableHttpFutureVersionGates.test.ts | 6 +- ...mableHttpUnsupportedVersionLiteral.test.ts | 4 +- pnpm-lock.yaml | 21 +-- scripts/cli.ts | 155 ------------------ test/conformance/package.json | 3 - test/conformance/src/everythingClient.ts | 6 +- .../conformance/src/helpers/withOAuthRetry.ts | 2 +- test/e2e/coverage.test.ts | 2 +- test/e2e/helpers/index.ts | 8 +- test/e2e/helpers/verifies.ts | 6 +- test/e2e/helpers/wire-sniffer.test.ts | 2 +- test/e2e/requirements.ts | 2 +- test/e2e/scenarios/client-auth.test.ts | 6 +- test/e2e/scenarios/completion.test.ts | 6 +- test/e2e/scenarios/custom-methods.test.ts | 6 +- test/e2e/scenarios/dynamic.test.ts | 6 +- test/e2e/scenarios/elicitation.test.ts | 6 +- test/e2e/scenarios/errors.test.ts | 6 +- test/e2e/scenarios/flow.test.ts | 8 +- test/e2e/scenarios/handler-context.test.ts | 6 +- test/e2e/scenarios/hosting-auth.test.ts | 4 +- test/e2e/scenarios/hosting-express.test.ts | 6 +- test/e2e/scenarios/hosting-fastify.test.ts | 4 +- test/e2e/scenarios/hosting-hono.test.ts | 4 +- test/e2e/scenarios/hosting-http.test.ts | 8 +- test/e2e/scenarios/hosting-resume.test.ts | 6 +- test/e2e/scenarios/hosting-session.test.ts | 8 +- test/e2e/scenarios/lifecycle.test.ts | 6 +- test/e2e/scenarios/logging.test.ts | 6 +- test/e2e/scenarios/pagination.test.ts | 6 +- test/e2e/scenarios/prompts.test.ts | 6 +- test/e2e/scenarios/protocol.test.ts | 6 +- test/e2e/scenarios/resources.test.ts | 6 +- test/e2e/scenarios/roots.test.ts | 6 +- test/e2e/scenarios/sampling.test.ts | 6 +- test/e2e/scenarios/standard-schema.test.ts | 6 +- test/e2e/scenarios/stdio.test.ts | 4 +- test/e2e/scenarios/tools.test.ts | 6 +- test/e2e/scenarios/transport-http.test.ts | 8 +- test/e2e/scenarios/transport-raw.test.ts | 6 +- test/e2e/scenarios/transport-sse.test.ts | 4 +- test/e2e/scenarios/validation.test.ts | 6 +- test/helpers/package.json | 5 +- test/helpers/src/index.ts | 4 +- test/integration/package.json | 3 - 235 files changed, 668 insertions(+), 863 deletions(-) delete mode 100644 scripts/cli.ts diff --git a/CLAUDE.md b/CLAUDE.md index d5a188676a..8876b0bfb1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -36,7 +36,7 @@ Include what changed, why, and how to migrate. Search for related sections and g - **TypeScript**: Strict type checking, ES modules, explicit return types - **Naming**: PascalCase for classes/types, camelCase for functions/variables - **Files**: Lowercase with hyphens, test files with `.test.ts` suffix -- **Imports**: ES module style, include `.js` extension, group imports logically +- **Imports**: ES module style, no `.js` extension on relative imports (project uses `moduleResolution: bundler`), group imports logically - **Formatting**: 2-space indentation, semicolons required, single quotes preferred - **Testing**: Place tests under each package's `test/` directory (vitest only includes `test/**/*.test.ts`), use descriptive test names - **Comments**: JSDoc for public APIs, inline comments for complex logic diff --git a/common/eslint-config/eslint.config.mjs b/common/eslint-config/eslint.config.mjs index a32b4208cc..fb0b5d3db6 100644 --- a/common/eslint-config/eslint.config.mjs +++ b/common/eslint-config/eslint.config.mjs @@ -36,7 +36,7 @@ export default defineConfig( settings: { 'import/resolver': { typescript: { - // Let the TS resolver handle NodeNext-style imports like "./foo.js" + // Resolve extensionless relative imports (moduleResolution: bundler) to their TS sources extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts'], // Use the tsconfig in each package root (when running ESLint from that package) project: 'tsconfig.json' diff --git a/common/tsconfig/tsconfig.json b/common/tsconfig/tsconfig.json index 6db7d705bf..c6fff64f48 100644 --- a/common/tsconfig/tsconfig.json +++ b/common/tsconfig/tsconfig.json @@ -2,8 +2,8 @@ "compilerOptions": { "target": "esnext", "lib": ["esnext"], - "module": "NodeNext", - "moduleResolution": "NodeNext", + "module": "ESNext", + "moduleResolution": "bundler", "noFallthroughCasesInSwitch": true, "noUncheckedIndexedAccess": true, "noImplicitOverride": true, diff --git a/docs/client-quickstart.md b/docs/client-quickstart.md index 71b8a9e12a..30537f0ae2 100644 --- a/docs/client-quickstart.md +++ b/docs/client-quickstart.md @@ -88,10 +88,10 @@ Create a `tsconfig.json` in the root of your project: ```json { "compilerOptions": { - "target": "ES2023", - "lib": ["ES2023"], - "module": "Node16", - "moduleResolution": "Node16", + "target": "ESNext", + "lib": ["ESNext"], + "module": "ESNext", + "moduleResolution": "bundler", "outDir": "./build", "rootDir": "./src", "strict": true, @@ -236,7 +236,8 @@ Now let's add the core functionality for processing queries and handling tool ca messages, }); - finalText.push(followUp.content[0].type === 'text' ? followUp.content[0].text : ''); + const firstBlock = followUp.content[0]; + finalText.push(firstBlock?.type === 'text' ? firstBlock.text : ''); } } @@ -284,13 +285,14 @@ Finally, we'll add the main execution logic: ```ts source="../examples/client-quickstart/src/index.ts#main" async function main() { - if (process.argv.length < 3) { + const serverScriptPath = process.argv[2]; + if (!serverScriptPath) { console.log('Usage: node build/index.js '); return; } const mcpClient = new MCPClient(); try { - await mcpClient.connectToServer(process.argv[2]); + await mcpClient.connectToServer(serverScriptPath); // Check if we have a valid API key to continue const apiKey = process.env.ANTHROPIC_API_KEY; diff --git a/docs/server-quickstart.md b/docs/server-quickstart.md index b8d19e7e1c..167fe560db 100644 --- a/docs/server-quickstart.md +++ b/docs/server-quickstart.md @@ -103,9 +103,10 @@ Create a `tsconfig.json` in the root of your project: ```json { "compilerOptions": { - "target": "ES2022", - "module": "Node16", - "moduleResolution": "Node16", + "target": "ESNext", + "lib": ["ESNext"], + "module": "ESNext", + "moduleResolution": "bundler", "outDir": "./build", "rootDir": "./src", "strict": true, diff --git a/examples/client-quickstart/package.json b/examples/client-quickstart/package.json index 98919df995..646890492e 100644 --- a/examples/client-quickstart/package.json +++ b/examples/client-quickstart/package.json @@ -15,6 +15,7 @@ "@modelcontextprotocol/client": "workspace:^" }, "devDependencies": { + "@modelcontextprotocol/tsconfig": "workspace:^", "@types/node": "^24.10.1", "typescript": "catalog:devTools" } diff --git a/examples/client-quickstart/src/index.ts b/examples/client-quickstart/src/index.ts index f677834c03..6764fe61ff 100644 --- a/examples/client-quickstart/src/index.ts +++ b/examples/client-quickstart/src/index.ts @@ -116,7 +116,8 @@ class MCPClient { messages, }); - finalText.push(followUp.content[0].type === 'text' ? followUp.content[0].text : ''); + const firstBlock = followUp.content[0]; + finalText.push(firstBlock?.type === 'text' ? firstBlock.text : ''); } } @@ -156,13 +157,14 @@ class MCPClient { //#region main async function main() { - if (process.argv.length < 3) { + const serverScriptPath = process.argv[2]; + if (!serverScriptPath) { console.log('Usage: node build/index.js '); return; } const mcpClient = new MCPClient(); try { - await mcpClient.connectToServer(process.argv[2]); + await mcpClient.connectToServer(serverScriptPath); // Check if we have a valid API key to continue const apiKey = process.env.ANTHROPIC_API_KEY; diff --git a/examples/client-quickstart/tsconfig.json b/examples/client-quickstart/tsconfig.json index e7b40b59ba..a2bf4fd724 100644 --- a/examples/client-quickstart/tsconfig.json +++ b/examples/client-quickstart/tsconfig.json @@ -1,15 +1,11 @@ { + "extends": "@modelcontextprotocol/tsconfig", "compilerOptions": { - "target": "ES2023", - "lib": ["ES2023"], - "module": "Node16", - "moduleResolution": "Node16", "outDir": "./build", "rootDir": "./src", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, + "declaration": false, + "declarationMap": false, + "types": ["node"], "paths": { "@modelcontextprotocol/client": ["./node_modules/@modelcontextprotocol/client/src/index.ts"], "@modelcontextprotocol/client/stdio": ["./node_modules/@modelcontextprotocol/client/src/stdio.ts"], diff --git a/examples/client/package.json b/examples/client/package.json index 57b329fd2d..68dfc2718b 100644 --- a/examples/client/package.json +++ b/examples/client/package.json @@ -26,10 +26,7 @@ "prepack": "pnpm run build:esm && pnpm run build:cjs", "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", - "check": "pnpm run typecheck && pnpm run lint", - "start": "pnpm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "check": "pnpm run typecheck && pnpm run lint" }, "dependencies": { "@modelcontextprotocol/client": "workspace:^", diff --git a/examples/client/src/elicitationUrlExample.ts b/examples/client/src/elicitationUrlExample.ts index 7c5cce2ee2..f1b6db3b52 100644 --- a/examples/client/src/elicitationUrlExample.ts +++ b/examples/client/src/elicitationUrlExample.ts @@ -27,7 +27,7 @@ import { } from '@modelcontextprotocol/client'; import open from 'open'; -import { InMemoryOAuthClientProvider } from './simpleOAuthClientProvider.js'; +import { InMemoryOAuthClientProvider } from './simpleOAuthClientProvider'; // Set up OAuth (required for this example) const OAUTH_CALLBACK_PORT = 8090; // Use different port than auth server (3001) diff --git a/examples/client/src/simpleOAuthClient.ts b/examples/client/src/simpleOAuthClient.ts index 1187f8ec1a..a0a24b1452 100644 --- a/examples/client/src/simpleOAuthClient.ts +++ b/examples/client/src/simpleOAuthClient.ts @@ -8,7 +8,7 @@ import type { ListToolsRequest, OAuthClientMetadata } from '@modelcontextprotoco import { Client, StreamableHTTPClientTransport, UnauthorizedError } from '@modelcontextprotocol/client'; import open from 'open'; -import { InMemoryOAuthClientProvider } from './simpleOAuthClientProvider.js'; +import { InMemoryOAuthClientProvider } from './simpleOAuthClientProvider'; // Configuration const DEFAULT_SERVER_URL = 'http://localhost:3000/mcp'; diff --git a/examples/server-quickstart/package.json b/examples/server-quickstart/package.json index 133af7a1d6..e06a9832f9 100644 --- a/examples/server-quickstart/package.json +++ b/examples/server-quickstart/package.json @@ -15,6 +15,7 @@ "zod": "catalog:runtimeShared" }, "devDependencies": { + "@modelcontextprotocol/tsconfig": "workspace:^", "@types/node": "^24.10.1", "typescript": "catalog:devTools" } diff --git a/examples/server-quickstart/tsconfig.json b/examples/server-quickstart/tsconfig.json index c760b5e4c0..bd80e544cd 100644 --- a/examples/server-quickstart/tsconfig.json +++ b/examples/server-quickstart/tsconfig.json @@ -1,14 +1,11 @@ { + "extends": "@modelcontextprotocol/tsconfig", "compilerOptions": { - "target": "ES2022", - "module": "Node16", - "moduleResolution": "Node16", "outDir": "./build", "rootDir": "./src", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, + "declaration": false, + "declarationMap": false, + "types": ["node"], "paths": { "@modelcontextprotocol/server": ["./node_modules/@modelcontextprotocol/server/src/index.ts"], "@modelcontextprotocol/server/stdio": ["./node_modules/@modelcontextprotocol/server/src/stdio.ts"], diff --git a/examples/server/package.json b/examples/server/package.json index fcff95d9a9..8ffb48ce65 100644 --- a/examples/server/package.json +++ b/examples/server/package.json @@ -26,10 +26,7 @@ "prepack": "pnpm run build:esm && pnpm run build:cjs", "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", - "check": "pnpm run typecheck && pnpm run lint", - "start": "pnpm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "check": "pnpm run typecheck && pnpm run lint" }, "dependencies": { "@hono/node-server": "catalog:runtimeServerOnly", diff --git a/examples/server/src/elicitationUrlExample.ts b/examples/server/src/elicitationUrlExample.ts index 93b59152f8..7016d11b9b 100644 --- a/examples/server/src/elicitationUrlExample.ts +++ b/examples/server/src/elicitationUrlExample.ts @@ -19,7 +19,7 @@ import type { Request, Response } from 'express'; import express from 'express'; import * as z from 'zod/v4'; -import { InMemoryEventStore } from './inMemoryEventStore.js'; +import { InMemoryEventStore } from './inMemoryEventStore'; // Create an MCP server with implementation details const getServer = () => { diff --git a/examples/server/src/simpleStreamableHttp.ts b/examples/server/src/simpleStreamableHttp.ts index d034a48d83..f0ab17d821 100644 --- a/examples/server/src/simpleStreamableHttp.ts +++ b/examples/server/src/simpleStreamableHttp.ts @@ -15,7 +15,7 @@ import cors from 'cors'; import type { Request, Response } from 'express'; import * as z from 'zod/v4'; -import { InMemoryEventStore } from './inMemoryEventStore.js'; +import { InMemoryEventStore } from './inMemoryEventStore'; // Check for OAuth flag const useOAuth = process.argv.includes('--oauth'); diff --git a/examples/server/src/ssePollingExample.ts b/examples/server/src/ssePollingExample.ts index 2675a038ed..bb28c092b6 100644 --- a/examples/server/src/ssePollingExample.ts +++ b/examples/server/src/ssePollingExample.ts @@ -21,7 +21,7 @@ import { McpServer } from '@modelcontextprotocol/server'; import cors from 'cors'; import type { Request, Response } from 'express'; -import { InMemoryEventStore } from './inMemoryEventStore.js'; +import { InMemoryEventStore } from './inMemoryEventStore'; // Create a fresh MCP server per client connection to avoid shared state between clients const getServer = () => { diff --git a/examples/shared/package.json b/examples/shared/package.json index 0bab8be920..a55c3dd2e6 100644 --- a/examples/shared/package.json +++ b/examples/shared/package.json @@ -26,10 +26,7 @@ "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", "check": "pnpm run typecheck && pnpm run lint", "test": "vitest run", - "test:watch": "vitest", - "start": "pnpm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "test:watch": "vitest" }, "dependencies": { "@modelcontextprotocol/core": "workspace:^", @@ -54,7 +51,6 @@ "eslint-config-prettier": "catalog:devTools", "eslint-plugin-n": "catalog:devTools", "prettier": "catalog:devTools", - "tsx": "catalog:devTools", "typescript": "catalog:devTools", "typescript-eslint": "catalog:devTools", "vitest": "catalog:devTools" diff --git a/examples/shared/src/authServer.ts b/examples/shared/src/authServer.ts index 995fedc7d9..6ddb2fa7c1 100644 --- a/examples/shared/src/authServer.ts +++ b/examples/shared/src/authServer.ts @@ -18,8 +18,8 @@ import cors from 'cors'; import type { Request, Response as ExpressResponse, Router } from 'express'; import express from 'express'; -import type { DemoAuth } from './auth.js'; -import { createDemoAuth, DEMO_USER_CREDENTIALS } from './auth.js'; +import type { DemoAuth } from './auth'; +import { createDemoAuth, DEMO_USER_CREDENTIALS } from './auth'; export interface SetupAuthServerOptions { authServerUrl: URL; diff --git a/examples/shared/src/index.ts b/examples/shared/src/index.ts index 47c4d67109..dc5dd4a03b 100644 --- a/examples/shared/src/index.ts +++ b/examples/shared/src/index.ts @@ -1,7 +1,7 @@ // Auth configuration -export type { CreateDemoAuthOptions, DemoAuth } from './auth.js'; -export { createDemoAuth } from './auth.js'; +export type { CreateDemoAuthOptions, DemoAuth } from './auth'; +export { createDemoAuth } from './auth'; // Auth server setup + demo token verifier (pass to `requireBearerAuth` from @modelcontextprotocol/express) -export type { SetupAuthServerOptions } from './authServer.js'; -export { createProtectedResourceMetadataRouter, demoTokenVerifier, getAuth, setupAuthServer } from './authServer.js'; +export type { SetupAuthServerOptions } from './authServer'; +export { createProtectedResourceMetadataRouter, demoTokenVerifier, getAuth, setupAuthServer } from './authServer'; diff --git a/examples/shared/test/demoInMemoryOAuthProvider.test.ts b/examples/shared/test/demoInMemoryOAuthProvider.test.ts index bd3131dbad..a7eb35dbfd 100644 --- a/examples/shared/test/demoInMemoryOAuthProvider.test.ts +++ b/examples/shared/test/demoInMemoryOAuthProvider.test.ts @@ -9,8 +9,8 @@ import { describe, expect, it } from 'vitest'; -import type { CreateDemoAuthOptions } from '../src/auth.js'; -import { createDemoAuth } from '../src/auth.js'; +import type { CreateDemoAuthOptions } from '../src/auth'; +import { createDemoAuth } from '../src/auth'; describe('createDemoAuth', () => { const validOptions: CreateDemoAuthOptions = { diff --git a/packages/client/package.json b/packages/client/package.json index 4362c4fe86..c712172139 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -81,9 +81,7 @@ "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", "check": "pnpm run typecheck && pnpm run lint", "test": "vitest run", - "test:watch": "vitest", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "test:watch": "vitest" }, "dependencies": { "cross-spawn": "catalog:runtimeClientOnly", @@ -111,7 +109,6 @@ "eslint-config-prettier": "catalog:devTools", "eslint-plugin-n": "catalog:devTools", "prettier": "catalog:devTools", - "tsx": "catalog:devTools", "typescript": "catalog:devTools", "typescript-eslint": "catalog:devTools", "vitest": "catalog:devTools", diff --git a/packages/client/src/client/auth.examples.ts b/packages/client/src/client/auth.examples.ts index 17c04e6a04..01531c9780 100644 --- a/packages/client/src/client/auth.examples.ts +++ b/packages/client/src/client/auth.examples.ts @@ -9,8 +9,8 @@ import type { AuthorizationServerMetadata } from '@modelcontextprotocol/core'; -import type { OAuthClientProvider } from './auth.js'; -import { fetchToken } from './auth.js'; +import type { OAuthClientProvider } from './auth'; +import { fetchToken } from './auth'; /** * Base class providing no-op implementations of required OAuthClientProvider methods. diff --git a/packages/client/src/client/authExtensions.examples.ts b/packages/client/src/client/authExtensions.examples.ts index bcb26a3d41..668cdd3504 100644 --- a/packages/client/src/client/authExtensions.examples.ts +++ b/packages/client/src/client/authExtensions.examples.ts @@ -7,8 +7,8 @@ * @module */ -import { ClientCredentialsProvider, createPrivateKeyJwtAuth, PrivateKeyJwtProvider } from './authExtensions.js'; -import { StreamableHTTPClientTransport } from './streamableHttp.js'; +import { ClientCredentialsProvider, createPrivateKeyJwtAuth, PrivateKeyJwtProvider } from './authExtensions'; +import { StreamableHTTPClientTransport } from './streamableHttp'; /** * Example: Creating a private key JWT authentication function. diff --git a/packages/client/src/client/authExtensions.ts b/packages/client/src/client/authExtensions.ts index cb476c12fd..c62d635138 100644 --- a/packages/client/src/client/authExtensions.ts +++ b/packages/client/src/client/authExtensions.ts @@ -8,7 +8,7 @@ import type { FetchLike, OAuthClientInformation, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/core'; import type { CryptoKey, JWK } from 'jose'; -import type { AddClientAuthentication, OAuthClientProvider } from './auth.js'; +import type { AddClientAuthentication, OAuthClientProvider } from './auth'; /** * Helper to produce a `private_key_jwt` client authentication function. diff --git a/packages/client/src/client/client.examples.ts b/packages/client/src/client/client.examples.ts index 0789b1501a..e748463574 100644 --- a/packages/client/src/client/client.examples.ts +++ b/packages/client/src/client/client.examples.ts @@ -9,10 +9,10 @@ import type { Prompt, Resource, Tool } from '@modelcontextprotocol/core'; -import { Client } from './client.js'; -import { SSEClientTransport } from './sse.js'; -import { StdioClientTransport } from './stdio.js'; -import { StreamableHTTPClientTransport } from './streamableHttp.js'; +import { Client } from './client'; +import { SSEClientTransport } from './sse'; +import { StdioClientTransport } from './stdio'; +import { StreamableHTTPClientTransport } from './streamableHttp'; /** * Example: Using listChanged to automatically track tool and prompt updates. diff --git a/packages/client/src/client/crossAppAccess.ts b/packages/client/src/client/crossAppAccess.ts index 9e0219dfe6..7db9371cae 100644 --- a/packages/client/src/client/crossAppAccess.ts +++ b/packages/client/src/client/crossAppAccess.ts @@ -11,8 +11,8 @@ import type { FetchLike } from '@modelcontextprotocol/core'; import { IdJagTokenExchangeResponseSchema, OAuthErrorResponseSchema, OAuthTokensSchema } from '@modelcontextprotocol/core'; -import type { ClientAuthMethod } from './auth.js'; -import { applyClientAuthentication, discoverAuthorizationServerMetadata } from './auth.js'; +import type { ClientAuthMethod } from './auth'; +import { applyClientAuthentication, discoverAuthorizationServerMetadata } from './auth'; /** * Options for requesting a JWT Authorization Grant via RFC 8693 Token Exchange. diff --git a/packages/client/src/client/middleware.examples.ts b/packages/client/src/client/middleware.examples.ts index 9ccea3abc3..1782ac8502 100644 --- a/packages/client/src/client/middleware.examples.ts +++ b/packages/client/src/client/middleware.examples.ts @@ -7,8 +7,8 @@ * @module */ -import type { Middleware } from './middleware.js'; -import { applyMiddlewares, createMiddleware } from './middleware.js'; +import type { Middleware } from './middleware'; +import { applyMiddlewares, createMiddleware } from './middleware'; // Stubs for hypothetical application middleware declare function withOAuth(provider: unknown, url: string): Middleware; diff --git a/packages/client/src/client/middleware.ts b/packages/client/src/client/middleware.ts index 7494144410..f5f36ae215 100644 --- a/packages/client/src/client/middleware.ts +++ b/packages/client/src/client/middleware.ts @@ -1,7 +1,7 @@ import type { FetchLike } from '@modelcontextprotocol/core'; -import type { OAuthClientProvider } from './auth.js'; -import { auth, extractWWWAuthenticateParams, UnauthorizedError } from './auth.js'; +import type { OAuthClientProvider } from './auth'; +import { auth, extractWWWAuthenticateParams, UnauthorizedError } from './auth'; /** * Middleware function that wraps and enhances fetch functionality. diff --git a/packages/client/src/client/sse.ts b/packages/client/src/client/sse.ts index bf554aba29..fcd93f0594 100644 --- a/packages/client/src/client/sse.ts +++ b/packages/client/src/client/sse.ts @@ -10,8 +10,8 @@ import { import type { ErrorEvent, EventSourceInit } from 'eventsource'; import { EventSource } from 'eventsource'; -import type { AuthProvider, OAuthClientProvider } from './auth.js'; -import { adaptOAuthProvider, auth, extractWWWAuthenticateParams, isOAuthClientProvider, UnauthorizedError } from './auth.js'; +import type { AuthProvider, OAuthClientProvider } from './auth'; +import { adaptOAuthProvider, auth, extractWWWAuthenticateParams, isOAuthClientProvider, UnauthorizedError } from './auth'; export class SseError extends Error { constructor( diff --git a/packages/client/src/client/streamableHttp.examples.ts b/packages/client/src/client/streamableHttp.examples.ts index 5a67ed576f..7383cb752d 100644 --- a/packages/client/src/client/streamableHttp.examples.ts +++ b/packages/client/src/client/streamableHttp.examples.ts @@ -9,7 +9,7 @@ /* eslint-disable unicorn/consistent-function-scoping -- examples must live inside region blocks */ -import type { ReconnectionScheduler } from './streamableHttp.js'; +import type { ReconnectionScheduler } from './streamableHttp'; // Stub for a hypothetical platform-specific background scheduling API declare const platformBackgroundTask: { diff --git a/packages/client/src/client/streamableHttp.ts b/packages/client/src/client/streamableHttp.ts index 3b8ddafe5a..7a7da69dc1 100644 --- a/packages/client/src/client/streamableHttp.ts +++ b/packages/client/src/client/streamableHttp.ts @@ -15,8 +15,8 @@ import { } from '@modelcontextprotocol/core'; import { EventSourceParserStream } from 'eventsource-parser/stream'; -import type { AuthProvider, OAuthClientProvider } from './auth.js'; -import { adaptOAuthProvider, auth, extractWWWAuthenticateParams, isOAuthClientProvider, UnauthorizedError } from './auth.js'; +import type { AuthProvider, OAuthClientProvider } from './auth'; +import { adaptOAuthProvider, auth, extractWWWAuthenticateParams, isOAuthClientProvider, UnauthorizedError } from './auth'; // Default reconnection options for StreamableHTTP connections const DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS: StreamableHTTPReconnectionOptions = { diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 8a08e8fd79..69cee24488 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -14,7 +14,7 @@ export type { OAuthClientProvider, OAuthDiscoveryState, OAuthServerInfo -} from './client/auth.js'; +} from './client/auth'; export { auth, buildDiscoveryUrls, @@ -36,7 +36,7 @@ export { startAuthorization, UnauthorizedError, validateClientMetadataUrl -} from './client/auth.js'; +} from './client/auth'; export type { AssertionCallback, ClientCredentialsProviderOptions, @@ -44,23 +44,23 @@ export type { CrossAppAccessProviderOptions, PrivateKeyJwtProviderOptions, StaticPrivateKeyJwtProviderOptions -} from './client/authExtensions.js'; +} from './client/authExtensions'; export { ClientCredentialsProvider, createPrivateKeyJwtAuth, CrossAppAccessProvider, PrivateKeyJwtProvider, StaticPrivateKeyJwtProvider -} from './client/authExtensions.js'; -export type { ClientOptions } from './client/client.js'; -export { Client } from './client/client.js'; -export { getSupportedElicitationModes } from './client/client.js'; -export type { DiscoverAndRequestJwtAuthGrantOptions, JwtAuthGrantResult, RequestJwtAuthGrantOptions } from './client/crossAppAccess.js'; -export { discoverAndRequestJwtAuthGrant, exchangeJwtAuthGrant, requestJwtAuthorizationGrant } from './client/crossAppAccess.js'; -export type { LoggingOptions, Middleware, RequestLogger } from './client/middleware.js'; -export { applyMiddlewares, createMiddleware, withLogging, withOAuth } from './client/middleware.js'; -export type { SSEClientTransportOptions } from './client/sse.js'; -export { SSEClientTransport, SseError } from './client/sse.js'; +} from './client/authExtensions'; +export type { ClientOptions } from './client/client'; +export { Client } from './client/client'; +export { getSupportedElicitationModes } from './client/client'; +export type { DiscoverAndRequestJwtAuthGrantOptions, JwtAuthGrantResult, RequestJwtAuthGrantOptions } from './client/crossAppAccess'; +export { discoverAndRequestJwtAuthGrant, exchangeJwtAuthGrant, requestJwtAuthorizationGrant } from './client/crossAppAccess'; +export type { LoggingOptions, Middleware, RequestLogger } from './client/middleware'; +export { applyMiddlewares, createMiddleware, withLogging, withOAuth } from './client/middleware'; +export type { SSEClientTransportOptions } from './client/sse'; +export { SSEClientTransport, SseError } from './client/sse'; // StdioClientTransport, getDefaultEnvironment, DEFAULT_INHERITED_ENV_VARS, StdioServerParameters are exported from // the './stdio' subpath to keep the root entry free of process-spawning runtime dependencies (child_process, cross-spawn). export type { @@ -68,11 +68,11 @@ export type { StartSSEOptions, StreamableHTTPClientTransportOptions, StreamableHTTPReconnectionOptions -} from './client/streamableHttp.js'; -export { StreamableHTTPClientTransport } from './client/streamableHttp.js'; +} from './client/streamableHttp'; +export { StreamableHTTPClientTransport } from './client/streamableHttp'; // runtime-aware wrapper (shadows core/public's fromJsonSchema with optional validator) -export { fromJsonSchema } from './fromJsonSchema.js'; +export { fromJsonSchema } from './fromJsonSchema'; // re-export curated public API from core export * from '@modelcontextprotocol/core/public'; diff --git a/packages/client/src/stdio.ts b/packages/client/src/stdio.ts index a6ecd1697e..f0c7b1af4d 100644 --- a/packages/client/src/stdio.ts +++ b/packages/client/src/stdio.ts @@ -4,5 +4,5 @@ // Cloudflare Workers targets does not pull in `node:child_process`, `node:stream`, or `cross-spawn`. Import // from `@modelcontextprotocol/client/stdio` only in process-spawning runtimes (Node.js, Bun, Deno). -export type { StdioServerParameters } from './client/stdio.js'; -export { DEFAULT_INHERITED_ENV_VARS, getDefaultEnvironment, StdioClientTransport } from './client/stdio.js'; +export type { StdioServerParameters } from './client/stdio'; +export { DEFAULT_INHERITED_ENV_VARS, getDefaultEnvironment, StdioClientTransport } from './client/stdio'; diff --git a/packages/client/test/client/auth.test.ts b/packages/client/test/client/auth.test.ts index 04d7f4a3fb..8239024c0c 100644 --- a/packages/client/test/client/auth.test.ts +++ b/packages/client/test/client/auth.test.ts @@ -3,7 +3,7 @@ import { LATEST_PROTOCOL_VERSION, OAuthError, OAuthErrorCode } from '@modelconte import type { Mock } from 'vitest'; import { expect, vi } from 'vitest'; -import type { OAuthClientProvider } from '../../src/client/auth.js'; +import type { OAuthClientProvider } from '../../src/client/auth'; import { auth, buildDiscoveryUrls, @@ -20,8 +20,8 @@ import { selectClientAuthMethod, startAuthorization, validateClientMetadataUrl -} from '../../src/client/auth.js'; -import { createPrivateKeyJwtAuth } from '../../src/client/authExtensions.js'; +} from '../../src/client/auth'; +import { createPrivateKeyJwtAuth } from '../../src/client/authExtensions'; // Mock pkce-challenge vi.mock('pkce-challenge', () => ({ diff --git a/packages/client/test/client/authExtensions.test.ts b/packages/client/test/client/authExtensions.test.ts index 16c3ea33e1..3f55593fc7 100644 --- a/packages/client/test/client/authExtensions.test.ts +++ b/packages/client/test/client/authExtensions.test.ts @@ -1,14 +1,14 @@ import { createMockOAuthFetch } from '@modelcontextprotocol/test-helpers'; import { describe, expect, it, vi } from 'vitest'; -import { auth } from '../../src/client/auth.js'; +import { auth } from '../../src/client/auth'; import { ClientCredentialsProvider, createPrivateKeyJwtAuth, CrossAppAccessProvider, PrivateKeyJwtProvider, StaticPrivateKeyJwtProvider -} from '../../src/client/authExtensions.js'; +} from '../../src/client/authExtensions'; const RESOURCE_SERVER_URL = 'https://resource.example.com/'; const AUTH_SERVER_URL = 'https://auth.example.com'; diff --git a/packages/client/test/client/crossAppAccess.test.ts b/packages/client/test/client/crossAppAccess.test.ts index 1b595c4daa..166f08fa9b 100644 --- a/packages/client/test/client/crossAppAccess.test.ts +++ b/packages/client/test/client/crossAppAccess.test.ts @@ -1,7 +1,7 @@ import type { FetchLike } from '@modelcontextprotocol/core'; import { describe, expect, it, vi } from 'vitest'; -import { discoverAndRequestJwtAuthGrant, exchangeJwtAuthGrant, requestJwtAuthorizationGrant } from '../../src/client/crossAppAccess.js'; +import { discoverAndRequestJwtAuthGrant, exchangeJwtAuthGrant, requestJwtAuthorizationGrant } from '../../src/client/crossAppAccess'; describe('crossAppAccess', () => { describe('requestJwtAuthorizationGrant', () => { diff --git a/packages/client/test/client/crossSpawn.test.ts b/packages/client/test/client/crossSpawn.test.ts index a6d0272a4c..f7e8823091 100644 --- a/packages/client/test/client/crossSpawn.test.ts +++ b/packages/client/test/client/crossSpawn.test.ts @@ -4,7 +4,7 @@ import type { JSONRPCMessage } from '@modelcontextprotocol/core'; import spawn from 'cross-spawn'; import type { Mock, MockedFunction } from 'vitest'; -import { getDefaultEnvironment, StdioClientTransport } from '../../src/client/stdio.js'; +import { getDefaultEnvironment, StdioClientTransport } from '../../src/client/stdio'; // mock cross-spawn vi.mock('cross-spawn'); diff --git a/packages/client/test/client/jsonSchemaValidatorOverride.test.ts b/packages/client/test/client/jsonSchemaValidatorOverride.test.ts index 2e38f618c5..f61a66033e 100644 --- a/packages/client/test/client/jsonSchemaValidatorOverride.test.ts +++ b/packages/client/test/client/jsonSchemaValidatorOverride.test.ts @@ -1,7 +1,7 @@ import type { JSONRPCMessage, JsonSchemaType, JsonSchemaValidatorResult, jsonSchemaValidator } from '@modelcontextprotocol/core'; import { InMemoryTransport, LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/core'; -import { Client } from '../../src/client/client.js'; -import { fromJsonSchema } from '../../src/fromJsonSchema.js'; +import { Client } from '../../src/client/client'; +import { fromJsonSchema } from '../../src/fromJsonSchema'; class RecordingValidator implements jsonSchemaValidator { schemas: JsonSchemaType[] = []; diff --git a/packages/client/test/client/middleware.test.ts b/packages/client/test/client/middleware.test.ts index 64bbfa6735..f4090b4ed0 100644 --- a/packages/client/test/client/middleware.test.ts +++ b/packages/client/test/client/middleware.test.ts @@ -1,11 +1,11 @@ import type { FetchLike } from '@modelcontextprotocol/core'; import type { Mocked, MockedFunction, MockInstance } from 'vitest'; -import type { OAuthClientProvider } from '../../src/client/auth.js'; -import { applyMiddlewares, createMiddleware, withLogging, withOAuth } from '../../src/client/middleware.js'; +import type { OAuthClientProvider } from '../../src/client/auth'; +import { applyMiddlewares, createMiddleware, withLogging, withOAuth } from '../../src/client/middleware'; -vi.mock('../../src/client/auth.js', async () => { - const actual = await vi.importActual('../../src/client/auth.js'); +vi.mock('../../src/client/auth', async () => { + const actual = await vi.importActual('../../src/client/auth'); return { ...actual, auth: vi.fn(), @@ -13,7 +13,7 @@ vi.mock('../../src/client/auth.js', async () => { }; }); -import { auth, extractWWWAuthenticateParams } from '../../src/client/auth.js'; +import { auth, extractWWWAuthenticateParams } from '../../src/client/auth'; const mockAuth = auth as MockedFunction; const mockExtractWWWAuthenticateParams = extractWWWAuthenticateParams as MockedFunction; diff --git a/packages/client/test/client/sse.test.ts b/packages/client/test/client/sse.test.ts index 4ccbb91e5f..f44681e589 100644 --- a/packages/client/test/client/sse.test.ts +++ b/packages/client/test/client/sse.test.ts @@ -7,9 +7,9 @@ import { OAuthError, OAuthErrorCode, SdkErrorCode, SdkHttpError } from '@modelco import { listenOnRandomPort } from '@modelcontextprotocol/test-helpers'; import type { Mock, Mocked, MockedFunction, MockInstance } from 'vitest'; -import type { AuthProvider, OAuthClientProvider } from '../../src/client/auth.js'; -import { UnauthorizedError } from '../../src/client/auth.js'; -import { SSEClientTransport } from '../../src/client/sse.js'; +import type { AuthProvider, OAuthClientProvider } from '../../src/client/auth'; +import { UnauthorizedError } from '../../src/client/auth'; +import { SSEClientTransport } from '../../src/client/sse'; /** * Parses HTTP Basic auth from a request's Authorization header. diff --git a/packages/client/test/client/stdio.test.ts b/packages/client/test/client/stdio.test.ts index 3eaa88d71a..6b13d7d819 100644 --- a/packages/client/test/client/stdio.test.ts +++ b/packages/client/test/client/stdio.test.ts @@ -1,7 +1,7 @@ import type { JSONRPCMessage } from '@modelcontextprotocol/core'; -import type { StdioServerParameters } from '../../src/client/stdio.js'; -import { StdioClientTransport } from '../../src/client/stdio.js'; +import type { StdioServerParameters } from '../../src/client/stdio'; +import { StdioClientTransport } from '../../src/client/stdio'; // Configure default server parameters based on OS // Uses 'more' command for Windows and 'tee' command for Unix/Linux diff --git a/packages/client/test/client/streamableHttp.test.ts b/packages/client/test/client/streamableHttp.test.ts index 6542302c9d..db1f80fe9e 100644 --- a/packages/client/test/client/streamableHttp.test.ts +++ b/packages/client/test/client/streamableHttp.test.ts @@ -2,10 +2,10 @@ import type { JSONRPCMessage, JSONRPCRequest } from '@modelcontextprotocol/core' import { OAuthError, OAuthErrorCode, SdkErrorCode, SdkHttpError } from '@modelcontextprotocol/core'; import type { Mock, Mocked } from 'vitest'; -import type { OAuthClientProvider } from '../../src/client/auth.js'; -import { UnauthorizedError } from '../../src/client/auth.js'; -import type { ReconnectionScheduler, StartSSEOptions, StreamableHTTPReconnectionOptions } from '../../src/client/streamableHttp.js'; -import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp.js'; +import type { OAuthClientProvider } from '../../src/client/auth'; +import { UnauthorizedError } from '../../src/client/auth'; +import type { ReconnectionScheduler, StartSSEOptions, StreamableHTTPReconnectionOptions } from '../../src/client/streamableHttp'; +import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp'; describe('StreamableHTTPClientTransport', () => { let transport: StreamableHTTPClientTransport; @@ -813,7 +813,7 @@ describe('StreamableHTTPClientTransport', () => { }); // Spy on the imported auth function and mock successful authorization - const authModule = await import('../../src/client/auth.js'); + const authModule = await import('../../src/client/auth'); const authSpy = vi.spyOn(authModule, 'auth'); authSpy.mockResolvedValue('AUTHORIZED'); @@ -855,8 +855,8 @@ describe('StreamableHTTPClientTransport', () => { }); // Spy on the imported auth function and mock successful authorization - const authModule = await import('../../src/client/auth.js'); - const authSpy = vi.spyOn(authModule as typeof import('../../src/client/auth.js'), 'auth'); + const authModule = await import('../../src/client/auth'); + const authSpy = vi.spyOn(authModule as typeof import('../../src/client/auth'), 'auth'); authSpy.mockResolvedValue('AUTHORIZED'); // First send: should trigger upscoping diff --git a/packages/client/test/client/tokenProvider.test.ts b/packages/client/test/client/tokenProvider.test.ts index 4defbc2bd1..89c2c69041 100644 --- a/packages/client/test/client/tokenProvider.test.ts +++ b/packages/client/test/client/tokenProvider.test.ts @@ -6,9 +6,9 @@ import { SdkErrorCode, SdkHttpError } from '@modelcontextprotocol/core'; import { listenOnRandomPort } from '@modelcontextprotocol/test-helpers'; import type { Mock } from 'vitest'; -import type { AuthProvider, OAuthClientProvider } from '../../src/client/auth.js'; -import { UnauthorizedError } from '../../src/client/auth.js'; -import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp.js'; +import type { AuthProvider, OAuthClientProvider } from '../../src/client/auth'; +import { UnauthorizedError } from '../../src/client/auth'; +import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp'; describe('StreamableHTTPClientTransport with AuthProvider', () => { let transport: StreamableHTTPClientTransport; diff --git a/packages/codemod/src/bin/batchTest.ts b/packages/codemod/src/bin/batchTest.ts index 0e45e1715b..7c9761cb69 100644 --- a/packages/codemod/src/bin/batchTest.ts +++ b/packages/codemod/src/bin/batchTest.ts @@ -5,9 +5,9 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; -import { getMigration } from '../migrations/index.js'; -import { run } from '../runner.js'; -import type { Diagnostic, RunnerResult } from '../types.js'; +import { getMigration } from '../migrations/index'; +import { run } from '../runner'; +import type { Diagnostic, RunnerResult } from '../types'; // --------------------------------------------------------------------------- // Types diff --git a/packages/codemod/src/cli.ts b/packages/codemod/src/cli.ts index d8599c70a0..a1c467761f 100644 --- a/packages/codemod/src/cli.ts +++ b/packages/codemod/src/cli.ts @@ -6,10 +6,10 @@ import path from 'node:path'; import { Command } from 'commander'; -import { listMigrations } from './migrations/index.js'; -import { run } from './runner.js'; -import { DiagnosticLevel } from './types.js'; -import { CODEMOD_ERROR_PREFIX, formatDiagnostic } from './utils/diagnostics.js'; +import { listMigrations } from './migrations/index'; +import { run } from './runner'; +import { DiagnosticLevel } from './types'; +import { CODEMOD_ERROR_PREFIX, formatDiagnostic } from './utils/diagnostics'; const require = createRequire(import.meta.url); const { version } = require('../package.json') as { version: string }; diff --git a/packages/codemod/src/index.ts b/packages/codemod/src/index.ts index 724cd2697e..4698196c9a 100644 --- a/packages/codemod/src/index.ts +++ b/packages/codemod/src/index.ts @@ -1,5 +1,5 @@ -export { getMigration, listMigrations } from './migrations/index.js'; -export { run } from './runner.js'; +export { getMigration, listMigrations } from './migrations/index'; +export { run } from './runner'; export type { Diagnostic, FileResult, @@ -10,5 +10,5 @@ export type { Transform, TransformContext, TransformResult -} from './types.js'; -export { DiagnosticLevel } from './types.js'; +} from './types'; +export { DiagnosticLevel } from './types'; diff --git a/packages/codemod/src/migrations/index.ts b/packages/codemod/src/migrations/index.ts index 1630393a8f..09d9093453 100644 --- a/packages/codemod/src/migrations/index.ts +++ b/packages/codemod/src/migrations/index.ts @@ -1,5 +1,5 @@ -import type { Migration } from '../types.js'; -import { v1ToV2Migration } from './v1-to-v2/index.js'; +import type { Migration } from '../types'; +import { v1ToV2Migration } from './v1-to-v2/index'; const migrations = new Map([['v1-to-v2', v1ToV2Migration]]); diff --git a/packages/codemod/src/migrations/v1-to-v2/index.ts b/packages/codemod/src/migrations/v1-to-v2/index.ts index 689331a9c3..083aa56123 100644 --- a/packages/codemod/src/migrations/v1-to-v2/index.ts +++ b/packages/codemod/src/migrations/v1-to-v2/index.ts @@ -1,5 +1,5 @@ -import type { Migration } from '../../types.js'; -import { v1ToV2Transforms } from './transforms/index.js'; +import type { Migration } from '../../types'; +import { v1ToV2Transforms } from './transforms/index'; export const v1ToV2Migration: Migration = { name: 'v1-to-v2', diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/contextTypes.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/contextTypes.ts index b55efdb877..78ebc2487d 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/contextTypes.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/contextTypes.ts @@ -1,11 +1,11 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { isKeyPositionIdentifier } from '../../../utils/astUtils.js'; -import { actionRequired, info } from '../../../utils/diagnostics.js'; -import { hasMcpImports } from '../../../utils/importUtils.js'; -import { CONTEXT_PROPERTY_MAP, CTX_PARAM_NAME, EXTRA_PARAM_NAME } from '../mappings/contextPropertyMap.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { isKeyPositionIdentifier } from '../../../utils/astUtils'; +import { actionRequired, info } from '../../../utils/diagnostics'; +import { hasMcpImports } from '../../../utils/importUtils'; +import { CONTEXT_PROPERTY_MAP, CTX_PARAM_NAME, EXTRA_PARAM_NAME } from '../mappings/contextPropertyMap'; const HANDLER_METHODS = new Set(['setRequestHandler', 'setNotificationHandler']); diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/expressMiddleware.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/expressMiddleware.ts index 319461070a..b7b7867539 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/expressMiddleware.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/expressMiddleware.ts @@ -1,9 +1,9 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { info } from '../../../utils/diagnostics.js'; -import { isOriginalNameImportedFromMcp, resolveLocalImportName } from '../../../utils/importUtils.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { info } from '../../../utils/diagnostics'; +import { isOriginalNameImportedFromMcp, resolveLocalImportName } from '../../../utils/importUtils'; export const expressMiddlewareTransform: Transform = { name: 'Express middleware signature migration', diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/handlerRegistration.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/handlerRegistration.ts index 7e6645dc56..216490178d 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/handlerRegistration.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/handlerRegistration.ts @@ -1,10 +1,10 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { actionRequired } from '../../../utils/diagnostics.js'; -import { hasMcpImports, isImportedFromMcp, removeUnusedImport, resolveOriginalImportName } from '../../../utils/importUtils.js'; -import { NOTIFICATION_SCHEMA_TO_METHOD, SCHEMA_TO_METHOD } from '../mappings/schemaToMethodMap.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { actionRequired } from '../../../utils/diagnostics'; +import { hasMcpImports, isImportedFromMcp, removeUnusedImport, resolveOriginalImportName } from '../../../utils/importUtils'; +import { NOTIFICATION_SCHEMA_TO_METHOD, SCHEMA_TO_METHOD } from '../mappings/schemaToMethodMap'; const ALL_SCHEMA_TO_METHOD: Record = { ...SCHEMA_TO_METHOD, diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/importPaths.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/importPaths.ts index 482ae3e57d..008b576686 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/importPaths.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/importPaths.ts @@ -1,12 +1,12 @@ import type { SourceFile } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { renameAllReferences } from '../../../utils/astUtils.js'; -import { actionRequired, info, v2Gap, warning } from '../../../utils/diagnostics.js'; -import { addOrMergeImport, getSdkExports, getSdkImports, isTypeOnlyImport } from '../../../utils/importUtils.js'; -import { resolveTypesPackage } from '../../../utils/projectAnalyzer.js'; -import { IMPORT_MAP, isAuthImport } from '../mappings/importMap.js'; -import { SIMPLE_RENAMES } from '../mappings/symbolMap.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { renameAllReferences } from '../../../utils/astUtils'; +import { actionRequired, info, v2Gap, warning } from '../../../utils/diagnostics'; +import { addOrMergeImport, getSdkExports, getSdkImports, isTypeOnlyImport } from '../../../utils/importUtils'; +import { resolveTypesPackage } from '../../../utils/projectAnalyzer'; +import { IMPORT_MAP, isAuthImport } from '../mappings/importMap'; +import { SIMPLE_RENAMES } from '../mappings/symbolMap'; const REEXPORT_WARNINGS: Record = { ErrorCode: 'Re-exported ErrorCode was split into ProtocolErrorCode and SdkErrorCode in v2. Update this re-export manually.', diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/index.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/index.ts index 7b6b54b28b..47cb1988ce 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/index.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/index.ts @@ -1,14 +1,14 @@ -import type { Transform } from '../../../types.js'; -import { contextTypesTransform } from './contextTypes.js'; -import { expressMiddlewareTransform } from './expressMiddleware.js'; -import { handlerRegistrationTransform } from './handlerRegistration.js'; -import { importPathsTransform } from './importPaths.js'; -import { mcpServerApiTransform } from './mcpServerApi.js'; -import { mockPathsTransform } from './mockPaths.js'; -import { removedApisTransform } from './removedApis.js'; -import { schemaParamRemovalTransform } from './schemaParamRemoval.js'; -import { specSchemaAccessTransform } from './specSchemaAccess.js'; -import { symbolRenamesTransform } from './symbolRenames.js'; +import type { Transform } from '../../../types'; +import { contextTypesTransform } from './contextTypes'; +import { expressMiddlewareTransform } from './expressMiddleware'; +import { handlerRegistrationTransform } from './handlerRegistration'; +import { importPathsTransform } from './importPaths'; +import { mcpServerApiTransform } from './mcpServerApi'; +import { mockPathsTransform } from './mockPaths'; +import { removedApisTransform } from './removedApis'; +import { schemaParamRemovalTransform } from './schemaParamRemoval'; +import { specSchemaAccessTransform } from './specSchemaAccess'; +import { symbolRenamesTransform } from './symbolRenames'; // Ordering matters — do not reorder without understanding dependencies: // diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/mcpServerApi.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/mcpServerApi.ts index 9efc2d5839..ddfbc28d8c 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/mcpServerApi.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/mcpServerApi.ts @@ -1,9 +1,9 @@ import type { CallExpression, SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { actionRequired, info } from '../../../utils/diagnostics.js'; -import { isOriginalNameImportedFromMcp, resolveLocalImportName } from '../../../utils/importUtils.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { actionRequired, info } from '../../../utils/diagnostics'; +import { isOriginalNameImportedFromMcp, resolveLocalImportName } from '../../../utils/importUtils'; export const mcpServerApiTransform: Transform = { name: 'McpServer API migration', diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/mockPaths.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/mockPaths.ts index 65ce7a4d6b..0316c33b78 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/mockPaths.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/mockPaths.ts @@ -1,12 +1,12 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { actionRequired, v2Gap, warning } from '../../../utils/diagnostics.js'; -import { isSdkSpecifier } from '../../../utils/importUtils.js'; -import { resolveTypesPackage } from '../../../utils/projectAnalyzer.js'; -import { IMPORT_MAP, isAuthImport } from '../mappings/importMap.js'; -import { SIMPLE_RENAMES } from '../mappings/symbolMap.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { actionRequired, v2Gap, warning } from '../../../utils/diagnostics'; +import { isSdkSpecifier } from '../../../utils/importUtils'; +import { resolveTypesPackage } from '../../../utils/projectAnalyzer'; +import { IMPORT_MAP, isAuthImport } from '../mappings/importMap'; +import { SIMPLE_RENAMES } from '../mappings/symbolMap'; const MOCK_METHODS = new Set([ 'mock', diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/removedApis.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/removedApis.ts index e4bf721dd4..2fc2573fed 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/removedApis.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/removedApis.ts @@ -1,10 +1,10 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { renameAllReferences } from '../../../utils/astUtils.js'; -import { warning } from '../../../utils/diagnostics.js'; -import { addOrMergeImport, isAnyMcpSpecifier } from '../../../utils/importUtils.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { renameAllReferences } from '../../../utils/astUtils'; +import { warning } from '../../../utils/diagnostics'; +import { addOrMergeImport, isAnyMcpSpecifier } from '../../../utils/importUtils'; const REMOVED_ZOD_HELPERS: Record = { schemaToJson: diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/schemaParamRemoval.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/schemaParamRemoval.ts index eea8e33fd8..bc48a3cfb0 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/schemaParamRemoval.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/schemaParamRemoval.ts @@ -1,8 +1,8 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Transform, TransformContext, TransformResult } from '../../../types.js'; -import { isImportedFromMcp, removeUnusedImport, resolveOriginalImportName } from '../../../utils/importUtils.js'; +import type { Transform, TransformContext, TransformResult } from '../../../types'; +import { isImportedFromMcp, removeUnusedImport, resolveOriginalImportName } from '../../../utils/importUtils'; const TARGET_METHODS = new Set(['request', 'callTool']); diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/specSchemaAccess.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/specSchemaAccess.ts index 79f4a0a707..37891e361e 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/specSchemaAccess.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/specSchemaAccess.ts @@ -1,11 +1,11 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import { SPEC_SCHEMA_NAMES, specSchemaToTypeName } from '../../../generated/specSchemaMap.js'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { isKeyPositionIdentifier } from '../../../utils/astUtils.js'; -import { actionRequired, warning } from '../../../utils/diagnostics.js'; -import { addOrMergeImport, isAnyMcpSpecifier, removeUnusedImport } from '../../../utils/importUtils.js'; +import { SPEC_SCHEMA_NAMES, specSchemaToTypeName } from '../../../generated/specSchemaMap'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { isKeyPositionIdentifier } from '../../../utils/astUtils'; +import { actionRequired, warning } from '../../../utils/diagnostics'; +import { addOrMergeImport, isAnyMcpSpecifier, removeUnusedImport } from '../../../utils/importUtils'; export const specSchemaAccessTransform: Transform = { name: 'Spec schema standalone usage', diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/symbolRenames.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/symbolRenames.ts index 651faf5680..4e47c1ee68 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/symbolRenames.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/symbolRenames.ts @@ -1,12 +1,12 @@ import type { SourceFile } from 'ts-morph'; import { Node } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { renameAllReferences } from '../../../utils/astUtils.js'; -import { info, warning } from '../../../utils/diagnostics.js'; -import { addOrMergeImport, isAnyMcpSpecifier, removeUnusedImport } from '../../../utils/importUtils.js'; -import { resolveTypesPackage } from '../../../utils/projectAnalyzer.js'; -import { ERROR_CODE_SDK_MEMBERS, SIMPLE_RENAMES } from '../mappings/symbolMap.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { renameAllReferences } from '../../../utils/astUtils'; +import { info, warning } from '../../../utils/diagnostics'; +import { addOrMergeImport, isAnyMcpSpecifier, removeUnusedImport } from '../../../utils/importUtils'; +import { resolveTypesPackage } from '../../../utils/projectAnalyzer'; +import { ERROR_CODE_SDK_MEMBERS, SIMPLE_RENAMES } from '../mappings/symbolMap'; const SERVER_GENERIC_ARGS = new Set(['ServerRequest', 'ServerNotification']); const CLIENT_GENERIC_ARGS = new Set(['ClientRequest', 'ClientNotification']); diff --git a/packages/codemod/src/runner.ts b/packages/codemod/src/runner.ts index 965d5827c3..15a5f05064 100644 --- a/packages/codemod/src/runner.ts +++ b/packages/codemod/src/runner.ts @@ -1,10 +1,10 @@ import type { Node } from 'ts-morph'; import { Project, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, FileResult, Migration, RunnerOptions, RunnerResult } from './types.js'; -import { CODEMOD_ERROR_PREFIX, error } from './utils/diagnostics.js'; -import { updatePackageJson } from './utils/packageJsonUpdater.js'; -import { analyzeProject } from './utils/projectAnalyzer.js'; +import type { Diagnostic, FileResult, Migration, RunnerOptions, RunnerResult } from './types'; +import { CODEMOD_ERROR_PREFIX, error } from './utils/diagnostics'; +import { updatePackageJson } from './utils/packageJsonUpdater'; +import { analyzeProject } from './utils/projectAnalyzer'; const LITERAL_NODE_KINDS = new Set([ SyntaxKind.NoSubstitutionTemplateLiteral, diff --git a/packages/codemod/src/utils/diagnostics.ts b/packages/codemod/src/utils/diagnostics.ts index 3ebfd8e1be..b3d961d3e6 100644 --- a/packages/codemod/src/utils/diagnostics.ts +++ b/packages/codemod/src/utils/diagnostics.ts @@ -1,7 +1,7 @@ import type { Node } from 'ts-morph'; -import type { Diagnostic } from '../types.js'; -import { DiagnosticLevel } from '../types.js'; +import type { Diagnostic } from '../types'; +import { DiagnosticLevel } from '../types'; export const CODEMOD_ERROR_PREFIX = '@mcp-codemod-error'; diff --git a/packages/codemod/src/utils/packageJsonUpdater.ts b/packages/codemod/src/utils/packageJsonUpdater.ts index 96a41430c8..54a7b97624 100644 --- a/packages/codemod/src/utils/packageJsonUpdater.ts +++ b/packages/codemod/src/utils/packageJsonUpdater.ts @@ -1,8 +1,8 @@ import { readFileSync, writeFileSync } from 'node:fs'; -import { V2_PACKAGE_VERSIONS } from '../generated/versions.js'; -import type { PackageJsonChange } from '../types.js'; -import { findPackageJson } from './projectAnalyzer.js'; +import { V2_PACKAGE_VERSIONS } from '../generated/versions'; +import type { PackageJsonChange } from '../types'; +import { findPackageJson } from './projectAnalyzer'; const V1_PACKAGE = '@modelcontextprotocol/sdk'; const PRIVATE_PACKAGES = new Set(['@modelcontextprotocol/core']); diff --git a/packages/codemod/src/utils/projectAnalyzer.ts b/packages/codemod/src/utils/projectAnalyzer.ts index daf4088876..f8c1a40537 100644 --- a/packages/codemod/src/utils/projectAnalyzer.ts +++ b/packages/codemod/src/utils/projectAnalyzer.ts @@ -1,8 +1,8 @@ import { existsSync, readFileSync } from 'node:fs'; import path from 'node:path'; -import type { Diagnostic, TransformContext } from '../types.js'; -import { warning } from './diagnostics.js'; +import type { Diagnostic, TransformContext } from '../types'; +import { warning } from './diagnostics'; const PROJECT_ROOT_MARKERS = ['.git', 'node_modules']; diff --git a/packages/codemod/test/cli.test.ts b/packages/codemod/test/cli.test.ts index b32244364c..01f36a9d44 100644 --- a/packages/codemod/test/cli.test.ts +++ b/packages/codemod/test/cli.test.ts @@ -3,9 +3,9 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { describe, it, expect, afterEach } from 'vitest'; -import { getMigration } from '../src/migrations/index.js'; -import { run } from '../src/runner.js'; -import { DiagnosticLevel } from '../src/types.js'; +import { getMigration } from '../src/migrations/index'; +import { run } from '../src/runner'; +import { DiagnosticLevel } from '../src/types'; const migration = getMigration('v1-to-v2')!; diff --git a/packages/codemod/test/commentInsertion.test.ts b/packages/codemod/test/commentInsertion.test.ts index a50c4698be..b8e2b2e98e 100644 --- a/packages/codemod/test/commentInsertion.test.ts +++ b/packages/codemod/test/commentInsertion.test.ts @@ -3,9 +3,9 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterEach, describe, expect, it } from 'vitest'; -import { getMigration } from '../src/migrations/index.js'; -import { run } from '../src/runner.js'; -import { CODEMOD_ERROR_PREFIX } from '../src/utils/diagnostics.js'; +import { getMigration } from '../src/migrations/index'; +import { run } from '../src/runner'; +import { CODEMOD_ERROR_PREFIX } from '../src/utils/diagnostics'; const migration = getMigration('v1-to-v2')!; diff --git a/packages/codemod/test/integration.test.ts b/packages/codemod/test/integration.test.ts index eeb9de2e17..c6292338d8 100644 --- a/packages/codemod/test/integration.test.ts +++ b/packages/codemod/test/integration.test.ts @@ -3,10 +3,10 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { describe, it, expect, afterEach } from 'vitest'; -import { getMigration } from '../src/migrations/index.js'; -import { run } from '../src/runner.js'; -import { DiagnosticLevel } from '../src/types.js'; -import type { Migration, Transform } from '../src/types.js'; +import { getMigration } from '../src/migrations/index'; +import { run } from '../src/runner'; +import { DiagnosticLevel } from '../src/types'; +import type { Migration, Transform } from '../src/types'; const migration = getMigration('v1-to-v2')!; diff --git a/packages/codemod/test/packageJsonUpdater.test.ts b/packages/codemod/test/packageJsonUpdater.test.ts index 27227efd15..2c272b8642 100644 --- a/packages/codemod/test/packageJsonUpdater.test.ts +++ b/packages/codemod/test/packageJsonUpdater.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterEach, describe, expect, it } from 'vitest'; -import { updatePackageJson } from '../src/utils/packageJsonUpdater.js'; +import { updatePackageJson } from '../src/utils/packageJsonUpdater'; let tempDir: string; diff --git a/packages/codemod/test/projectAnalyzer.test.ts b/packages/codemod/test/projectAnalyzer.test.ts index 0f69eacf79..e19aec3553 100644 --- a/packages/codemod/test/projectAnalyzer.test.ts +++ b/packages/codemod/test/projectAnalyzer.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { describe, it, expect, afterEach } from 'vitest'; -import { analyzeProject } from '../src/utils/projectAnalyzer.js'; +import { analyzeProject } from '../src/utils/projectAnalyzer'; let tempDir: string; diff --git a/packages/codemod/test/v1-to-v2/transforms/contextTypes.test.ts b/packages/codemod/test/v1-to-v2/transforms/contextTypes.test.ts index ac8ea1b235..039fcf559d 100644 --- a/packages/codemod/test/v1-to-v2/transforms/contextTypes.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/contextTypes.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { contextTypesTransform } from '../../../src/migrations/v1-to-v2/transforms/contextTypes.js'; -import type { TransformContext } from '../../../src/types.js'; +import { contextTypesTransform } from '../../../src/migrations/v1-to-v2/transforms/contextTypes'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/expressMiddleware.test.ts b/packages/codemod/test/v1-to-v2/transforms/expressMiddleware.test.ts index 35182e47b2..ca497fb501 100644 --- a/packages/codemod/test/v1-to-v2/transforms/expressMiddleware.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/expressMiddleware.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { expressMiddlewareTransform } from '../../../src/migrations/v1-to-v2/transforms/expressMiddleware.js'; -import type { TransformContext } from '../../../src/types.js'; +import { expressMiddlewareTransform } from '../../../src/migrations/v1-to-v2/transforms/expressMiddleware'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/handlerRegistration.test.ts b/packages/codemod/test/v1-to-v2/transforms/handlerRegistration.test.ts index e4602910de..8fdea4d000 100644 --- a/packages/codemod/test/v1-to-v2/transforms/handlerRegistration.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/handlerRegistration.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { handlerRegistrationTransform } from '../../../src/migrations/v1-to-v2/transforms/handlerRegistration.js'; -import type { TransformContext } from '../../../src/types.js'; +import { handlerRegistrationTransform } from '../../../src/migrations/v1-to-v2/transforms/handlerRegistration'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/importPaths.test.ts b/packages/codemod/test/v1-to-v2/transforms/importPaths.test.ts index f0563f9f69..f2bf7a647f 100644 --- a/packages/codemod/test/v1-to-v2/transforms/importPaths.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/importPaths.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { importPathsTransform } from '../../../src/migrations/v1-to-v2/transforms/importPaths.js'; -import type { TransformContext } from '../../../src/types.js'; +import { importPathsTransform } from '../../../src/migrations/v1-to-v2/transforms/importPaths'; +import type { TransformContext } from '../../../src/types'; function applyTransform(code: string, context: TransformContext = { projectType: 'both' }): string { const project = new Project({ useInMemoryFileSystem: true }); diff --git a/packages/codemod/test/v1-to-v2/transforms/mcpServerApi.test.ts b/packages/codemod/test/v1-to-v2/transforms/mcpServerApi.test.ts index b18a1abb3f..1a0a0b7691 100644 --- a/packages/codemod/test/v1-to-v2/transforms/mcpServerApi.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/mcpServerApi.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { mcpServerApiTransform } from '../../../src/migrations/v1-to-v2/transforms/mcpServerApi.js'; -import type { TransformContext } from '../../../src/types.js'; +import { mcpServerApiTransform } from '../../../src/migrations/v1-to-v2/transforms/mcpServerApi'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; const MCP_IMPORT = `import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n`; diff --git a/packages/codemod/test/v1-to-v2/transforms/mockPaths.test.ts b/packages/codemod/test/v1-to-v2/transforms/mockPaths.test.ts index 2922618986..3e1958b714 100644 --- a/packages/codemod/test/v1-to-v2/transforms/mockPaths.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/mockPaths.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { mockPathsTransform } from '../../../src/migrations/v1-to-v2/transforms/mockPaths.js'; -import type { TransformContext } from '../../../src/types.js'; +import { mockPathsTransform } from '../../../src/migrations/v1-to-v2/transforms/mockPaths'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/removedApis.test.ts b/packages/codemod/test/v1-to-v2/transforms/removedApis.test.ts index b2ba1995e3..bf1001978a 100644 --- a/packages/codemod/test/v1-to-v2/transforms/removedApis.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/removedApis.test.ts @@ -1,9 +1,9 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { removedApisTransform } from '../../../src/migrations/v1-to-v2/transforms/removedApis.js'; -import type { TransformContext } from '../../../src/types.js'; -import { DiagnosticLevel } from '../../../src/types.js'; +import { removedApisTransform } from '../../../src/migrations/v1-to-v2/transforms/removedApis'; +import type { TransformContext } from '../../../src/types'; +import { DiagnosticLevel } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/schemaParamRemoval.test.ts b/packages/codemod/test/v1-to-v2/transforms/schemaParamRemoval.test.ts index f1a2413982..70e391ce86 100644 --- a/packages/codemod/test/v1-to-v2/transforms/schemaParamRemoval.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/schemaParamRemoval.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { schemaParamRemovalTransform } from '../../../src/migrations/v1-to-v2/transforms/schemaParamRemoval.js'; -import type { TransformContext } from '../../../src/types.js'; +import { schemaParamRemovalTransform } from '../../../src/migrations/v1-to-v2/transforms/schemaParamRemoval'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'client' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/specSchemaAccess.test.ts b/packages/codemod/test/v1-to-v2/transforms/specSchemaAccess.test.ts index 2c7f592e1f..92a8384ff8 100644 --- a/packages/codemod/test/v1-to-v2/transforms/specSchemaAccess.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/specSchemaAccess.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { specSchemaAccessTransform } from '../../../src/migrations/v1-to-v2/transforms/specSchemaAccess.js'; -import type { TransformContext } from '../../../src/types.js'; +import { specSchemaAccessTransform } from '../../../src/migrations/v1-to-v2/transforms/specSchemaAccess'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/symbolRenames.test.ts b/packages/codemod/test/v1-to-v2/transforms/symbolRenames.test.ts index d6ef103de6..9a227d2f4d 100644 --- a/packages/codemod/test/v1-to-v2/transforms/symbolRenames.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/symbolRenames.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { symbolRenamesTransform } from '../../../src/migrations/v1-to-v2/transforms/symbolRenames.js'; -import type { TransformContext } from '../../../src/types.js'; +import { symbolRenamesTransform } from '../../../src/migrations/v1-to-v2/transforms/symbolRenames'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/core/package.json b/packages/core/package.json index beb46ccb88..360f37ea1c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -48,9 +48,7 @@ "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", "check": "pnpm run typecheck && pnpm run lint", "test": "vitest run", - "test:watch": "vitest", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "test:watch": "vitest" }, "dependencies": { "json-schema-typed": "catalog:runtimeShared", @@ -95,7 +93,6 @@ "eslint-config-prettier": "catalog:devTools", "eslint-plugin-n": "catalog:devTools", "prettier": "catalog:devTools", - "tsx": "catalog:devTools", "typescript": "catalog:devTools", "typescript-eslint": "catalog:devTools", "vitest": "catalog:devTools" diff --git a/packages/core/src/auth/errors.ts b/packages/core/src/auth/errors.ts index 30c8741601..f2060887f1 100644 --- a/packages/core/src/auth/errors.ts +++ b/packages/core/src/auth/errors.ts @@ -1,4 +1,4 @@ -import type { OAuthErrorResponse } from '../shared/auth.js'; +import type { OAuthErrorResponse } from '../shared/auth'; /** * OAuth error codes as defined by {@link https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 | RFC 6749} diff --git a/packages/core/src/errors/sdkErrors.examples.ts b/packages/core/src/errors/sdkErrors.examples.ts index d80fd6e756..c828d443ec 100644 --- a/packages/core/src/errors/sdkErrors.examples.ts +++ b/packages/core/src/errors/sdkErrors.examples.ts @@ -7,7 +7,7 @@ * @module */ -import { SdkError, SdkErrorCode, SdkHttpError } from './sdkErrors.js'; +import { SdkError, SdkErrorCode, SdkHttpError } from './sdkErrors'; /** * Example: Throwing and catching SDK errors. diff --git a/packages/core/src/exports/public/index.ts b/packages/core/src/exports/public/index.ts index ec0be8986c..0ea4b2683a 100644 --- a/packages/core/src/exports/public/index.ts +++ b/packages/core/src/exports/public/index.ts @@ -10,11 +10,11 @@ */ // Auth error classes -export { OAuthError, OAuthErrorCode } from '../../auth/errors.js'; +export { OAuthError, OAuthErrorCode } from '../../auth/errors'; // SDK error types (local errors that never cross the wire) -export type { SdkHttpErrorData } from '../../errors/sdkErrors.js'; -export { SdkError, SdkErrorCode, SdkHttpError } from '../../errors/sdkErrors.js'; +export type { SdkHttpErrorData } from '../../errors/sdkErrors'; +export { SdkError, SdkErrorCode, SdkHttpError } from '../../errors/sdkErrors'; // Auth TypeScript types (NOT Zod schemas like OAuthMetadataSchema) export type { @@ -31,13 +31,13 @@ export type { OAuthTokens, OpenIdProviderDiscoveryMetadata, OpenIdProviderMetadata -} from '../../shared/auth.js'; +} from '../../shared/auth'; // Auth utilities -export { checkResourceAllowed, resourceUrlFromServerUrl } from '../../shared/authUtils.js'; +export { checkResourceAllowed, resourceUrlFromServerUrl } from '../../shared/authUtils'; // Metadata utilities -export { getDisplayName } from '../../shared/metadataUtils.js'; +export { getDisplayName } from '../../shared/metadataUtils'; // Protocol types (NOT the Protocol class itself or mergeCapabilities) export type { @@ -49,25 +49,25 @@ export type { RequestHandlerSchemas, RequestOptions, ServerContext -} from '../../shared/protocol.js'; -export { DEFAULT_REQUEST_TIMEOUT_MSEC } from '../../shared/protocol.js'; +} from '../../shared/protocol'; +export { DEFAULT_REQUEST_TIMEOUT_MSEC } from '../../shared/protocol'; // stdio message framing utilities (for custom transport authors) -export { deserializeMessage, ReadBuffer, serializeMessage, STDIO_DEFAULT_MAX_BUFFER_SIZE } from '../../shared/stdio.js'; +export { deserializeMessage, ReadBuffer, serializeMessage, STDIO_DEFAULT_MAX_BUFFER_SIZE } from '../../shared/stdio'; // Transport types (NOT normalizeHeaders) -export type { FetchLike, Transport, TransportSendOptions } from '../../shared/transport.js'; -export { createFetchWithInit } from '../../shared/transport.js'; -export { InMemoryTransport } from '../../util/inMemory.js'; +export type { FetchLike, Transport, TransportSendOptions } from '../../shared/transport'; +export { createFetchWithInit } from '../../shared/transport'; +export { InMemoryTransport } from '../../util/inMemory'; // URI Template -export type { Variables } from '../../shared/uriTemplate.js'; -export { UriTemplate } from '../../shared/uriTemplate.js'; +export type { Variables } from '../../shared/uriTemplate'; +export { UriTemplate } from '../../shared/uriTemplate'; // Types — all TypeScript types (standalone interfaces + schema-derived). // This is the one intentional `export *`: types.ts contains only spec-derived TS // types, and every type there should be public. See comment in types.ts. -export * from '../../types/types.js'; +export * from '../../types/types'; // Constants export { @@ -88,13 +88,13 @@ export { SUPPORTED_PROTOCOL_VERSIONS, TRACEPARENT_META_KEY, TRACESTATE_META_KEY -} from '../../types/constants.js'; +} from '../../types/constants'; // Enums -export { ProtocolErrorCode } from '../../types/enums.js'; +export { ProtocolErrorCode } from '../../types/enums'; // Error classes -export { ProtocolError, UnsupportedProtocolVersionError, UrlElicitationRequiredError } from '../../types/errors.js'; +export { ProtocolError, UnsupportedProtocolVersionError, UrlElicitationRequiredError } from '../../types/errors'; // Type guards and message parsing export { @@ -110,16 +110,16 @@ export { isJSONRPCResultResponse, isTaskAugmentedRequestParams, parseJSONRPCMessage -} from '../../types/guards.js'; +} from '../../types/guards'; // Validator types and classes -export type { SpecTypeName, SpecTypes } from '../../types/specTypeSchema.js'; -export { isSpecType, specTypeSchemas } from '../../types/specTypeSchema.js'; -export type { StandardSchemaV1, StandardSchemaV1Sync, StandardSchemaWithJSON } from '../../util/standardSchema.js'; +export type { SpecTypeName, SpecTypes } from '../../types/specTypeSchema'; +export { isSpecType, specTypeSchemas } from '../../types/specTypeSchema'; +export type { StandardSchemaV1, StandardSchemaV1Sync, StandardSchemaWithJSON } from '../../util/standardSchema'; // Validator providers are type-only here — import the runtime classes from the explicit // `@modelcontextprotocol/{client,server}/validators/{ajv,cf-worker}` subpaths to customise. -export type { AjvJsonSchemaValidator } from '../../validators/ajvProvider.js'; -export type { CfWorkerJsonSchemaValidator, CfWorkerSchemaDraft } from '../../validators/cfWorkerProvider.js'; +export type { AjvJsonSchemaValidator } from '../../validators/ajvProvider'; +export type { CfWorkerJsonSchemaValidator, CfWorkerSchemaDraft } from '../../validators/cfWorkerProvider'; // fromJsonSchema is intentionally NOT exported here — the server and client packages // provide runtime-aware wrappers that default to the appropriate validator via _shims. -export type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from '../../validators/types.js'; +export type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from '../../validators/types'; diff --git a/packages/core/src/exports/types/index.ts b/packages/core/src/exports/types/index.ts index b957a8874c..cfd18a47ce 100644 --- a/packages/core/src/exports/types/index.ts +++ b/packages/core/src/exports/types/index.ts @@ -1 +1 @@ -export type * from '../../types/index.js'; +export type * from '../../types/index'; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index a704267ee3..940ab08187 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,22 +1,22 @@ -export * from './auth/errors.js'; -export * from './errors/sdkErrors.js'; -export * from './shared/auth.js'; -export * from './shared/authUtils.js'; -export * from './shared/metadataUtils.js'; -export * from './shared/protocol.js'; -export * from './shared/stdio.js'; -export * from './shared/toolNameValidation.js'; -export * from './shared/transport.js'; -export * from './shared/uriTemplate.js'; -export * from './types/index.js'; -export * from './util/inMemory.js'; -export * from './util/schema.js'; -export * from './util/standardSchema.js'; -export * from './util/zodCompat.js'; +export * from './auth/errors'; +export * from './errors/sdkErrors'; +export * from './shared/auth'; +export * from './shared/authUtils'; +export * from './shared/metadataUtils'; +export * from './shared/protocol'; +export * from './shared/stdio'; +export * from './shared/toolNameValidation'; +export * from './shared/transport'; +export * from './shared/uriTemplate'; +export * from './types/index'; +export * from './util/inMemory'; +export * from './util/schema'; +export * from './util/standardSchema'; +export * from './util/zodCompat'; // Validator providers are type-only here — import the runtime classes from the explicit // `@modelcontextprotocol/{core,client,server}/validators/{ajv,cf-worker}` subpaths to customise. -export type { AjvJsonSchemaValidator } from './validators/ajvProvider.js'; -export type { CfWorkerJsonSchemaValidator, CfWorkerSchemaDraft } from './validators/cfWorkerProvider.js'; -export * from './validators/fromJsonSchema.js'; -export type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from './validators/types.js'; +export type { AjvJsonSchemaValidator } from './validators/ajvProvider'; +export type { CfWorkerJsonSchemaValidator, CfWorkerSchemaDraft } from './validators/cfWorkerProvider'; +export * from './validators/fromJsonSchema'; +export type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from './validators/types'; diff --git a/packages/core/src/shared/metadataUtils.ts b/packages/core/src/shared/metadataUtils.ts index 1b11660e86..0836b4394a 100644 --- a/packages/core/src/shared/metadataUtils.ts +++ b/packages/core/src/shared/metadataUtils.ts @@ -1,4 +1,4 @@ -import type { BaseMetadata } from '../types/index.js'; +import type { BaseMetadata } from '../types/index'; /** * Utilities for working with {@linkcode BaseMetadata} objects. diff --git a/packages/core/src/shared/protocol.examples.ts b/packages/core/src/shared/protocol.examples.ts index ba3a701a2f..0ae10e6d08 100644 --- a/packages/core/src/shared/protocol.examples.ts +++ b/packages/core/src/shared/protocol.examples.ts @@ -9,7 +9,7 @@ import * as z from 'zod/v4'; -import type { BaseContext, Protocol } from './protocol.js'; +import type { BaseContext, Protocol } from './protocol'; /** * Example: registering a handler for a custom (non-spec) request method. diff --git a/packages/core/src/shared/protocol.ts b/packages/core/src/shared/protocol.ts index 16d2181018..3b7efec2a4 100644 --- a/packages/core/src/shared/protocol.ts +++ b/packages/core/src/shared/protocol.ts @@ -1,4 +1,4 @@ -import { SdkError, SdkErrorCode } from '../errors/sdkErrors.js'; +import { SdkError, SdkErrorCode } from '../errors/sdkErrors'; import type { AuthInfo, CancelledNotification, @@ -29,7 +29,7 @@ import type { Result, ResultTypeMap, ServerCapabilities -} from '../types/index.js'; +} from '../types/index'; import { getNotificationSchema, getRequestSchema, @@ -41,10 +41,10 @@ import { ProtocolError, ProtocolErrorCode, SUPPORTED_PROTOCOL_VERSIONS -} from '../types/index.js'; -import type { StandardSchemaV1 } from '../util/standardSchema.js'; -import { isStandardSchema, validateStandardSchema } from '../util/standardSchema.js'; -import type { Transport, TransportSendOptions } from './transport.js'; +} from '../types/index'; +import type { StandardSchemaV1 } from '../util/standardSchema'; +import { isStandardSchema, validateStandardSchema } from '../util/standardSchema'; +import type { Transport, TransportSendOptions } from './transport'; /** * Callback for progress notifications. diff --git a/packages/core/src/shared/stdio.ts b/packages/core/src/shared/stdio.ts index ffadff6c86..8bd794b87b 100644 --- a/packages/core/src/shared/stdio.ts +++ b/packages/core/src/shared/stdio.ts @@ -1,5 +1,5 @@ -import type { JSONRPCMessage } from '../types/index.js'; -import { JSONRPCMessageSchema } from '../types/index.js'; +import type { JSONRPCMessage } from '../types/index'; +import { JSONRPCMessageSchema } from '../types/index'; export const STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024; diff --git a/packages/core/src/shared/transport.ts b/packages/core/src/shared/transport.ts index c606e2e3b5..ddca2f7992 100644 --- a/packages/core/src/shared/transport.ts +++ b/packages/core/src/shared/transport.ts @@ -1,4 +1,4 @@ -import type { JSONRPCMessage, MessageExtraInfo, RequestId } from '../types/index.js'; +import type { JSONRPCMessage, MessageExtraInfo, RequestId } from '../types/index'; export type FetchLike = (url: string | URL, init?: RequestInit) => Promise; diff --git a/packages/core/src/types/errors.ts b/packages/core/src/types/errors.ts index a175686d13..3d3654d46f 100644 --- a/packages/core/src/types/errors.ts +++ b/packages/core/src/types/errors.ts @@ -1,5 +1,5 @@ -import { ProtocolErrorCode } from './enums.js'; -import type { ElicitRequestURLParams, UnsupportedProtocolVersionErrorData } from './types.js'; +import { ProtocolErrorCode } from './enums'; +import type { ElicitRequestURLParams, UnsupportedProtocolVersionErrorData } from './types'; /** * Protocol errors are JSON-RPC errors that cross the wire as error responses. diff --git a/packages/core/src/types/guards.ts b/packages/core/src/types/guards.ts index f385b91b42..3bd069b0d8 100644 --- a/packages/core/src/types/guards.ts +++ b/packages/core/src/types/guards.ts @@ -9,7 +9,7 @@ import { JSONRPCResponseSchema, JSONRPCResultResponseSchema, TaskAugmentedRequestParamsSchema -} from './schemas.js'; +} from './schemas'; import type { CallToolResult, CompleteRequest, @@ -24,7 +24,7 @@ import type { JSONRPCResponse, JSONRPCResultResponse, TaskAugmentedRequestParams -} from './types.js'; +} from './types'; /** * Validates and parses an unknown value as a JSON-RPC message. diff --git a/packages/core/src/types/index.ts b/packages/core/src/types/index.ts index c150aea737..bbb00b1e73 100644 --- a/packages/core/src/types/index.ts +++ b/packages/core/src/types/index.ts @@ -1,9 +1,9 @@ // Internal barrel — re-exports everything for use within the SDK packages. // The public API is defined in @modelcontextprotocol/core/public (see exports/public/index.ts). -export * from './constants.js'; -export * from './enums.js'; -export * from './errors.js'; -export * from './guards.js'; -export * from './schemas.js'; -export * from './specTypeSchema.js'; -export * from './types.js'; +export * from './constants'; +export * from './enums'; +export * from './errors'; +export * from './guards'; +export * from './schemas'; +export * from './specTypeSchema'; +export * from './types'; diff --git a/packages/core/src/types/schemas.ts b/packages/core/src/types/schemas.ts index fe850284e2..3c942256fd 100644 --- a/packages/core/src/types/schemas.ts +++ b/packages/core/src/types/schemas.ts @@ -7,7 +7,7 @@ import { LOG_LEVEL_META_KEY, PROTOCOL_VERSION_META_KEY, RELATED_TASK_META_KEY -} from './constants.js'; +} from './constants'; import type { JSONArray, JSONObject, @@ -17,7 +17,7 @@ import type { RequestMethod, RequestTypeMap, ResultTypeMap -} from './types.js'; +} from './types'; export const JSONValueSchema: z.ZodType = z.lazy(() => z.union([z.string(), z.number(), z.boolean(), z.null(), z.record(z.string(), JSONValueSchema), z.array(JSONValueSchema)]) diff --git a/packages/core/src/types/specTypeSchema.examples.ts b/packages/core/src/types/specTypeSchema.examples.ts index 8e991d4f94..c05f65e62d 100644 --- a/packages/core/src/types/specTypeSchema.examples.ts +++ b/packages/core/src/types/specTypeSchema.examples.ts @@ -7,7 +7,7 @@ * @module */ -import { isSpecType, specTypeSchemas } from './specTypeSchema.js'; +import { isSpecType, specTypeSchemas } from './specTypeSchema'; declare const untrusted: unknown; declare const value: unknown; diff --git a/packages/core/src/types/specTypeSchema.ts b/packages/core/src/types/specTypeSchema.ts index e538da8fa5..927e3790d6 100644 --- a/packages/core/src/types/specTypeSchema.ts +++ b/packages/core/src/types/specTypeSchema.ts @@ -12,9 +12,9 @@ import { OAuthTokensSchema, OpenIdProviderDiscoveryMetadataSchema, OpenIdProviderMetadataSchema -} from '../shared/auth.js'; -import type { StandardSchemaV1, StandardSchemaV1Sync } from '../util/standardSchema.js'; -import * as schemas from './schemas.js'; +} from '../shared/auth'; +import type { StandardSchemaV1, StandardSchemaV1Sync } from '../util/standardSchema'; +import * as schemas from './schemas'; /** * Explicit allowlist of protocol Zod schemas that correspond to a public spec type in `types.ts`. diff --git a/packages/core/src/types/types.ts b/packages/core/src/types/types.ts index e0fe28b500..9abc68f79e 100644 --- a/packages/core/src/types/types.ts +++ b/packages/core/src/types/types.ts @@ -4,7 +4,7 @@ import type * as z from 'zod/v4'; -import type { INTERNAL_ERROR, INVALID_PARAMS, INVALID_REQUEST, METHOD_NOT_FOUND, PARSE_ERROR } from './constants.js'; +import type { INTERNAL_ERROR, INVALID_PARAMS, INVALID_REQUEST, METHOD_NOT_FOUND, PARSE_ERROR } from './constants'; import type { AnnotationsSchema, AudioContentSchema, @@ -159,7 +159,7 @@ import type { UnsubscribeRequestSchema, UntitledMultiSelectEnumSchemaSchema, UntitledSingleSelectEnumSchemaSchema -} from './schemas.js'; +} from './schemas'; /* JSON types */ export type JSONValue = string | number | boolean | null | JSONObject | JSONArray; diff --git a/packages/core/src/util/inMemory.ts b/packages/core/src/util/inMemory.ts index 4e79932094..3afd2b1ac7 100644 --- a/packages/core/src/util/inMemory.ts +++ b/packages/core/src/util/inMemory.ts @@ -1,6 +1,6 @@ -import { SdkError, SdkErrorCode } from '../errors/sdkErrors.js'; -import type { Transport } from '../shared/transport.js'; -import type { AuthInfo, JSONRPCMessage, RequestId } from '../types/index.js'; +import { SdkError, SdkErrorCode } from '../errors/sdkErrors'; +import type { Transport } from '../shared/transport'; +import type { AuthInfo, JSONRPCMessage, RequestId } from '../types/index'; interface QueuedMessage { message: JSONRPCMessage; diff --git a/packages/core/src/util/zodCompat.ts b/packages/core/src/util/zodCompat.ts index 3bb208809c..249dba5154 100644 --- a/packages/core/src/util/zodCompat.ts +++ b/packages/core/src/util/zodCompat.ts @@ -6,8 +6,8 @@ import * as z from 'zod/v4'; -import type { StandardSchemaWithJSON } from './standardSchema.js'; -import { isStandardSchema } from './standardSchema.js'; +import type { StandardSchemaWithJSON } from './standardSchema'; +import { isStandardSchema } from './standardSchema'; function isZodV4Schema(v: unknown): v is z.ZodType { // `_zod` is the v4 internal namespace property. Zod v3 schemas have `_def` diff --git a/packages/core/src/validators/ajvProvider.examples.ts b/packages/core/src/validators/ajvProvider.examples.ts index abf8d1572a..923d5a68ba 100644 --- a/packages/core/src/validators/ajvProvider.examples.ts +++ b/packages/core/src/validators/ajvProvider.examples.ts @@ -7,7 +7,7 @@ * @module */ -import { addFormats, Ajv, AjvJsonSchemaValidator } from './ajvProvider.js'; +import { addFormats, Ajv, AjvJsonSchemaValidator } from './ajvProvider'; /** * Example: Default AJV instance. diff --git a/packages/core/src/validators/ajvProvider.ts b/packages/core/src/validators/ajvProvider.ts index f62a8469ae..23d64dac7c 100644 --- a/packages/core/src/validators/ajvProvider.ts +++ b/packages/core/src/validators/ajvProvider.ts @@ -5,7 +5,7 @@ import { Ajv } from 'ajv'; import _addFormats from 'ajv-formats'; -import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from './types.js'; +import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from './types'; /** Structural subset of the AJV interface used by {@link AjvJsonSchemaValidator}. */ interface AjvLike { diff --git a/packages/core/src/validators/cfWorkerProvider.examples.ts b/packages/core/src/validators/cfWorkerProvider.examples.ts index c166c18dd6..facc971b0c 100644 --- a/packages/core/src/validators/cfWorkerProvider.examples.ts +++ b/packages/core/src/validators/cfWorkerProvider.examples.ts @@ -7,7 +7,7 @@ * @module */ -import { CfWorkerJsonSchemaValidator } from './cfWorkerProvider.js'; +import { CfWorkerJsonSchemaValidator } from './cfWorkerProvider'; /** * Example: Default configuration (draft 2020-12, shortcircuit on). diff --git a/packages/core/src/validators/cfWorkerProvider.ts b/packages/core/src/validators/cfWorkerProvider.ts index 6fcc3d507e..c3cfb34481 100644 --- a/packages/core/src/validators/cfWorkerProvider.ts +++ b/packages/core/src/validators/cfWorkerProvider.ts @@ -10,7 +10,7 @@ import { Validator } from '@cfworker/json-schema'; -import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from './types.js'; +import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from './types'; /** * JSON Schema draft version supported by `@cfworker/json-schema`. diff --git a/packages/core/src/validators/fromJsonSchema.examples.ts b/packages/core/src/validators/fromJsonSchema.examples.ts index af72b5b036..7df661c545 100644 --- a/packages/core/src/validators/fromJsonSchema.examples.ts +++ b/packages/core/src/validators/fromJsonSchema.examples.ts @@ -6,8 +6,8 @@ * @module */ -import { fromJsonSchema } from './fromJsonSchema.js'; -import type { jsonSchemaValidator } from './types.js'; +import { fromJsonSchema } from './fromJsonSchema'; +import type { jsonSchemaValidator } from './types'; declare const validator: jsonSchemaValidator; diff --git a/packages/core/src/validators/fromJsonSchema.ts b/packages/core/src/validators/fromJsonSchema.ts index 4b7a6f11a3..696d1f29e9 100644 --- a/packages/core/src/validators/fromJsonSchema.ts +++ b/packages/core/src/validators/fromJsonSchema.ts @@ -1,5 +1,5 @@ -import type { StandardSchemaV1, StandardSchemaWithJSON } from '../util/standardSchema.js'; -import type { JsonSchemaType, jsonSchemaValidator } from './types.js'; +import type { StandardSchemaV1, StandardSchemaWithJSON } from '../util/standardSchema'; +import type { JsonSchemaType, jsonSchemaValidator } from './types'; /** * Wrap a raw JSON Schema object as a {@linkcode StandardSchemaWithJSON} so it can be diff --git a/packages/core/src/validators/types.examples.ts b/packages/core/src/validators/types.examples.ts index b6cd760695..2066a8aff3 100644 --- a/packages/core/src/validators/types.examples.ts +++ b/packages/core/src/validators/types.examples.ts @@ -7,7 +7,7 @@ * @module */ -import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator } from './types.js'; +import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator } from './types'; // Stub for hypothetical schema validation function declare function isValid(schema: JsonSchemaType, input: unknown): boolean; diff --git a/packages/core/test/errors/sdkHttpError.test.ts b/packages/core/test/errors/sdkHttpError.test.ts index b217483580..421a51d6c6 100644 --- a/packages/core/test/errors/sdkHttpError.test.ts +++ b/packages/core/test/errors/sdkHttpError.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from 'vitest'; -import { SdkError, SdkErrorCode, SdkHttpError } from '../../src/index.js'; +import { SdkError, SdkErrorCode, SdkHttpError } from '../../src/index'; describe('SdkHttpError', () => { it('exposes status and statusText via getters', () => { diff --git a/packages/core/test/inMemory.test.ts b/packages/core/test/inMemory.test.ts index 46332eaa20..0dc72fd32f 100644 --- a/packages/core/test/inMemory.test.ts +++ b/packages/core/test/inMemory.test.ts @@ -1,5 +1,5 @@ -import type { AuthInfo, JSONRPCMessage } from '../src/types/index.js'; -import { InMemoryTransport } from '../src/util/inMemory.js'; +import type { AuthInfo, JSONRPCMessage } from '../src/types/index'; +import { InMemoryTransport } from '../src/util/inMemory'; describe('InMemoryTransport', () => { let clientTransport: InMemoryTransport; diff --git a/packages/core/test/shared/auth.test.ts b/packages/core/test/shared/auth.test.ts index 770e0c4d48..10c9462c9a 100644 --- a/packages/core/test/shared/auth.test.ts +++ b/packages/core/test/shared/auth.test.ts @@ -4,7 +4,7 @@ import { OpenIdProviderMetadataSchema, OptionalSafeUrlSchema, SafeUrlSchema -} from '../../src/shared/auth.js'; +} from '../../src/shared/auth'; describe('SafeUrlSchema', () => { it('accepts valid HTTPS URLs', () => { diff --git a/packages/core/test/shared/authUtils.test.ts b/packages/core/test/shared/authUtils.test.ts index 902cfe41df..312d1809ef 100644 --- a/packages/core/test/shared/authUtils.test.ts +++ b/packages/core/test/shared/authUtils.test.ts @@ -1,4 +1,4 @@ -import { checkResourceAllowed, resourceUrlFromServerUrl } from '../../src/shared/authUtils.js'; +import { checkResourceAllowed, resourceUrlFromServerUrl } from '../../src/shared/authUtils'; describe('auth-utils', () => { describe('resourceUrlFromServerUrl', () => { diff --git a/packages/core/test/shared/customMethods.test.ts b/packages/core/test/shared/customMethods.test.ts index ffee5b9a7d..624d6bfdd1 100644 --- a/packages/core/test/shared/customMethods.test.ts +++ b/packages/core/test/shared/customMethods.test.ts @@ -1,11 +1,11 @@ import { describe, expect, it } from 'vitest'; import { z } from 'zod/v4'; -import { Protocol } from '../../src/shared/protocol.js'; -import type { BaseContext, JSONRPCRequest, Result, StandardSchemaV1 } from '../../src/exports/public/index.js'; -import { ProtocolError } from '../../src/types/index.js'; -import { SdkErrorCode } from '../../src/errors/sdkErrors.js'; -import { InMemoryTransport } from '../../src/util/inMemory.js'; +import { Protocol } from '../../src/shared/protocol'; +import type { BaseContext, JSONRPCRequest, Result, StandardSchemaV1 } from '../../src/exports/public/index'; +import { ProtocolError } from '../../src/types/index'; +import { SdkErrorCode } from '../../src/errors/sdkErrors'; +import { InMemoryTransport } from '../../src/util/inMemory'; class TestProtocol extends Protocol { protected buildContext(ctx: BaseContext): BaseContext { diff --git a/packages/core/test/shared/protocol.test.ts b/packages/core/test/shared/protocol.test.ts index 6e77430d61..6f0eda2912 100644 --- a/packages/core/test/shared/protocol.test.ts +++ b/packages/core/test/shared/protocol.test.ts @@ -3,9 +3,9 @@ import { vi } from 'vitest'; import * as z from 'zod/v4'; import type { ZodType } from 'zod/v4'; -import type { BaseContext } from '../../src/shared/protocol.js'; -import { mergeCapabilities, Protocol } from '../../src/shared/protocol.js'; -import type { Transport, TransportSendOptions } from '../../src/shared/transport.js'; +import type { BaseContext } from '../../src/shared/protocol'; +import { mergeCapabilities, Protocol } from '../../src/shared/protocol'; +import type { Transport, TransportSendOptions } from '../../src/shared/transport'; import type { ClientCapabilities, JSONRPCErrorResponse, @@ -19,9 +19,9 @@ import type { RequestId, Result, ServerCapabilities -} from '../../src/types/index.js'; -import { ProtocolError, ProtocolErrorCode } from '../../src/types/index.js'; -import { SdkError, SdkErrorCode } from '../../src/errors/sdkErrors.js'; +} from '../../src/types/index'; +import { ProtocolError, ProtocolErrorCode } from '../../src/types/index'; +import { SdkError, SdkErrorCode } from '../../src/errors/sdkErrors'; // Test Protocol subclass for testing class TestProtocolImpl extends Protocol { diff --git a/packages/core/test/shared/protocolTransportHandling.test.ts b/packages/core/test/shared/protocolTransportHandling.test.ts index 23e3dad76b..731914265b 100644 --- a/packages/core/test/shared/protocolTransportHandling.test.ts +++ b/packages/core/test/shared/protocolTransportHandling.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, test } from 'vitest'; -import type { BaseContext } from '../../src/shared/protocol.js'; -import { Protocol } from '../../src/shared/protocol.js'; -import type { Transport } from '../../src/shared/transport.js'; -import type { EmptyResult, JSONRPCMessage, Notification, Request, Result } from '../../src/types/index.js'; +import type { BaseContext } from '../../src/shared/protocol'; +import { Protocol } from '../../src/shared/protocol'; +import type { Transport } from '../../src/shared/transport'; +import type { EmptyResult, JSONRPCMessage, Notification, Request, Result } from '../../src/types/index'; // Mock Transport class class MockTransport implements Transport { diff --git a/packages/core/test/shared/stdio.test.ts b/packages/core/test/shared/stdio.test.ts index ec00f1c2f0..f8d27a4c1f 100644 --- a/packages/core/test/shared/stdio.test.ts +++ b/packages/core/test/shared/stdio.test.ts @@ -1,5 +1,5 @@ -import { ReadBuffer, STDIO_DEFAULT_MAX_BUFFER_SIZE } from '../../src/shared/stdio.js'; -import type { JSONRPCMessage } from '../../src/types/index.js'; +import { ReadBuffer, STDIO_DEFAULT_MAX_BUFFER_SIZE } from '../../src/shared/stdio'; +import type { JSONRPCMessage } from '../../src/types/index'; const testMessage: JSONRPCMessage = { jsonrpc: '2.0', diff --git a/packages/core/test/shared/toolNameValidation.test.ts b/packages/core/test/shared/toolNameValidation.test.ts index 131cbbc5f6..5628b731ca 100644 --- a/packages/core/test/shared/toolNameValidation.test.ts +++ b/packages/core/test/shared/toolNameValidation.test.ts @@ -1,7 +1,7 @@ import type { MockInstance } from 'vitest'; import { vi } from 'vitest'; -import { issueToolNameWarning, validateAndWarnToolName, validateToolName } from '../../src/shared/toolNameValidation.js'; +import { issueToolNameWarning, validateAndWarnToolName, validateToolName } from '../../src/shared/toolNameValidation'; // Spy on console.warn to capture output let warnSpy: MockInstance; diff --git a/packages/core/test/shared/traceContextMeta.test.ts b/packages/core/test/shared/traceContextMeta.test.ts index ff8c0bbf9e..312fbca6e3 100644 --- a/packages/core/test/shared/traceContextMeta.test.ts +++ b/packages/core/test/shared/traceContextMeta.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest'; import { z } from 'zod/v4'; -import { Protocol } from '../../src/shared/protocol.js'; -import type { BaseContext } from '../../src/exports/public/index.js'; -import { BAGGAGE_META_KEY, TRACEPARENT_META_KEY, TRACESTATE_META_KEY } from '../../src/exports/public/index.js'; -import { InMemoryTransport } from '../../src/util/inMemory.js'; +import { Protocol } from '../../src/shared/protocol'; +import type { BaseContext } from '../../src/exports/public/index'; +import { BAGGAGE_META_KEY, TRACEPARENT_META_KEY, TRACESTATE_META_KEY } from '../../src/exports/public/index'; +import { InMemoryTransport } from '../../src/util/inMemory'; class TestProtocol extends Protocol { protected buildContext(ctx: BaseContext): BaseContext { diff --git a/packages/core/test/shared/transport.test.ts b/packages/core/test/shared/transport.test.ts index bdef03a5ec..2a17ac0643 100644 --- a/packages/core/test/shared/transport.test.ts +++ b/packages/core/test/shared/transport.test.ts @@ -1,4 +1,4 @@ -import { createFetchWithInit, type FetchLike, normalizeHeaders } from '../../src/shared/transport.js'; +import { createFetchWithInit, type FetchLike, normalizeHeaders } from '../../src/shared/transport'; describe('normalizeHeaders', () => { test('returns empty object for undefined', () => { diff --git a/packages/core/test/shared/uriTemplate.test.ts b/packages/core/test/shared/uriTemplate.test.ts index 3954901c4f..bfc3237872 100644 --- a/packages/core/test/shared/uriTemplate.test.ts +++ b/packages/core/test/shared/uriTemplate.test.ts @@ -1,4 +1,4 @@ -import { UriTemplate } from '../../src/shared/uriTemplate.js'; +import { UriTemplate } from '../../src/shared/uriTemplate'; describe('UriTemplate', () => { describe('isTemplate', () => { diff --git a/packages/core/test/shared/wrapHandler.test.ts b/packages/core/test/shared/wrapHandler.test.ts index 452b58194f..06a5045ecd 100644 --- a/packages/core/test/shared/wrapHandler.test.ts +++ b/packages/core/test/shared/wrapHandler.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; -import { Protocol } from '../../src/shared/protocol.js'; -import type { BaseContext, JSONRPCRequest, Result } from '../../src/exports/public/index.js'; +import { Protocol } from '../../src/shared/protocol'; +import type { BaseContext, JSONRPCRequest, Result } from '../../src/exports/public/index'; class TestProtocol extends Protocol { protected buildContext(ctx: BaseContext): BaseContext { diff --git a/packages/core/test/spec.types.2025-11-25.test.ts b/packages/core/test/spec.types.2025-11-25.test.ts index bf0903cd1a..ad3fec3f92 100644 --- a/packages/core/test/spec.types.2025-11-25.test.ts +++ b/packages/core/test/spec.types.2025-11-25.test.ts @@ -12,8 +12,8 @@ import fs from 'node:fs'; import path from 'node:path'; -import type * as SpecTypes from '../src/types/spec.types.2025-11-25.js'; -import type * as SDKTypes from '../src/types/index.js'; +import type * as SpecTypes from '../src/types/spec.types.2025-11-25'; +import type * as SDKTypes from '../src/types/index'; /* eslint-disable @typescript-eslint/no-unused-vars */ diff --git a/packages/core/test/spec.types.2026-07-28.test.ts b/packages/core/test/spec.types.2026-07-28.test.ts index 064221963a..7360f2dc79 100644 --- a/packages/core/test/spec.types.2026-07-28.test.ts +++ b/packages/core/test/spec.types.2026-07-28.test.ts @@ -18,16 +18,16 @@ import { LATEST_PROTOCOL_VERSION, MISSING_REQUIRED_CLIENT_CAPABILITY, UNSUPPORTED_PROTOCOL_VERSION -} from '../src/types/spec.types.2026-07-28.js'; -import type * as SpecTypes from '../src/types/spec.types.2026-07-28.js'; -import type * as SDKTypes from '../src/types/index.js'; +} from '../src/types/spec.types.2026-07-28'; +import type * as SpecTypes from '../src/types/spec.types.2026-07-28'; +import type * as SDKTypes from '../src/types/index'; import { CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, LOG_LEVEL_META_KEY, PROTOCOL_VERSION_META_KEY, ProtocolErrorCode -} from '../src/types/index.js'; +} from '../src/types/index'; /* eslint-disable @typescript-eslint/no-unused-vars */ diff --git a/packages/core/test/types.capabilities.test.ts b/packages/core/test/types.capabilities.test.ts index 1f66184525..18e7d9745c 100644 --- a/packages/core/test/types.capabilities.test.ts +++ b/packages/core/test/types.capabilities.test.ts @@ -1,4 +1,4 @@ -import { ClientCapabilitiesSchema, InitializeRequestParamsSchema } from '../src/types/index.js'; +import { ClientCapabilitiesSchema, InitializeRequestParamsSchema } from '../src/types/index'; describe('ClientCapabilitiesSchema backwards compatibility', () => { describe('ElicitationCapabilitySchema preprocessing', () => { diff --git a/packages/core/test/types.test.ts b/packages/core/test/types.test.ts index a92615bceb..c6c2b5c413 100644 --- a/packages/core/test/types.test.ts +++ b/packages/core/test/types.test.ts @@ -27,7 +27,7 @@ import { ToolResultContentSchema, ToolSchema, ToolUseContentSchema -} from '../src/types/index.js'; +} from '../src/types/index'; describe('Types', () => { test('should have correct latest protocol version', () => { diff --git a/packages/core/test/types/errors.test.ts b/packages/core/test/types/errors.test.ts index b908dfb397..1072537d97 100644 --- a/packages/core/test/types/errors.test.ts +++ b/packages/core/test/types/errors.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; -import { ProtocolErrorCode } from '../../src/types/enums.js'; -import { ProtocolError, UnsupportedProtocolVersionError } from '../../src/types/errors.js'; +import { ProtocolErrorCode } from '../../src/types/enums'; +import { ProtocolError, UnsupportedProtocolVersionError } from '../../src/types/errors'; describe('UnsupportedProtocolVersionError', () => { const data = { supported: ['2025-11-25', '2025-06-18'], requested: '2026-07-28' }; diff --git a/packages/core/test/types/guards.test.ts b/packages/core/test/types/guards.test.ts index 117e9ecda7..fe96b64dd3 100644 --- a/packages/core/test/types/guards.test.ts +++ b/packages/core/test/types/guards.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest'; -import { JSONRPC_VERSION } from '../../src/types/constants.js'; -import { isCallToolResult, isJSONRPCErrorResponse, isJSONRPCResponse, isJSONRPCResultResponse } from '../../src/types/guards.js'; +import { JSONRPC_VERSION } from '../../src/types/constants'; +import { isCallToolResult, isJSONRPCErrorResponse, isJSONRPCResponse, isJSONRPCResultResponse } from '../../src/types/guards'; describe('isJSONRPCResponse', () => { it('returns true for a valid result response', () => { diff --git a/packages/core/test/types/specTypeSchema.test.ts b/packages/core/test/types/specTypeSchema.test.ts index 198e104f9f..5605b2d48a 100644 --- a/packages/core/test/types/specTypeSchema.test.ts +++ b/packages/core/test/types/specTypeSchema.test.ts @@ -1,9 +1,9 @@ import { describe, expect, expectTypeOf, it } from 'vitest'; -import type { OAuthMetadata, OAuthTokens } from '../../src/shared/auth.js'; -import * as schemas from '../../src/types/schemas.js'; -import type { SpecTypeName, SpecTypes } from '../../src/types/specTypeSchema.js'; -import { isSpecType, specTypeSchemas } from '../../src/types/specTypeSchema.js'; +import type { OAuthMetadata, OAuthTokens } from '../../src/shared/auth'; +import * as schemas from '../../src/types/schemas'; +import type { SpecTypeName, SpecTypes } from '../../src/types/specTypeSchema'; +import { isSpecType, specTypeSchemas } from '../../src/types/specTypeSchema'; import type { CallToolResult, ContentBlock, @@ -13,7 +13,7 @@ import type { JSONValue, ResourceTemplateType, Tool -} from '../../src/types/types.js'; +} from '../../src/types/types'; describe('specTypeSchemas', () => { it('returns a StandardSchemaV1Sync validator that accepts valid values', () => { diff --git a/packages/core/test/util/standardSchema.test.ts b/packages/core/test/util/standardSchema.test.ts index 6c3de99d77..8856592ff0 100644 --- a/packages/core/test/util/standardSchema.test.ts +++ b/packages/core/test/util/standardSchema.test.ts @@ -1,6 +1,6 @@ import * as z from 'zod/v4'; -import { standardSchemaToJsonSchema } from '../../src/util/standardSchema.js'; +import { standardSchemaToJsonSchema } from '../../src/util/standardSchema'; describe('standardSchemaToJsonSchema', () => { test('emits type:object for plain z.object schemas', () => { diff --git a/packages/core/test/util/standardSchema.zodFallback.test.ts b/packages/core/test/util/standardSchema.zodFallback.test.ts index d825a3271d..f8862b08a3 100644 --- a/packages/core/test/util/standardSchema.zodFallback.test.ts +++ b/packages/core/test/util/standardSchema.zodFallback.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest'; import * as z from 'zod/v4'; -import { standardSchemaToJsonSchema } from '../../src/util/standardSchema.js'; +import { standardSchemaToJsonSchema } from '../../src/util/standardSchema'; type SchemaArg = Parameters[0]; diff --git a/packages/core/test/util/zodCompat.test.ts b/packages/core/test/util/zodCompat.test.ts index cf48be3d3b..5bdc229298 100644 --- a/packages/core/test/util/zodCompat.test.ts +++ b/packages/core/test/util/zodCompat.test.ts @@ -1,8 +1,8 @@ import { vi } from 'vitest'; import * as z from 'zod/v4'; -import { standardSchemaToJsonSchema } from '../../src/util/standardSchema.js'; -import { isZodRawShape, normalizeRawShapeSchema } from '../../src/util/zodCompat.js'; +import { standardSchemaToJsonSchema } from '../../src/util/standardSchema'; +import { isZodRawShape, normalizeRawShapeSchema } from '../../src/util/zodCompat'; describe('isZodRawShape', () => { test('treats empty object as a raw shape (matches v1)', () => { diff --git a/packages/core/test/validators/validators.test.ts b/packages/core/test/validators/validators.test.ts index 6c543cb058..7ffb4d16dc 100644 --- a/packages/core/test/validators/validators.test.ts +++ b/packages/core/test/validators/validators.test.ts @@ -9,9 +9,9 @@ import path from 'node:path'; import { vi } from 'vitest'; -import { AjvJsonSchemaValidator } from '../../src/validators/ajvProvider.js'; -import { CfWorkerJsonSchemaValidator } from '../../src/validators/cfWorkerProvider.js'; -import type { JsonSchemaType } from '../../src/validators/types.js'; +import { AjvJsonSchemaValidator } from '../../src/validators/ajvProvider'; +import { CfWorkerJsonSchemaValidator } from '../../src/validators/cfWorkerProvider'; +import type { JsonSchemaType } from '../../src/validators/types'; // Test with both AJV and CfWorker validators // AJV validator will use default configuration with format validation enabled @@ -554,7 +554,7 @@ describe('Missing dependencies', () => { }); // Attempting to import ajv-provider should fail - await expect(import('../../src/validators/ajvProvider.js')).rejects.toThrow(); + await expect(import('../../src/validators/ajvProvider')).rejects.toThrow(); }); it('should be able to import cfWorkerProvider when ajv is missing', async () => { @@ -568,7 +568,7 @@ describe('Missing dependencies', () => { }); // But cfWorkerProvider should import successfully - const cfworkerModule = await import('../../src/validators/cfWorkerProvider.js'); + const cfworkerModule = await import('../../src/validators/cfWorkerProvider'); expect(cfworkerModule.CfWorkerJsonSchemaValidator).toBeDefined(); // And should work correctly @@ -595,7 +595,7 @@ describe('Missing dependencies', () => { }); // Attempting to import cfWorkerProvider should fail - await expect(import('../../src/validators/cfWorkerProvider.js')).rejects.toThrow(); + await expect(import('../../src/validators/cfWorkerProvider')).rejects.toThrow(); }); it('should be able to import ajv-provider when @cfworker/json-schema is missing', async () => { @@ -605,7 +605,7 @@ describe('Missing dependencies', () => { }); // But ajv-provider should import successfully - const ajvModule = await import('../../src/validators/ajvProvider.js'); + const ajvModule = await import('../../src/validators/ajvProvider'); expect(ajvModule.AjvJsonSchemaValidator).toBeDefined(); // And should work correctly diff --git a/packages/middleware/express/src/auth/bearerAuth.ts b/packages/middleware/express/src/auth/bearerAuth.ts index 5f46be792e..b2230e0bb6 100644 --- a/packages/middleware/express/src/auth/bearerAuth.ts +++ b/packages/middleware/express/src/auth/bearerAuth.ts @@ -1,7 +1,7 @@ import { OAuthError, OAuthErrorCode } from '@modelcontextprotocol/server'; import type { RequestHandler } from 'express'; -import type { OAuthTokenVerifier } from './types.js'; +import type { OAuthTokenVerifier } from './types'; /** * Options for {@link requireBearerAuth}. diff --git a/packages/middleware/express/src/express.examples.ts b/packages/middleware/express/src/express.examples.ts index 8d3f8e2ffc..42daa70064 100644 --- a/packages/middleware/express/src/express.examples.ts +++ b/packages/middleware/express/src/express.examples.ts @@ -7,7 +7,7 @@ * @module */ -import { createMcpExpressApp } from './express.js'; +import { createMcpExpressApp } from './express'; /** * Example: Basic usage with default DNS rebinding protection. diff --git a/packages/middleware/express/src/express.ts b/packages/middleware/express/src/express.ts index 252502952b..f987e1f193 100644 --- a/packages/middleware/express/src/express.ts +++ b/packages/middleware/express/src/express.ts @@ -1,7 +1,7 @@ import type { Express } from 'express'; import express from 'express'; -import { hostHeaderValidation, localhostHostValidation } from './middleware/hostHeaderValidation.js'; +import { hostHeaderValidation, localhostHostValidation } from './middleware/hostHeaderValidation'; /** * Options for creating an MCP Express application. diff --git a/packages/middleware/express/src/index.ts b/packages/middleware/express/src/index.ts index d2742ce782..cee0a8ef77 100644 --- a/packages/middleware/express/src/index.ts +++ b/packages/middleware/express/src/index.ts @@ -1,9 +1,9 @@ -export * from './express.js'; -export * from './middleware/hostHeaderValidation.js'; +export * from './express'; +export * from './middleware/hostHeaderValidation'; // OAuth Resource-Server glue: bearer-token middleware + PRM/AS metadata router. -export type { BearerAuthMiddlewareOptions } from './auth/bearerAuth.js'; -export { requireBearerAuth } from './auth/bearerAuth.js'; -export type { AuthMetadataOptions } from './auth/metadataRouter.js'; -export { getOAuthProtectedResourceMetadataUrl, mcpAuthMetadataRouter } from './auth/metadataRouter.js'; -export type { OAuthTokenVerifier } from './auth/types.js'; +export type { BearerAuthMiddlewareOptions } from './auth/bearerAuth'; +export { requireBearerAuth } from './auth/bearerAuth'; +export type { AuthMetadataOptions } from './auth/metadataRouter'; +export { getOAuthProtectedResourceMetadataUrl, mcpAuthMetadataRouter } from './auth/metadataRouter'; +export type { OAuthTokenVerifier } from './auth/types'; diff --git a/packages/middleware/express/src/middleware/hostHeaderValidation.examples.ts b/packages/middleware/express/src/middleware/hostHeaderValidation.examples.ts index 2e00f48b65..0e0ca43549 100644 --- a/packages/middleware/express/src/middleware/hostHeaderValidation.examples.ts +++ b/packages/middleware/express/src/middleware/hostHeaderValidation.examples.ts @@ -9,7 +9,7 @@ import type { Express } from 'express'; -import { hostHeaderValidation, localhostHostValidation } from './hostHeaderValidation.js'; +import { hostHeaderValidation, localhostHostValidation } from './hostHeaderValidation'; /** * Example: Using hostHeaderValidation middleware with custom allowed hosts. diff --git a/packages/middleware/express/test/auth/resourceServer.test.ts b/packages/middleware/express/test/auth/resourceServer.test.ts index e9ab4b617c..1214556e5e 100644 --- a/packages/middleware/express/test/auth/resourceServer.test.ts +++ b/packages/middleware/express/test/auth/resourceServer.test.ts @@ -6,9 +6,9 @@ import supertest from 'supertest'; import type { Mock } from 'vitest'; import { vi } from 'vitest'; -import type { OAuthTokenVerifier } from '../../src/auth/types.js'; -import { requireBearerAuth } from '../../src/auth/bearerAuth.js'; -import { getOAuthProtectedResourceMetadataUrl, mcpAuthMetadataRouter } from '../../src/auth/metadataRouter.js'; +import type { OAuthTokenVerifier } from '../../src/auth/types'; +import { requireBearerAuth } from '../../src/auth/bearerAuth'; +import { getOAuthProtectedResourceMetadataUrl, mcpAuthMetadataRouter } from '../../src/auth/metadataRouter'; // --------------------------------------------------------------------------- // requireBearerAuth diff --git a/packages/middleware/express/test/express.test.ts b/packages/middleware/express/test/express.test.ts index f4be9f998f..8f44ce0ee3 100644 --- a/packages/middleware/express/test/express.test.ts +++ b/packages/middleware/express/test/express.test.ts @@ -1,8 +1,8 @@ import type { NextFunction, Request, Response } from 'express'; import { vi } from 'vitest'; -import { createMcpExpressApp } from '../src/express.js'; -import { hostHeaderValidation, localhostHostValidation } from '../src/middleware/hostHeaderValidation.js'; +import { createMcpExpressApp } from '../src/express'; +import { hostHeaderValidation, localhostHostValidation } from '../src/middleware/hostHeaderValidation'; // Helper to create mock Express request/response/next function createMockReqResNext(host?: string) { diff --git a/packages/middleware/fastify/src/fastify.examples.ts b/packages/middleware/fastify/src/fastify.examples.ts index 36353ced7c..f3bd0318e8 100644 --- a/packages/middleware/fastify/src/fastify.examples.ts +++ b/packages/middleware/fastify/src/fastify.examples.ts @@ -7,7 +7,7 @@ * @module */ -import { createMcpFastifyApp } from './fastify.js'; +import { createMcpFastifyApp } from './fastify'; /** * Example: Basic usage with default DNS rebinding protection. diff --git a/packages/middleware/fastify/src/fastify.ts b/packages/middleware/fastify/src/fastify.ts index 33c03dc808..201350cc44 100644 --- a/packages/middleware/fastify/src/fastify.ts +++ b/packages/middleware/fastify/src/fastify.ts @@ -1,7 +1,7 @@ import type { FastifyInstance } from 'fastify'; import Fastify from 'fastify'; -import { hostHeaderValidation, localhostHostValidation } from './middleware/hostHeaderValidation.js'; +import { hostHeaderValidation, localhostHostValidation } from './middleware/hostHeaderValidation'; /** * Options for creating an MCP Fastify application. diff --git a/packages/middleware/fastify/src/index.ts b/packages/middleware/fastify/src/index.ts index 5c852617bb..12b5db4c70 100644 --- a/packages/middleware/fastify/src/index.ts +++ b/packages/middleware/fastify/src/index.ts @@ -1,2 +1,2 @@ -export * from './fastify.js'; -export * from './middleware/hostHeaderValidation.js'; +export * from './fastify'; +export * from './middleware/hostHeaderValidation'; diff --git a/packages/middleware/fastify/src/middleware/hostHeaderValidation.examples.ts b/packages/middleware/fastify/src/middleware/hostHeaderValidation.examples.ts index cbf6645840..c1d35a77d8 100644 --- a/packages/middleware/fastify/src/middleware/hostHeaderValidation.examples.ts +++ b/packages/middleware/fastify/src/middleware/hostHeaderValidation.examples.ts @@ -9,7 +9,7 @@ import type { FastifyInstance } from 'fastify'; -import { hostHeaderValidation, localhostHostValidation } from './hostHeaderValidation.js'; +import { hostHeaderValidation, localhostHostValidation } from './hostHeaderValidation'; /** * Example: Using hostHeaderValidation hook with custom allowed hosts. diff --git a/packages/middleware/fastify/test/fastify.test.ts b/packages/middleware/fastify/test/fastify.test.ts index a64e920934..d4a007bc3d 100644 --- a/packages/middleware/fastify/test/fastify.test.ts +++ b/packages/middleware/fastify/test/fastify.test.ts @@ -1,7 +1,7 @@ import Fastify from 'fastify'; -import { createMcpFastifyApp } from '../src/fastify.js'; -import { hostHeaderValidation, localhostHostValidation } from '../src/middleware/hostHeaderValidation.js'; +import { createMcpFastifyApp } from '../src/fastify'; +import { hostHeaderValidation, localhostHostValidation } from '../src/middleware/hostHeaderValidation'; describe('@modelcontextprotocol/fastify', () => { describe('hostHeaderValidation', () => { diff --git a/packages/middleware/hono/src/hono.ts b/packages/middleware/hono/src/hono.ts index eda3e5d8fa..22ee24da33 100644 --- a/packages/middleware/hono/src/hono.ts +++ b/packages/middleware/hono/src/hono.ts @@ -1,7 +1,7 @@ import type { Context } from 'hono'; import { Hono } from 'hono'; -import { hostHeaderValidation, localhostHostValidation } from './middleware/hostHeaderValidation.js'; +import { hostHeaderValidation, localhostHostValidation } from './middleware/hostHeaderValidation'; /** * Options for creating an MCP Hono application. diff --git a/packages/middleware/hono/src/index.ts b/packages/middleware/hono/src/index.ts index a8c65a2e98..404c2fc2a2 100644 --- a/packages/middleware/hono/src/index.ts +++ b/packages/middleware/hono/src/index.ts @@ -1,2 +1,2 @@ -export * from './hono.js'; -export * from './middleware/hostHeaderValidation.js'; +export * from './hono'; +export * from './middleware/hostHeaderValidation'; diff --git a/packages/middleware/hono/test/hono.test.ts b/packages/middleware/hono/test/hono.test.ts index a080f1ffb1..1c743277b0 100644 --- a/packages/middleware/hono/test/hono.test.ts +++ b/packages/middleware/hono/test/hono.test.ts @@ -2,8 +2,8 @@ import type { Context } from 'hono'; import { Hono } from 'hono'; import { vi } from 'vitest'; -import { createMcpHonoApp } from '../src/hono.js'; -import { hostHeaderValidation } from '../src/middleware/hostHeaderValidation.js'; +import { createMcpHonoApp } from '../src/hono'; +import { hostHeaderValidation } from '../src/middleware/hostHeaderValidation'; describe('@modelcontextprotocol/hono', () => { test('hostHeaderValidation blocks invalid Host and allows valid Host', async () => { diff --git a/packages/middleware/node/package.json b/packages/middleware/node/package.json index 30fa7ed663..9d6ed525d9 100644 --- a/packages/middleware/node/package.json +++ b/packages/middleware/node/package.json @@ -46,9 +46,7 @@ "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../../.prettierignore --write .", "check": "pnpm run typecheck && pnpm run lint", "test": "vitest run", - "test:watch": "vitest", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "test:watch": "vitest" }, "dependencies": { "@hono/node-server": "catalog:runtimeServerOnly" @@ -76,7 +74,6 @@ "eslint-plugin-n": "catalog:devTools", "prettier": "catalog:devTools", "tsdown": "catalog:devTools", - "tsx": "catalog:devTools", "typescript": "catalog:devTools", "typescript-eslint": "catalog:devTools", "vitest": "catalog:devTools" diff --git a/packages/middleware/node/src/index.ts b/packages/middleware/node/src/index.ts index 2e0d3c9950..8b4deabb55 100644 --- a/packages/middleware/node/src/index.ts +++ b/packages/middleware/node/src/index.ts @@ -1 +1 @@ -export * from './streamableHttp.js'; +export * from './streamableHttp'; diff --git a/packages/middleware/node/src/streamableHttp.examples.ts b/packages/middleware/node/src/streamableHttp.examples.ts index fb4bef8417..4ac8778c92 100644 --- a/packages/middleware/node/src/streamableHttp.examples.ts +++ b/packages/middleware/node/src/streamableHttp.examples.ts @@ -12,7 +12,7 @@ import type { IncomingMessage, ServerResponse } from 'node:http'; import { McpServer } from '@modelcontextprotocol/server'; -import { NodeStreamableHTTPServerTransport } from './streamableHttp.js'; +import { NodeStreamableHTTPServerTransport } from './streamableHttp'; /** * Example: Stateful Streamable HTTP transport (Node.js). diff --git a/packages/middleware/node/test/streamableHttp.test.ts b/packages/middleware/node/test/streamableHttp.test.ts index c427aa2eea..e56166a279 100644 --- a/packages/middleware/node/test/streamableHttp.test.ts +++ b/packages/middleware/node/test/streamableHttp.test.ts @@ -18,7 +18,7 @@ import { listenOnRandomPort } from '@modelcontextprotocol/test-helpers'; import * as z from 'zod/v4'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { NodeStreamableHTTPServerTransport } from '../src/streamableHttp.js'; +import { NodeStreamableHTTPServerTransport } from '../src/streamableHttp'; async function getFreePort() { return new Promise(res => { diff --git a/packages/server-legacy/src/auth/handlers/authorize.ts b/packages/server-legacy/src/auth/handlers/authorize.ts index 15dfe3cb90..da09503497 100644 --- a/packages/server-legacy/src/auth/handlers/authorize.ts +++ b/packages/server-legacy/src/auth/handlers/authorize.ts @@ -4,9 +4,9 @@ import type { Options as RateLimitOptions } from 'express-rate-limit'; import { rateLimit } from 'express-rate-limit'; import * as z from 'zod/v4'; -import { InvalidClientError, InvalidRequestError, OAuthError, ServerError, TooManyRequestsError } from '../errors.js'; -import { allowedMethods } from '../middleware/allowedMethods.js'; -import type { OAuthServerProvider } from '../provider.js'; +import { InvalidClientError, InvalidRequestError, OAuthError, ServerError, TooManyRequestsError } from '../errors'; +import { allowedMethods } from '../middleware/allowedMethods'; +import type { OAuthServerProvider } from '../provider'; export type AuthorizationHandlerOptions = { provider: OAuthServerProvider; diff --git a/packages/server-legacy/src/auth/handlers/metadata.ts b/packages/server-legacy/src/auth/handlers/metadata.ts index 529a6e57a8..23230e3d3f 100644 --- a/packages/server-legacy/src/auth/handlers/metadata.ts +++ b/packages/server-legacy/src/auth/handlers/metadata.ts @@ -3,7 +3,7 @@ import cors from 'cors'; import type { RequestHandler } from 'express'; import express from 'express'; -import { allowedMethods } from '../middleware/allowedMethods.js'; +import { allowedMethods } from '../middleware/allowedMethods'; export function metadataHandler(metadata: OAuthMetadata | OAuthProtectedResourceMetadata): RequestHandler { // Nested router so we can configure middleware and restrict HTTP method diff --git a/packages/server-legacy/src/auth/handlers/register.ts b/packages/server-legacy/src/auth/handlers/register.ts index 6ca5324ebb..1cc19e96e9 100644 --- a/packages/server-legacy/src/auth/handlers/register.ts +++ b/packages/server-legacy/src/auth/handlers/register.ts @@ -8,9 +8,9 @@ import express from 'express'; import type { Options as RateLimitOptions } from 'express-rate-limit'; import { rateLimit } from 'express-rate-limit'; -import type { OAuthRegisteredClientsStore } from '../clients.js'; -import { InvalidClientMetadataError, OAuthError, ServerError, TooManyRequestsError } from '../errors.js'; -import { allowedMethods } from '../middleware/allowedMethods.js'; +import type { OAuthRegisteredClientsStore } from '../clients'; +import { InvalidClientMetadataError, OAuthError, ServerError, TooManyRequestsError } from '../errors'; +import { allowedMethods } from '../middleware/allowedMethods'; export type ClientRegistrationHandlerOptions = { /** diff --git a/packages/server-legacy/src/auth/handlers/revoke.ts b/packages/server-legacy/src/auth/handlers/revoke.ts index 2a34a4449c..0d39a80ece 100644 --- a/packages/server-legacy/src/auth/handlers/revoke.ts +++ b/packages/server-legacy/src/auth/handlers/revoke.ts @@ -5,10 +5,10 @@ import express from 'express'; import type { Options as RateLimitOptions } from 'express-rate-limit'; import { rateLimit } from 'express-rate-limit'; -import { InvalidRequestError, OAuthError, ServerError, TooManyRequestsError } from '../errors.js'; -import { allowedMethods } from '../middleware/allowedMethods.js'; -import { authenticateClient } from '../middleware/clientAuth.js'; -import type { OAuthServerProvider } from '../provider.js'; +import { InvalidRequestError, OAuthError, ServerError, TooManyRequestsError } from '../errors'; +import { allowedMethods } from '../middleware/allowedMethods'; +import { authenticateClient } from '../middleware/clientAuth'; +import type { OAuthServerProvider } from '../provider'; export type RevocationHandlerOptions = { provider: OAuthServerProvider; diff --git a/packages/server-legacy/src/auth/handlers/token.ts b/packages/server-legacy/src/auth/handlers/token.ts index 8a7683ab5d..e2552673d9 100644 --- a/packages/server-legacy/src/auth/handlers/token.ts +++ b/packages/server-legacy/src/auth/handlers/token.ts @@ -13,10 +13,10 @@ import { ServerError, TooManyRequestsError, UnsupportedGrantTypeError -} from '../errors.js'; -import { allowedMethods } from '../middleware/allowedMethods.js'; -import { authenticateClient } from '../middleware/clientAuth.js'; -import type { OAuthServerProvider } from '../provider.js'; +} from '../errors'; +import { allowedMethods } from '../middleware/allowedMethods'; +import { authenticateClient } from '../middleware/clientAuth'; +import type { OAuthServerProvider } from '../provider'; export type TokenHandlerOptions = { provider: OAuthServerProvider; diff --git a/packages/server-legacy/src/auth/index.ts b/packages/server-legacy/src/auth/index.ts index e864576096..5f9319364a 100644 --- a/packages/server-legacy/src/auth/index.ts +++ b/packages/server-legacy/src/auth/index.ts @@ -1,37 +1,37 @@ // Core router -export type { AuthMetadataOptions, AuthRouterOptions } from './router.js'; -export { createOAuthMetadata, getOAuthProtectedResourceMetadataUrl, mcpAuthMetadataRouter, mcpAuthRouter } from './router.js'; +export type { AuthMetadataOptions, AuthRouterOptions } from './router'; +export { createOAuthMetadata, getOAuthProtectedResourceMetadataUrl, mcpAuthMetadataRouter, mcpAuthRouter } from './router'; // Provider interfaces -export type { AuthorizationParams, OAuthServerProvider, OAuthTokenVerifier } from './provider.js'; +export type { AuthorizationParams, OAuthServerProvider, OAuthTokenVerifier } from './provider'; // Proxy provider -export type { ProxyEndpoints, ProxyOptions } from './providers/proxyProvider.js'; -export { ProxyOAuthServerProvider } from './providers/proxyProvider.js'; +export type { ProxyEndpoints, ProxyOptions } from './providers/proxyProvider'; +export { ProxyOAuthServerProvider } from './providers/proxyProvider'; // Client store -export type { OAuthRegisteredClientsStore } from './clients.js'; +export type { OAuthRegisteredClientsStore } from './clients'; // Handlers -export type { AuthorizationHandlerOptions } from './handlers/authorize.js'; -export { authorizationHandler, redirectUriMatches } from './handlers/authorize.js'; -export { metadataHandler } from './handlers/metadata.js'; -export type { ClientRegistrationHandlerOptions } from './handlers/register.js'; -export { clientRegistrationHandler } from './handlers/register.js'; -export type { RevocationHandlerOptions } from './handlers/revoke.js'; -export { revocationHandler } from './handlers/revoke.js'; -export type { TokenHandlerOptions } from './handlers/token.js'; -export { tokenHandler } from './handlers/token.js'; +export type { AuthorizationHandlerOptions } from './handlers/authorize'; +export { authorizationHandler, redirectUriMatches } from './handlers/authorize'; +export { metadataHandler } from './handlers/metadata'; +export type { ClientRegistrationHandlerOptions } from './handlers/register'; +export { clientRegistrationHandler } from './handlers/register'; +export type { RevocationHandlerOptions } from './handlers/revoke'; +export { revocationHandler } from './handlers/revoke'; +export type { TokenHandlerOptions } from './handlers/token'; +export { tokenHandler } from './handlers/token'; // Middleware -export { allowedMethods } from './middleware/allowedMethods.js'; -export type { BearerAuthMiddlewareOptions } from './middleware/bearerAuth.js'; -export { requireBearerAuth } from './middleware/bearerAuth.js'; -export type { ClientAuthenticationMiddlewareOptions } from './middleware/clientAuth.js'; -export { authenticateClient } from './middleware/clientAuth.js'; +export { allowedMethods } from './middleware/allowedMethods'; +export type { BearerAuthMiddlewareOptions } from './middleware/bearerAuth'; +export { requireBearerAuth } from './middleware/bearerAuth'; +export type { ClientAuthenticationMiddlewareOptions } from './middleware/clientAuth'; +export { authenticateClient } from './middleware/clientAuth'; // Error classes -export * from './errors.js'; +export * from './errors'; // Types -export type { AuthInfo } from './types.js'; +export type { AuthInfo } from './types'; diff --git a/packages/server-legacy/src/auth/middleware/allowedMethods.ts b/packages/server-legacy/src/auth/middleware/allowedMethods.ts index b24dac3f2e..b5ca41c8b6 100644 --- a/packages/server-legacy/src/auth/middleware/allowedMethods.ts +++ b/packages/server-legacy/src/auth/middleware/allowedMethods.ts @@ -1,6 +1,6 @@ import type { RequestHandler } from 'express'; -import { MethodNotAllowedError } from '../errors.js'; +import { MethodNotAllowedError } from '../errors'; /** * Middleware to handle unsupported HTTP methods with a 405 Method Not Allowed response. diff --git a/packages/server-legacy/src/auth/middleware/bearerAuth.ts b/packages/server-legacy/src/auth/middleware/bearerAuth.ts index b615b5bf48..14710221a2 100644 --- a/packages/server-legacy/src/auth/middleware/bearerAuth.ts +++ b/packages/server-legacy/src/auth/middleware/bearerAuth.ts @@ -1,8 +1,8 @@ import type { RequestHandler } from 'express'; -import { InsufficientScopeError, InvalidTokenError, OAuthError, ServerError } from '../errors.js'; -import type { OAuthTokenVerifier } from '../provider.js'; -import type { AuthInfo } from '../types.js'; +import { InsufficientScopeError, InvalidTokenError, OAuthError, ServerError } from '../errors'; +import type { OAuthTokenVerifier } from '../provider'; +import type { AuthInfo } from '../types'; export type BearerAuthMiddlewareOptions = { /** diff --git a/packages/server-legacy/src/auth/middleware/clientAuth.ts b/packages/server-legacy/src/auth/middleware/clientAuth.ts index f3f7a3896e..611d797d1a 100644 --- a/packages/server-legacy/src/auth/middleware/clientAuth.ts +++ b/packages/server-legacy/src/auth/middleware/clientAuth.ts @@ -2,8 +2,8 @@ import type { OAuthClientInformationFull } from '@modelcontextprotocol/core'; import type { RequestHandler } from 'express'; import * as z from 'zod/v4'; -import type { OAuthRegisteredClientsStore } from '../clients.js'; -import { InvalidClientError, InvalidRequestError, OAuthError, ServerError } from '../errors.js'; +import type { OAuthRegisteredClientsStore } from '../clients'; +import { InvalidClientError, InvalidRequestError, OAuthError, ServerError } from '../errors'; export type ClientAuthenticationMiddlewareOptions = { /** diff --git a/packages/server-legacy/src/auth/provider.ts b/packages/server-legacy/src/auth/provider.ts index 528e8d27bc..0884997272 100644 --- a/packages/server-legacy/src/auth/provider.ts +++ b/packages/server-legacy/src/auth/provider.ts @@ -1,8 +1,8 @@ import type { OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '@modelcontextprotocol/core'; import type { Response } from 'express'; -import type { OAuthRegisteredClientsStore } from './clients.js'; -import type { AuthInfo } from './types.js'; +import type { OAuthRegisteredClientsStore } from './clients'; +import type { AuthInfo } from './types'; export type AuthorizationParams = { state?: string; diff --git a/packages/server-legacy/src/auth/providers/proxyProvider.ts b/packages/server-legacy/src/auth/providers/proxyProvider.ts index b469ce6df0..622b576b0e 100644 --- a/packages/server-legacy/src/auth/providers/proxyProvider.ts +++ b/packages/server-legacy/src/auth/providers/proxyProvider.ts @@ -2,10 +2,10 @@ import type { FetchLike, OAuthClientInformationFull, OAuthTokenRevocationRequest import { OAuthClientInformationFullSchema, OAuthTokensSchema } from '@modelcontextprotocol/core'; import type { Response } from 'express'; -import type { OAuthRegisteredClientsStore } from '../clients.js'; -import { ServerError } from '../errors.js'; -import type { AuthorizationParams, OAuthServerProvider } from '../provider.js'; -import type { AuthInfo } from '../types.js'; +import type { OAuthRegisteredClientsStore } from '../clients'; +import { ServerError } from '../errors'; +import type { AuthorizationParams, OAuthServerProvider } from '../provider'; +import type { AuthInfo } from '../types'; export type ProxyEndpoints = { authorizationUrl: string; diff --git a/packages/server-legacy/src/auth/router.ts b/packages/server-legacy/src/auth/router.ts index ba8b030e08..71cd3d54ec 100644 --- a/packages/server-legacy/src/auth/router.ts +++ b/packages/server-legacy/src/auth/router.ts @@ -2,16 +2,16 @@ import type { OAuthMetadata, OAuthProtectedResourceMetadata } from '@modelcontex import type { RequestHandler } from 'express'; import express from 'express'; -import type { AuthorizationHandlerOptions } from './handlers/authorize.js'; -import { authorizationHandler } from './handlers/authorize.js'; -import { metadataHandler } from './handlers/metadata.js'; -import type { ClientRegistrationHandlerOptions } from './handlers/register.js'; -import { clientRegistrationHandler } from './handlers/register.js'; -import type { RevocationHandlerOptions } from './handlers/revoke.js'; -import { revocationHandler } from './handlers/revoke.js'; -import type { TokenHandlerOptions } from './handlers/token.js'; -import { tokenHandler } from './handlers/token.js'; -import type { OAuthServerProvider } from './provider.js'; +import type { AuthorizationHandlerOptions } from './handlers/authorize'; +import { authorizationHandler } from './handlers/authorize'; +import { metadataHandler } from './handlers/metadata'; +import type { ClientRegistrationHandlerOptions } from './handlers/register'; +import { clientRegistrationHandler } from './handlers/register'; +import type { RevocationHandlerOptions } from './handlers/revoke'; +import { revocationHandler } from './handlers/revoke'; +import type { TokenHandlerOptions } from './handlers/token'; +import { tokenHandler } from './handlers/token'; +import type { OAuthServerProvider } from './provider'; // Check for dev mode flag that allows HTTP issuer URLs (for development/testing only) const allowInsecureIssuerUrl = diff --git a/packages/server-legacy/src/index.ts b/packages/server-legacy/src/index.ts index 0ce1af0fca..2e8fae62ae 100644 --- a/packages/server-legacy/src/index.ts +++ b/packages/server-legacy/src/index.ts @@ -1,2 +1,2 @@ -export * from './auth/index.js'; -export * from './sse/index.js'; +export * from './auth/index'; +export * from './sse/index'; diff --git a/packages/server-legacy/src/sse/index.ts b/packages/server-legacy/src/sse/index.ts index 108a3d884e..1fcbd3f6e5 100644 --- a/packages/server-legacy/src/sse/index.ts +++ b/packages/server-legacy/src/sse/index.ts @@ -1 +1 @@ -export { SSEServerTransport, type SSEServerTransportOptions } from './sse.js'; +export { SSEServerTransport, type SSEServerTransportOptions } from './sse'; diff --git a/packages/server-legacy/test/auth/handlers/authorize.test.ts b/packages/server-legacy/test/auth/handlers/authorize.test.ts index cacecd8881..bd11269349 100644 --- a/packages/server-legacy/test/auth/handlers/authorize.test.ts +++ b/packages/server-legacy/test/auth/handlers/authorize.test.ts @@ -1,11 +1,11 @@ -import { authorizationHandler, AuthorizationHandlerOptions, redirectUriMatches } from '../../../src/auth/handlers/authorize.js'; -import { OAuthServerProvider, AuthorizationParams } from '../../../src/auth/provider.js'; -import { OAuthRegisteredClientsStore } from '../../../src/auth/clients.js'; +import { authorizationHandler, AuthorizationHandlerOptions, redirectUriMatches } from '../../../src/auth/handlers/authorize'; +import { OAuthServerProvider, AuthorizationParams } from '../../../src/auth/provider'; +import { OAuthRegisteredClientsStore } from '../../../src/auth/clients'; import { OAuthClientInformationFull, OAuthTokens } from '@modelcontextprotocol/core'; import express, { Response } from 'express'; import supertest from 'supertest'; -import { AuthInfo } from '../../../src/auth/types.js'; -import { InvalidTokenError } from '../../../src/auth/errors.js'; +import { AuthInfo } from '../../../src/auth/types'; +import { InvalidTokenError } from '../../../src/auth/errors'; describe('Authorization Handler', () => { // Mock client data diff --git a/packages/server-legacy/test/auth/handlers/metadata.test.ts b/packages/server-legacy/test/auth/handlers/metadata.test.ts index 875f3749cc..bf77b3badb 100644 --- a/packages/server-legacy/test/auth/handlers/metadata.test.ts +++ b/packages/server-legacy/test/auth/handlers/metadata.test.ts @@ -1,4 +1,4 @@ -import { metadataHandler } from '../../../src/auth/handlers/metadata.js'; +import { metadataHandler } from '../../../src/auth/handlers/metadata'; import { OAuthMetadata } from '@modelcontextprotocol/core'; import express from 'express'; import supertest from 'supertest'; diff --git a/packages/server-legacy/test/auth/handlers/register.test.ts b/packages/server-legacy/test/auth/handlers/register.test.ts index b2d01adb3b..bcdafdc264 100644 --- a/packages/server-legacy/test/auth/handlers/register.test.ts +++ b/packages/server-legacy/test/auth/handlers/register.test.ts @@ -1,5 +1,5 @@ -import { clientRegistrationHandler, ClientRegistrationHandlerOptions } from '../../../src/auth/handlers/register.js'; -import { OAuthRegisteredClientsStore } from '../../../src/auth/clients.js'; +import { clientRegistrationHandler, ClientRegistrationHandlerOptions } from '../../../src/auth/handlers/register'; +import { OAuthRegisteredClientsStore } from '../../../src/auth/clients'; import { OAuthClientInformationFull, OAuthClientMetadata } from '@modelcontextprotocol/core'; import express from 'express'; import supertest from 'supertest'; diff --git a/packages/server-legacy/test/auth/handlers/revoke.test.ts b/packages/server-legacy/test/auth/handlers/revoke.test.ts index 02bf86f4dd..ba3343fc74 100644 --- a/packages/server-legacy/test/auth/handlers/revoke.test.ts +++ b/packages/server-legacy/test/auth/handlers/revoke.test.ts @@ -1,11 +1,11 @@ -import { revocationHandler, RevocationHandlerOptions } from '../../../src/auth/handlers/revoke.js'; -import { OAuthServerProvider, AuthorizationParams } from '../../../src/auth/provider.js'; -import { OAuthRegisteredClientsStore } from '../../../src/auth/clients.js'; +import { revocationHandler, RevocationHandlerOptions } from '../../../src/auth/handlers/revoke'; +import { OAuthServerProvider, AuthorizationParams } from '../../../src/auth/provider'; +import { OAuthRegisteredClientsStore } from '../../../src/auth/clients'; import { OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '@modelcontextprotocol/core'; import express, { Response } from 'express'; import supertest from 'supertest'; -import { AuthInfo } from '../../../src/auth/types.js'; -import { InvalidTokenError } from '../../../src/auth/errors.js'; +import { AuthInfo } from '../../../src/auth/types'; +import { InvalidTokenError } from '../../../src/auth/errors'; import { MockInstance } from 'vitest'; describe('Revocation Handler', () => { diff --git a/packages/server-legacy/test/auth/handlers/token.test.ts b/packages/server-legacy/test/auth/handlers/token.test.ts index d298185cc3..88ab66e684 100644 --- a/packages/server-legacy/test/auth/handlers/token.test.ts +++ b/packages/server-legacy/test/auth/handlers/token.test.ts @@ -1,13 +1,13 @@ -import { tokenHandler, TokenHandlerOptions } from '../../../src/auth/handlers/token.js'; -import { OAuthServerProvider, AuthorizationParams } from '../../../src/auth/provider.js'; -import { OAuthRegisteredClientsStore } from '../../../src/auth/clients.js'; +import { tokenHandler, TokenHandlerOptions } from '../../../src/auth/handlers/token'; +import { OAuthServerProvider, AuthorizationParams } from '../../../src/auth/provider'; +import { OAuthRegisteredClientsStore } from '../../../src/auth/clients'; import { OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '@modelcontextprotocol/core'; import express, { Response } from 'express'; import supertest from 'supertest'; import * as pkceChallenge from 'pkce-challenge'; -import { InvalidGrantError, InvalidTokenError } from '../../../src/auth/errors.js'; -import { AuthInfo } from '../../../src/auth/types.js'; -import { ProxyOAuthServerProvider } from '../../../src/auth/providers/proxyProvider.js'; +import { InvalidGrantError, InvalidTokenError } from '../../../src/auth/errors'; +import { AuthInfo } from '../../../src/auth/types'; +import { ProxyOAuthServerProvider } from '../../../src/auth/providers/proxyProvider'; import { type Mock } from 'vitest'; // Mock pkce-challenge diff --git a/packages/server-legacy/test/auth/middleware/allowedMethods.test.ts b/packages/server-legacy/test/auth/middleware/allowedMethods.test.ts index 731e6e551b..833bb8a072 100644 --- a/packages/server-legacy/test/auth/middleware/allowedMethods.test.ts +++ b/packages/server-legacy/test/auth/middleware/allowedMethods.test.ts @@ -1,4 +1,4 @@ -import { allowedMethods } from '../../../src/auth/middleware/allowedMethods.js'; +import { allowedMethods } from '../../../src/auth/middleware/allowedMethods'; import express, { Request, Response } from 'express'; import request from 'supertest'; diff --git a/packages/server-legacy/test/auth/middleware/bearerAuth.test.ts b/packages/server-legacy/test/auth/middleware/bearerAuth.test.ts index cd2e0a7f92..58df280616 100644 --- a/packages/server-legacy/test/auth/middleware/bearerAuth.test.ts +++ b/packages/server-legacy/test/auth/middleware/bearerAuth.test.ts @@ -1,10 +1,10 @@ import { Request, Response } from 'express'; import { Mock } from 'vitest'; -import { requireBearerAuth } from '../../../src/auth/middleware/bearerAuth.js'; -import { AuthInfo } from '../../../src/auth/types.js'; -import { InsufficientScopeError, InvalidTokenError, CustomOAuthError, ServerError } from '../../../src/auth/errors.js'; -import { OAuthTokenVerifier } from '../../../src/auth/provider.js'; -import { createExpressResponseMock } from '../../helpers/http.js'; +import { requireBearerAuth } from '../../../src/auth/middleware/bearerAuth'; +import { AuthInfo } from '../../../src/auth/types'; +import { InsufficientScopeError, InvalidTokenError, CustomOAuthError, ServerError } from '../../../src/auth/errors'; +import { OAuthTokenVerifier } from '../../../src/auth/provider'; +import { createExpressResponseMock } from '../../helpers/http'; // Mock verifier const mockVerifyAccessToken = vi.fn(); diff --git a/packages/server-legacy/test/auth/middleware/clientAuth.test.ts b/packages/server-legacy/test/auth/middleware/clientAuth.test.ts index 4c7b0b6157..82aaa23281 100644 --- a/packages/server-legacy/test/auth/middleware/clientAuth.test.ts +++ b/packages/server-legacy/test/auth/middleware/clientAuth.test.ts @@ -1,5 +1,5 @@ -import { authenticateClient, ClientAuthenticationMiddlewareOptions } from '../../../src/auth/middleware/clientAuth.js'; -import { OAuthRegisteredClientsStore } from '../../../src/auth/clients.js'; +import { authenticateClient, ClientAuthenticationMiddlewareOptions } from '../../../src/auth/middleware/clientAuth'; +import { OAuthRegisteredClientsStore } from '../../../src/auth/clients'; import { OAuthClientInformationFull } from '@modelcontextprotocol/core'; import express from 'express'; import supertest from 'supertest'; diff --git a/packages/server-legacy/test/auth/providers/proxyProvider.test.ts b/packages/server-legacy/test/auth/providers/proxyProvider.test.ts index 1214ef5a05..ed2b2b8651 100644 --- a/packages/server-legacy/test/auth/providers/proxyProvider.test.ts +++ b/packages/server-legacy/test/auth/providers/proxyProvider.test.ts @@ -1,10 +1,10 @@ import { Response } from 'express'; -import { ProxyOAuthServerProvider, ProxyOptions } from '../../../src/auth/providers/proxyProvider.js'; -import { AuthInfo } from '../../../src/auth/types.js'; +import { ProxyOAuthServerProvider, ProxyOptions } from '../../../src/auth/providers/proxyProvider'; +import { AuthInfo } from '../../../src/auth/types'; import { OAuthClientInformationFull, OAuthTokens } from '@modelcontextprotocol/core'; -import { ServerError } from '../../../src/auth/errors.js'; -import { InvalidTokenError } from '../../../src/auth/errors.js'; -import { InsufficientScopeError } from '../../../src/auth/errors.js'; +import { ServerError } from '../../../src/auth/errors'; +import { InvalidTokenError } from '../../../src/auth/errors'; +import { InsufficientScopeError } from '../../../src/auth/errors'; import { type Mock } from 'vitest'; describe('Proxy OAuth Server Provider', () => { diff --git a/packages/server-legacy/test/auth/router.test.ts b/packages/server-legacy/test/auth/router.test.ts index f4c4472d08..1e21f2cf5e 100644 --- a/packages/server-legacy/test/auth/router.test.ts +++ b/packages/server-legacy/test/auth/router.test.ts @@ -1,11 +1,11 @@ -import { mcpAuthRouter, AuthRouterOptions, mcpAuthMetadataRouter, AuthMetadataOptions } from '../../src/auth/router.js'; -import { OAuthServerProvider, AuthorizationParams } from '../../src/auth/provider.js'; -import { OAuthRegisteredClientsStore } from '../../src/auth/clients.js'; +import { mcpAuthRouter, AuthRouterOptions, mcpAuthMetadataRouter, AuthMetadataOptions } from '../../src/auth/router'; +import { OAuthServerProvider, AuthorizationParams } from '../../src/auth/provider'; +import { OAuthRegisteredClientsStore } from '../../src/auth/clients'; import { OAuthClientInformationFull, OAuthMetadata, OAuthTokenRevocationRequest, OAuthTokens } from '@modelcontextprotocol/core'; import express, { Response } from 'express'; import supertest from 'supertest'; -import { AuthInfo } from '../../src/auth/types.js'; -import { InvalidTokenError } from '../../src/auth/errors.js'; +import { AuthInfo } from '../../src/auth/types'; +import { InvalidTokenError } from '../../src/auth/errors'; describe('MCP Auth Router', () => { // Setup mock provider with full capabilities diff --git a/packages/server-legacy/test/sse/sse.test.ts b/packages/server-legacy/test/sse/sse.test.ts index 13d19640bb..c9e17ea010 100644 --- a/packages/server-legacy/test/sse/sse.test.ts +++ b/packages/server-legacy/test/sse/sse.test.ts @@ -1,7 +1,7 @@ import http from 'node:http'; import { type Mocked } from 'vitest'; -import { SSEServerTransport } from '../../src/sse/sse.js'; +import { SSEServerTransport } from '../../src/sse/sse'; import type { JSONRPCMessage } from '@modelcontextprotocol/core'; const createMockResponse = () => { diff --git a/packages/server/package.json b/packages/server/package.json index d7bce70fa4..4a058cbd7b 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -84,9 +84,7 @@ "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", "check": "pnpm run typecheck && pnpm run lint", "test": "vitest run", - "test:watch": "vitest", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "test:watch": "vitest" }, "dependencies": { "zod": "catalog:runtimeShared" @@ -109,7 +107,6 @@ "prettier": "catalog:devTools", "supertest": "catalog:devTools", "tsdown": "catalog:devTools", - "tsx": "catalog:devTools", "typescript": "catalog:devTools", "typescript-eslint": "catalog:devTools", "vitest": "catalog:devTools" diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index c33d394c8b..d74972e140 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -6,8 +6,8 @@ // // Any new export added here becomes public API. Use named exports, not wildcards. -export type { CompletableSchema, CompleteCallback } from './server/completable.js'; -export { completable, isCompletable } from './server/completable.js'; +export type { CompletableSchema, CompleteCallback } from './server/completable'; +export { completable, isCompletable } from './server/completable'; export type { AnyToolHandler, BaseToolCallback, @@ -22,12 +22,12 @@ export type { RegisteredTool, ResourceMetadata, ToolCallback -} from './server/mcp.js'; -export { McpServer, ResourceTemplate } from './server/mcp.js'; -export type { HostHeaderValidationResult } from './server/middleware/hostHeaderValidation.js'; -export { hostHeaderValidationResponse, localhostAllowedHostnames, validateHostHeader } from './server/middleware/hostHeaderValidation.js'; -export type { ServerOptions } from './server/server.js'; -export { Server } from './server/server.js'; +} from './server/mcp'; +export { McpServer, ResourceTemplate } from './server/mcp'; +export type { HostHeaderValidationResult } from './server/middleware/hostHeaderValidation'; +export { hostHeaderValidationResponse, localhostAllowedHostnames, validateHostHeader } from './server/middleware/hostHeaderValidation'; +export type { ServerOptions } from './server/server'; +export { Server } from './server/server'; // StdioServerTransport is exported from the './stdio' subpath — server stdio has only type-level Node // imports (erased at compile time), but matching the client's `./stdio` subpath gives consumers a // consistent shape across packages. @@ -37,11 +37,11 @@ export type { HandleRequestOptions, StreamId, WebStandardStreamableHTTPServerTransportOptions -} from './server/streamableHttp.js'; -export { WebStandardStreamableHTTPServerTransport } from './server/streamableHttp.js'; +} from './server/streamableHttp'; +export { WebStandardStreamableHTTPServerTransport } from './server/streamableHttp'; // runtime-aware wrapper (shadows core/public's fromJsonSchema with optional validator) -export { fromJsonSchema } from './fromJsonSchema.js'; +export { fromJsonSchema } from './fromJsonSchema'; // re-export curated public API from core export * from '@modelcontextprotocol/core/public'; diff --git a/packages/server/src/server/completable.examples.ts b/packages/server/src/server/completable.examples.ts index b0655d2438..925f24e2a3 100644 --- a/packages/server/src/server/completable.examples.ts +++ b/packages/server/src/server/completable.examples.ts @@ -9,8 +9,8 @@ import * as z from 'zod/v4'; -import { completable } from './completable.js'; -import { McpServer } from './mcp.js'; +import { completable } from './completable'; +import { McpServer } from './mcp'; /** * Example: Using completable() in a prompt registration. diff --git a/packages/server/src/server/mcp.examples.ts b/packages/server/src/server/mcp.examples.ts index 740c1bf186..7c30582e81 100644 --- a/packages/server/src/server/mcp.examples.ts +++ b/packages/server/src/server/mcp.examples.ts @@ -10,8 +10,8 @@ import type { CallToolResult } from '@modelcontextprotocol/core'; import * as z from 'zod/v4'; -import { McpServer } from './mcp.js'; -import { StdioServerTransport } from './stdio.js'; +import { McpServer } from './mcp'; +import { StdioServerTransport } from './stdio'; /** * Example: Creating a new McpServer. diff --git a/packages/server/src/server/mcp.ts b/packages/server/src/server/mcp.ts index 95c2476f34..b93d92d589 100644 --- a/packages/server/src/server/mcp.ts +++ b/packages/server/src/server/mcp.ts @@ -39,9 +39,9 @@ import { } from '@modelcontextprotocol/core'; import type * as z from 'zod/v4'; -import { getCompleter, isCompletable } from './completable.js'; -import type { ServerOptions } from './server.js'; -import { Server } from './server.js'; +import { getCompleter, isCompletable } from './completable'; +import type { ServerOptions } from './server'; +import { Server } from './server'; /** * High-level MCP server that provides a simpler API for working with resources, tools, and prompts. diff --git a/packages/server/src/server/middleware/hostHeaderValidation.examples.ts b/packages/server/src/server/middleware/hostHeaderValidation.examples.ts index fd49d97516..f46a04c570 100644 --- a/packages/server/src/server/middleware/hostHeaderValidation.examples.ts +++ b/packages/server/src/server/middleware/hostHeaderValidation.examples.ts @@ -7,7 +7,7 @@ * @module */ -import { validateHostHeader } from './hostHeaderValidation.js'; +import { validateHostHeader } from './hostHeaderValidation'; /** * Example: Validating a host header against allowed hosts. diff --git a/packages/server/src/server/stdio.examples.ts b/packages/server/src/server/stdio.examples.ts index de4603eaa7..6b51203b3b 100644 --- a/packages/server/src/server/stdio.examples.ts +++ b/packages/server/src/server/stdio.examples.ts @@ -7,8 +7,8 @@ * @module */ -import { McpServer } from './mcp.js'; -import { StdioServerTransport } from './stdio.js'; +import { McpServer } from './mcp'; +import { StdioServerTransport } from './stdio'; /** * Example: Basic stdio transport usage. diff --git a/packages/server/src/server/streamableHttp.examples.ts b/packages/server/src/server/streamableHttp.examples.ts index a805c1dcee..678c43c928 100644 --- a/packages/server/src/server/streamableHttp.examples.ts +++ b/packages/server/src/server/streamableHttp.examples.ts @@ -7,8 +7,8 @@ * @module */ -import { McpServer } from './mcp.js'; -import { WebStandardStreamableHTTPServerTransport } from './streamableHttp.js'; +import { McpServer } from './mcp'; +import { WebStandardStreamableHTTPServerTransport } from './streamableHttp'; /** * Example: Stateful Streamable HTTP transport (Web Standard). diff --git a/packages/server/src/stdio.ts b/packages/server/src/stdio.ts index 7865c9cedc..97b1518fba 100644 --- a/packages/server/src/stdio.ts +++ b/packages/server/src/stdio.ts @@ -5,4 +5,4 @@ // subpath gives consumers a consistent shape across packages. Import from // `@modelcontextprotocol/server/stdio` only in process-stdio runtimes (Node.js, Bun, Deno). -export { StdioServerTransport } from './server/stdio.js'; +export { StdioServerTransport } from './server/stdio'; diff --git a/packages/server/test/server/completable.test.ts b/packages/server/test/server/completable.test.ts index 9dfa7b42ba..79dc576f1d 100644 --- a/packages/server/test/server/completable.test.ts +++ b/packages/server/test/server/completable.test.ts @@ -1,7 +1,7 @@ import * as z from 'zod/v4'; import { describe, expect, it } from 'vitest'; -import { completable, getCompleter } from '../../src/server/completable.js'; +import { completable, getCompleter } from '../../src/server/completable'; describe('completable with Zod v4', () => { it('preserves types and values of underlying schema', () => { diff --git a/packages/server/test/server/jsonSchemaValidatorOverride.test.ts b/packages/server/test/server/jsonSchemaValidatorOverride.test.ts index 729111d9a8..2931f8aa00 100644 --- a/packages/server/test/server/jsonSchemaValidatorOverride.test.ts +++ b/packages/server/test/server/jsonSchemaValidatorOverride.test.ts @@ -1,7 +1,7 @@ import type { JsonSchemaType, JsonSchemaValidatorResult, jsonSchemaValidator } from '@modelcontextprotocol/core'; import { InMemoryTransport, LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/core'; -import { fromJsonSchema } from '../../src/fromJsonSchema.js'; -import { Server } from '../../src/server/server.js'; +import { fromJsonSchema } from '../../src/fromJsonSchema'; +import { Server } from '../../src/server/server'; class RecordingValidator implements jsonSchemaValidator { schemas: JsonSchemaType[] = []; diff --git a/packages/server/test/server/mcp.compat.test.ts b/packages/server/test/server/mcp.compat.test.ts index 322b615353..2b6e960bb4 100644 --- a/packages/server/test/server/mcp.compat.test.ts +++ b/packages/server/test/server/mcp.compat.test.ts @@ -2,9 +2,9 @@ import type { JSONRPCMessage } from '@modelcontextprotocol/core'; import { InMemoryTransport, isStandardSchema, LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/core'; import { describe, expect, expectTypeOf, it, vi } from 'vitest'; import * as z from 'zod/v4'; -import { McpServer } from '../../src/index.js'; -import type { InferRawShape } from '../../src/server/mcp.js'; -import { completable } from '../../src/server/completable.js'; +import { McpServer } from '../../src/index'; +import type { InferRawShape } from '../../src/server/mcp'; +import { completable } from '../../src/server/completable'; describe('registerTool/registerPrompt accept raw Zod shape (auto-wrapped)', () => { it('registerTool accepts a raw shape for inputSchema and auto-wraps it', () => { diff --git a/packages/server/test/server/mcp.icons.test.ts b/packages/server/test/server/mcp.icons.test.ts index 42aba4fdd4..cbd3f15483 100644 --- a/packages/server/test/server/mcp.icons.test.ts +++ b/packages/server/test/server/mcp.icons.test.ts @@ -1,7 +1,7 @@ import type { Icon, JSONRPCMessage } from '@modelcontextprotocol/core'; import { InMemoryTransport, LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/core'; import { describe, expect, it, vi } from 'vitest'; -import { McpServer, ResourceTemplate } from '../../src/index.js'; +import { McpServer, ResourceTemplate } from '../../src/index'; const ICONS: Icon[] = [ { src: 'https://example.com/icon.png', mimeType: 'image/png', sizes: ['48x48', '96x96'] }, diff --git a/packages/server/test/server/server.test.ts b/packages/server/test/server/server.test.ts index 0edcfd3af0..1929197b19 100644 --- a/packages/server/test/server/server.test.ts +++ b/packages/server/test/server/server.test.ts @@ -6,7 +6,7 @@ import { LATEST_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS } from '@modelcontextprotocol/core'; -import { Server } from '../../src/server/server.js'; +import { Server } from '../../src/server/server'; /** An older protocol version the server supports out of the box. */ const OLDER_SUPPORTED_VERSION = '2025-03-26'; diff --git a/packages/server/test/server/stdio.test.ts b/packages/server/test/server/stdio.test.ts index be52951688..e21143aea5 100644 --- a/packages/server/test/server/stdio.test.ts +++ b/packages/server/test/server/stdio.test.ts @@ -3,7 +3,7 @@ import { Readable, Writable } from 'node:stream'; import type { JSONRPCMessage } from '@modelcontextprotocol/core'; import { ReadBuffer, serializeMessage } from '@modelcontextprotocol/core'; -import { StdioServerTransport } from '../../src/server/stdio.js'; +import { StdioServerTransport } from '../../src/server/stdio'; let input: Readable; let outputBuffer: ReadBuffer; diff --git a/packages/server/test/server/streamableHttp.test.ts b/packages/server/test/server/streamableHttp.test.ts index 7a23dd56bb..0fc61ce32a 100644 --- a/packages/server/test/server/streamableHttp.test.ts +++ b/packages/server/test/server/streamableHttp.test.ts @@ -3,9 +3,9 @@ import { randomUUID } from 'node:crypto'; import type { CallToolResult, JSONRPCErrorResponse, JSONRPCMessage } from '@modelcontextprotocol/core'; import * as z from 'zod/v4'; -import { McpServer } from '../../src/server/mcp.js'; -import type { EventId, EventStore, StreamId } from '../../src/server/streamableHttp.js'; -import { WebStandardStreamableHTTPServerTransport } from '../../src/server/streamableHttp.js'; +import { McpServer } from '../../src/server/mcp'; +import type { EventId, EventStore, StreamId } from '../../src/server/streamableHttp'; +import { WebStandardStreamableHTTPServerTransport } from '../../src/server/streamableHttp'; /** * Common test messages diff --git a/packages/server/test/server/streamableHttpFutureVersionGates.test.ts b/packages/server/test/server/streamableHttpFutureVersionGates.test.ts index ef1670444d..def61b5223 100644 --- a/packages/server/test/server/streamableHttpFutureVersionGates.test.ts +++ b/packages/server/test/server/streamableHttpFutureVersionGates.test.ts @@ -2,9 +2,9 @@ import { randomUUID } from 'node:crypto'; import type { JSONRPCMessage, MessageExtraInfo } from '@modelcontextprotocol/core'; -import { McpServer } from '../../src/server/mcp.js'; -import type { EventId, EventStore, StreamId } from '../../src/server/streamableHttp.js'; -import { WebStandardStreamableHTTPServerTransport } from '../../src/server/streamableHttp.js'; +import { McpServer } from '../../src/server/mcp'; +import type { EventId, EventStore, StreamId } from '../../src/server/streamableHttp'; +import { WebStandardStreamableHTTPServerTransport } from '../../src/server/streamableHttp'; /** * Gate-closure tests for the two protocol-version checks that guard diff --git a/packages/server/test/server/streamableHttpUnsupportedVersionLiteral.test.ts b/packages/server/test/server/streamableHttpUnsupportedVersionLiteral.test.ts index a797d90eb4..b098af1fea 100644 --- a/packages/server/test/server/streamableHttpUnsupportedVersionLiteral.test.ts +++ b/packages/server/test/server/streamableHttpUnsupportedVersionLiteral.test.ts @@ -3,8 +3,8 @@ import { randomUUID } from 'node:crypto'; import type { JSONRPCMessage } from '@modelcontextprotocol/core'; import { SUPPORTED_PROTOCOL_VERSIONS } from '@modelcontextprotocol/core'; -import { McpServer } from '../../src/server/mcp.js'; -import { WebStandardStreamableHTTPServerTransport } from '../../src/server/streamableHttp.js'; +import { McpServer } from '../../src/server/mcp'; +import { WebStandardStreamableHTTPServerTransport } from '../../src/server/streamableHttp'; /** * Wire-level continuity tests for the "Unsupported protocol version" rejection. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9ffd38d3dd..8fbb1208bc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -333,6 +333,9 @@ importers: specifier: workspace:^ version: link:../../packages/client devDependencies: + '@modelcontextprotocol/tsconfig': + specifier: workspace:^ + version: link:../../common/tsconfig '@types/node': specifier: ^24.10.1 version: 24.12.0 @@ -413,6 +416,9 @@ importers: specifier: catalog:runtimeShared version: 4.3.6 devDependencies: + '@modelcontextprotocol/tsconfig': + specifier: workspace:^ + version: link:../../common/tsconfig '@types/node': specifier: ^24.10.1 version: 24.12.0 @@ -483,9 +489,6 @@ importers: prettier: specifier: catalog:devTools version: 3.6.2 - tsx: - specifier: catalog:devTools - version: 4.21.0 typescript: specifier: catalog:devTools version: 5.9.3 @@ -571,9 +574,6 @@ importers: tsdown: specifier: catalog:devTools version: 0.18.4(@typescript/native-preview@7.0.0-dev.20260327.2)(typescript@5.9.3) - tsx: - specifier: catalog:devTools - version: 4.21.0 typescript: specifier: catalog:devTools version: 5.9.3 @@ -699,9 +699,6 @@ importers: prettier: specifier: catalog:devTools version: 3.6.2 - tsx: - specifier: catalog:devTools - version: 4.21.0 typescript: specifier: catalog:devTools version: 5.9.3 @@ -925,9 +922,6 @@ importers: tsdown: specifier: catalog:devTools version: 0.18.4(@typescript/native-preview@7.0.0-dev.20260327.2)(typescript@5.9.3) - tsx: - specifier: catalog:devTools - version: 4.21.0 typescript: specifier: catalog:devTools version: 5.9.3 @@ -995,9 +989,6 @@ importers: tsdown: specifier: catalog:devTools version: 0.18.4(@typescript/native-preview@7.0.0-dev.20260327.2)(typescript@5.9.3) - tsx: - specifier: catalog:devTools - version: 4.21.0 typescript: specifier: catalog:devTools version: 5.9.3 diff --git a/scripts/cli.ts b/scripts/cli.ts deleted file mode 100644 index 809a23efed..0000000000 --- a/scripts/cli.ts +++ /dev/null @@ -1,155 +0,0 @@ -import express from 'express'; -import { Client } from '../src/client/index.js'; -import { SSEClientTransport } from '../src/client/sse.js'; -import { StdioClientTransport } from '../src/client/stdio.js'; -import { Server } from '../src/server/index.js'; -import { SSEServerTransport } from '../src/server/sse.js'; -import { StdioServerTransport } from '../src/server/stdio.js'; -import { ListResourcesResultSchema } from '../src/types.js'; - -async function runClient(url_or_command: string, args: string[]) { - const client = new Client( - { - name: 'mcp-typescript test client', - version: '0.1.0' - }, - { - capabilities: { - sampling: {} - } - } - ); - - let clientTransport; - - let url: URL | undefined = undefined; - try { - url = new URL(url_or_command); - } catch { - // Ignore - } - - if (url?.protocol === 'http:' || url?.protocol === 'https:') { - clientTransport = new SSEClientTransport(new URL(url_or_command)); - } else if (url?.protocol === 'ws:' || url?.protocol === 'wss:') { - throw new Error('WebSocket URLs are no longer supported. Use http(s) or stdio instead.'); - } else { - clientTransport = new StdioClientTransport({ - command: url_or_command, - args - }); - } - - console.log('Connected to server.'); - - await client.connect(clientTransport); - console.log('Initialized.'); - - await client.request({ method: 'resources/list' }, ListResourcesResultSchema); - - await client.close(); - console.log('Closed.'); -} - -async function runServer(port: number | null) { - if (port !== null) { - const app = express(); - - let servers: Server[] = []; - - app.get('/sse', async (req, res) => { - console.log('Got new SSE connection'); - - const transport = new SSEServerTransport('/message', res); - const server = new Server( - { - name: 'mcp-typescript test server', - version: '0.1.0' - }, - { - capabilities: {} - } - ); - - servers.push(server); - - server.onclose = () => { - console.log('SSE connection closed'); - servers = servers.filter(s => s !== server); - }; - - await server.connect(transport); - }); - - app.post('/message', async (req, res) => { - console.log('Received message'); - - const sessionId = req.query.sessionId as string; - const transport = servers.map(s => s.transport as SSEServerTransport).find(t => t.sessionId === sessionId); - if (!transport) { - res.status(404).send('Session not found'); - return; - } - - await transport.handlePostMessage(req, res); - }); - - app.listen(port, error => { - if (error) { - console.error('Failed to start server:', error); - process.exit(1); - } - console.log(`Server running on http://localhost:${port}/sse`); - }); - } else { - const server = new Server( - { - name: 'mcp-typescript test server', - version: '0.1.0' - }, - { - capabilities: { - prompts: {}, - resources: {}, - tools: {}, - logging: {} - } - } - ); - - const transport = new StdioServerTransport(); - await server.connect(transport); - - console.log('Server running on stdio'); - } -} - -const args = process.argv.slice(2); -const command = args[0]; -switch (command) { - case 'client': - if (args.length < 2) { - console.error('Usage: client [args...]'); - process.exit(1); - } - - runClient(args[1], args.slice(2)).catch(error => { - console.error(error); - process.exit(1); - }); - - break; - - case 'server': { - const port = args[1] ? parseInt(args[1]) : null; - runServer(port).catch(error => { - console.error(error); - process.exit(1); - }); - - break; - } - - default: - console.error('Unrecognized command:', command); -} diff --git a/test/conformance/package.json b/test/conformance/package.json index 7a1154b8ed..f4f927096c 100644 --- a/test/conformance/package.json +++ b/test/conformance/package.json @@ -25,9 +25,6 @@ "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", "check": "npm run typecheck && npm run lint", - "start": "npm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client", "test:conformance:client": "conformance client --command 'node --import tsx ./src/everythingClient.ts' --suite core --expected-failures ./expected-failures.yaml", "test:conformance:client:all": "conformance client --command 'node --import tsx ./src/everythingClient.ts' --suite all --expected-failures ./expected-failures.yaml", "test:conformance:client:run": "node --import tsx ./src/everythingClient.ts", diff --git a/test/conformance/src/everythingClient.ts b/test/conformance/src/everythingClient.ts index 05103eb26d..6603c4a0e8 100644 --- a/test/conformance/src/everythingClient.ts +++ b/test/conformance/src/everythingClient.ts @@ -22,9 +22,9 @@ import { } from '@modelcontextprotocol/client'; import * as z from 'zod/v4'; -import { ConformanceOAuthProvider } from './helpers/conformanceOAuthProvider.js'; -import { logger } from './helpers/logger.js'; -import { handle401, withOAuthRetry } from './helpers/withOAuthRetry.js'; +import { ConformanceOAuthProvider } from './helpers/conformanceOAuthProvider'; +import { logger } from './helpers/logger'; +import { handle401, withOAuthRetry } from './helpers/withOAuthRetry'; /** * Fixed client metadata URL for CIMD conformance tests. diff --git a/test/conformance/src/helpers/withOAuthRetry.ts b/test/conformance/src/helpers/withOAuthRetry.ts index cbed3e2382..8ebebdb63c 100644 --- a/test/conformance/src/helpers/withOAuthRetry.ts +++ b/test/conformance/src/helpers/withOAuthRetry.ts @@ -1,7 +1,7 @@ import type { FetchLike, Middleware } from '@modelcontextprotocol/client'; import { auth, extractWWWAuthenticateParams, UnauthorizedError } from '@modelcontextprotocol/client'; -import { ConformanceOAuthProvider } from './conformanceOAuthProvider.js'; +import { ConformanceOAuthProvider } from './conformanceOAuthProvider'; export const handle401 = async ( response: Response, diff --git a/test/e2e/coverage.test.ts b/test/e2e/coverage.test.ts index ed580b9a74..135151b83c 100644 --- a/test/e2e/coverage.test.ts +++ b/test/e2e/coverage.test.ts @@ -13,7 +13,7 @@ import { fileURLToPath } from 'node:url'; import { expect, test } from 'vitest'; -import { REQUIREMENTS } from './requirements.js'; +import { REQUIREMENTS } from './requirements'; const E2E_DIR = path.dirname(fileURLToPath(import.meta.url)); diff --git a/test/e2e/helpers/index.ts b/test/e2e/helpers/index.ts index 0fe566be8c..df9d7d3715 100644 --- a/test/e2e/helpers/index.ts +++ b/test/e2e/helpers/index.ts @@ -19,10 +19,10 @@ import type { EventStore, JSONRPCMessage, McpServer, Server } from '@modelcontex import { InMemoryTransport, ReadBuffer, serializeMessage, WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/server'; import { StdioServerTransport } from '@modelcontextprotocol/server/stdio'; -import type { Transport } from '../types.js'; -import { startLegacySseHost } from './sse-host.js'; -import type { SnifferOptions } from './wire-sniffer.js'; -import { sniffTransport } from './wire-sniffer.js'; +import type { Transport } from '../types'; +import { startLegacySseHost } from './sse-host'; +import type { SnifferOptions } from './wire-sniffer'; +import { sniffTransport } from './wire-sniffer'; export type ServerFactory = () => McpServer | Server; diff --git a/test/e2e/helpers/verifies.ts b/test/e2e/helpers/verifies.ts index bfcdc47216..a3dde2feaf 100644 --- a/test/e2e/helpers/verifies.ts +++ b/test/e2e/helpers/verifies.ts @@ -17,9 +17,9 @@ import { describe, test } from 'vitest'; -import { REQUIREMENTS } from '../requirements.js'; -import type { TestArgs } from '../types.js'; -import { ALL_SPEC_VERSIONS, ALL_TRANSPORTS } from '../types.js'; +import { REQUIREMENTS } from '../requirements'; +import type { TestArgs } from '../types'; +import { ALL_SPEC_VERSIONS, ALL_TRANSPORTS } from '../types'; type TestBody = (args: TestArgs) => Promise; diff --git a/test/e2e/helpers/wire-sniffer.test.ts b/test/e2e/helpers/wire-sniffer.test.ts index 73ea7222e8..c61d60c518 100644 --- a/test/e2e/helpers/wire-sniffer.test.ts +++ b/test/e2e/helpers/wire-sniffer.test.ts @@ -1,7 +1,7 @@ import { LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/server'; import { describe, expect, it } from 'vitest'; -import { assertWireMessage } from './wire-sniffer.js'; +import { assertWireMessage } from './wire-sniffer'; const req = (method: string, params?: unknown, id = 1) => ({ jsonrpc: '2.0' as const, diff --git a/test/e2e/requirements.ts b/test/e2e/requirements.ts index ea471a21fc..a338864298 100644 --- a/test/e2e/requirements.ts +++ b/test/e2e/requirements.ts @@ -7,7 +7,7 @@ * the behavior). */ -import type { Requirement } from './types.js'; +import type { Requirement } from './types'; /** Transports with a persistent server instance / standalone notification stream. */ const STATEFUL_TRANSPORTS = ['inMemory', 'stdio', 'streamableHttp', 'sse'] as const; diff --git a/test/e2e/scenarios/client-auth.test.ts b/test/e2e/scenarios/client-auth.test.ts index 0d19a40cb8..4b726224e3 100644 --- a/test/e2e/scenarios/client-auth.test.ts +++ b/test/e2e/scenarios/client-auth.test.ts @@ -43,9 +43,9 @@ import { importSPKI, jwtVerify } from 'jose'; import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { hostPerSession } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { hostPerSession } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const ISSUER = 'https://auth.example.com'; const MCP_URL = 'http://in-process/mcp'; diff --git a/test/e2e/scenarios/completion.test.ts b/test/e2e/scenarios/completion.test.ts index 34f3d888fd..0752fac099 100644 --- a/test/e2e/scenarios/completion.test.ts +++ b/test/e2e/scenarios/completion.test.ts @@ -12,9 +12,9 @@ import { completable, McpServer, ProtocolError, ProtocolErrorCode, ResourceTempl import { expect } from 'vitest'; import { z } from 'zod/v4'; -import { wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const COLORS = ['red', 'green', 'blue', 'rebeccapurple'] as const; const FILE_PATHS = ['README.md', 'src/index.ts', 'src/types.ts'] as const; diff --git a/test/e2e/scenarios/custom-methods.test.ts b/test/e2e/scenarios/custom-methods.test.ts index 6c724cd7b8..5c770eb308 100644 --- a/test/e2e/scenarios/custom-methods.test.ts +++ b/test/e2e/scenarios/custom-methods.test.ts @@ -15,9 +15,9 @@ import { McpServer, ProtocolErrorCode, Server } from '@modelcontextprotocol/serv import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; verifies('custom-methods:server-handler:roundtrip', async ({ transport }: TestArgs) => { const SearchParams = z.object({ query: z.string(), limit: z.number().int().default(5) }); diff --git a/test/e2e/scenarios/dynamic.test.ts b/test/e2e/scenarios/dynamic.test.ts index b806d33c87..4e180d6cc6 100644 --- a/test/e2e/scenarios/dynamic.test.ts +++ b/test/e2e/scenarios/dynamic.test.ts @@ -12,9 +12,9 @@ import { McpServer, ProtocolErrorCode, Server } from '@modelcontextprotocol/serv import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const newClient = () => new Client({ name: 'c', version: '0' }); diff --git a/test/e2e/scenarios/elicitation.test.ts b/test/e2e/scenarios/elicitation.test.ts index 840a3009e5..30e70a06f5 100644 --- a/test/e2e/scenarios/elicitation.test.ts +++ b/test/e2e/scenarios/elicitation.test.ts @@ -22,9 +22,9 @@ import { import { expect } from 'vitest'; import { z } from 'zod/v4'; -import { tapWire, wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { tapWire, wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; /** Client with form-mode elicitation support. */ const formClient = () => new Client({ name: 'c', version: '0' }, { capabilities: { elicitation: { form: {} } } }); diff --git a/test/e2e/scenarios/errors.test.ts b/test/e2e/scenarios/errors.test.ts index 3809c7a172..c8e8562c75 100644 --- a/test/e2e/scenarios/errors.test.ts +++ b/test/e2e/scenarios/errors.test.ts @@ -24,9 +24,9 @@ import { import { expect } from 'vitest'; import { z } from 'zod/v4'; -import { hostPerSession, tapWire, wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { hostPerSession, tapWire, wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const newClient = () => new Client({ name: 'c', version: '0' }); diff --git a/test/e2e/scenarios/flow.test.ts b/test/e2e/scenarios/flow.test.ts index ea3b20e554..2b75c8fe44 100644 --- a/test/e2e/scenarios/flow.test.ts +++ b/test/e2e/scenarios/flow.test.ts @@ -24,10 +24,10 @@ import { McpServer, ProtocolErrorCode, Server, specTypeSchemas, UrlElicitationRe import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { hostPerSession, hostResumable, wire } from '../helpers/index.js'; -import { startLegacySseHost } from '../helpers/sse-host.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { hostPerSession, hostResumable, wire } from '../helpers/index'; +import { startLegacySseHost } from '../helpers/sse-host'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; verifies('flow:compat:dual-transport-server', async (_args: TestArgs) => { // One deployment, one server factory, both transports: the modern Streamable HTTP diff --git a/test/e2e/scenarios/handler-context.test.ts b/test/e2e/scenarios/handler-context.test.ts index 81c5a776ba..6b624d4626 100644 --- a/test/e2e/scenarios/handler-context.test.ts +++ b/test/e2e/scenarios/handler-context.test.ts @@ -15,9 +15,9 @@ import { McpServer } from '@modelcontextprotocol/server'; import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { hostPerSession, wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { hostPerSession, wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; verifies('mcpserver:context:log-from-handler', async ({ transport }: TestArgs) => { let releaseHandler!: () => void; diff --git a/test/e2e/scenarios/hosting-auth.test.ts b/test/e2e/scenarios/hosting-auth.test.ts index 235c96f4b4..ce02625872 100644 --- a/test/e2e/scenarios/hosting-auth.test.ts +++ b/test/e2e/scenarios/hosting-auth.test.ts @@ -31,8 +31,8 @@ import { McpServer, WebStandardStreamableHTTPServerTransport } from '@modelconte import { expect } from 'vitest'; import { z } from 'zod/v4'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const VALID_TOKEN = 'analytics-dashboard-access-token'; diff --git a/test/e2e/scenarios/hosting-express.test.ts b/test/e2e/scenarios/hosting-express.test.ts index fbc9851c5e..5262d64af6 100644 --- a/test/e2e/scenarios/hosting-express.test.ts +++ b/test/e2e/scenarios/hosting-express.test.ts @@ -30,9 +30,9 @@ import express from 'express'; import { expect } from 'vitest'; import { z } from 'zod/v4'; -import { startExpressMinimal, startExpressWithHostValidation } from '../helpers/express.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { startExpressMinimal, startExpressWithHostValidation } from '../helpers/express'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const RESOURCE_METADATA_URL = 'https://mcp.example.com/.well-known/oauth-protected-resource'; const VALID_TOKEN = 'analytics-dashboard-token'; diff --git a/test/e2e/scenarios/hosting-fastify.test.ts b/test/e2e/scenarios/hosting-fastify.test.ts index d1c1ddb58e..b7d3a6e7ea 100644 --- a/test/e2e/scenarios/hosting-fastify.test.ts +++ b/test/e2e/scenarios/hosting-fastify.test.ts @@ -19,8 +19,8 @@ import type { FastifyInstance, FastifyRequest } from 'fastify'; import { expect } from 'vitest'; import { z } from 'zod/v4'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; function forecastServer(): McpServer { const s = new McpServer({ name: 'forecast-server', version: '0.3.0' }); diff --git a/test/e2e/scenarios/hosting-hono.test.ts b/test/e2e/scenarios/hosting-hono.test.ts index e9df10565a..fb5373c75b 100644 --- a/test/e2e/scenarios/hosting-hono.test.ts +++ b/test/e2e/scenarios/hosting-hono.test.ts @@ -20,8 +20,8 @@ import type { Hono } from 'hono'; import { expect } from 'vitest'; import { z } from 'zod/v4'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; function recipeServer(): McpServer { const s = new McpServer({ name: 'recipe-server', version: '1.2.0' }); diff --git a/test/e2e/scenarios/hosting-http.test.ts b/test/e2e/scenarios/hosting-http.test.ts index e055672e47..68df7ea365 100644 --- a/test/e2e/scenarios/hosting-http.test.ts +++ b/test/e2e/scenarios/hosting-http.test.ts @@ -18,10 +18,10 @@ import { LATEST_PROTOCOL_VERSION, McpServer, WebStandardStreamableHTTPServerTran import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import type { HttpHandler } from '../helpers/index.js'; -import { hostPerSession, hostStateless } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import type { HttpHandler } from '../helpers/index'; +import { hostPerSession, hostStateless } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; function echoServer(): McpServer { const s = new McpServer({ name: 's', version: '0' }); diff --git a/test/e2e/scenarios/hosting-resume.test.ts b/test/e2e/scenarios/hosting-resume.test.ts index 1a0f8b14ad..762c445b7e 100644 --- a/test/e2e/scenarios/hosting-resume.test.ts +++ b/test/e2e/scenarios/hosting-resume.test.ts @@ -12,9 +12,9 @@ import { LATEST_PROTOCOL_VERSION, McpServer, parseJSONRPCMessage } from '@modelc import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { hostResumable } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { hostResumable } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; /** * These three tests assert the raw frame sequence of the POST SSE stream itself, so they cannot run their traffic through a connected client. diff --git a/test/e2e/scenarios/hosting-session.test.ts b/test/e2e/scenarios/hosting-session.test.ts index 81c5d5ba89..d8af0d34d3 100644 --- a/test/e2e/scenarios/hosting-session.test.ts +++ b/test/e2e/scenarios/hosting-session.test.ts @@ -19,10 +19,10 @@ import express from 'express'; import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { startExpressMinimal } from '../helpers/express.js'; -import { hostPerSession, hostStateless, wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { startExpressMinimal } from '../helpers/express'; +import { hostPerSession, hostStateless, wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const newClient = () => new Client({ name: 'c', version: '0' }); diff --git a/test/e2e/scenarios/lifecycle.test.ts b/test/e2e/scenarios/lifecycle.test.ts index 2fba4a84e8..7ccf781aa6 100644 --- a/test/e2e/scenarios/lifecycle.test.ts +++ b/test/e2e/scenarios/lifecycle.test.ts @@ -32,9 +32,9 @@ import { import { expect } from 'vitest'; import { z } from 'zod/v4'; -import { tapWire, wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { tapWire, wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; function olderSupportedVersion(): string { const older = SUPPORTED_PROTOCOL_VERSIONS.find(v => v !== LATEST_PROTOCOL_VERSION); diff --git a/test/e2e/scenarios/logging.test.ts b/test/e2e/scenarios/logging.test.ts index 08f3bb40da..277f2a3499 100644 --- a/test/e2e/scenarios/logging.test.ts +++ b/test/e2e/scenarios/logging.test.ts @@ -17,9 +17,9 @@ import { isJSONRPCRequest, McpServer, ProtocolError, ProtocolErrorCode, Server, import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { tapWire, wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { tapWire, wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const ALL_LEVELS: LoggingLevel[] = ['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency']; diff --git a/test/e2e/scenarios/pagination.test.ts b/test/e2e/scenarios/pagination.test.ts index e0106494d6..0921f5b189 100644 --- a/test/e2e/scenarios/pagination.test.ts +++ b/test/e2e/scenarios/pagination.test.ts @@ -10,9 +10,9 @@ import { isJSONRPCRequest, McpServer, ProtocolError, ProtocolErrorCode, Resource import { expect } from 'vitest'; import { z } from 'zod/v4'; -import { tapWire, wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { tapWire, wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const newClient = () => new Client({ name: 'c', version: '0' }); diff --git a/test/e2e/scenarios/prompts.test.ts b/test/e2e/scenarios/prompts.test.ts index b5052b5572..eb66659679 100644 --- a/test/e2e/scenarios/prompts.test.ts +++ b/test/e2e/scenarios/prompts.test.ts @@ -14,9 +14,9 @@ import { McpServer, ProtocolError, ProtocolErrorCode, Server } from '@modelconte import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const TINY_PNG_BASE64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; const TINY_WAV_BASE64 = 'UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA='; diff --git a/test/e2e/scenarios/protocol.test.ts b/test/e2e/scenarios/protocol.test.ts index 40b5a20af3..d5bf100753 100644 --- a/test/e2e/scenarios/protocol.test.ts +++ b/test/e2e/scenarios/protocol.test.ts @@ -34,9 +34,9 @@ import { import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { tapWire, wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { tapWire, wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const newClient = () => new Client({ name: 'c', version: '0' }); diff --git a/test/e2e/scenarios/resources.test.ts b/test/e2e/scenarios/resources.test.ts index ea83696915..826066cdf9 100644 --- a/test/e2e/scenarios/resources.test.ts +++ b/test/e2e/scenarios/resources.test.ts @@ -13,9 +13,9 @@ import type { RegisteredResource } from '@modelcontextprotocol/server'; import { McpServer, ProtocolError, ProtocolErrorCode, ResourceTemplate, Server } from '@modelcontextprotocol/server'; import { expect, vi } from 'vitest'; -import { wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const TINY_PNG_BASE64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; const FIXTURE_LAST_MODIFIED = '2024-01-15T10:30:00.000Z'; diff --git a/test/e2e/scenarios/roots.test.ts b/test/e2e/scenarios/roots.test.ts index 8328d088ac..c09f1eb485 100644 --- a/test/e2e/scenarios/roots.test.ts +++ b/test/e2e/scenarios/roots.test.ts @@ -12,9 +12,9 @@ import { McpServer, ProtocolError, ProtocolErrorCode } from '@modelcontextprotoc import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; verifies('roots:list:basic', async ({ transport }: TestArgs) => { const received: Array<{ method: string }> = []; diff --git a/test/e2e/scenarios/sampling.test.ts b/test/e2e/scenarios/sampling.test.ts index f251a9ef5f..acec14413d 100644 --- a/test/e2e/scenarios/sampling.test.ts +++ b/test/e2e/scenarios/sampling.test.ts @@ -16,9 +16,9 @@ import { McpServer, ProtocolError, ProtocolErrorCode } from '@modelcontextprotoc import { expect } from 'vitest'; import { z } from 'zod/v4'; -import { tapWire, wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { tapWire, wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const newClient = (capabilities?: ClientCapabilities) => new Client({ name: 'c', version: '0' }, { capabilities: capabilities ?? { sampling: {} } }); diff --git a/test/e2e/scenarios/standard-schema.test.ts b/test/e2e/scenarios/standard-schema.test.ts index f646b573f3..a8f3406577 100644 --- a/test/e2e/scenarios/standard-schema.test.ts +++ b/test/e2e/scenarios/standard-schema.test.ts @@ -16,9 +16,9 @@ import { type } from 'arktype'; import * as v from 'valibot'; import { expect } from 'vitest'; -import { wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; /** Plain client with no extra capabilities declared. */ const newClient = () => new Client({ name: 'c', version: '0' }); diff --git a/test/e2e/scenarios/stdio.test.ts b/test/e2e/scenarios/stdio.test.ts index a6149945e5..f066dde648 100644 --- a/test/e2e/scenarios/stdio.test.ts +++ b/test/e2e/scenarios/stdio.test.ts @@ -20,8 +20,8 @@ import { StdioClientTransport } from '@modelcontextprotocol/client/stdio'; import { JSONRPCMessageSchema } from '@modelcontextprotocol/core'; import { expect, vi } from 'vitest'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; /** Absolute path to the runnable fixture server (executed with tsx). */ const FIXTURE_PATH = fileURLToPath(new URL('../fixtures/stdio-server.ts', import.meta.url)); diff --git a/test/e2e/scenarios/tools.test.ts b/test/e2e/scenarios/tools.test.ts index 408712f23a..cc12a54b1b 100644 --- a/test/e2e/scenarios/tools.test.ts +++ b/test/e2e/scenarios/tools.test.ts @@ -36,9 +36,9 @@ import { AjvJsonSchemaValidator } from '@modelcontextprotocol/server/validators/ import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const TINY_PNG_BASE64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='; const TINY_WAV_BASE64 = 'UklGRiQAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQAAAAA='; diff --git a/test/e2e/scenarios/transport-http.test.ts b/test/e2e/scenarios/transport-http.test.ts index b0bd8abbd8..526e554fa2 100644 --- a/test/e2e/scenarios/transport-http.test.ts +++ b/test/e2e/scenarios/transport-http.test.ts @@ -29,10 +29,10 @@ import { import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import type { HttpHandler } from '../helpers/index.js'; -import { hostPerSession, hostStateless } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import type { HttpHandler } from '../helpers/index'; +import { hostPerSession, hostStateless } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; const newClient = () => new Client({ name: 'c', version: '0' }); diff --git a/test/e2e/scenarios/transport-raw.test.ts b/test/e2e/scenarios/transport-raw.test.ts index 5645df0181..7a6aa4fa34 100644 --- a/test/e2e/scenarios/transport-raw.test.ts +++ b/test/e2e/scenarios/transport-raw.test.ts @@ -23,9 +23,9 @@ import { InMemoryTransport, McpServer } from '@modelcontextprotocol/server'; import { expect, vi } from 'vitest'; import { z } from 'zod/v4'; -import { hostPerSession, hostStateless } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { hostPerSession, hostStateless } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; /** Absolute path to the runnable stdio fixture server (executed with tsx). */ const FIXTURE_PATH = fileURLToPath(new URL('../fixtures/stdio-server.ts', import.meta.url)); diff --git a/test/e2e/scenarios/transport-sse.test.ts b/test/e2e/scenarios/transport-sse.test.ts index b9d5dcefe1..31dbd901e1 100644 --- a/test/e2e/scenarios/transport-sse.test.ts +++ b/test/e2e/scenarios/transport-sse.test.ts @@ -8,8 +8,8 @@ import { expect } from 'vitest'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs } from '../types.js'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs } from '../types'; verifies('transport:sse:server-transport', async (_args: TestArgs) => { // The server half of the legacy SSE transport must be on the public server-side surface for SSE deployments to be hosted on the SDK alone. diff --git a/test/e2e/scenarios/validation.test.ts b/test/e2e/scenarios/validation.test.ts index 21121240e7..dfdce32d63 100644 --- a/test/e2e/scenarios/validation.test.ts +++ b/test/e2e/scenarios/validation.test.ts @@ -29,9 +29,9 @@ import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/server/valida import { expect } from 'vitest'; import { z } from 'zod/v4'; -import { wire } from '../helpers/index.js'; -import { verifies } from '../helpers/verifies.js'; -import type { TestArgs, Transport } from '../types.js'; +import { wire } from '../helpers/index'; +import { verifies } from '../helpers/verifies'; +import type { TestArgs, Transport } from '../types'; const FORECAST_OUTPUT_SCHEMA: Tool['outputSchema'] = { type: 'object', diff --git a/test/helpers/package.json b/test/helpers/package.json index 88f2c3f93e..1826205a1b 100644 --- a/test/helpers/package.json +++ b/test/helpers/package.json @@ -24,10 +24,7 @@ "scripts": { "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", - "check": "npm run typecheck && npm run lint", - "start": "npm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "check": "npm run typecheck && npm run lint" }, "devDependencies": { "@modelcontextprotocol/core": "workspace:^", diff --git a/test/helpers/src/index.ts b/test/helpers/src/index.ts index 1fd7ce2b9b..99e6ed301b 100644 --- a/test/helpers/src/index.ts +++ b/test/helpers/src/index.ts @@ -1,2 +1,2 @@ -export * from './helpers/http.js'; -export * from './helpers/oauth.js'; +export * from './helpers/http'; +export * from './helpers/oauth'; diff --git a/test/integration/package.json b/test/integration/package.json index 8618d0580e..97a62e6c32 100644 --- a/test/integration/package.json +++ b/test/integration/package.json @@ -27,9 +27,6 @@ "check": "npm run typecheck && npm run lint", "test": "vitest run", "test:watch": "vitest", - "start": "npm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client", "test:integration:bun": "bun test test/server/bun.test.ts", "test:integration:deno": "deno test --no-check --allow-net --allow-read --allow-env test/server/deno.test.ts" },