@@ -22,6 +22,8 @@ const __filename = fileURLToPath(import.meta.url);
2222const __dirname = dirname ( __filename ) ;
2323const packageJson = JSON . parse ( readFileSync ( join ( __dirname , '../package.json' ) , 'utf8' ) ) ;
2424
25+ const GITHUB_HELP_TEXT = `Learn more:\n For detailed examples and documentation see the README at https://github.com/steviec/mcp-server-tester` ;
26+
2527interface CliOptions {
2628 serverConfig: string ;
2729 serverName ? : string ;
@@ -228,25 +230,23 @@ async function main(): Promise<void> {
228230 . description ( 'Standalone CLI tool for testing MCP servers' )
229231 . version ( packageJson . version , '--version' )
230232 . helpOption ( '--help' , 'Show help for command' )
231- . option ( '--help-schema' , 'Show JSON schema for test files' )
232233 . addHelpText (
233234 'after' ,
234235 `
235236Examples:
236237 $ mcp-server-tester tools test.yaml --server-config server.json
237238 $ mcp-server-tester evals eval.yaml --server-config server.json
238239 $ mcp-server-tester compliance --server-config server.json
239- $ mcp-server-tester --help- schema
240+ $ mcp-server-tester schema
240241
241- Get test file schema:
242- $ mcp-server-tester --help-schema`
242+ ${ GITHUB_HELP_TEXT } `
243243 ) ;
244244
245245 // Tools command
246246 program
247247 . command ( 'tools' )
248248 . description (
249- 'Run MCP server tools tests (direct API testing). Use "mcp-server-tester --help- schema" to see test file schema.'
249+ 'Run MCP server tools tests (direct API testing). Use "mcp-server-tester schema" to see test file schema.'
250250 )
251251 . argument ( '[test-file]' , 'Test configuration file (YAML)' )
252252 . option ( '--server-config <file>' , 'MCP server configuration file (JSON)' )
@@ -257,6 +257,7 @@ Get test file schema:
257257 . option ( '--timeout <ms>' , 'Test timeout in milliseconds' , '10000' )
258258 . option ( '--debug' , 'Enable debug output with additional details' )
259259 . option ( '--junit-xml [filename]' , 'Generate JUnit XML output (default: junit.xml)' )
260+ . addHelpText ( 'after' , GITHUB_HELP_TEXT )
260261 . action ( async ( testFile : string | undefined , options : CliOptions ) => {
261262 // Validate required arguments
262263 if ( ! testFile ) {
@@ -275,7 +276,7 @@ Get test file schema:
275276 program
276277 . command ( 'evals' )
277278 . description (
278- 'Run LLM evaluation tests (end-to-end testing with real LLMs). Requires ANTHROPIC_API_KEY. Use "mcp-server-tester --help- schema" to see test file schema.'
279+ 'Run LLM evaluation tests (end-to-end testing with real LLMs). Requires ANTHROPIC_API_KEY. Use "mcp-server-tester schema" to see test file schema.'
279280 )
280281 . argument ( '[test-file]' , 'Test configuration file (YAML)' )
281282 . option ( '--server-config <file>' , 'MCP server configuration file (JSON)' )
@@ -286,6 +287,7 @@ Get test file schema:
286287 . option ( '--timeout <ms>' , 'Test timeout in milliseconds' , '10000' )
287288 . option ( '--debug' , 'Enable debug output with additional details' )
288289 . option ( '--junit-xml [filename]' , 'Generate JUnit XML output (default: junit.xml)' )
290+ . addHelpText ( 'after' , GITHUB_HELP_TEXT )
289291 . action ( async ( testFile : string | undefined , options : CliOptions ) => {
290292 // Validate required arguments
291293 if ( ! testFile ) {
@@ -312,20 +314,22 @@ Get test file schema:
312314 . option ( '--categories <list>' , 'Test categories to run (comma-separated)' )
313315 . option ( '--output <format>' , 'Output format: console, json' , 'console' )
314316 . option ( '--timeout <ms>' , 'Overall timeout for compliance tests' , '300000' )
317+ . addHelpText ( 'after' , GITHUB_HELP_TEXT )
315318 . action ( async ( options : ComplianceOptions ) => {
316319 await runCompliance ( options ) ;
317320 } ) ;
318321
319- // Handle --help-schema option (regardless of command)
320- const args = process . argv ;
321- if ( args . includes ( '--help-schema' ) ) {
322- console . log ( 'Test Configuration Schema:' ) ;
323- console . log ( 'This schema supports both "tools:" and "evals:" sections.' ) ;
324- console . log ( `
325- ${ JSON . stringify ( testConfigSchema , null , 2 ) }
326- ` ) ;
327- process . exit ( 0 ) ;
328- }
322+ // Schema command
323+ program
324+ . command ( 'schema' )
325+ . description ( 'Display JSON schema for test configuration files' )
326+ . action ( ( ) => {
327+ console . log ( '# Test file JSON Schema for both tools and evals commands' ) ;
328+ console . log ( '' ) ;
329+ console . log ( '```json' ) ;
330+ console . log ( JSON . stringify ( testConfigSchema , null , 2 ) ) ;
331+ console . log ( '```' ) ;
332+ } ) ;
329333
330334 // Parse command line arguments
331335 program . parse ( ) ;
0 commit comments