chore: switch to module ESNext + moduleResolution bundler (#2095)
This commit is contained in:
parent
c59dc3aa1a
commit
ee732d64b6
41 changed files with 668 additions and 863 deletions
|
|
@ -25,9 +25,6 @@
|
|||
"lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .",
|
||||
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
|
||||
"check": "npm run typecheck && npm run lint",
|
||||
"start": "npm run server",
|
||||
"server": "tsx watch --clear-screen=false scripts/cli.ts server",
|
||||
"client": "tsx scripts/cli.ts client",
|
||||
"test:conformance:client": "conformance client --command 'node --import tsx ./src/everythingClient.ts' --suite core --expected-failures ./expected-failures.yaml",
|
||||
"test:conformance:client:all": "conformance client --command 'node --import tsx ./src/everythingClient.ts' --suite all --expected-failures ./expected-failures.yaml",
|
||||
"test:conformance:client:run": "node --import tsx ./src/everythingClient.ts",
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import { fileURLToPath } from 'node:url';
|
|||
|
||||
import { expect, test } from 'vitest';
|
||||
|
||||
import { REQUIREMENTS } from './requirements.js';
|
||||
import { REQUIREMENTS } from './requirements';
|
||||
|
||||
const E2E_DIR = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ import type { EventStore, JSONRPCMessage, McpServer, Server } from '@modelcontex
|
|||
import { InMemoryTransport, ReadBuffer, serializeMessage, WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/server';
|
||||
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
|
||||
|
||||
import type { Transport } from '../types.js';
|
||||
import { startLegacySseHost } from './sse-host.js';
|
||||
import type { SnifferOptions } from './wire-sniffer.js';
|
||||
import { sniffTransport } from './wire-sniffer.js';
|
||||
import type { Transport } from '../types';
|
||||
import { startLegacySseHost } from './sse-host';
|
||||
import type { SnifferOptions } from './wire-sniffer';
|
||||
import { sniffTransport } from './wire-sniffer';
|
||||
|
||||
export type ServerFactory = () => McpServer | Server;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
import { describe, test } from 'vitest';
|
||||
|
||||
import { REQUIREMENTS } from '../requirements.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { ALL_SPEC_VERSIONS, ALL_TRANSPORTS } from '../types.js';
|
||||
import { REQUIREMENTS } from '../requirements';
|
||||
import type { TestArgs } from '../types';
|
||||
import { ALL_SPEC_VERSIONS, ALL_TRANSPORTS } from '../types';
|
||||
|
||||
type TestBody = (args: TestArgs) => Promise<void>;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { LATEST_PROTOCOL_VERSION } from '@modelcontextprotocol/server';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { assertWireMessage } from './wire-sniffer.js';
|
||||
import { assertWireMessage } from './wire-sniffer';
|
||||
|
||||
const req = (method: string, params?: unknown, id = 1) => ({
|
||||
jsonrpc: '2.0' as const,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* the behavior).
|
||||
*/
|
||||
|
||||
import type { Requirement } from './types.js';
|
||||
import type { Requirement } from './types';
|
||||
|
||||
/** Transports with a persistent server instance / standalone notification stream. */
|
||||
const STATEFUL_TRANSPORTS = ['inMemory', 'stdio', 'streamableHttp', 'sse'] as const;
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ import { importSPKI, jwtVerify } from 'jose';
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { hostPerSession } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { hostPerSession } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const ISSUER = 'https://auth.example.com';
|
||||
const MCP_URL = 'http://in-process/mcp';
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import { completable, McpServer, ProtocolError, ProtocolErrorCode, ResourceTempl
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const COLORS = ['red', 'green', 'blue', 'rebeccapurple'] as const;
|
||||
const FILE_PATHS = ['README.md', 'src/index.ts', 'src/types.ts'] as const;
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ import { McpServer, ProtocolErrorCode, Server } from '@modelcontextprotocol/serv
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
verifies('custom-methods:server-handler:roundtrip', async ({ transport }: TestArgs) => {
|
||||
const SearchParams = z.object({ query: z.string(), limit: z.number().int().default(5) });
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import { McpServer, ProtocolErrorCode, Server } from '@modelcontextprotocol/serv
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const newClient = () => new Client({ name: 'c', version: '0' });
|
||||
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ import {
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { tapWire, wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { tapWire, wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
/** Client with form-mode elicitation support. */
|
||||
const formClient = () => new Client({ name: 'c', version: '0' }, { capabilities: { elicitation: { form: {} } } });
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ import {
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { hostPerSession, tapWire, wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { hostPerSession, tapWire, wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const newClient = () => new Client({ name: 'c', version: '0' });
|
||||
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ import { McpServer, ProtocolErrorCode, Server, specTypeSchemas, UrlElicitationRe
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { hostPerSession, hostResumable, wire } from '../helpers/index.js';
|
||||
import { startLegacySseHost } from '../helpers/sse-host.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { hostPerSession, hostResumable, wire } from '../helpers/index';
|
||||
import { startLegacySseHost } from '../helpers/sse-host';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
verifies('flow:compat:dual-transport-server', async (_args: TestArgs) => {
|
||||
// One deployment, one server factory, both transports: the modern Streamable HTTP
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ import { McpServer } from '@modelcontextprotocol/server';
|
|||
import { expect, vi } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { hostPerSession, wire } from '../helpers/index.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { hostPerSession, wire } from '../helpers/index';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
verifies('mcpserver:context:log-from-handler', async ({ transport }: TestArgs) => {
|
||||
let releaseHandler!: () => void;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ import { McpServer, WebStandardStreamableHTTPServerTransport } from '@modelconte
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const VALID_TOKEN = 'analytics-dashboard-access-token';
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ import express from 'express';
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { startExpressMinimal, startExpressWithHostValidation } from '../helpers/express.js';
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { startExpressMinimal, startExpressWithHostValidation } from '../helpers/express';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
const RESOURCE_METADATA_URL = 'https://mcp.example.com/.well-known/oauth-protected-resource';
|
||||
const VALID_TOKEN = 'analytics-dashboard-token';
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ import type { FastifyInstance, FastifyRequest } from 'fastify';
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
function forecastServer(): McpServer {
|
||||
const s = new McpServer({ name: 'forecast-server', version: '0.3.0' });
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ import type { Hono } from 'hono';
|
|||
import { expect } from 'vitest';
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
import { verifies } from '../helpers/verifies.js';
|
||||
import type { TestArgs } from '../types.js';
|
||||
import { verifies } from '../helpers/verifies';
|
||||
import type { TestArgs } from '../types';
|
||||
|
||||
function recipeServer(): McpServer {
|
||||
const s = new McpServer({ name: 'recipe-server', version: '1.2.0' });
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue