Skip to content

Commit 13352e1

Browse files
authored
Merge branch 'main' into adam-bloomston--strict-zod-validation
2 parents 46bff56 + 7387c44 commit 13352e1

21 files changed

+2566
-257
lines changed

package-lock.json

Lines changed: 124 additions & 14 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",
@@ -76,7 +89,16 @@
7689
"zod": "^3.23.8",
7790
"zod-to-json-schema": "^3.24.1"
7891
},
92+
"peerDependencies": {
93+
"@cfworker/json-schema": "^4.1.1"
94+
},
95+
"peerDependenciesMeta": {
96+
"@cfworker/json-schema": {
97+
"optional": true
98+
}
99+
},
79100
"devDependencies": {
101+
"@cfworker/json-schema": "^4.1.1",
80102
"@eslint/js": "^9.8.0",
81103
"@jest-mock/express": "^3.0.0",
82104
"@types/content-type": "^1.1.8",
@@ -91,8 +113,8 @@
91113
"@types/ws": "^8.5.12",
92114
"eslint": "^9.8.0",
93115
"eslint-config-prettier": "^10.1.8",
94-
"prettier": "3.6.2",
95116
"jest": "^29.7.0",
117+
"prettier": "3.6.2",
96118
"supertest": "^7.0.0",
97119
"ts-jest": "^29.2.4",
98120
"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)