From e886551771343f5f5ba4090b74296615a87c50fc Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Fri, 15 May 2026 15:37:59 +0100 Subject: [PATCH] chore: switch to module ESNext + moduleResolution bundler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Internal-only build configuration change. Consumers are not affected: they continue to import from the built `.mjs`/`.d.mts` files declared in each package's `exports` map. What changed: - `common/tsconfig/tsconfig.json`: `module: NodeNext` → `module: ESNext`, `moduleResolution: NodeNext` → `moduleResolution: bundler`. - `examples/{client,server}-quickstart/tsconfig.json`: same flip (they extend a different base and overrode the resolution). - Strip `.js` extensions from every relative TypeScript import across packages/, examples/, scripts/, test/. - Update CLAUDE.md to reflect the new import convention. Why: - Removes the long-standing footgun of having to write `from './foo.js'` in `.ts` source files. Bundler resolution treats the path as a module reference and lets the tooling resolve it. - Aligns with what the bundler (`tsdown`), vitest, and downstream consumers' bundlers actually do at runtime. Verification: `pnpm typecheck:all`, `pnpm lint:all`, `pnpm test:all`, `pnpm build:all` all pass. --- CLAUDE.md | 2 +- common/tsconfig/tsconfig.json | 4 +- examples/client-quickstart/tsconfig.json | 4 +- examples/client/src/elicitationUrlExample.ts | 2 +- examples/client/src/simpleOAuthClient.ts | 2 +- examples/server-quickstart/tsconfig.json | 4 +- examples/server/src/elicitationUrlExample.ts | 2 +- examples/server/src/simpleStreamableHttp.ts | 2 +- examples/server/src/ssePollingExample.ts | 2 +- examples/shared/src/authServer.ts | 4 +- examples/shared/src/index.ts | 8 +-- .../test/demoInMemoryOAuthProvider.test.ts | 4 +- 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/client.ts | 2 +- 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/experimental/index.ts | 2 +- .../src/experimental/tasks/client.examples.ts | 2 +- .../client/src/experimental/tasks/client.ts | 2 +- packages/client/src/index.ts | 34 +++++----- 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 +- .../client/test/client/middleware.test.ts | 8 +-- 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/core/src/auth/errors.ts | 2 +- .../core/src/errors/sdkErrors.examples.ts | 2 +- packages/core/src/experimental/index.ts | 6 +- .../core/src/experimental/tasks/helpers.ts | 2 +- .../core/src/experimental/tasks/interfaces.ts | 6 +- .../src/experimental/tasks/stores/inMemory.ts | 6 +- packages/core/src/exports/public/index.ts | 62 +++++++++---------- packages/core/src/exports/types/index.ts | 2 +- packages/core/src/index.examples.ts | 4 +- packages/core/src/index.ts | 46 +++++++------- packages/core/src/shared/metadataUtils.ts | 2 +- packages/core/src/shared/protocol.examples.ts | 2 +- packages/core/src/shared/protocol.ts | 16 ++--- packages/core/src/shared/responseMessage.ts | 2 +- packages/core/src/shared/stdio.ts | 4 +- packages/core/src/shared/taskManager.ts | 16 ++--- 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/experimental/inMemory.test.ts | 6 +- 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 | 24 +++---- .../shared/protocolTransportHandling.test.ts | 8 +-- packages/core/test/shared/stdio.test.ts | 4 +- .../test/shared/toolNameValidation.test.ts | 2 +- packages/core/test/shared/transport.test.ts | 2 +- packages/core/test/shared/uriTemplate.test.ts | 2 +- packages/core/test/shared/wrapHandler.test.ts | 4 +- packages/core/test/spec.types.test.ts | 4 +- packages/core/test/types.capabilities.test.ts | 2 +- packages/core/test/types.test.ts | 2 +- 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/src/index.ts | 2 +- .../node/src/streamableHttp.examples.ts | 2 +- .../node/test/streamableHttp.test.ts | 2 +- packages/server/src/experimental/index.ts | 2 +- .../server/src/experimental/tasks/index.ts | 6 +- .../src/experimental/tasks/interfaces.ts | 2 +- .../src/experimental/tasks/mcpServer.ts | 4 +- .../server/src/experimental/tasks/server.ts | 2 +- packages/server/src/index.ts | 28 ++++----- .../server/src/server/completable.examples.ts | 4 +- packages/server/src/server/mcp.examples.ts | 4 +- packages/server/src/server/mcp.ts | 10 +-- .../hostHeaderValidation.examples.ts | 2 +- packages/server/src/server/server.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 +- .../server/test/server/mcp.compat.test.ts | 6 +- packages/server/test/server/server.test.ts | 2 +- packages/server/test/server/stdio.test.ts | 2 +- .../server/test/server/streamableHttp.test.ts | 6 +- scripts/cli.ts | 14 ++--- test/conformance/src/everythingClient.ts | 6 +- .../conformance/src/helpers/withOAuthRetry.ts | 2 +- test/helpers/src/index.ts | 6 +- .../experimental/tasks/taskListing.test.ts | 2 +- 133 files changed, 363 insertions(+), 363 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index cbbf950273..511b7db9c4 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/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/examples/client-quickstart/tsconfig.json b/examples/client-quickstart/tsconfig.json index e7b40b59ba..665b6cd678 100644 --- a/examples/client-quickstart/tsconfig.json +++ b/examples/client-quickstart/tsconfig.json @@ -2,8 +2,8 @@ "compilerOptions": { "target": "ES2023", "lib": ["ES2023"], - "module": "Node16", - "moduleResolution": "Node16", + "module": "ESNext", + "moduleResolution": "bundler", "outDir": "./build", "rootDir": "./src", "strict": true, 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 c75aea9483..3bb84b9e3c 100644 --- a/examples/client/src/simpleOAuthClient.ts +++ b/examples/client/src/simpleOAuthClient.ts @@ -8,7 +8,7 @@ import type { CallToolResult, ListToolsRequest, OAuthClientMetadata } from '@mod 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/tsconfig.json b/examples/server-quickstart/tsconfig.json index c760b5e4c0..6466181ad4 100644 --- a/examples/server-quickstart/tsconfig.json +++ b/examples/server-quickstart/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "target": "ES2022", - "module": "Node16", - "moduleResolution": "Node16", + "module": "ESNext", + "moduleResolution": "bundler", "outDir": "./build", "rootDir": "./src", "strict": true, 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 6da0841ec1..c96eaab883 100644 --- a/examples/server/src/simpleStreamableHttp.ts +++ b/examples/server/src/simpleStreamableHttp.ts @@ -16,7 +16,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 7c318d70d9..002b822ec3 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/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/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 b08694cfbd..150ff1c4ad 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/client.ts b/packages/client/src/client/client.ts index 5fa2e14d94..4ea7bff818 100644 --- a/packages/client/src/client/client.ts +++ b/packages/client/src/client/client.ts @@ -65,7 +65,7 @@ import { SdkErrorCode } from '@modelcontextprotocol/core'; -import { ExperimentalClientTasks } from '../experimental/tasks/client.js'; +import { ExperimentalClientTasks } from '../experimental/tasks/client'; /** * Elicitation default application helper. Applies defaults to the `data` based on the `schema`. 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 f441e9cdb8..011b681b59 100644 --- a/packages/client/src/client/sse.ts +++ b/packages/client/src/client/sse.ts @@ -3,8 +3,8 @@ import { createFetchWithInit, JSONRPCMessageSchema, normalizeHeaders, SdkError, 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 74023fa51f..6cde706092 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 cd643c96dc..5c99ecd17e 100644 --- a/packages/client/src/client/streamableHttp.ts +++ b/packages/client/src/client/streamableHttp.ts @@ -14,8 +14,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/experimental/index.ts b/packages/client/src/experimental/index.ts index 926369f994..7fd1fb4d71 100644 --- a/packages/client/src/experimental/index.ts +++ b/packages/client/src/experimental/index.ts @@ -10,4 +10,4 @@ * @experimental */ -export * from './tasks/client.js'; +export * from './tasks/client'; diff --git a/packages/client/src/experimental/tasks/client.examples.ts b/packages/client/src/experimental/tasks/client.examples.ts index 5652062758..f805c731d0 100644 --- a/packages/client/src/experimental/tasks/client.examples.ts +++ b/packages/client/src/experimental/tasks/client.examples.ts @@ -9,7 +9,7 @@ import type { RequestOptions } from '@modelcontextprotocol/core'; -import type { Client } from '../../client/client.js'; +import type { Client } from '../../client/client'; /** * Example: Using callToolStream to execute a tool with task lifecycle events. diff --git a/packages/client/src/experimental/tasks/client.ts b/packages/client/src/experimental/tasks/client.ts index 75ba873c97..32ef3e7e24 100644 --- a/packages/client/src/experimental/tasks/client.ts +++ b/packages/client/src/experimental/tasks/client.ts @@ -28,7 +28,7 @@ import { ProtocolErrorCode } from '@modelcontextprotocol/core'; -import type { Client } from '../../client/client.js'; +import type { Client } from '../../client/client'; /** * Internal interface for accessing {@linkcode Client}'s private methods. diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 06ca1141b2..4b64577107 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,14 +68,14 @@ export type { StartSSEOptions, StreamableHTTPClientTransportOptions, StreamableHTTPReconnectionOptions -} from './client/streamableHttp.js'; -export { StreamableHTTPClientTransport } from './client/streamableHttp.js'; +} from './client/streamableHttp'; +export { StreamableHTTPClientTransport } from './client/streamableHttp'; // experimental exports -export { ExperimentalClientTasks } from './experimental/tasks/client.js'; +export { ExperimentalClientTasks } from './experimental/tasks/client'; // 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/middleware.test.ts b/packages/client/test/client/middleware.test.ts index 64bbfa6735..262a114607 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'); + const actual = await vi.importActual('../../src/client/auth.js'); 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 b0b9588f02..a2248fab92 100644 --- a/packages/client/test/client/sse.test.ts +++ b/packages/client/test/client/sse.test.ts @@ -7,9 +7,9 @@ import { OAuthError, OAuthErrorCode, SdkError, SdkErrorCode } from '@modelcontex 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 28a7834bcb..f571611bc4 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 b2138b3fa8..0246d3c7a0 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, SdkError, SdkErrorCode } 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; @@ -812,7 +812,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'); @@ -854,8 +854,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 d6ef35bdee..4c3a7400a6 100644 --- a/packages/client/test/client/tokenProvider.test.ts +++ b/packages/client/test/client/tokenProvider.test.ts @@ -6,9 +6,9 @@ import { SdkError, SdkErrorCode } 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/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 729a879acd..12f709cce4 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 } from './sdkErrors.js'; +import { SdkError, SdkErrorCode } from './sdkErrors'; /** * Example: Throwing and catching SDK errors. diff --git a/packages/core/src/experimental/index.ts b/packages/core/src/experimental/index.ts index ea39eb79f6..c0b5d4ad3e 100644 --- a/packages/core/src/experimental/index.ts +++ b/packages/core/src/experimental/index.ts @@ -1,3 +1,3 @@ -export * from './tasks/helpers.js'; -export * from './tasks/interfaces.js'; -export * from './tasks/stores/inMemory.js'; +export * from './tasks/helpers'; +export * from './tasks/interfaces'; +export * from './tasks/stores/inMemory'; diff --git a/packages/core/src/experimental/tasks/helpers.ts b/packages/core/src/experimental/tasks/helpers.ts index 7a13fffbd3..63049d2a95 100644 --- a/packages/core/src/experimental/tasks/helpers.ts +++ b/packages/core/src/experimental/tasks/helpers.ts @@ -5,7 +5,7 @@ * @experimental */ -import { SdkError, SdkErrorCode } from '../../errors/sdkErrors.js'; +import { SdkError, SdkErrorCode } from '../../errors/sdkErrors'; /** * Type representing the task requests capability structure. diff --git a/packages/core/src/experimental/tasks/interfaces.ts b/packages/core/src/experimental/tasks/interfaces.ts index d980f304ca..ece1f6267e 100644 --- a/packages/core/src/experimental/tasks/interfaces.ts +++ b/packages/core/src/experimental/tasks/interfaces.ts @@ -3,8 +3,8 @@ * WARNING: These APIs are experimental and may change without notice. */ -import type { ServerContext } from '../../shared/protocol.js'; -import type { RequestTaskStore } from '../../shared/taskManager.js'; +import type { ServerContext } from '../../shared/protocol'; +import type { RequestTaskStore } from '../../shared/taskManager'; import type { JSONRPCErrorResponse, JSONRPCNotification, @@ -15,7 +15,7 @@ import type { Result, Task, ToolExecution -} from '../../types/index.js'; +} from '../../types/index'; // ============================================================================ // Task Handler Types (for registerToolTask) diff --git a/packages/core/src/experimental/tasks/stores/inMemory.ts b/packages/core/src/experimental/tasks/stores/inMemory.ts index fbd7e39f53..ad099465e3 100644 --- a/packages/core/src/experimental/tasks/stores/inMemory.ts +++ b/packages/core/src/experimental/tasks/stores/inMemory.ts @@ -3,9 +3,9 @@ * @experimental */ -import type { Request, RequestId, Result, Task } from '../../../types/index.js'; -import type { CreateTaskOptions, QueuedMessage, TaskMessageQueue, TaskStore } from '../interfaces.js'; -import { isTerminal } from '../interfaces.js'; +import type { Request, RequestId, Result, Task } from '../../../types/index'; +import type { CreateTaskOptions, QueuedMessage, TaskMessageQueue, TaskStore } from '../interfaces'; +import { isTerminal } from '../interfaces'; interface StoredTask { task: Task; diff --git a/packages/core/src/exports/public/index.ts b/packages/core/src/exports/public/index.ts index e305f32a44..23b8e1c8f1 100644 --- a/packages/core/src/exports/public/index.ts +++ b/packages/core/src/exports/public/index.ts @@ -10,10 +10,10 @@ */ // 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 { SdkError, SdkErrorCode } from '../../errors/sdkErrors.js'; +export { SdkError, SdkErrorCode } from '../../errors/sdkErrors'; // Auth TypeScript types (NOT Zod schemas like OAuthMetadataSchema) export type { @@ -30,13 +30,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 { @@ -48,11 +48,11 @@ 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'; // Task manager types (NOT TaskManager class itself — internal) -export type { RequestTaskStore, TaskContext, TaskManagerOptions, TaskRequestOptions } from '../../shared/taskManager.js'; +export type { RequestTaskStore, TaskContext, TaskManagerOptions, TaskRequestOptions } from '../../shared/taskManager'; // Response message types export type { @@ -62,25 +62,25 @@ export type { ResultMessage, TaskCreatedMessage, TaskStatusMessage -} from '../../shared/responseMessage.js'; -export { takeResult, toArrayAsync } from '../../shared/responseMessage.js'; +} from '../../shared/responseMessage'; +export { takeResult, toArrayAsync } from '../../shared/responseMessage'; // stdio message framing utilities (for custom transport authors) -export { deserializeMessage, ReadBuffer, serializeMessage } from '../../shared/stdio.js'; +export { deserializeMessage, ReadBuffer, serializeMessage } 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 { @@ -94,13 +94,13 @@ export { PARSE_ERROR, RELATED_TASK_META_KEY, SUPPORTED_PROTOCOL_VERSIONS -} from '../../types/constants.js'; +} from '../../types/constants'; // Enums -export { ProtocolErrorCode } from '../../types/enums.js'; +export { ProtocolErrorCode } from '../../types/enums'; // Error classes -export { ProtocolError, UrlElicitationRequiredError } from '../../types/errors.js'; +export { ProtocolError, UrlElicitationRequiredError } from '../../types/errors'; // Type guards and message parsing export { @@ -116,10 +116,10 @@ export { isJSONRPCResultResponse, isTaskAugmentedRequestParams, parseJSONRPCMessage -} from '../../types/guards.js'; +} from '../../types/guards'; // Experimental task types and classes -export { assertClientRequestTaskCapability, assertToolsCallTaskCapability } from '../../experimental/tasks/helpers.js'; +export { assertClientRequestTaskCapability, assertToolsCallTaskCapability } from '../../experimental/tasks/helpers'; export type { BaseQueuedMessage, CreateTaskOptions, @@ -133,16 +133,16 @@ export type { TaskServerContext, TaskStore, TaskToolExecution -} from '../../experimental/tasks/interfaces.js'; -export { isTerminal } from '../../experimental/tasks/interfaces.js'; -export { InMemoryTaskMessageQueue, InMemoryTaskStore } from '../../experimental/tasks/stores/inMemory.js'; +} from '../../experimental/tasks/interfaces'; +export { isTerminal } from '../../experimental/tasks/interfaces'; +export { InMemoryTaskMessageQueue, InMemoryTaskStore } from '../../experimental/tasks/stores/inMemory'; // 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 { AjvJsonSchemaValidator } from '../../validators/ajvProvider.js'; -export type { CfWorkerSchemaDraft } from '../../validators/cfWorkerProvider.js'; +export type { SpecTypeName, SpecTypes } from '../../types/specTypeSchema'; +export { isSpecType, specTypeSchemas } from '../../types/specTypeSchema'; +export type { StandardSchemaV1, StandardSchemaV1Sync, StandardSchemaWithJSON } from '../../util/standardSchema'; +export { AjvJsonSchemaValidator } from '../../validators/ajvProvider'; +export type { 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.examples.ts b/packages/core/src/index.examples.ts index 531f512113..529abfecf6 100644 --- a/packages/core/src/index.examples.ts +++ b/packages/core/src/index.examples.ts @@ -7,8 +7,8 @@ * @module */ -import { AjvJsonSchemaValidator } from './validators/ajvProvider.js'; -import { CfWorkerJsonSchemaValidator } from './validators/cfWorkerProvider.js'; +import { AjvJsonSchemaValidator } from './validators/ajvProvider'; +import { CfWorkerJsonSchemaValidator } from './validators/cfWorkerProvider'; /** * Example: AJV validator for Node.js. diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 8bcc9c9591..2d17a7d531 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,31 +1,31 @@ -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/responseMessage.js'; -export * from './shared/stdio.js'; -export type { RequestTaskStore, TaskContext, TaskManagerOptions, TaskRequestOptions } from './shared/taskManager.js'; -export { extractTaskManagerOptions, NullTaskManager, TaskManager } from './shared/taskManager.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/responseMessage'; +export * from './shared/stdio'; +export type { RequestTaskStore, TaskContext, TaskManagerOptions, TaskRequestOptions } from './shared/taskManager'; +export { extractTaskManagerOptions, NullTaskManager, TaskManager } from './shared/taskManager'; +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'; // experimental exports -export * from './experimental/index.js'; -export * from './validators/ajvProvider.js'; +export * from './experimental/index'; +export * from './validators/ajvProvider'; // cfWorkerProvider is intentionally NOT re-exported here: it statically imports // `@cfworker/json-schema` (an optional peer), and bundling it into the main barrel // would force that import on all Node consumers. Import via `@modelcontextprotocol/core/validators/cfWorker` // (used by the workerd/browser `_shims` and the public `/validators/cf-worker` subpaths). -export type { CfWorkerSchemaDraft } from './validators/cfWorkerProvider.js'; -export * from './validators/fromJsonSchema.js'; +export type { CfWorkerSchemaDraft } from './validators/cfWorkerProvider'; +export * from './validators/fromJsonSchema'; /** * JSON Schema validation * @@ -53,4 +53,4 @@ export * from './validators/fromJsonSchema.js'; */ // Core types only - implementations are exported via separate entry points -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/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 361bd6fc7c..ef62838c8a 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, @@ -31,7 +31,7 @@ import type { ResultTypeMap, ServerCapabilities, TaskCreationParams -} from '../types/index.js'; +} from '../types/index'; import { getNotificationSchema, getRequestSchema, @@ -43,12 +43,12 @@ 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 { TaskContext, TaskManagerHost, TaskManagerOptions, TaskRequestOptions } from './taskManager.js'; -import { NullTaskManager, TaskManager } from './taskManager.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 { TaskContext, TaskManagerHost, TaskManagerOptions, TaskRequestOptions } from './taskManager'; +import { NullTaskManager, TaskManager } from './taskManager'; +import type { Transport, TransportSendOptions } from './transport'; /** * Callback for progress notifications. diff --git a/packages/core/src/shared/responseMessage.ts b/packages/core/src/shared/responseMessage.ts index 25922a355f..3944bd33a9 100644 --- a/packages/core/src/shared/responseMessage.ts +++ b/packages/core/src/shared/responseMessage.ts @@ -1,4 +1,4 @@ -import type { Result, Task } from '../types/index.js'; +import type { Result, Task } from '../types/index'; /** * Base message type for the response stream. diff --git a/packages/core/src/shared/stdio.ts b/packages/core/src/shared/stdio.ts index 7283a5ef96..f1c1d485a4 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'; /** * Buffers a continuous stdio stream into discrete JSON-RPC messages. diff --git a/packages/core/src/shared/taskManager.ts b/packages/core/src/shared/taskManager.ts index 257dbec827..9194c525d7 100644 --- a/packages/core/src/shared/taskManager.ts +++ b/packages/core/src/shared/taskManager.ts @@ -1,5 +1,5 @@ -import type { CreateTaskOptions, QueuedMessage, TaskMessageQueue, TaskStore } from '../experimental/tasks/interfaces.js'; -import { isTerminal } from '../experimental/tasks/interfaces.js'; +import type { CreateTaskOptions, QueuedMessage, TaskMessageQueue, TaskStore } from '../experimental/tasks/interfaces'; +import { isTerminal } from '../experimental/tasks/interfaces'; import type { GetTaskPayloadRequest, GetTaskRequest, @@ -16,7 +16,7 @@ import type { Task, TaskCreationParams, TaskStatusNotification -} from '../types/index.js'; +} from '../types/index'; import { CancelTaskResultSchema, CreateTaskResultSchema, @@ -30,11 +30,11 @@ import { ProtocolErrorCode, RELATED_TASK_META_KEY, TaskStatusNotificationSchema -} from '../types/index.js'; -import type { AnyObjectSchema, AnySchema, SchemaOutput } from '../util/schema.js'; -import type { StandardSchemaV1 } from '../util/standardSchema.js'; -import type { BaseContext, NotificationOptions, RequestOptions } from './protocol.js'; -import type { ResponseMessage } from './responseMessage.js'; +} from '../types/index'; +import type { AnyObjectSchema, AnySchema, SchemaOutput } from '../util/schema'; +import type { StandardSchemaV1 } from '../util/standardSchema'; +import type { BaseContext, NotificationOptions, RequestOptions } from './protocol'; +import type { ResponseMessage } from './responseMessage'; /** * Host interface for TaskManager to call back into Protocol. @internal 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 796c0d2bc5..130b6c2db4 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 } from './types.js'; +import { ProtocolErrorCode } from './enums'; +import type { ElicitRequestURLParams } 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 a243c1b829..7b93b9aff2 100644 --- a/packages/core/src/types/schemas.ts +++ b/packages/core/src/types/schemas.ts @@ -1,6 +1,6 @@ import * as z from 'zod/v4'; -import { JSONRPC_VERSION, RELATED_TASK_META_KEY } from './constants.js'; +import { JSONRPC_VERSION, RELATED_TASK_META_KEY } from './constants'; import type { JSONArray, JSONObject, @@ -10,7 +10,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 477d61a55a..f0df4fe83a 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 a92deec8e1..ed3b8f0040 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, @@ -156,7 +156,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 eea45bf15c..44f305f470 100644 --- a/packages/core/src/validators/ajvProvider.examples.ts +++ b/packages/core/src/validators/ajvProvider.examples.ts @@ -10,7 +10,7 @@ import { Ajv } from 'ajv'; import _addFormats from 'ajv-formats'; -import { AjvJsonSchemaValidator } from './ajvProvider.js'; +import { AjvJsonSchemaValidator } from './ajvProvider'; const addFormats = _addFormats as unknown as typeof _addFormats.default; diff --git a/packages/core/src/validators/ajvProvider.ts b/packages/core/src/validators/ajvProvider.ts index 820a3d6618..b6cdd3fd68 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'; function createDefaultAjvInstance(): Ajv { const ajv = new Ajv({ diff --git a/packages/core/src/validators/cfWorkerProvider.examples.ts b/packages/core/src/validators/cfWorkerProvider.examples.ts index a347f9b7cf..90f163e968 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. diff --git a/packages/core/src/validators/cfWorkerProvider.ts b/packages/core/src/validators/cfWorkerProvider.ts index f2cce37e8b..ef360f8c33 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 22ff4a9d60..0f282291d7 100644 --- a/packages/core/src/validators/fromJsonSchema.examples.ts +++ b/packages/core/src/validators/fromJsonSchema.examples.ts @@ -6,8 +6,8 @@ * @module */ -import { AjvJsonSchemaValidator } from './ajvProvider.js'; -import { fromJsonSchema } from './fromJsonSchema.js'; +import { AjvJsonSchemaValidator } from './ajvProvider'; +import { fromJsonSchema } from './fromJsonSchema'; /** * Example: wrap a raw JSON Schema object for use with registerTool. diff --git a/packages/core/src/validators/fromJsonSchema.ts b/packages/core/src/validators/fromJsonSchema.ts index 73db24e8cc..ddd9f0be0c 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/experimental/inMemory.test.ts b/packages/core/test/experimental/inMemory.test.ts index 7639cad9f4..f211351517 100644 --- a/packages/core/test/experimental/inMemory.test.ts +++ b/packages/core/test/experimental/inMemory.test.ts @@ -1,8 +1,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import type { QueuedMessage } from '../../src/experimental/tasks/interfaces.js'; -import { InMemoryTaskMessageQueue, InMemoryTaskStore } from '../../src/experimental/tasks/stores/inMemory.js'; -import type { Request, TaskCreationParams } from '../../src/types/index.js'; +import type { QueuedMessage } from '../../src/experimental/tasks/interfaces'; +import { InMemoryTaskMessageQueue, InMemoryTaskStore } from '../../src/experimental/tasks/stores/inMemory'; +import type { Request, TaskCreationParams } from '../../src/types/index'; describe('InMemoryTaskStore', () => { let store: InMemoryTaskStore; 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 47e02c9bca..1dcfddbb9a 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 619e09376a..fff2c8c849 100644 --- a/packages/core/test/shared/protocol.test.ts +++ b/packages/core/test/shared/protocol.test.ts @@ -9,15 +9,15 @@ import type { QueuedRequest, TaskMessageQueue, TaskStore -} from '../../src/experimental/tasks/interfaces.js'; -import { InMemoryTaskMessageQueue } from '../../src/experimental/tasks/stores/inMemory.js'; -import type { BaseContext } from '../../src/shared/protocol.js'; -import { mergeCapabilities, Protocol } from '../../src/shared/protocol.js'; -import type { ErrorMessage, ResponseMessage } from '../../src/shared/responseMessage.js'; -import { toArrayAsync } from '../../src/shared/responseMessage.js'; -import type { TaskManagerOptions } from '../../src/shared/taskManager.js'; -import { NullTaskManager, TaskManager } from '../../src/shared/taskManager.js'; -import type { Transport, TransportSendOptions } from '../../src/shared/transport.js'; +} from '../../src/experimental/tasks/interfaces'; +import { InMemoryTaskMessageQueue } from '../../src/experimental/tasks/stores/inMemory'; +import type { BaseContext } from '../../src/shared/protocol'; +import { mergeCapabilities, Protocol } from '../../src/shared/protocol'; +import type { ErrorMessage, ResponseMessage } from '../../src/shared/responseMessage'; +import { toArrayAsync } from '../../src/shared/responseMessage'; +import type { TaskManagerOptions } from '../../src/shared/taskManager'; +import { NullTaskManager, TaskManager } from '../../src/shared/taskManager'; +import type { Transport, TransportSendOptions } from '../../src/shared/transport'; import type { ClientCapabilities, JSONRPCErrorResponse, @@ -33,9 +33,9 @@ import type { ServerCapabilities, Task, TaskCreationParams -} from '../../src/types/index.js'; -import { ProtocolError, ProtocolErrorCode, RELATED_TASK_META_KEY } from '../../src/types/index.js'; -import { SdkError, SdkErrorCode } from '../../src/errors/sdkErrors.js'; +} from '../../src/types/index'; +import { ProtocolError, ProtocolErrorCode, RELATED_TASK_META_KEY } 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 4e9c33e67d..06054fdeac 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 65d1de0eaa..10185da66d 100644 --- a/packages/core/test/shared/stdio.test.ts +++ b/packages/core/test/shared/stdio.test.ts @@ -1,5 +1,5 @@ -import { ReadBuffer } from '../../src/shared/stdio.js'; -import type { JSONRPCMessage } from '../../src/types/index.js'; +import { ReadBuffer } 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/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 6a6e33fb09..9a2f006882 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.test.ts b/packages/core/test/spec.types.test.ts index d26a4cd701..abdcc3874b 100644 --- a/packages/core/test/spec.types.test.ts +++ b/packages/core/test/spec.types.test.ts @@ -8,8 +8,8 @@ import fs from 'node:fs'; import path from 'node:path'; -import type * as SpecTypes from '../src/types/spec.types.js'; -import type * as SDKTypes from '../src/types/index.js'; +import type * as SpecTypes from '../src/types/spec.types'; +import type * as SDKTypes 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 9383f7d5ec..2aef1da054 100644 --- a/packages/core/test/types.test.ts +++ b/packages/core/test/types.test.ts @@ -16,7 +16,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/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/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/src/experimental/index.ts b/packages/server/src/experimental/index.ts index 55dd44ed08..40c055ead3 100644 --- a/packages/server/src/experimental/index.ts +++ b/packages/server/src/experimental/index.ts @@ -10,4 +10,4 @@ * @experimental */ -export * from './tasks/index.js'; +export * from './tasks/index'; diff --git a/packages/server/src/experimental/tasks/index.ts b/packages/server/src/experimental/tasks/index.ts index 6917fe61af..8c3aa23123 100644 --- a/packages/server/src/experimental/tasks/index.ts +++ b/packages/server/src/experimental/tasks/index.ts @@ -5,6 +5,6 @@ * @experimental */ -export * from './interfaces.js'; -export * from './mcpServer.js'; -export * from './server.js'; +export * from './interfaces'; +export * from './mcpServer'; +export * from './server'; diff --git a/packages/server/src/experimental/tasks/interfaces.ts b/packages/server/src/experimental/tasks/interfaces.ts index 2aef91a8c0..e47fea761d 100644 --- a/packages/server/src/experimental/tasks/interfaces.ts +++ b/packages/server/src/experimental/tasks/interfaces.ts @@ -13,7 +13,7 @@ import type { TaskServerContext } from '@modelcontextprotocol/core'; -import type { BaseToolCallback } from '../../server/mcp.js'; +import type { BaseToolCallback } from '../../server/mcp'; // ============================================================================ // Task Handler Types (for registerToolTask) diff --git a/packages/server/src/experimental/tasks/mcpServer.ts b/packages/server/src/experimental/tasks/mcpServer.ts index b7c28c40d3..159eb3a627 100644 --- a/packages/server/src/experimental/tasks/mcpServer.ts +++ b/packages/server/src/experimental/tasks/mcpServer.ts @@ -7,8 +7,8 @@ import type { StandardSchemaWithJSON, TaskToolExecution, ToolAnnotations, ToolExecution } from '@modelcontextprotocol/core'; -import type { AnyToolHandler, McpServer, RegisteredTool } from '../../server/mcp.js'; -import type { ToolTaskHandler } from './interfaces.js'; +import type { AnyToolHandler, McpServer, RegisteredTool } from '../../server/mcp'; +import type { ToolTaskHandler } from './interfaces'; /** * Internal interface for accessing {@linkcode McpServer}'s private _createRegisteredTool method. diff --git a/packages/server/src/experimental/tasks/server.ts b/packages/server/src/experimental/tasks/server.ts index 2e7b205fd6..88c346664e 100644 --- a/packages/server/src/experimental/tasks/server.ts +++ b/packages/server/src/experimental/tasks/server.ts @@ -24,7 +24,7 @@ import type { } from '@modelcontextprotocol/core'; import { getResultSchema, GetTaskPayloadResultSchema, SdkError, SdkErrorCode } from '@modelcontextprotocol/core'; -import type { Server } from '../../server/server.js'; +import type { Server } from '../../server/server'; /** * Experimental task features for low-level MCP servers. diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 95566bbb4d..ba9a9b0d66 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,16 +37,16 @@ export type { HandleRequestOptions, StreamId, WebStandardStreamableHTTPServerTransportOptions -} from './server/streamableHttp.js'; -export { WebStandardStreamableHTTPServerTransport } from './server/streamableHttp.js'; +} from './server/streamableHttp'; +export { WebStandardStreamableHTTPServerTransport } from './server/streamableHttp'; // experimental exports -export type { CreateTaskRequestHandler, TaskRequestHandler, ToolTaskHandler } from './experimental/tasks/interfaces.js'; -export { ExperimentalMcpServerTasks } from './experimental/tasks/mcpServer.js'; -export { ExperimentalServerTasks } from './experimental/tasks/server.js'; +export type { CreateTaskRequestHandler, TaskRequestHandler, ToolTaskHandler } from './experimental/tasks/interfaces'; +export { ExperimentalMcpServerTasks } from './experimental/tasks/mcpServer'; +export { ExperimentalServerTasks } from './experimental/tasks/server'; // 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 fb45fd5db6..522220f30f 100644 --- a/packages/server/src/server/mcp.ts +++ b/packages/server/src/server/mcp.ts @@ -41,11 +41,11 @@ import { } from '@modelcontextprotocol/core'; import type * as z from 'zod/v4'; -import type { ToolTaskHandler } from '../experimental/tasks/interfaces.js'; -import { ExperimentalMcpServerTasks } from '../experimental/tasks/mcpServer.js'; -import { getCompleter, isCompletable } from './completable.js'; -import type { ServerOptions } from './server.js'; -import { Server } from './server.js'; +import type { ToolTaskHandler } from '../experimental/tasks/interfaces'; +import { ExperimentalMcpServerTasks } from '../experimental/tasks/mcpServer'; +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/server.ts b/packages/server/src/server/server.ts index f6a34f02da..bddd4c800a 100644 --- a/packages/server/src/server/server.ts +++ b/packages/server/src/server/server.ts @@ -56,7 +56,7 @@ import { } from '@modelcontextprotocol/core'; import { DefaultJsonSchemaValidator } from '@modelcontextprotocol/server/_shims'; -import { ExperimentalServerTasks } from '../experimental/tasks/server.js'; +import { ExperimentalServerTasks } from '../experimental/tasks/server'; /** * Extended tasks capability that includes runtime configuration (store, messageQueue). 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/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/server.test.ts b/packages/server/test/server/server.test.ts index fdb8214c56..8012e11b07 100644 --- a/packages/server/test/server/server.test.ts +++ b/packages/server/test/server/server.test.ts @@ -1,6 +1,6 @@ import type { JSONRPCMessage } from '@modelcontextprotocol/core'; import { InMemoryTransport, LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/core'; -import { Server } from '../../src/server/server.js'; +import { Server } from '../../src/server/server'; describe('Server', () => { describe('_oninitialize', () => { diff --git a/packages/server/test/server/stdio.test.ts b/packages/server/test/server/stdio.test.ts index 92671cacd9..340195fbfe 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/scripts/cli.ts b/scripts/cli.ts index 809a23efed..1bb8d61838 100644 --- a/scripts/cli.ts +++ b/scripts/cli.ts @@ -1,11 +1,11 @@ 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'; +import { Client } from '../src/client/index'; +import { SSEClientTransport } from '../src/client/sse'; +import { StdioClientTransport } from '../src/client/stdio'; +import { Server } from '../src/server/index'; +import { SSEServerTransport } from '../src/server/sse'; +import { StdioServerTransport } from '../src/server/stdio'; +import { ListResourcesResultSchema } from '../src/types'; async function runClient(url_or_command: string, args: string[]) { const client = new Client( 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/helpers/src/index.ts b/test/helpers/src/index.ts index 1ecfa8e24a..3901b4e1a5 100644 --- a/test/helpers/src/index.ts +++ b/test/helpers/src/index.ts @@ -1,3 +1,3 @@ -export * from './helpers/http.js'; -export * from './helpers/oauth.js'; -export * from './helpers/tasks.js'; +export * from './helpers/http'; +export * from './helpers/oauth'; +export * from './helpers/tasks'; diff --git a/test/integration/test/experimental/tasks/taskListing.test.ts b/test/integration/test/experimental/tasks/taskListing.test.ts index 2b21e99d51..ba1207fce6 100644 --- a/test/integration/test/experimental/tasks/taskListing.test.ts +++ b/test/integration/test/experimental/tasks/taskListing.test.ts @@ -1,7 +1,7 @@ import { ProtocolError, ProtocolErrorCode } from '@modelcontextprotocol/core'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { createInMemoryTaskEnvironment } from '../../helpers/mcp.js'; +import { createInMemoryTaskEnvironment } from '../../helpers/mcp'; describe('Task Listing with Pagination', () => { let client: Awaited>['client'];