Skip to content

Commit ac71aa8

Browse files
committed
merge commit
2 parents 20fb7fb + 1fb7b25 commit ac71aa8

File tree

13 files changed

+150
-37
lines changed

13 files changed

+150
-37
lines changed

package.json

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
"lint:fix:all": "pnpm -r lint:fix",
3434
"check:all": "pnpm -r typecheck && pnpm -r lint",
3535
"test:all": "pnpm -r test",
36-
"test:conformance:client": "conformance client --command 'npx tsx src/conformance/everything-client.ts'",
37-
"test:conformance:client:all": "conformance client --command 'npx tsx src/conformance/everything-client.ts' --suite all",
38-
"test:conformance:client:run": "npx tsx src/conformance/everything-client.ts",
39-
"test:conformance:server": "scripts/run-server-conformance.sh",
40-
"test:conformance:server:all": "scripts/run-server-conformance.sh --suite all",
41-
"test:conformance:server:run": "npx tsx src/conformance/everything-server.ts",
42-
"test:conformance:all": "pnpm run test:conformance:client:all && pnpm run test:conformance:server:all",
43-
"prepare": "npx --no-install lefthook install"
36+
"prepare": "npx --no-install lefthook install",
37+
"test:conformance:client": "pnpm --filter @modelcontextprotocol/test-conformance run test:conformance:client",
38+
"test:conformance:client:all": "pnpm --filter @modelcontextprotocol/test-conformance run test:conformance:client:all",
39+
"test:conformance:client:run": "pnpm --filter @modelcontextprotocol/test-conformance run test:conformance:client:run",
40+
"test:conformance:server": "pnpm --filter @modelcontextprotocol/test-conformance run test:conformance:server",
41+
"test:conformance:server:all": "pnpm --filter @modelcontextprotocol/test-conformance run test:conformance:server:all",
42+
"test:conformance:server:run": "pnpm --filter @modelcontextprotocol/test-conformance run test:conformance:server:run",
43+
"test:conformance:all": "pnpm run test:conformance:client:all && pnpm run test:conformance:server:all"
4444
},
4545
"devDependencies": {
4646
"lefthook": "^2.0.16",
@@ -49,7 +49,6 @@
4949
"@changesets/cli": "^2.29.8",
5050
"@eslint/js": "catalog:devTools",
5151
"@modelcontextprotocol/client": "workspace:^",
52-
"@modelcontextprotocol/conformance": "0.1.10",
5352
"@modelcontextprotocol/server": "workspace:^",
5453
"@modelcontextprotocol/node": "workspace:^",
5554
"@types/content-type": "catalog:devTools",
@@ -62,12 +61,10 @@
6261
"@types/supertest": "catalog:devTools",
6362
"@types/ws": "catalog:devTools",
6463
"@typescript/native-preview": "catalog:devTools",
65-
"cors": "catalog:runtimeServerOnly",
6664
"eslint": "catalog:devTools",
6765
"eslint-config-prettier": "catalog:devTools",
6866
"eslint-plugin-n": "catalog:devTools",
6967
"fast-glob": "^3.3.3",
70-
"express": "catalog:runtimeServerOnly",
7168
"prettier": "catalog:devTools",
7269
"supertest": "catalog:devTools",
7370
"tsdown": "catalog:devTools",

pnpm-lock.yaml

Lines changed: 42 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

test/conformance/eslint.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// @ts-check
2+
3+
import baseConfig from '@modelcontextprotocol/eslint-config';
4+
5+
export default baseConfig;

test/conformance/package.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "@modelcontextprotocol/test-conformance",
3+
"private": true,
4+
"version": "2.0.0-alpha.0",
5+
"description": "Model Context Protocol implementation for TypeScript",
6+
"license": "MIT",
7+
"author": "Anthropic, PBC (https://anthropic.com)",
8+
"homepage": "https://modelcontextprotocol.io",
9+
"bugs": "https://github.com/modelcontextprotocol/typescript-sdk/issues",
10+
"type": "module",
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/modelcontextprotocol/typescript-sdk.git"
14+
},
15+
"engines": {
16+
"node": ">=20",
17+
"pnpm": ">=10.24.0"
18+
},
19+
"packageManager": "pnpm@10.24.0",
20+
"keywords": [
21+
"modelcontextprotocol",
22+
"mcp"
23+
],
24+
"scripts": {
25+
"lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .",
26+
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
27+
"check": "npm run typecheck && npm run lint",
28+
"start": "npm run server",
29+
"server": "tsx watch --clear-screen=false scripts/cli.ts server",
30+
"client": "tsx scripts/cli.ts client",
31+
"test:conformance:client": "conformance client --command 'npx tsx ./src/everythingClient.ts'",
32+
"test:conformance:client:all": "conformance client --command 'npx tsx ./src/everythingClient.ts' --suite all",
33+
"test:conformance:client:run": "npx tsx ./src/everythingClient.ts",
34+
"test:conformance:server": "scripts/run-server-conformance.sh",
35+
"test:conformance:server:all": "scripts/run-server-conformance.sh --suite all",
36+
"test:conformance:server:run": "npx tsx ./src/everythingServer.ts",
37+
"test:conformance:all": "pnpm run test:conformance:client:all && pnpm run test:conformance:server:all"
38+
},
39+
"devDependencies": {
40+
"@modelcontextprotocol/conformance": "0.1.10",
41+
"@modelcontextprotocol/client": "workspace:^",
42+
"@modelcontextprotocol/server": "workspace:^",
43+
"@modelcontextprotocol/core": "workspace:^",
44+
"@modelcontextprotocol/express": "workspace:^",
45+
"@modelcontextprotocol/node": "workspace:^",
46+
"@modelcontextprotocol/tsconfig": "workspace:^",
47+
"@modelcontextprotocol/vitest-config": "workspace:^",
48+
"@modelcontextprotocol/eslint-config": "workspace:^",
49+
"@modelcontextprotocol/test-helpers": "workspace:^",
50+
"cors": "catalog:runtimeServerOnly",
51+
"express": "catalog:runtimeServerOnly",
52+
"zod": "catalog:runtimeShared"
53+
}
54+
}

scripts/run-server-conformance.sh renamed to test/conformance/scripts/run-server-conformance.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cd "$SCRIPT_DIR/.."
1313

1414
# Start the server in the background
1515
echo "Starting conformance test server on port ${PORT}..."
16-
npx tsx src/conformance/everything-server.ts &
16+
npx tsx ./src/everythingServer.ts &
1717
SERVER_PID=$!
1818

1919
# Function to cleanup on exit
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
* consolidating all the individual test clients into one.
1313
*/
1414

15-
import { Client, StreamableHTTPClientTransport, ClientCredentialsProvider, PrivateKeyJwtProvider } from '@modelcontextprotocol/client';
15+
import { Client, ClientCredentialsProvider, PrivateKeyJwtProvider, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
1616
import { z } from 'zod';
17-
import { withOAuthRetry, handle401 } from './helpers/withOAuthRetry.js';
17+
1818
import { logger } from './helpers/logger.js';
19+
import { handle401, withOAuthRetry } from './helpers/withOAuthRetry.js';
1920

2021
/**
2122
* Fixed client metadata URL for CIMD conformance tests.
@@ -353,7 +354,7 @@ async function main(): Promise<void> {
353354
logger.error('Usage: MCP_CONFORMANCE_SCENARIO=<scenario> everything-client <server-url>');
354355
logger.error('\nThe MCP_CONFORMANCE_SCENARIO env var is set automatically by the conformance runner.');
355356
logger.error('\nAvailable scenarios:');
356-
for (const name of Object.keys(scenarioHandlers).sort()) {
357+
for (const name of Object.keys(scenarioHandlers).toSorted()) {
357358
logger.error(` - ${name}`);
358359
}
359360
process.exit(1);
@@ -363,7 +364,7 @@ async function main(): Promise<void> {
363364
if (!handler) {
364365
logger.error(`Unknown scenario: ${scenarioName}`);
365366
logger.error('\nAvailable scenarios:');
366-
for (const name of Object.keys(scenarioHandlers).sort()) {
367+
for (const name of Object.keys(scenarioHandlers).toSorted()) {
367368
logger.error(` - ${name}`);
368369
}
369370
process.exit(1);
@@ -378,7 +379,9 @@ async function main(): Promise<void> {
378379
}
379380
}
380381

381-
main().catch(error => {
382-
logger.error('Unhandled error:', error);
382+
try {
383+
await main();
384+
} catch (error) {
385+
logger.error('Error:', error);
383386
process.exit(1);
384-
});
387+
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
import { randomUUID } from 'node:crypto';
1111

12-
import type { CallToolResult, GetPromptResult, ReadResourceResult, EventId, EventStore, StreamId } from '@modelcontextprotocol/server';
13-
import { ElicitResultSchema, isInitializeRequest, McpServer, ResourceTemplate } from '@modelcontextprotocol/server';
1412
import { NodeStreamableHTTPServerTransport } from '@modelcontextprotocol/node';
15-
import type { Request, Response } from 'express';
13+
import type { CallToolResult, EventId, EventStore, GetPromptResult, ReadResourceResult, StreamId } from '@modelcontextprotocol/server';
14+
import { ElicitResultSchema, isInitializeRequest, McpServer, ResourceTemplate } from '@modelcontextprotocol/server';
1615
import cors from 'cors';
16+
import type { Request, Response } from 'express';
1717
import express from 'express';
1818
import * as z from 'zod/v4';
1919

@@ -64,7 +64,7 @@ const TEST_IMAGE_BASE64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQ
6464
const TEST_AUDIO_BASE64 = 'UklGRiYAAABXQVZFZm10IBAAAAABAAEAQB8AAAB9AAACABAAZGF0YQIAAAA=';
6565

6666
// Function to create a new MCP server instance (one per session)
67-
function createMcpServer(sessionId?: string) {
67+
function createMcpServer() {
6868
const mcpServer = new McpServer(
6969
{
7070
name: 'mcp-conformance-test-server',
@@ -941,7 +941,7 @@ app.post('/mcp', async (req: Request, res: Response) => {
941941
res.status(400).json({
942942
jsonrpc: '2.0',
943943
error: {
944-
code: -32000,
944+
code: -32_000,
945945
message: 'Invalid or missing session ID'
946946
},
947947
id: null
@@ -956,7 +956,7 @@ app.post('/mcp', async (req: Request, res: Response) => {
956956
res.status(500).json({
957957
jsonrpc: '2.0',
958958
error: {
959-
code: -32603,
959+
code: -32_603,
960960
message: 'Internal server error'
961961
},
962962
id: null

src/conformance/helpers/ConformanceOAuthProvider.ts renamed to test/conformance/src/helpers/conformanceOAuthProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type {
2-
OAuthClientProvider,
32
OAuthClientInformation,
43
OAuthClientInformationFull,
54
OAuthClientMetadata,
5+
OAuthClientProvider,
66
OAuthTokens
77
} from '@modelcontextprotocol/client';
88

0 commit comments

Comments
 (0)