1- #!/usr/bin/env npx tsx
1+ import { TestSuite } from "." ;
22
3- import { ComplianceTestRunner , TestSuite } from '../src/test-framework/index.js' ;
43
5- // Basic compliance tests
6- const basicSuite : TestSuite = {
4+
5+ // Test suite definitions
6+ export const basicSuite : TestSuite = {
77 name : 'Basic Compliance' ,
88 description : 'Tests basic MCP protocol compliance without authentication' ,
99 scenarios : [
@@ -13,14 +13,12 @@ const basicSuite: TestSuite = {
1313 serverConfig : {
1414 authRequired : false
1515 } ,
16- clientCommand : 'npx tsx examples/typescript-client/test-client.ts' ,
1716 expectedResult : 'PASS'
1817 }
1918 ]
2019} ;
2120
22- // OAuth compliance tests
23- const oauthSuite : TestSuite = {
21+ export const oauthSuite : TestSuite = {
2422 name : 'OAuth Compliance' ,
2523 description : 'Tests OAuth2/OIDC authorization flow' ,
2624 scenarios : [
@@ -30,14 +28,12 @@ const oauthSuite: TestSuite = {
3028 serverConfig : {
3129 authRequired : true
3230 } ,
33- clientCommand : 'npx tsx examples/typescript-client/test-client.ts' ,
3431 expectedResult : 'PASS'
3532 }
3633 ]
3734} ;
3835
39- // Metadata location tests
40- const metadataLocationSuite : TestSuite = {
36+ export const metadataLocationSuite : TestSuite = {
4137 name : 'Metadata Location Tests' ,
4238 description : 'Tests different OAuth protected resource metadata locations' ,
4339 scenarios : [
@@ -48,7 +44,6 @@ const metadataLocationSuite: TestSuite = {
4844 metadataLocation : '/.well-known/oauth-protected-resource' ,
4945 includeWwwAuthenticate : true
5046 } ,
51- clientCommand : 'npx tsx examples/typescript-client/test-client.ts' ,
5247 expectedResult : 'PASS'
5348 } ,
5449 {
@@ -59,7 +54,6 @@ const metadataLocationSuite: TestSuite = {
5954 metadataLocation : '/custom/oauth/metadata' ,
6055 includeWwwAuthenticate : true
6156 } ,
62- clientCommand : 'npx tsx examples/typescript-client/test-client.ts' ,
6357 expectedResult : 'PASS'
6458 } ,
6559 {
@@ -69,7 +63,6 @@ const metadataLocationSuite: TestSuite = {
6963 metadataLocation : '/.well-known/oauth-protected-resource/mcp' ,
7064 includeWwwAuthenticate : true
7165 } ,
72- clientCommand : 'npx tsx examples/typescript-client/test-client.ts' ,
7366 expectedResult : 'PASS'
7467 } ,
7568 {
@@ -80,7 +73,6 @@ const metadataLocationSuite: TestSuite = {
8073 metadataLocation : '/.well-known/oauth-protected-resource' ,
8174 includeWwwAuthenticate : false
8275 } ,
83- clientCommand : 'npx tsx examples/typescript-client/test-client.ts' ,
8476 expectedResult : 'PASS'
8577 } ,
8678 {
@@ -91,14 +83,13 @@ const metadataLocationSuite: TestSuite = {
9183 metadataLocation : '/custom/oauth/metadata' ,
9284 includeWwwAuthenticate : false
9385 } ,
94- clientCommand : 'npx tsx examples/typescript-client/test-client.ts' ,
9586 expectedResult : 'FAIL' // Should fail - client won't find non-standard location
9687 }
9788 ]
9889} ;
9990
100- // Behavior validation tests
101- const behaviorSuite : TestSuite = {
91+ // TODO: this is busted
92+ export const behaviorSuite : TestSuite = {
10293 name : 'Client Behavior Validation' ,
10394 description : 'Tests specific client behaviors' ,
10495 scenarios : [
@@ -107,7 +98,6 @@ const behaviorSuite: TestSuite = {
10798 serverConfig : {
10899 authRequired : true
109100 } ,
110- clientCommand : 'npx tsx examples/typescript-client/test-client.ts' ,
111101 expectedResult : 'PASS' ,
112102 validateBehavior : ( behavior ) => {
113103 const errors = [ ] ;
@@ -122,47 +112,3 @@ const behaviorSuite: TestSuite = {
122112 }
123113 ]
124114} ;
125-
126- // Main test runner
127- async function main ( ) {
128- const args = process . argv . slice ( 2 ) ;
129- const verbose = args . includes ( '--verbose' ) || args . includes ( '-v' ) ;
130- const json = args . includes ( '--json' ) ;
131- const suite = args . find ( arg => arg . startsWith ( '--suite=' ) ) ?. split ( '=' ) [ 1 ] ;
132-
133- const runner = new ComplianceTestRunner ( { verbose, json } ) ;
134-
135- // Select which suites to run
136- let suitesToRun : TestSuite [ ] = [ ] ;
137-
138- if ( suite ) {
139- // Run specific suite
140- const suiteMap : Record < string , TestSuite > = {
141- 'basic' : basicSuite ,
142- 'oauth' : oauthSuite ,
143- 'metadata' : metadataLocationSuite ,
144- 'behavior' : behaviorSuite
145- } ;
146-
147- if ( suiteMap [ suite ] ) {
148- suitesToRun = [ suiteMap [ suite ] ] ;
149- } else {
150- console . error ( `Unknown suite: ${ suite } ` ) ;
151- console . error ( `Available suites: ${ Object . keys ( suiteMap ) . join ( ', ' ) } ` ) ;
152- process . exit ( 1 ) ;
153- }
154- } else {
155- // Run all suites
156- suitesToRun = [ basicSuite , oauthSuite , metadataLocationSuite , behaviorSuite ] ;
157- }
158-
159- console . log ( 'MCP Authorization Compliance Test Suite' ) ;
160- console . log ( '=' . repeat ( 60 ) ) ;
161-
162- await runner . runSuites ( suitesToRun ) ;
163- }
164-
165- main ( ) . catch ( ( error ) => {
166- console . error ( 'Test runner error:' , error ) ;
167- process . exit ( 1 ) ;
168- } ) ;
0 commit comments