Skip to content

Commit 9560a6b

Browse files
authored
Merge branch 'main' into copilot/update-mcp-inspector-license
2 parents 1876a77 + 44d0e58 commit 9560a6b

19 files changed

Lines changed: 4206 additions & 2490 deletions

.github/workflows/cli_tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ jobs:
3131
- name: Build CLI
3232
run: npm run build
3333

34-
- name: Explicitly pre-install test dependencies
35-
run: npx -y @modelcontextprotocol/server-everything --help || true
36-
3734
- name: Run tests
3835
run: npm test
3936
env:

cli/__tests__/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# CLI Tests
2+
3+
## Running Tests
4+
5+
```bash
6+
# Run all tests
7+
npm test
8+
9+
# Run in watch mode (useful for test file changes; won't work on CLI source changes without rebuild)
10+
npm run test:watch
11+
12+
# Run specific test file
13+
npm run test:cli # cli.test.ts
14+
npm run test:cli-tools # tools.test.ts
15+
npm run test:cli-headers # headers.test.ts
16+
npm run test:cli-metadata # metadata.test.ts
17+
```
18+
19+
## Test Files
20+
21+
- `cli.test.ts` - Basic CLI functionality: CLI mode, environment variables, config files, resources, prompts, logging, transport types
22+
- `tools.test.ts` - Tool-related tests: Tool discovery, JSON argument parsing, error handling, prompts
23+
- `headers.test.ts` - Header parsing and validation
24+
- `metadata.test.ts` - Metadata functionality: General metadata, tool-specific metadata, parsing, merging, validation
25+
26+
## Helpers
27+
28+
The `helpers/` directory contains shared utilities:
29+
30+
- `cli-runner.ts` - Spawns CLI as subprocess and captures output
31+
- `test-mcp-server.ts` - Standalone stdio MCP server script for stdio transport testing
32+
- `instrumented-server.ts` - In-process MCP test server for HTTP/SSE transports with request recording
33+
- `assertions.ts` - Custom assertion helpers for CLI output validation
34+
- `fixtures.ts` - Test config file generators and temporary directory management
35+
36+
## Notes
37+
38+
- Tests run in parallel across files (Vitest default)
39+
- Tests within a file run sequentially (we have isolated config files and ports, so we could get more aggressive if desired)
40+
- Config files use `crypto.randomUUID()` for uniqueness in parallel execution
41+
- HTTP/SSE servers use dynamic port allocation to avoid conflicts
42+
- Coverage is not used because much of the code that we want to measure is run by a spawned process, so it can't be tracked by Vitest
43+
- /sample-config.json is no longer used by tests - not clear if this file serves some other purpose so leaving it for now
44+
- All tests now use built-in MCP test servers, there are no external dependencies on servers from a registry

0 commit comments

Comments
 (0)