Skip to content

Commit 6f18614

Browse files
committed
Merge branch 'main' into feature/zod-v3-compat
2 parents 63656a8 + 7387c44 commit 6f18614

22 files changed

+2686
-312
lines changed

package-lock.json

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

package.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/sdk",
3-
"version": "1.20.1",
3+
"version": "1.20.2",
44
"description": "Model Context Protocol implementation for TypeScript",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",
@@ -31,6 +31,18 @@
3131
"import": "./dist/esm/server/index.js",
3232
"require": "./dist/cjs/server/index.js"
3333
},
34+
"./validation": {
35+
"import": "./dist/esm/validation/index.js",
36+
"require": "./dist/cjs/validation/index.js"
37+
},
38+
"./validation/ajv": {
39+
"import": "./dist/esm/validation/ajv-provider.js",
40+
"require": "./dist/cjs/validation/ajv-provider.js"
41+
},
42+
"./validation/cfworker": {
43+
"import": "./dist/esm/validation/cfworker-provider.js",
44+
"require": "./dist/cjs/validation/cfworker-provider.js"
45+
},
3446
"./*": {
3547
"import": "./dist/esm/*",
3648
"require": "./dist/cjs/*"
@@ -63,7 +75,8 @@
6375
"client": "tsx src/cli.ts client"
6476
},
6577
"dependencies": {
66-
"ajv": "^6.12.6",
78+
"ajv": "^8.17.1",
79+
"ajv-formats": "^3.0.1",
6780
"content-type": "^1.0.5",
6881
"cors": "^2.8.5",
6982
"cross-spawn": "^7.0.5",
@@ -75,7 +88,16 @@
7588
"raw-body": "^3.0.0",
7689
"zod": "^3.25 || ^4.0"
7790
},
91+
"peerDependencies": {
92+
"@cfworker/json-schema": "^4.1.1"
93+
},
94+
"peerDependenciesMeta": {
95+
"@cfworker/json-schema": {
96+
"optional": true
97+
}
98+
},
7899
"devDependencies": {
100+
"@cfworker/json-schema": "^4.1.1",
79101
"@eslint/js": "^9.8.0",
80102
"@jest-mock/express": "^3.0.0",
81103
"@types/content-type": "^1.1.8",
@@ -90,8 +112,8 @@
90112
"@types/ws": "^8.5.12",
91113
"eslint": "^9.8.0",
92114
"eslint-config-prettier": "^10.1.8",
93-
"prettier": "3.6.2",
94115
"jest": "^29.7.0",
116+
"prettier": "3.6.2",
95117
"supertest": "^7.0.0",
96118
"ts-jest": "^29.2.4",
97119
"tsx": "^4.16.5",

src/client/auth.test.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
discoverOAuthProtectedResourceMetadata,
1111
extractResourceMetadataUrl,
1212
auth,
13-
type OAuthClientProvider
13+
type OAuthClientProvider,
14+
selectClientAuthMethod
1415
} from './auth.js';
1516
import { ServerError } from '../server/auth/errors.js';
1617
import { AuthorizationServerMetadata } from '../shared/auth.js';
@@ -881,6 +882,25 @@ describe('OAuth Authorization', () => {
881882
});
882883
});
883884

885+
describe('selectClientAuthMethod', () => {
886+
it('selects the correct client authentication method from client information', () => {
887+
const clientInfo = {
888+
client_id: 'test-client-id',
889+
client_secret: 'test-client-secret',
890+
token_endpoint_auth_method: 'client_secret_basic'
891+
};
892+
const supportedMethods = ['client_secret_post', 'client_secret_basic', 'none'];
893+
const authMethod = selectClientAuthMethod(clientInfo, supportedMethods);
894+
expect(authMethod).toBe('client_secret_basic');
895+
});
896+
it('selects the correct client authentication method from supported methods', () => {
897+
const clientInfo = { client_id: 'test-client-id' };
898+
const supportedMethods = ['client_secret_post', 'client_secret_basic', 'none'];
899+
const authMethod = selectClientAuthMethod(clientInfo, supportedMethods);
900+
expect(authMethod).toBe('none');
901+
});
902+
});
903+
884904
describe('startAuthorization', () => {
885905
const validMetadata = {
886906
issuer: 'https://auth.example.com',

0 commit comments

Comments
 (0)