Skip to content

Commit 3e0657f

Browse files
committed
test imports, pnpm catalogs, package.json cleanup
1 parent f1c45f2 commit 3e0657f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+625
-773
lines changed

.github/workflows/update-spec-types.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,35 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout repository
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
19+
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v4
22+
id: pnpm-install
23+
with:
24+
run_install: false
1925

2026
- name: Setup Node.js
21-
uses: actions/setup-node@v4
27+
uses: actions/setup-node@v6
2228
with:
23-
node-version: '24'
29+
node-version: 24
30+
cache: pnpm
31+
cache-dependency-path: pnpm-lock.yaml
2432

2533
- name: Install dependencies
26-
run: npm ci
34+
run: pnpm install
2735

2836
- name: Fetch latest spec types
29-
run: npm run fetch:spec-types
37+
run: pnpm run fetch:spec-types
3038

3139
- name: Check for changes
3240
id: check_changes
3341
run: |
34-
if git diff --quiet src/spec.types.ts; then
42+
if git diff --quiet packages/core/src/types/spec.types.ts; then
3543
echo "has_changes=false" >> $GITHUB_OUTPUT
3644
else
3745
echo "has_changes=true" >> $GITHUB_OUTPUT
38-
LATEST_SHA=$(grep "Last updated from commit:" src/spec.types.ts | cut -d: -f2 | tr -d ' ')
46+
LATEST_SHA=$(grep "Last updated from commit:" packages/core/src/types/spec.types.ts | cut -d: -f2 | tr -d ' ')
3947
echo "sha=$LATEST_SHA" >> $GITHUB_OUTPUT
4048
fi
4149
@@ -48,12 +56,12 @@ jobs:
4856
git config user.email "github-actions[bot]@users.noreply.github.com"
4957
5058
git checkout -B update-spec-types
51-
git add src/spec.types.ts
59+
git add packages/core/src/types/spec.types.ts
5260
git commit -m "chore: update spec.types.ts from upstream"
5361
git push -f origin update-spec-types
5462
5563
# Create PR if it doesn't exist, or update if it does
56-
PR_BODY="This PR updates \`src/spec.types.ts\` from the Model Context Protocol specification.
64+
PR_BODY="This PR updates \`packages/core/src/types/spec.types.ts\` from the Model Context Protocol specification.
5765
5866
Source file: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/${{ steps.check_changes.outputs.sha }}/schema/draft/schema.ts
5967

common/eslint-config/eslint.config.mjs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// @ts-check
2+
import path from 'node:path';
3+
import { fileURLToPath } from 'node:url';
24

35
import eslint from '@eslint/js';
4-
import tseslint from 'typescript-eslint';
56
import eslintConfigPrettier from 'eslint-config-prettier/flat';
6-
import nodePlugin from 'eslint-plugin-n';
77
import importPlugin from 'eslint-plugin-import';
8-
import { fileURLToPath } from 'node:url';
9-
import path from 'node:path';
8+
import nodePlugin from 'eslint-plugin-n';
109
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
10+
import tseslint from 'typescript-eslint';
1111

1212
const __dirname = path.dirname(fileURLToPath(import.meta.url));
1313

@@ -45,7 +45,23 @@ export default tseslint.config(
4545
'n/prefer-node-protocol': 'error',
4646
'@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
4747
'simple-import-sort/imports': 'warn',
48-
'simple-import-sort/exports': 'warn'
48+
'simple-import-sort/exports': 'warn',
49+
'import/no-extraneous-dependencies': [
50+
'error',
51+
{
52+
devDependencies: [
53+
'**/test/**',
54+
'**/*.test.ts',
55+
'**/*.test.tsx',
56+
'**/scripts/**',
57+
'**/vitest.config.*',
58+
'**/eslint.config.*',
59+
'**/vitest.setup.*'
60+
],
61+
optionalDependencies: false,
62+
peerDependencies: true
63+
}
64+
]
4965
}
5066
},
5167
{

common/eslint-config/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
},
2323
"version": "2.0.0",
2424
"devDependencies": {
25-
"@eslint/js": "^9.39.1",
26-
"eslint": "^9.8.0",
27-
"eslint-config-prettier": "^10.1.8",
25+
"@eslint/js": "catalog:",
26+
"eslint": "catalog:",
27+
"eslint-config-prettier": "catalog:",
2828
"eslint-import-resolver-typescript": "^4.4.4",
2929
"eslint-plugin-import": "^2.32.0",
30-
"eslint-plugin-n": "^17.23.1",
30+
"eslint-plugin-n": "catalog:",
3131
"eslint-plugin-simple-import-sort": "^12.1.1",
32-
"prettier": "3.6.2",
33-
"typescript": "^5.5.4",
34-
"typescript-eslint": "^8.48.1"
32+
"prettier": "catalog:",
33+
"typescript": "catalog:",
34+
"typescript-eslint": "catalog:"
3535
}
3636
}

common/vitest-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
"version": "2.0.0",
2424
"devDependencies": {
2525
"@modelcontextprotocol/tsconfig": "workspace:^",
26-
"vite-tsconfig-paths": "^5.1.4"
26+
"vite-tsconfig-paths": "catalog:"
2727
}
2828
}

package.json

Lines changed: 21 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -29,58 +29,29 @@
2929
"check:all": "pnpm -r typecheck && pnpm -r lint",
3030
"test:all": "pnpm -r test"
3131
},
32-
"dependencies": {
33-
"ajv": "^8.17.1",
34-
"ajv-formats": "^3.0.1",
35-
"content-type": "^1.0.5",
36-
"cors": "^2.8.5",
37-
"cross-spawn": "^7.0.5",
38-
"eventsource": "^3.0.2",
39-
"eventsource-parser": "^3.0.0",
40-
"express": "^5.0.1",
41-
"express-rate-limit": "^7.5.0",
42-
"jose": "^6.1.1",
43-
"json-schema-typed": "^8.0.2",
44-
"pkce-challenge": "^5.0.0",
45-
"raw-body": "^3.0.0",
46-
"zod": "^3.25 || ^4.0",
47-
"zod-to-json-schema": "^3.25.0"
48-
},
49-
"peerDependencies": {
50-
"@cfworker/json-schema": "^4.1.1",
51-
"zod": "^3.25 || ^4.0"
52-
},
53-
"peerDependenciesMeta": {
54-
"@cfworker/json-schema": {
55-
"optional": true
56-
},
57-
"zod": {
58-
"optional": false
59-
}
60-
},
6132
"devDependencies": {
62-
"@cfworker/json-schema": "^4.1.1",
63-
"@eslint/js": "^9.39.1",
64-
"@types/content-type": "^1.1.8",
65-
"@types/cors": "^2.8.17",
66-
"@types/cross-spawn": "^6.0.6",
67-
"@types/eventsource": "^1.1.15",
68-
"@types/express": "^5.0.0",
69-
"@types/express-serve-static-core": "^5.1.0",
33+
"@cfworker/json-schema": "catalog:",
34+
"@eslint/js": "catalog:",
35+
"@types/content-type": "catalog:",
36+
"@types/cors": "catalog:",
37+
"@types/cross-spawn": "catalog:",
38+
"@types/eventsource": "catalog:",
39+
"@types/express": "catalog:",
40+
"@types/express-serve-static-core": "catalog:",
7041
"@types/node": "^24.10.1",
71-
"@types/supertest": "^6.0.2",
72-
"@types/ws": "^8.5.12",
73-
"@typescript/native-preview": "^7.0.0-dev.20251103.1",
74-
"eslint": "^9.8.0",
75-
"eslint-config-prettier": "^10.1.8",
76-
"eslint-plugin-n": "^17.23.1",
77-
"prettier": "3.6.2",
78-
"supertest": "^7.0.0",
79-
"tsx": "^4.16.5",
80-
"typescript": "^5.9.3",
81-
"typescript-eslint": "^8.48.1",
82-
"vitest": "^4.0.8",
83-
"ws": "^8.18.0"
42+
"@types/supertest": "catalog:",
43+
"@types/ws": "catalog:",
44+
"@typescript/native-preview": "catalog:",
45+
"eslint": "catalog:",
46+
"eslint-config-prettier": "catalog:",
47+
"eslint-plugin-n": "catalog:",
48+
"prettier": "catalog:",
49+
"supertest": "catalog:",
50+
"tsx": "catalog:",
51+
"typescript": "catalog:",
52+
"typescript-eslint": "catalog:",
53+
"vitest": "catalog:",
54+
"ws": "catalog:"
8455
},
8556
"resolutions": {
8657
"strip-ansi": "6.0.1"

packages/client/package.json

Lines changed: 30 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,23 @@
5050
},
5151
"dependencies": {
5252
"@modelcontextprotocol/sdk-core": "workspace:^",
53-
"ajv": "^8.17.1",
54-
"ajv-formats": "^3.0.1",
55-
"content-type": "^1.0.5",
56-
"cors": "^2.8.5",
57-
"cross-spawn": "^7.0.5",
58-
"eventsource": "^3.0.2",
59-
"eventsource-parser": "^3.0.0",
60-
"express": "^5.0.1",
61-
"express-rate-limit": "^7.5.0",
62-
"jose": "^6.1.1",
63-
"json-schema-typed": "^8.0.2",
64-
"pkce-challenge": "^5.0.0",
65-
"raw-body": "^3.0.0",
66-
"zod": "^3.25 || ^4.0",
67-
"zod-to-json-schema": "^3.25.0"
53+
"ajv": "catalog:",
54+
"ajv-formats": "catalog:",
55+
"content-type": "catalog:",
56+
"cors": "catalog:",
57+
"cross-spawn": "catalog:",
58+
"eventsource": "catalog:",
59+
"eventsource-parser": "catalog:",
60+
"jose": "catalog:",
61+
"json-schema-typed": "catalog:",
62+
"pkce-challenge": "catalog:",
63+
"raw-body": "catalog:",
64+
"zod": "catalog:",
65+
"zod-to-json-schema": "catalog:"
6866
},
6967
"peerDependencies": {
70-
"@cfworker/json-schema": "^4.1.1",
71-
"zod": "^3.25 || ^4.0"
68+
"@cfworker/json-schema": "catalog:",
69+
"zod": "catalog:"
7270
},
7371
"peerDependenciesMeta": {
7472
"@cfworker/json-schema": {
@@ -82,26 +80,20 @@
8280
"@modelcontextprotocol/tsconfig": "workspace:^",
8381
"@modelcontextprotocol/vitest-config": "workspace:^",
8482
"@modelcontextprotocol/eslint-config": "workspace:^",
85-
"@cfworker/json-schema": "^4.1.1",
86-
"@eslint/js": "^9.39.1",
87-
"@types/content-type": "^1.1.8",
88-
"@types/cors": "^2.8.17",
89-
"@types/cross-spawn": "^6.0.6",
90-
"@types/eventsource": "^1.1.15",
91-
"@types/express": "^5.0.0",
92-
"@types/express-serve-static-core": "^5.1.0",
93-
"@types/supertest": "^6.0.2",
94-
"@types/ws": "^8.5.12",
95-
"@typescript/native-preview": "^7.0.0-dev.20251103.1",
96-
"eslint": "^9.8.0",
97-
"eslint-config-prettier": "^10.1.8",
98-
"eslint-plugin-n": "^17.23.1",
99-
"prettier": "3.6.2",
100-
"supertest": "^7.0.0",
101-
"tsx": "^4.16.5",
102-
"typescript": "^5.5.4",
103-
"typescript-eslint": "^8.48.1",
104-
"vitest": "^4.0.8",
105-
"ws": "^8.18.0"
83+
"@cfworker/json-schema": "catalog:",
84+
"@eslint/js": "catalog:",
85+
"@types/content-type": "catalog:",
86+
"@types/cors": "catalog:",
87+
"@types/cross-spawn": "catalog:",
88+
"@types/eventsource": "catalog:",
89+
"@typescript/native-preview": "catalog:",
90+
"eslint": "catalog:",
91+
"eslint-config-prettier": "catalog:",
92+
"eslint-plugin-n": "catalog:",
93+
"prettier": "catalog:",
94+
"tsx": "catalog:",
95+
"typescript": "catalog:",
96+
"typescript-eslint": "catalog:",
97+
"vitest": "catalog:"
10698
}
10799
}

packages/client/test/client/auth-extensions.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import { describe, it, expect } from 'vitest';
2-
import { auth } from '../../src/client/auth.js';
1+
import { describe, expect, it } from 'vitest';
2+
3+
import { createMockOAuthFetch } from '../../../integration/test/helpers/oauth.js';
4+
35
import {
46
ClientCredentialsProvider,
7+
createPrivateKeyJwtAuth,
58
PrivateKeyJwtProvider,
6-
StaticPrivateKeyJwtProvider,
7-
createPrivateKeyJwtAuth
9+
StaticPrivateKeyJwtProvider
810
} from '../../src/client/auth-extensions.js';
9-
import { createMockOAuthFetch } from '../helpers/oauth.js';
11+
import { auth } from '../../src/client/auth.js';
1012

1113
const RESOURCE_SERVER_URL = 'https://resource.example.com/';
1214
const AUTH_SERVER_URL = 'https://auth.example.com';

packages/client/test/client/auth.test.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
import {
2-
LATEST_PROTOCOL_VERSION,
3-
InvalidClientMetadataError,
4-
ServerError,
5-
AuthorizationServerMetadata,
6-
OAuthTokens
7-
} from '@modelcontextprotocol/sdk-core';
1+
import type { AuthorizationServerMetadata, OAuthTokens } from '@modelcontextprotocol/sdk-core';
2+
import { LATEST_PROTOCOL_VERSION, InvalidClientMetadataError, ServerError } from '@modelcontextprotocol/sdk-core';
83
import {
94
discoverOAuthMetadata,
105
discoverAuthorizationServerMetadata,

packages/client/test/client/cross-spawn.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { StdioClientTransport, getDefaultEnvironment } from '../../src/client/stdio.js';
22
import spawn from 'cross-spawn';
3-
import { JSONRPCMessage } from '@modelcontextprotocol/sdk-core';
4-
import { ChildProcess } from 'node:child_process';
5-
import { Mock, MockedFunction } from 'vitest';
3+
import type { JSONRPCMessage } from '@modelcontextprotocol/sdk-core';
4+
import type { ChildProcess } from 'node:child_process';
5+
import type { Mock, MockedFunction } from 'vitest';
66

77
// mock cross-spawn
88
vi.mock('cross-spawn');

packages/client/test/client/middleware.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { withOAuth, withLogging, applyMiddlewares, createMiddleware } from '../../src/client/middleware.js';
2-
import { OAuthClientProvider } from '../../src/client/auth.js';
2+
import type { OAuthClientProvider } from '../../src/client/auth.js';
33
import type { FetchLike } from '@modelcontextprotocol/sdk-core';
4-
import { MockInstance, Mocked, MockedFunction } from 'vitest';
4+
import type { MockInstance, Mocked, MockedFunction } from 'vitest';
55

66
vi.mock('../../src/client/auth.js', async () => {
77
const actual = await vi.importActual<typeof import('../../src/client/auth.js')>('../../src/client/auth.js');
@@ -1016,7 +1016,7 @@ describe('createMiddleware', () => {
10161016
const response = await next(input, init);
10171017

10181018
if (response.headers.get('content-type')?.includes('application/json')) {
1019-
const data = await response.json();
1019+
const data = (await response.json()) as Record<string, unknown>;
10201020
const transformed = { ...data, timestamp: 123456789 };
10211021

10221022
return new Response(JSON.stringify(transformed), {

0 commit comments

Comments
 (0)