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/docs/client-quickstart.md b/docs/client-quickstart.md index 71b8a9e12a..30537f0ae2 100644 --- a/docs/client-quickstart.md +++ b/docs/client-quickstart.md @@ -88,10 +88,10 @@ Create a `tsconfig.json` in the root of your project: ```json { "compilerOptions": { - "target": "ES2023", - "lib": ["ES2023"], - "module": "Node16", - "moduleResolution": "Node16", + "target": "ESNext", + "lib": ["ESNext"], + "module": "ESNext", + "moduleResolution": "bundler", "outDir": "./build", "rootDir": "./src", "strict": true, @@ -236,7 +236,8 @@ Now let's add the core functionality for processing queries and handling tool ca messages, }); - finalText.push(followUp.content[0].type === 'text' ? followUp.content[0].text : ''); + const firstBlock = followUp.content[0]; + finalText.push(firstBlock?.type === 'text' ? firstBlock.text : ''); } } @@ -284,13 +285,14 @@ Finally, we'll add the main execution logic: ```ts source="../examples/client-quickstart/src/index.ts#main" async function main() { - if (process.argv.length < 3) { + const serverScriptPath = process.argv[2]; + if (!serverScriptPath) { console.log('Usage: node build/index.js '); return; } const mcpClient = new MCPClient(); try { - await mcpClient.connectToServer(process.argv[2]); + await mcpClient.connectToServer(serverScriptPath); // Check if we have a valid API key to continue const apiKey = process.env.ANTHROPIC_API_KEY; diff --git a/docs/server-quickstart.md b/docs/server-quickstart.md index b8d19e7e1c..167fe560db 100644 --- a/docs/server-quickstart.md +++ b/docs/server-quickstart.md @@ -103,9 +103,10 @@ Create a `tsconfig.json` in the root of your project: ```json { "compilerOptions": { - "target": "ES2022", - "module": "Node16", - "moduleResolution": "Node16", + "target": "ESNext", + "lib": ["ESNext"], + "module": "ESNext", + "moduleResolution": "bundler", "outDir": "./build", "rootDir": "./src", "strict": true, diff --git a/examples/client-quickstart/package.json b/examples/client-quickstart/package.json index 98919df995..646890492e 100644 --- a/examples/client-quickstart/package.json +++ b/examples/client-quickstart/package.json @@ -15,6 +15,7 @@ "@modelcontextprotocol/client": "workspace:^" }, "devDependencies": { + "@modelcontextprotocol/tsconfig": "workspace:^", "@types/node": "^24.10.1", "typescript": "catalog:devTools" } diff --git a/examples/client-quickstart/src/index.ts b/examples/client-quickstart/src/index.ts index f677834c03..6764fe61ff 100644 --- a/examples/client-quickstart/src/index.ts +++ b/examples/client-quickstart/src/index.ts @@ -116,7 +116,8 @@ class MCPClient { messages, }); - finalText.push(followUp.content[0].type === 'text' ? followUp.content[0].text : ''); + const firstBlock = followUp.content[0]; + finalText.push(firstBlock?.type === 'text' ? firstBlock.text : ''); } } @@ -156,13 +157,14 @@ class MCPClient { //#region main async function main() { - if (process.argv.length < 3) { + const serverScriptPath = process.argv[2]; + if (!serverScriptPath) { console.log('Usage: node build/index.js '); return; } const mcpClient = new MCPClient(); try { - await mcpClient.connectToServer(process.argv[2]); + await mcpClient.connectToServer(serverScriptPath); // Check if we have a valid API key to continue const apiKey = process.env.ANTHROPIC_API_KEY; diff --git a/examples/client-quickstart/tsconfig.json b/examples/client-quickstart/tsconfig.json index e7b40b59ba..a2bf4fd724 100644 --- a/examples/client-quickstart/tsconfig.json +++ b/examples/client-quickstart/tsconfig.json @@ -1,15 +1,11 @@ { + "extends": "@modelcontextprotocol/tsconfig", "compilerOptions": { - "target": "ES2023", - "lib": ["ES2023"], - "module": "Node16", - "moduleResolution": "Node16", "outDir": "./build", "rootDir": "./src", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, + "declaration": false, + "declarationMap": false, + "types": ["node"], "paths": { "@modelcontextprotocol/client": ["./node_modules/@modelcontextprotocol/client/src/index.ts"], "@modelcontextprotocol/client/stdio": ["./node_modules/@modelcontextprotocol/client/src/stdio.ts"], diff --git a/examples/client/package.json b/examples/client/package.json index 57b329fd2d..68dfc2718b 100644 --- a/examples/client/package.json +++ b/examples/client/package.json @@ -26,10 +26,7 @@ "prepack": "pnpm run build:esm && pnpm run build:cjs", "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", - "check": "pnpm run typecheck && pnpm run lint", - "start": "pnpm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "check": "pnpm run typecheck && pnpm run lint" }, "dependencies": { "@modelcontextprotocol/client": "workspace:^", diff --git a/examples/client/src/elicitationUrlExample.ts b/examples/client/src/elicitationUrlExample.ts index 7c5cce2ee2..f1b6db3b52 100644 --- a/examples/client/src/elicitationUrlExample.ts +++ b/examples/client/src/elicitationUrlExample.ts @@ -27,7 +27,7 @@ import { } from '@modelcontextprotocol/client'; import open from 'open'; -import { InMemoryOAuthClientProvider } from './simpleOAuthClientProvider.js'; +import { InMemoryOAuthClientProvider } from './simpleOAuthClientProvider'; // Set up OAuth (required for this example) const OAUTH_CALLBACK_PORT = 8090; // Use different port than auth server (3001) diff --git a/examples/client/src/simpleOAuthClient.ts b/examples/client/src/simpleOAuthClient.ts index 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/package.json b/examples/server-quickstart/package.json index 133af7a1d6..e06a9832f9 100644 --- a/examples/server-quickstart/package.json +++ b/examples/server-quickstart/package.json @@ -15,6 +15,7 @@ "zod": "catalog:runtimeShared" }, "devDependencies": { + "@modelcontextprotocol/tsconfig": "workspace:^", "@types/node": "^24.10.1", "typescript": "catalog:devTools" } diff --git a/examples/server-quickstart/tsconfig.json b/examples/server-quickstart/tsconfig.json index c760b5e4c0..bd80e544cd 100644 --- a/examples/server-quickstart/tsconfig.json +++ b/examples/server-quickstart/tsconfig.json @@ -1,14 +1,11 @@ { + "extends": "@modelcontextprotocol/tsconfig", "compilerOptions": { - "target": "ES2022", - "module": "Node16", - "moduleResolution": "Node16", "outDir": "./build", "rootDir": "./src", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, + "declaration": false, + "declarationMap": false, + "types": ["node"], "paths": { "@modelcontextprotocol/server": ["./node_modules/@modelcontextprotocol/server/src/index.ts"], "@modelcontextprotocol/server/stdio": ["./node_modules/@modelcontextprotocol/server/src/stdio.ts"], diff --git a/examples/server/package.json b/examples/server/package.json index fcff95d9a9..8ffb48ce65 100644 --- a/examples/server/package.json +++ b/examples/server/package.json @@ -26,10 +26,7 @@ "prepack": "pnpm run build:esm && pnpm run build:cjs", "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", - "check": "pnpm run typecheck && pnpm run lint", - "start": "pnpm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "check": "pnpm run typecheck && pnpm run lint" }, "dependencies": { "@hono/node-server": "catalog:runtimeServerOnly", diff --git a/examples/server/src/elicitationUrlExample.ts b/examples/server/src/elicitationUrlExample.ts index 93b59152f8..7016d11b9b 100644 --- a/examples/server/src/elicitationUrlExample.ts +++ b/examples/server/src/elicitationUrlExample.ts @@ -19,7 +19,7 @@ import type { Request, Response } from 'express'; import express from 'express'; import * as z from 'zod/v4'; -import { InMemoryEventStore } from './inMemoryEventStore.js'; +import { InMemoryEventStore } from './inMemoryEventStore'; // Create an MCP server with implementation details const getServer = () => { diff --git a/examples/server/src/simpleStreamableHttp.ts b/examples/server/src/simpleStreamableHttp.ts index 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/package.json b/examples/shared/package.json index 0bab8be920..4b5fd03e5d 100644 --- a/examples/shared/package.json +++ b/examples/shared/package.json @@ -26,10 +26,7 @@ "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", "check": "pnpm run typecheck && pnpm run lint", "test": "vitest run", - "test:watch": "vitest", - "start": "pnpm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "test:watch": "vitest" }, "dependencies": { "@modelcontextprotocol/core": "workspace:^", diff --git a/examples/shared/src/authServer.ts b/examples/shared/src/authServer.ts index 995fedc7d9..6ddb2fa7c1 100644 --- a/examples/shared/src/authServer.ts +++ b/examples/shared/src/authServer.ts @@ -18,8 +18,8 @@ import cors from 'cors'; import type { Request, Response as ExpressResponse, Router } from 'express'; import express from 'express'; -import type { DemoAuth } from './auth.js'; -import { createDemoAuth, DEMO_USER_CREDENTIALS } from './auth.js'; +import type { DemoAuth } from './auth'; +import { createDemoAuth, DEMO_USER_CREDENTIALS } from './auth'; export interface SetupAuthServerOptions { authServerUrl: URL; diff --git a/examples/shared/src/index.ts b/examples/shared/src/index.ts index 47c4d67109..dc5dd4a03b 100644 --- a/examples/shared/src/index.ts +++ b/examples/shared/src/index.ts @@ -1,7 +1,7 @@ // Auth configuration -export type { CreateDemoAuthOptions, DemoAuth } from './auth.js'; -export { createDemoAuth } from './auth.js'; +export type { CreateDemoAuthOptions, DemoAuth } from './auth'; +export { createDemoAuth } from './auth'; // Auth server setup + demo token verifier (pass to `requireBearerAuth` from @modelcontextprotocol/express) -export type { SetupAuthServerOptions } from './authServer.js'; -export { createProtectedResourceMetadataRouter, demoTokenVerifier, getAuth, setupAuthServer } from './authServer.js'; +export type { SetupAuthServerOptions } from './authServer'; +export { createProtectedResourceMetadataRouter, demoTokenVerifier, getAuth, setupAuthServer } from './authServer'; diff --git a/examples/shared/test/demoInMemoryOAuthProvider.test.ts b/examples/shared/test/demoInMemoryOAuthProvider.test.ts index bd3131dbad..a7eb35dbfd 100644 --- a/examples/shared/test/demoInMemoryOAuthProvider.test.ts +++ b/examples/shared/test/demoInMemoryOAuthProvider.test.ts @@ -9,8 +9,8 @@ import { describe, expect, it } from 'vitest'; -import type { CreateDemoAuthOptions } from '../src/auth.js'; -import { createDemoAuth } from '../src/auth.js'; +import type { CreateDemoAuthOptions } from '../src/auth'; +import { createDemoAuth } from '../src/auth'; describe('createDemoAuth', () => { const validOptions: CreateDemoAuthOptions = { diff --git a/packages/client/package.json b/packages/client/package.json index 537804b732..1f71b21c9c 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -74,9 +74,7 @@ "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", "check": "pnpm run typecheck && pnpm run lint", "test": "vitest run", - "test:watch": "vitest", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "test:watch": "vitest" }, "dependencies": { "cross-spawn": "catalog:runtimeClientOnly", 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 bf554aba29..fcd93f0594 100644 --- a/packages/client/src/client/sse.ts +++ b/packages/client/src/client/sse.ts @@ -10,8 +10,8 @@ import { import type { ErrorEvent, EventSourceInit } from 'eventsource'; import { EventSource } from 'eventsource'; -import type { AuthProvider, OAuthClientProvider } from './auth.js'; -import { adaptOAuthProvider, auth, extractWWWAuthenticateParams, isOAuthClientProvider, UnauthorizedError } from './auth.js'; +import type { AuthProvider, OAuthClientProvider } from './auth'; +import { adaptOAuthProvider, auth, extractWWWAuthenticateParams, isOAuthClientProvider, UnauthorizedError } from './auth'; export class SseError extends Error { constructor( diff --git a/packages/client/src/client/streamableHttp.examples.ts b/packages/client/src/client/streamableHttp.examples.ts index 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 3b8ddafe5a..7a7da69dc1 100644 --- a/packages/client/src/client/streamableHttp.ts +++ b/packages/client/src/client/streamableHttp.ts @@ -15,8 +15,8 @@ import { } from '@modelcontextprotocol/core'; import { EventSourceParserStream } from 'eventsource-parser/stream'; -import type { AuthProvider, OAuthClientProvider } from './auth.js'; -import { adaptOAuthProvider, auth, extractWWWAuthenticateParams, isOAuthClientProvider, UnauthorizedError } from './auth.js'; +import type { AuthProvider, OAuthClientProvider } from './auth'; +import { adaptOAuthProvider, auth, extractWWWAuthenticateParams, isOAuthClientProvider, UnauthorizedError } from './auth'; // Default reconnection options for StreamableHTTP connections const DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS: StreamableHTTPReconnectionOptions = { diff --git a/packages/client/src/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..f4090b4ed0 100644 --- a/packages/client/test/client/middleware.test.ts +++ b/packages/client/test/client/middleware.test.ts @@ -1,11 +1,11 @@ import type { FetchLike } from '@modelcontextprotocol/core'; import type { Mocked, MockedFunction, MockInstance } from 'vitest'; -import type { OAuthClientProvider } from '../../src/client/auth.js'; -import { applyMiddlewares, createMiddleware, withLogging, withOAuth } from '../../src/client/middleware.js'; +import type { OAuthClientProvider } from '../../src/client/auth'; +import { applyMiddlewares, createMiddleware, withLogging, withOAuth } from '../../src/client/middleware'; -vi.mock('../../src/client/auth.js', async () => { - const actual = await vi.importActual('../../src/client/auth.js'); +vi.mock('../../src/client/auth', async () => { + const actual = await vi.importActual('../../src/client/auth'); return { ...actual, auth: vi.fn(), @@ -13,7 +13,7 @@ vi.mock('../../src/client/auth.js', async () => { }; }); -import { auth, extractWWWAuthenticateParams } from '../../src/client/auth.js'; +import { auth, extractWWWAuthenticateParams } from '../../src/client/auth'; const mockAuth = auth as MockedFunction; const mockExtractWWWAuthenticateParams = extractWWWAuthenticateParams as MockedFunction; diff --git a/packages/client/test/client/sse.test.ts b/packages/client/test/client/sse.test.ts index 6948d9a4e0..f4f2f463cf 100644 --- a/packages/client/test/client/sse.test.ts +++ b/packages/client/test/client/sse.test.ts @@ -7,9 +7,9 @@ import { OAuthError, OAuthErrorCode, SdkErrorCode, SdkHttpError } from '@modelco import { listenOnRandomPort } from '@modelcontextprotocol/test-helpers'; import type { Mock, Mocked, MockedFunction, MockInstance } from 'vitest'; -import type { AuthProvider, OAuthClientProvider } from '../../src/client/auth.js'; -import { UnauthorizedError } from '../../src/client/auth.js'; -import { SSEClientTransport } from '../../src/client/sse.js'; +import type { AuthProvider, OAuthClientProvider } from '../../src/client/auth'; +import { UnauthorizedError } from '../../src/client/auth'; +import { SSEClientTransport } from '../../src/client/sse'; /** * Parses HTTP Basic auth from a request's Authorization header. diff --git a/packages/client/test/client/stdio.test.ts b/packages/client/test/client/stdio.test.ts index 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 0edf8b75ac..51175b2ff8 100644 --- a/packages/client/test/client/streamableHttp.test.ts +++ b/packages/client/test/client/streamableHttp.test.ts @@ -2,10 +2,10 @@ import type { JSONRPCMessage, JSONRPCRequest } from '@modelcontextprotocol/core' import { OAuthError, OAuthErrorCode, SdkErrorCode, SdkHttpError } from '@modelcontextprotocol/core'; import type { Mock, Mocked } from 'vitest'; -import type { OAuthClientProvider } from '../../src/client/auth.js'; -import { UnauthorizedError } from '../../src/client/auth.js'; -import type { ReconnectionScheduler, StartSSEOptions, StreamableHTTPReconnectionOptions } from '../../src/client/streamableHttp.js'; -import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp.js'; +import type { OAuthClientProvider } from '../../src/client/auth'; +import { UnauthorizedError } from '../../src/client/auth'; +import type { ReconnectionScheduler, StartSSEOptions, StreamableHTTPReconnectionOptions } from '../../src/client/streamableHttp'; +import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp'; describe('StreamableHTTPClientTransport', () => { let transport: StreamableHTTPClientTransport; @@ -813,7 +813,7 @@ describe('StreamableHTTPClientTransport', () => { }); // Spy on the imported auth function and mock successful authorization - const authModule = await import('../../src/client/auth.js'); + const authModule = await import('../../src/client/auth'); const authSpy = vi.spyOn(authModule, 'auth'); authSpy.mockResolvedValue('AUTHORIZED'); @@ -855,8 +855,8 @@ describe('StreamableHTTPClientTransport', () => { }); // Spy on the imported auth function and mock successful authorization - const authModule = await import('../../src/client/auth.js'); - const authSpy = vi.spyOn(authModule as typeof import('../../src/client/auth.js'), 'auth'); + const authModule = await import('../../src/client/auth'); + const authSpy = vi.spyOn(authModule as typeof import('../../src/client/auth'), 'auth'); authSpy.mockResolvedValue('AUTHORIZED'); // First send: should trigger upscoping diff --git a/packages/client/test/client/tokenProvider.test.ts b/packages/client/test/client/tokenProvider.test.ts index e1108267ef..5f7f236977 100644 --- a/packages/client/test/client/tokenProvider.test.ts +++ b/packages/client/test/client/tokenProvider.test.ts @@ -6,9 +6,9 @@ import { SdkErrorCode, SdkHttpError } from '@modelcontextprotocol/core'; import { listenOnRandomPort } from '@modelcontextprotocol/test-helpers'; import type { Mock } from 'vitest'; -import type { AuthProvider, OAuthClientProvider } from '../../src/client/auth.js'; -import { UnauthorizedError } from '../../src/client/auth.js'; -import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp.js'; +import type { AuthProvider, OAuthClientProvider } from '../../src/client/auth'; +import { UnauthorizedError } from '../../src/client/auth'; +import { StreamableHTTPClientTransport } from '../../src/client/streamableHttp'; describe('StreamableHTTPClientTransport with AuthProvider', () => { let transport: StreamableHTTPClientTransport; diff --git a/packages/codemod/src/bin/batchTest.ts b/packages/codemod/src/bin/batchTest.ts index fac4e593c3..5cd6c3f9fd 100644 --- a/packages/codemod/src/bin/batchTest.ts +++ b/packages/codemod/src/bin/batchTest.ts @@ -5,9 +5,9 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; -import { getMigration } from '../migrations/index.js'; -import { run } from '../runner.js'; -import type { Diagnostic, RunnerResult } from '../types.js'; +import { getMigration } from '../migrations/index'; +import { run } from '../runner'; +import type { Diagnostic, RunnerResult } from '../types'; // --------------------------------------------------------------------------- // Types diff --git a/packages/codemod/src/cli.ts b/packages/codemod/src/cli.ts index d143a71a5a..9c3a085744 100644 --- a/packages/codemod/src/cli.ts +++ b/packages/codemod/src/cli.ts @@ -6,10 +6,10 @@ import path from 'node:path'; import { Command } from 'commander'; -import { listMigrations } from './migrations/index.js'; -import { run } from './runner.js'; -import { DiagnosticLevel } from './types.js'; -import { formatDiagnostic } from './utils/diagnostics.js'; +import { listMigrations } from './migrations/index'; +import { run } from './runner'; +import { DiagnosticLevel } from './types'; +import { formatDiagnostic } from './utils/diagnostics'; const require = createRequire(import.meta.url); const { version } = require('../package.json') as { version: string }; diff --git a/packages/codemod/src/index.ts b/packages/codemod/src/index.ts index 724cd2697e..4698196c9a 100644 --- a/packages/codemod/src/index.ts +++ b/packages/codemod/src/index.ts @@ -1,5 +1,5 @@ -export { getMigration, listMigrations } from './migrations/index.js'; -export { run } from './runner.js'; +export { getMigration, listMigrations } from './migrations/index'; +export { run } from './runner'; export type { Diagnostic, FileResult, @@ -10,5 +10,5 @@ export type { Transform, TransformContext, TransformResult -} from './types.js'; -export { DiagnosticLevel } from './types.js'; +} from './types'; +export { DiagnosticLevel } from './types'; diff --git a/packages/codemod/src/migrations/index.ts b/packages/codemod/src/migrations/index.ts index 1630393a8f..09d9093453 100644 --- a/packages/codemod/src/migrations/index.ts +++ b/packages/codemod/src/migrations/index.ts @@ -1,5 +1,5 @@ -import type { Migration } from '../types.js'; -import { v1ToV2Migration } from './v1-to-v2/index.js'; +import type { Migration } from '../types'; +import { v1ToV2Migration } from './v1-to-v2/index'; const migrations = new Map([['v1-to-v2', v1ToV2Migration]]); diff --git a/packages/codemod/src/migrations/v1-to-v2/index.ts b/packages/codemod/src/migrations/v1-to-v2/index.ts index 689331a9c3..083aa56123 100644 --- a/packages/codemod/src/migrations/v1-to-v2/index.ts +++ b/packages/codemod/src/migrations/v1-to-v2/index.ts @@ -1,5 +1,5 @@ -import type { Migration } from '../../types.js'; -import { v1ToV2Transforms } from './transforms/index.js'; +import type { Migration } from '../../types'; +import { v1ToV2Transforms } from './transforms/index'; export const v1ToV2Migration: Migration = { name: 'v1-to-v2', diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/contextTypes.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/contextTypes.ts index 5fb0d2f51e..209effeb61 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/contextTypes.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/contextTypes.ts @@ -1,10 +1,10 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { info, warning } from '../../../utils/diagnostics.js'; -import { hasMcpImports } from '../../../utils/importUtils.js'; -import { CONTEXT_PROPERTY_MAP, CTX_PARAM_NAME, EXTRA_PARAM_NAME } from '../mappings/contextPropertyMap.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { info, warning } from '../../../utils/diagnostics'; +import { hasMcpImports } from '../../../utils/importUtils'; +import { CONTEXT_PROPERTY_MAP, CTX_PARAM_NAME, EXTRA_PARAM_NAME } from '../mappings/contextPropertyMap'; const HANDLER_METHODS = new Set(['setRequestHandler', 'setNotificationHandler']); diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/expressMiddleware.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/expressMiddleware.ts index 319461070a..b7b7867539 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/expressMiddleware.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/expressMiddleware.ts @@ -1,9 +1,9 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { info } from '../../../utils/diagnostics.js'; -import { isOriginalNameImportedFromMcp, resolveLocalImportName } from '../../../utils/importUtils.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { info } from '../../../utils/diagnostics'; +import { isOriginalNameImportedFromMcp, resolveLocalImportName } from '../../../utils/importUtils'; export const expressMiddlewareTransform: Transform = { name: 'Express middleware signature migration', diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/handlerRegistration.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/handlerRegistration.ts index fe6d271df4..1b6809a8de 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/handlerRegistration.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/handlerRegistration.ts @@ -1,10 +1,10 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { warning } from '../../../utils/diagnostics.js'; -import { isImportedFromMcp, removeUnusedImport, resolveOriginalImportName } from '../../../utils/importUtils.js'; -import { NOTIFICATION_SCHEMA_TO_METHOD, SCHEMA_TO_METHOD } from '../mappings/schemaToMethodMap.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { warning } from '../../../utils/diagnostics'; +import { isImportedFromMcp, removeUnusedImport, resolveOriginalImportName } from '../../../utils/importUtils'; +import { NOTIFICATION_SCHEMA_TO_METHOD, SCHEMA_TO_METHOD } from '../mappings/schemaToMethodMap'; const ALL_SCHEMA_TO_METHOD: Record = { ...SCHEMA_TO_METHOD, diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/importPaths.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/importPaths.ts index 96e9308bfd..ddcb7a0c5b 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/importPaths.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/importPaths.ts @@ -1,12 +1,12 @@ import type { SourceFile } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { renameAllReferences } from '../../../utils/astUtils.js'; -import { v2Gap, warning } from '../../../utils/diagnostics.js'; -import { addOrMergeImport, getSdkExports, getSdkImports, isTypeOnlyImport } from '../../../utils/importUtils.js'; -import { resolveTypesPackage } from '../../../utils/projectAnalyzer.js'; -import { IMPORT_MAP, isAuthImport } from '../mappings/importMap.js'; -import { SIMPLE_RENAMES } from '../mappings/symbolMap.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { renameAllReferences } from '../../../utils/astUtils'; +import { v2Gap, warning } from '../../../utils/diagnostics'; +import { addOrMergeImport, getSdkExports, getSdkImports, isTypeOnlyImport } from '../../../utils/importUtils'; +import { resolveTypesPackage } from '../../../utils/projectAnalyzer'; +import { IMPORT_MAP, isAuthImport } from '../mappings/importMap'; +import { SIMPLE_RENAMES } from '../mappings/symbolMap'; const REEXPORT_WARNINGS: Record = { ErrorCode: 'Re-exported ErrorCode was split into ProtocolErrorCode and SdkErrorCode in v2. Update this re-export manually.', diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/index.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/index.ts index 7b6b54b28b..47cb1988ce 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/index.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/index.ts @@ -1,14 +1,14 @@ -import type { Transform } from '../../../types.js'; -import { contextTypesTransform } from './contextTypes.js'; -import { expressMiddlewareTransform } from './expressMiddleware.js'; -import { handlerRegistrationTransform } from './handlerRegistration.js'; -import { importPathsTransform } from './importPaths.js'; -import { mcpServerApiTransform } from './mcpServerApi.js'; -import { mockPathsTransform } from './mockPaths.js'; -import { removedApisTransform } from './removedApis.js'; -import { schemaParamRemovalTransform } from './schemaParamRemoval.js'; -import { specSchemaAccessTransform } from './specSchemaAccess.js'; -import { symbolRenamesTransform } from './symbolRenames.js'; +import type { Transform } from '../../../types'; +import { contextTypesTransform } from './contextTypes'; +import { expressMiddlewareTransform } from './expressMiddleware'; +import { handlerRegistrationTransform } from './handlerRegistration'; +import { importPathsTransform } from './importPaths'; +import { mcpServerApiTransform } from './mcpServerApi'; +import { mockPathsTransform } from './mockPaths'; +import { removedApisTransform } from './removedApis'; +import { schemaParamRemovalTransform } from './schemaParamRemoval'; +import { specSchemaAccessTransform } from './specSchemaAccess'; +import { symbolRenamesTransform } from './symbolRenames'; // Ordering matters — do not reorder without understanding dependencies: // diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/mcpServerApi.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/mcpServerApi.ts index cc9a3a55ef..f616623341 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/mcpServerApi.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/mcpServerApi.ts @@ -1,9 +1,9 @@ import type { CallExpression, SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { info, warning } from '../../../utils/diagnostics.js'; -import { isOriginalNameImportedFromMcp, resolveLocalImportName } from '../../../utils/importUtils.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { info, warning } from '../../../utils/diagnostics'; +import { isOriginalNameImportedFromMcp, resolveLocalImportName } from '../../../utils/importUtils'; export const mcpServerApiTransform: Transform = { name: 'McpServer API migration', diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/mockPaths.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/mockPaths.ts index e857b38adb..73cb6c5564 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/mockPaths.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/mockPaths.ts @@ -1,12 +1,12 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { v2Gap, warning } from '../../../utils/diagnostics.js'; -import { isSdkSpecifier } from '../../../utils/importUtils.js'; -import { resolveTypesPackage } from '../../../utils/projectAnalyzer.js'; -import { IMPORT_MAP, isAuthImport } from '../mappings/importMap.js'; -import { SIMPLE_RENAMES } from '../mappings/symbolMap.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { v2Gap, warning } from '../../../utils/diagnostics'; +import { isSdkSpecifier } from '../../../utils/importUtils'; +import { resolveTypesPackage } from '../../../utils/projectAnalyzer'; +import { IMPORT_MAP, isAuthImport } from '../mappings/importMap'; +import { SIMPLE_RENAMES } from '../mappings/symbolMap'; const MOCK_METHODS = new Set(['mock', 'doMock']); const MOCK_CALLERS = new Set(['vi', 'jest']); diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/removedApis.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/removedApis.ts index 82f5c2b1a7..2247035bb6 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/removedApis.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/removedApis.ts @@ -1,10 +1,10 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { renameAllReferences } from '../../../utils/astUtils.js'; -import { warning } from '../../../utils/diagnostics.js'; -import { addOrMergeImport, isAnyMcpSpecifier } from '../../../utils/importUtils.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { renameAllReferences } from '../../../utils/astUtils'; +import { warning } from '../../../utils/diagnostics'; +import { addOrMergeImport, isAnyMcpSpecifier } from '../../../utils/importUtils'; const REMOVED_ZOD_HELPERS: Record = { schemaToJson: diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/schemaParamRemoval.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/schemaParamRemoval.ts index eea8e33fd8..bc48a3cfb0 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/schemaParamRemoval.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/schemaParamRemoval.ts @@ -1,8 +1,8 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import type { Transform, TransformContext, TransformResult } from '../../../types.js'; -import { isImportedFromMcp, removeUnusedImport, resolveOriginalImportName } from '../../../utils/importUtils.js'; +import type { Transform, TransformContext, TransformResult } from '../../../types'; +import { isImportedFromMcp, removeUnusedImport, resolveOriginalImportName } from '../../../utils/importUtils'; const TARGET_METHODS = new Set(['request', 'callTool']); diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/specSchemaAccess.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/specSchemaAccess.ts index a9e9e99536..fb6f2d5203 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/specSchemaAccess.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/specSchemaAccess.ts @@ -1,10 +1,10 @@ import type { SourceFile } from 'ts-morph'; import { Node, SyntaxKind } from 'ts-morph'; -import { SPEC_SCHEMA_NAMES, specSchemaToTypeName } from '../../../generated/specSchemaMap.js'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { warning } from '../../../utils/diagnostics.js'; -import { addOrMergeImport, isAnyMcpSpecifier, removeUnusedImport } from '../../../utils/importUtils.js'; +import { SPEC_SCHEMA_NAMES, specSchemaToTypeName } from '../../../generated/specSchemaMap'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { warning } from '../../../utils/diagnostics'; +import { addOrMergeImport, isAnyMcpSpecifier, removeUnusedImport } from '../../../utils/importUtils'; export const specSchemaAccessTransform: Transform = { name: 'Spec schema standalone usage', diff --git a/packages/codemod/src/migrations/v1-to-v2/transforms/symbolRenames.ts b/packages/codemod/src/migrations/v1-to-v2/transforms/symbolRenames.ts index e01a11ab9f..6204058273 100644 --- a/packages/codemod/src/migrations/v1-to-v2/transforms/symbolRenames.ts +++ b/packages/codemod/src/migrations/v1-to-v2/transforms/symbolRenames.ts @@ -1,12 +1,12 @@ import type { SourceFile } from 'ts-morph'; import { Node } from 'ts-morph'; -import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types.js'; -import { renameAllReferences } from '../../../utils/astUtils.js'; -import { info, warning } from '../../../utils/diagnostics.js'; -import { addOrMergeImport, isAnyMcpSpecifier, removeUnusedImport } from '../../../utils/importUtils.js'; -import { resolveTypesPackage } from '../../../utils/projectAnalyzer.js'; -import { ERROR_CODE_SDK_MEMBERS, SIMPLE_RENAMES } from '../mappings/symbolMap.js'; +import type { Diagnostic, Transform, TransformContext, TransformResult } from '../../../types'; +import { renameAllReferences } from '../../../utils/astUtils'; +import { info, warning } from '../../../utils/diagnostics'; +import { addOrMergeImport, isAnyMcpSpecifier, removeUnusedImport } from '../../../utils/importUtils'; +import { resolveTypesPackage } from '../../../utils/projectAnalyzer'; +import { ERROR_CODE_SDK_MEMBERS, SIMPLE_RENAMES } from '../mappings/symbolMap'; const SERVER_GENERIC_ARGS = new Set(['ServerRequest', 'ServerNotification']); const CLIENT_GENERIC_ARGS = new Set(['ClientRequest', 'ClientNotification']); diff --git a/packages/codemod/src/runner.ts b/packages/codemod/src/runner.ts index fa664b572c..a25320fb57 100644 --- a/packages/codemod/src/runner.ts +++ b/packages/codemod/src/runner.ts @@ -1,9 +1,9 @@ import { Project } from 'ts-morph'; -import type { Diagnostic, FileResult, Migration, RunnerOptions, RunnerResult } from './types.js'; -import { error } from './utils/diagnostics.js'; -import { updatePackageJson } from './utils/packageJsonUpdater.js'; -import { analyzeProject } from './utils/projectAnalyzer.js'; +import type { Diagnostic, FileResult, Migration, RunnerOptions, RunnerResult } from './types'; +import { error } from './utils/diagnostics'; +import { updatePackageJson } from './utils/packageJsonUpdater'; +import { analyzeProject } from './utils/projectAnalyzer'; function escapeGlobPath(p: string): string { return p.replaceAll(/[[\]{}()*?!@#]/g, String.raw`\$&`); diff --git a/packages/codemod/src/utils/diagnostics.ts b/packages/codemod/src/utils/diagnostics.ts index 6b42db95bc..154b83ea42 100644 --- a/packages/codemod/src/utils/diagnostics.ts +++ b/packages/codemod/src/utils/diagnostics.ts @@ -1,5 +1,5 @@ -import type { Diagnostic } from '../types.js'; -import { DiagnosticLevel } from '../types.js'; +import type { Diagnostic } from '../types'; +import { DiagnosticLevel } from '../types'; export function error(file: string, line: number, message: string): Diagnostic { return { level: DiagnosticLevel.Error, file, line, message }; diff --git a/packages/codemod/src/utils/packageJsonUpdater.ts b/packages/codemod/src/utils/packageJsonUpdater.ts index 96a41430c8..54a7b97624 100644 --- a/packages/codemod/src/utils/packageJsonUpdater.ts +++ b/packages/codemod/src/utils/packageJsonUpdater.ts @@ -1,8 +1,8 @@ import { readFileSync, writeFileSync } from 'node:fs'; -import { V2_PACKAGE_VERSIONS } from '../generated/versions.js'; -import type { PackageJsonChange } from '../types.js'; -import { findPackageJson } from './projectAnalyzer.js'; +import { V2_PACKAGE_VERSIONS } from '../generated/versions'; +import type { PackageJsonChange } from '../types'; +import { findPackageJson } from './projectAnalyzer'; const V1_PACKAGE = '@modelcontextprotocol/sdk'; const PRIVATE_PACKAGES = new Set(['@modelcontextprotocol/core']); diff --git a/packages/codemod/src/utils/projectAnalyzer.ts b/packages/codemod/src/utils/projectAnalyzer.ts index daf4088876..f8c1a40537 100644 --- a/packages/codemod/src/utils/projectAnalyzer.ts +++ b/packages/codemod/src/utils/projectAnalyzer.ts @@ -1,8 +1,8 @@ import { existsSync, readFileSync } from 'node:fs'; import path from 'node:path'; -import type { Diagnostic, TransformContext } from '../types.js'; -import { warning } from './diagnostics.js'; +import type { Diagnostic, TransformContext } from '../types'; +import { warning } from './diagnostics'; const PROJECT_ROOT_MARKERS = ['.git', 'node_modules']; diff --git a/packages/codemod/test/cli.test.ts b/packages/codemod/test/cli.test.ts index 18f1952bf3..5f4c376798 100644 --- a/packages/codemod/test/cli.test.ts +++ b/packages/codemod/test/cli.test.ts @@ -3,9 +3,9 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { describe, it, expect, afterEach } from 'vitest'; -import { getMigration } from '../src/migrations/index.js'; -import { run } from '../src/runner.js'; -import { DiagnosticLevel } from '../src/types.js'; +import { getMigration } from '../src/migrations/index'; +import { run } from '../src/runner'; +import { DiagnosticLevel } from '../src/types'; const migration = getMigration('v1-to-v2')!; diff --git a/packages/codemod/test/integration.test.ts b/packages/codemod/test/integration.test.ts index 737d3ebf23..24507f4a8d 100644 --- a/packages/codemod/test/integration.test.ts +++ b/packages/codemod/test/integration.test.ts @@ -3,10 +3,10 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { describe, it, expect, afterEach } from 'vitest'; -import { getMigration } from '../src/migrations/index.js'; -import { run } from '../src/runner.js'; -import { DiagnosticLevel } from '../src/types.js'; -import type { Migration, Transform } from '../src/types.js'; +import { getMigration } from '../src/migrations/index'; +import { run } from '../src/runner'; +import { DiagnosticLevel } from '../src/types'; +import type { Migration, Transform } from '../src/types'; const migration = getMigration('v1-to-v2')!; diff --git a/packages/codemod/test/packageJsonUpdater.test.ts b/packages/codemod/test/packageJsonUpdater.test.ts index 27227efd15..2c272b8642 100644 --- a/packages/codemod/test/packageJsonUpdater.test.ts +++ b/packages/codemod/test/packageJsonUpdater.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { afterEach, describe, expect, it } from 'vitest'; -import { updatePackageJson } from '../src/utils/packageJsonUpdater.js'; +import { updatePackageJson } from '../src/utils/packageJsonUpdater'; let tempDir: string; diff --git a/packages/codemod/test/projectAnalyzer.test.ts b/packages/codemod/test/projectAnalyzer.test.ts index 0f69eacf79..e19aec3553 100644 --- a/packages/codemod/test/projectAnalyzer.test.ts +++ b/packages/codemod/test/projectAnalyzer.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { describe, it, expect, afterEach } from 'vitest'; -import { analyzeProject } from '../src/utils/projectAnalyzer.js'; +import { analyzeProject } from '../src/utils/projectAnalyzer'; let tempDir: string; diff --git a/packages/codemod/test/v1-to-v2/transforms/contextTypes.test.ts b/packages/codemod/test/v1-to-v2/transforms/contextTypes.test.ts index ee3798c388..b74fb145a7 100644 --- a/packages/codemod/test/v1-to-v2/transforms/contextTypes.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/contextTypes.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { contextTypesTransform } from '../../../src/migrations/v1-to-v2/transforms/contextTypes.js'; -import type { TransformContext } from '../../../src/types.js'; +import { contextTypesTransform } from '../../../src/migrations/v1-to-v2/transforms/contextTypes'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/expressMiddleware.test.ts b/packages/codemod/test/v1-to-v2/transforms/expressMiddleware.test.ts index 35182e47b2..ca497fb501 100644 --- a/packages/codemod/test/v1-to-v2/transforms/expressMiddleware.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/expressMiddleware.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { expressMiddlewareTransform } from '../../../src/migrations/v1-to-v2/transforms/expressMiddleware.js'; -import type { TransformContext } from '../../../src/types.js'; +import { expressMiddlewareTransform } from '../../../src/migrations/v1-to-v2/transforms/expressMiddleware'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/handlerRegistration.test.ts b/packages/codemod/test/v1-to-v2/transforms/handlerRegistration.test.ts index f7b4815aa5..2f3d588c93 100644 --- a/packages/codemod/test/v1-to-v2/transforms/handlerRegistration.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/handlerRegistration.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { handlerRegistrationTransform } from '../../../src/migrations/v1-to-v2/transforms/handlerRegistration.js'; -import type { TransformContext } from '../../../src/types.js'; +import { handlerRegistrationTransform } from '../../../src/migrations/v1-to-v2/transforms/handlerRegistration'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/importPaths.test.ts b/packages/codemod/test/v1-to-v2/transforms/importPaths.test.ts index 7068919077..3d1960aaf1 100644 --- a/packages/codemod/test/v1-to-v2/transforms/importPaths.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/importPaths.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { importPathsTransform } from '../../../src/migrations/v1-to-v2/transforms/importPaths.js'; -import type { TransformContext } from '../../../src/types.js'; +import { importPathsTransform } from '../../../src/migrations/v1-to-v2/transforms/importPaths'; +import type { TransformContext } from '../../../src/types'; function applyTransform(code: string, context: TransformContext = { projectType: 'both' }): string { const project = new Project({ useInMemoryFileSystem: true }); diff --git a/packages/codemod/test/v1-to-v2/transforms/mcpServerApi.test.ts b/packages/codemod/test/v1-to-v2/transforms/mcpServerApi.test.ts index b89e4c8d8b..8aba647936 100644 --- a/packages/codemod/test/v1-to-v2/transforms/mcpServerApi.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/mcpServerApi.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { mcpServerApiTransform } from '../../../src/migrations/v1-to-v2/transforms/mcpServerApi.js'; -import type { TransformContext } from '../../../src/types.js'; +import { mcpServerApiTransform } from '../../../src/migrations/v1-to-v2/transforms/mcpServerApi'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; const MCP_IMPORT = `import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n`; diff --git a/packages/codemod/test/v1-to-v2/transforms/mockPaths.test.ts b/packages/codemod/test/v1-to-v2/transforms/mockPaths.test.ts index 3cb1aec7ba..204cfbb4b0 100644 --- a/packages/codemod/test/v1-to-v2/transforms/mockPaths.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/mockPaths.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { mockPathsTransform } from '../../../src/migrations/v1-to-v2/transforms/mockPaths.js'; -import type { TransformContext } from '../../../src/types.js'; +import { mockPathsTransform } from '../../../src/migrations/v1-to-v2/transforms/mockPaths'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/removedApis.test.ts b/packages/codemod/test/v1-to-v2/transforms/removedApis.test.ts index 3e003f4182..d658fe737b 100644 --- a/packages/codemod/test/v1-to-v2/transforms/removedApis.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/removedApis.test.ts @@ -1,9 +1,9 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { removedApisTransform } from '../../../src/migrations/v1-to-v2/transforms/removedApis.js'; -import type { TransformContext } from '../../../src/types.js'; -import { DiagnosticLevel } from '../../../src/types.js'; +import { removedApisTransform } from '../../../src/migrations/v1-to-v2/transforms/removedApis'; +import type { TransformContext } from '../../../src/types'; +import { DiagnosticLevel } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/schemaParamRemoval.test.ts b/packages/codemod/test/v1-to-v2/transforms/schemaParamRemoval.test.ts index f1a2413982..70e391ce86 100644 --- a/packages/codemod/test/v1-to-v2/transforms/schemaParamRemoval.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/schemaParamRemoval.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { schemaParamRemovalTransform } from '../../../src/migrations/v1-to-v2/transforms/schemaParamRemoval.js'; -import type { TransformContext } from '../../../src/types.js'; +import { schemaParamRemovalTransform } from '../../../src/migrations/v1-to-v2/transforms/schemaParamRemoval'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'client' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/specSchemaAccess.test.ts b/packages/codemod/test/v1-to-v2/transforms/specSchemaAccess.test.ts index 6909083e79..ddb8ed09a6 100644 --- a/packages/codemod/test/v1-to-v2/transforms/specSchemaAccess.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/specSchemaAccess.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { specSchemaAccessTransform } from '../../../src/migrations/v1-to-v2/transforms/specSchemaAccess.js'; -import type { TransformContext } from '../../../src/types.js'; +import { specSchemaAccessTransform } from '../../../src/migrations/v1-to-v2/transforms/specSchemaAccess'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/codemod/test/v1-to-v2/transforms/symbolRenames.test.ts b/packages/codemod/test/v1-to-v2/transforms/symbolRenames.test.ts index d6ef103de6..9a227d2f4d 100644 --- a/packages/codemod/test/v1-to-v2/transforms/symbolRenames.test.ts +++ b/packages/codemod/test/v1-to-v2/transforms/symbolRenames.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect } from 'vitest'; import { Project } from 'ts-morph'; -import { symbolRenamesTransform } from '../../../src/migrations/v1-to-v2/transforms/symbolRenames.js'; -import type { TransformContext } from '../../../src/types.js'; +import { symbolRenamesTransform } from '../../../src/migrations/v1-to-v2/transforms/symbolRenames'; +import type { TransformContext } from '../../../src/types'; const ctx: TransformContext = { projectType: 'server' }; diff --git a/packages/core/package.json b/packages/core/package.json index 201773736f..7ded55182b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -44,9 +44,7 @@ "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", "check": "pnpm run typecheck && pnpm run lint", "test": "vitest run", - "test:watch": "vitest", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "test:watch": "vitest" }, "dependencies": { "ajv": "catalog:runtimeShared", diff --git a/packages/core/src/auth/errors.ts b/packages/core/src/auth/errors.ts index 30c8741601..f2060887f1 100644 --- a/packages/core/src/auth/errors.ts +++ b/packages/core/src/auth/errors.ts @@ -1,4 +1,4 @@ -import type { OAuthErrorResponse } from '../shared/auth.js'; +import type { OAuthErrorResponse } from '../shared/auth'; /** * OAuth error codes as defined by {@link https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 | RFC 6749} diff --git a/packages/core/src/errors/sdkErrors.examples.ts b/packages/core/src/errors/sdkErrors.examples.ts index d80fd6e756..c828d443ec 100644 --- a/packages/core/src/errors/sdkErrors.examples.ts +++ b/packages/core/src/errors/sdkErrors.examples.ts @@ -7,7 +7,7 @@ * @module */ -import { SdkError, SdkErrorCode, SdkHttpError } from './sdkErrors.js'; +import { SdkError, SdkErrorCode, SdkHttpError } from './sdkErrors'; /** * Example: Throwing and catching SDK errors. diff --git a/packages/core/src/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 f73ab2d2e7..68c998f607 100644 --- a/packages/core/src/exports/public/index.ts +++ b/packages/core/src/exports/public/index.ts @@ -10,11 +10,11 @@ */ // Auth error classes -export { OAuthError, OAuthErrorCode } from '../../auth/errors.js'; +export { OAuthError, OAuthErrorCode } from '../../auth/errors'; // SDK error types (local errors that never cross the wire) -export type { SdkHttpErrorData } from '../../errors/sdkErrors.js'; -export { SdkError, SdkErrorCode, SdkHttpError } from '../../errors/sdkErrors.js'; +export type { SdkHttpErrorData } from '../../errors/sdkErrors'; +export { SdkError, SdkErrorCode, SdkHttpError } from '../../errors/sdkErrors'; // Auth TypeScript types (NOT Zod schemas like OAuthMetadataSchema) export type { @@ -31,13 +31,13 @@ export type { OAuthTokens, OpenIdProviderDiscoveryMetadata, OpenIdProviderMetadata -} from '../../shared/auth.js'; +} from '../../shared/auth'; // Auth utilities -export { checkResourceAllowed, resourceUrlFromServerUrl } from '../../shared/authUtils.js'; +export { checkResourceAllowed, resourceUrlFromServerUrl } from '../../shared/authUtils'; // Metadata utilities -export { getDisplayName } from '../../shared/metadataUtils.js'; +export { getDisplayName } from '../../shared/metadataUtils'; // Protocol types (NOT the Protocol class itself or mergeCapabilities) export type { @@ -49,11 +49,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 { @@ -63,25 +63,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 { @@ -95,13 +95,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 { @@ -117,10 +117,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, @@ -134,16 +134,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/package.json b/packages/middleware/node/package.json index 30fa7ed663..a2fc9af934 100644 --- a/packages/middleware/node/package.json +++ b/packages/middleware/node/package.json @@ -46,9 +46,7 @@ "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../../.prettierignore --write .", "check": "pnpm run typecheck && pnpm run lint", "test": "vitest run", - "test:watch": "vitest", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "test:watch": "vitest" }, "dependencies": { "@hono/node-server": "catalog:runtimeServerOnly" 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/package.json b/packages/server/package.json index 20195e7101..303806810c 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -77,9 +77,7 @@ "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", "check": "pnpm run typecheck && pnpm run lint", "test": "vitest run", - "test:watch": "vitest", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "test:watch": "vitest" }, "dependencies": { "zod": "catalog:runtimeShared" 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/pnpm-lock.yaml b/pnpm-lock.yaml index d4fc799822..86ce7f732a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -327,6 +327,9 @@ importers: specifier: workspace:^ version: link:../../packages/client devDependencies: + '@modelcontextprotocol/tsconfig': + specifier: workspace:^ + version: link:../../common/tsconfig '@types/node': specifier: ^24.10.1 version: 24.12.0 @@ -407,6 +410,9 @@ importers: specifier: catalog:runtimeShared version: 4.3.6 devDependencies: + '@modelcontextprotocol/tsconfig': + specifier: workspace:^ + version: link:../../common/tsconfig '@types/node': specifier: ^24.10.1 version: 24.12.0 diff --git a/scripts/cli.ts b/scripts/cli.ts deleted file mode 100644 index 809a23efed..0000000000 --- a/scripts/cli.ts +++ /dev/null @@ -1,155 +0,0 @@ -import express from 'express'; -import { Client } from '../src/client/index.js'; -import { SSEClientTransport } from '../src/client/sse.js'; -import { StdioClientTransport } from '../src/client/stdio.js'; -import { Server } from '../src/server/index.js'; -import { SSEServerTransport } from '../src/server/sse.js'; -import { StdioServerTransport } from '../src/server/stdio.js'; -import { ListResourcesResultSchema } from '../src/types.js'; - -async function runClient(url_or_command: string, args: string[]) { - const client = new Client( - { - name: 'mcp-typescript test client', - version: '0.1.0' - }, - { - capabilities: { - sampling: {} - } - } - ); - - let clientTransport; - - let url: URL | undefined = undefined; - try { - url = new URL(url_or_command); - } catch { - // Ignore - } - - if (url?.protocol === 'http:' || url?.protocol === 'https:') { - clientTransport = new SSEClientTransport(new URL(url_or_command)); - } else if (url?.protocol === 'ws:' || url?.protocol === 'wss:') { - throw new Error('WebSocket URLs are no longer supported. Use http(s) or stdio instead.'); - } else { - clientTransport = new StdioClientTransport({ - command: url_or_command, - args - }); - } - - console.log('Connected to server.'); - - await client.connect(clientTransport); - console.log('Initialized.'); - - await client.request({ method: 'resources/list' }, ListResourcesResultSchema); - - await client.close(); - console.log('Closed.'); -} - -async function runServer(port: number | null) { - if (port !== null) { - const app = express(); - - let servers: Server[] = []; - - app.get('/sse', async (req, res) => { - console.log('Got new SSE connection'); - - const transport = new SSEServerTransport('/message', res); - const server = new Server( - { - name: 'mcp-typescript test server', - version: '0.1.0' - }, - { - capabilities: {} - } - ); - - servers.push(server); - - server.onclose = () => { - console.log('SSE connection closed'); - servers = servers.filter(s => s !== server); - }; - - await server.connect(transport); - }); - - app.post('/message', async (req, res) => { - console.log('Received message'); - - const sessionId = req.query.sessionId as string; - const transport = servers.map(s => s.transport as SSEServerTransport).find(t => t.sessionId === sessionId); - if (!transport) { - res.status(404).send('Session not found'); - return; - } - - await transport.handlePostMessage(req, res); - }); - - app.listen(port, error => { - if (error) { - console.error('Failed to start server:', error); - process.exit(1); - } - console.log(`Server running on http://localhost:${port}/sse`); - }); - } else { - const server = new Server( - { - name: 'mcp-typescript test server', - version: '0.1.0' - }, - { - capabilities: { - prompts: {}, - resources: {}, - tools: {}, - logging: {} - } - } - ); - - const transport = new StdioServerTransport(); - await server.connect(transport); - - console.log('Server running on stdio'); - } -} - -const args = process.argv.slice(2); -const command = args[0]; -switch (command) { - case 'client': - if (args.length < 2) { - console.error('Usage: client [args...]'); - process.exit(1); - } - - runClient(args[1], args.slice(2)).catch(error => { - console.error(error); - process.exit(1); - }); - - break; - - case 'server': { - const port = args[1] ? parseInt(args[1]) : null; - runServer(port).catch(error => { - console.error(error); - process.exit(1); - }); - - break; - } - - default: - console.error('Unrecognized command:', command); -} diff --git a/test/conformance/package.json b/test/conformance/package.json index db0f04a4db..9a9da2ecde 100644 --- a/test/conformance/package.json +++ b/test/conformance/package.json @@ -25,9 +25,6 @@ "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", "check": "npm run typecheck && npm run lint", - "start": "npm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client", "test:conformance:client": "conformance client --command 'npx tsx ./src/everythingClient.ts' --expected-failures ./expected-failures.yaml", "test:conformance:client:all": "conformance client --command 'npx tsx ./src/everythingClient.ts' --suite all --expected-failures ./expected-failures.yaml", "test:conformance:client:run": "npx tsx ./src/everythingClient.ts", diff --git a/test/conformance/src/everythingClient.ts b/test/conformance/src/everythingClient.ts index 05103eb26d..6603c4a0e8 100644 --- a/test/conformance/src/everythingClient.ts +++ b/test/conformance/src/everythingClient.ts @@ -22,9 +22,9 @@ import { } from '@modelcontextprotocol/client'; import * as z from 'zod/v4'; -import { ConformanceOAuthProvider } from './helpers/conformanceOAuthProvider.js'; -import { logger } from './helpers/logger.js'; -import { handle401, withOAuthRetry } from './helpers/withOAuthRetry.js'; +import { ConformanceOAuthProvider } from './helpers/conformanceOAuthProvider'; +import { logger } from './helpers/logger'; +import { handle401, withOAuthRetry } from './helpers/withOAuthRetry'; /** * Fixed client metadata URL for CIMD conformance tests. diff --git a/test/conformance/src/helpers/withOAuthRetry.ts b/test/conformance/src/helpers/withOAuthRetry.ts index cbed3e2382..8ebebdb63c 100644 --- a/test/conformance/src/helpers/withOAuthRetry.ts +++ b/test/conformance/src/helpers/withOAuthRetry.ts @@ -1,7 +1,7 @@ import type { FetchLike, Middleware } from '@modelcontextprotocol/client'; import { auth, extractWWWAuthenticateParams, UnauthorizedError } from '@modelcontextprotocol/client'; -import { ConformanceOAuthProvider } from './conformanceOAuthProvider.js'; +import { ConformanceOAuthProvider } from './conformanceOAuthProvider'; export const handle401 = async ( response: Response, diff --git a/test/helpers/package.json b/test/helpers/package.json index 88f2c3f93e..1826205a1b 100644 --- a/test/helpers/package.json +++ b/test/helpers/package.json @@ -24,10 +24,7 @@ "scripts": { "lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .", "lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .", - "check": "npm run typecheck && npm run lint", - "start": "npm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client" + "check": "npm run typecheck && npm run lint" }, "devDependencies": { "@modelcontextprotocol/core": "workspace:^", diff --git a/test/helpers/src/index.ts b/test/helpers/src/index.ts index 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/package.json b/test/integration/package.json index 8618d0580e..97a62e6c32 100644 --- a/test/integration/package.json +++ b/test/integration/package.json @@ -27,9 +27,6 @@ "check": "npm run typecheck && npm run lint", "test": "vitest run", "test:watch": "vitest", - "start": "npm run server", - "server": "tsx watch --clear-screen=false scripts/cli.ts server", - "client": "tsx scripts/cli.ts client", "test:integration:bun": "bun test test/server/bun.test.ts", "test:integration:deno": "deno test --no-check --allow-net --allow-read --allow-env test/server/deno.test.ts" }, 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'];