@slbdn/mcp-tester 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -82
- package/README.md +230 -1437
- package/dist/assert.d.ts +75 -0
- package/dist/assert.d.ts.map +1 -0
- package/dist/assert.js +250 -0
- package/dist/assert.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +311 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/client/MCPClient.d.ts +316 -0
- package/dist/client/MCPClient.d.ts.map +1 -1
- package/dist/client/MCPClient.js +240 -9
- package/dist/client/MCPClient.js.map +1 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -1
- package/dist/index.js.map +1 -1
- package/dist/matchers.d.ts +262 -0
- package/dist/matchers.d.ts.map +1 -0
- package/dist/matchers.js +527 -0
- package/dist/matchers.js.map +1 -0
- package/dist/utils/errors.d.ts +38 -0
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +38 -0
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/logger.d.ts +57 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +32 -3
- package/dist/utils/logger.js.map +1 -1
- package/package.json +32 -5
- package/vitest.d.ts +51 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,94 +5,82 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
9
|
-
|
|
10
|
-
### Fixed
|
|
11
|
-
- **Critical**: Removed duplicate process spawn in `MCPClient.start()` that spawned the server twice (once manually, once via StdioClientTransport). The transport now solely manages the server process lifecycle.
|
|
12
|
-
- **Critical**: Fixed broken example files (`basic-test.ts`, `full-test.ts`) that called `client.start()` without specifying a server path
|
|
13
|
-
- Fixed `MCPClient.stop()` to properly close client before transport, avoiding potential hanging connections
|
|
14
|
-
- Fixed `@ts-ignore` usage in test files — replaced with `@ts-expect-error` per project conventions
|
|
15
|
-
- Fixed `any` types in `resources-prompts.test.ts` — replaced with proper `MCPClient` type and removed duplicate dynamic imports
|
|
16
|
-
- Fixed `setElicitationHandler()` to use proper TypeScript types instead of `any`
|
|
17
|
-
|
|
18
|
-
### Changed
|
|
19
|
-
- `MCPClient.stop()` now calls `client.close()` + `transport.close()` instead of manual SIGTERM/SIGKILL
|
|
20
|
-
- Updated `@modelcontextprotocol/sdk` from `^1.25.2` to `^1.29.0`
|
|
21
|
-
- Improved `src/index.ts` exports to include error classes, logger types, and `RetryOptions`
|
|
22
|
-
- Updated `package.json` `files` field to exclude test files from npm package (40 → 28 files)
|
|
23
|
-
- `resources-prompts.test.ts` now registers custom matchers via `expect.extend()`
|
|
8
|
+
## [1.1.0] - 2026-04-23
|
|
24
9
|
|
|
25
10
|
### Added
|
|
26
|
-
-
|
|
27
|
-
- `
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
- `
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
- `
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
- `
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
- `validateToolResult(result)` - Validate result
|
|
70
|
-
- `src/__tests__/helpers-example.test.ts` - Usage examples
|
|
71
|
-
- Updated `src/__tests__/client.test.ts` to use helpers
|
|
72
|
-
- Documentation in README.md for helpers and matchers with usage examples
|
|
11
|
+
- **Assertion module** (`src/assert.ts`) — 30+ framework-agnostic assertion functions:
|
|
12
|
+
- Value: `equal`, `notEqual`, `deepEqual`, `ok`, `notOk`, `throws`, `doesNotThrow`
|
|
13
|
+
- Numeric: `equalNum`, `greaterThan`, `atLeast`, `lessThan`, `closeTo`
|
|
14
|
+
- String: `contains`, `notContains`, `matches`
|
|
15
|
+
- Tool results: `toolTextEquals`, `toolTextContains`, `toolNumEquals`, `toolNumCloseTo`, `toolJsonEquals`, `toolIsError`, `toolIsOk`, `toolHasContent`, `toolHasImage`
|
|
16
|
+
- Resources: `resourceHasContent`, `resourceTextContains`
|
|
17
|
+
- Prompts: `promptHasMessages`, `promptTextContains`
|
|
18
|
+
- Exported as `assert` namespace and `AssertionError` class
|
|
19
|
+
- **20 custom Jest/Vitest matchers** for MCP-specific assertions:
|
|
20
|
+
- Collection: `toHaveTool`, `toHaveToolWithSchema`, `toHaveToolCount`, `toHaveResource`, `toHaveResourceByName`, `toHaveResourceCount`, `toHavePrompt`, `toHavePromptWithArgs`, `toHavePromptCount`
|
|
21
|
+
- Tool results: `toReturnText`, `toReturnTextContaining`, `toReturnError`, `toReturnOk`, `toReturnJson`, `toReturnContentCount`, `toReturnImage`
|
|
22
|
+
- Resource results: `toReturnResourceText`, `toReturnResourceTextContaining`
|
|
23
|
+
- Prompt results: `toReturnPromptTextContaining`, `toReturnPromptMessageCount`
|
|
24
|
+
- **Vitest support** — all matchers work with Vitest via `setupVitestMatchers()`:
|
|
25
|
+
- `vitest.d.ts` type declarations included in package
|
|
26
|
+
- `setupJestMatchers()` (renamed from `setupCustomMatchers`, kept as alias)
|
|
27
|
+
- `setupVitestMatchers()` for Vitest environments
|
|
28
|
+
- Same `{ pass, message }` format, works identically in both frameworks
|
|
29
|
+
- **Standalone assertion wrappers** in `matchers.ts` for non-Jest usage: `assertHasTool`, `assertHasResource`, `assertHasPrompt`, `assertToolText`, `assertToolTextContains`
|
|
30
|
+
- **CLI tool** with shebang (`#!/usr/bin/env node`) for proper `npx` support
|
|
31
|
+
- **Examples** added to `examples/`:
|
|
32
|
+
- `everything-server-test.ts` — full test against real `@modelcontextprotocol/server-everything`
|
|
33
|
+
- `jest-matchers-example.ts` — demonstrates all 20 Jest matchers (20 tests)
|
|
34
|
+
- `assert-example.ts` — demonstrates all assert utilities (20 tests)
|
|
35
|
+
- **Documentation reorganization** — README condensed from 1610 to ~200 lines:
|
|
36
|
+
- `docs/api-reference.md` — full method docs, types, error classes, assert & matchers tables
|
|
37
|
+
- `docs/testing.md` — writing tests, Jest/Vitest setup, matchers, assert module, mock server
|
|
38
|
+
- `docs/examples.md` — practical code examples for Jest, Vitest, and assert
|
|
39
|
+
- `docs/advanced.md` — timeouts, retries, concurrency, notifications, logging
|
|
40
|
+
- `docs/cli.md` — CLI commands, options, output formats
|
|
41
|
+
- `docs/cicd.md` — GitHub Actions, CircleCI, Jenkins configs
|
|
42
|
+
- `docs/troubleshooting.md` — common issues, Vitest setup, solutions
|
|
43
|
+
- `docs/releases.md` — release process and commands
|
|
44
|
+
- `docs/nodejs-compatibility.md` — version matrix, upgrade guide
|
|
45
|
+
- **README improvements**:
|
|
46
|
+
- "This is not your grandpa's MCP Inspector" intro
|
|
47
|
+
- Capabilities table (9 categories)
|
|
48
|
+
- Parallel execution section with `Promise.all` examples
|
|
49
|
+
- Assertion utilities section with full API table
|
|
50
|
+
- Custom Jest matchers section with all 20 matchers
|
|
51
|
+
- Vitest setup section
|
|
52
|
+
- Removed old `CLI.md` (replaced by `docs/cli.md`)
|
|
53
|
+
- **227 tests** (up from 111) — new `assert.test.ts` (67 tests) and `matchers.test.ts` (49 tests)
|
|
73
54
|
|
|
74
55
|
### Changed
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
### Fixed
|
|
84
|
-
- Type safety issues with environment variable merging
|
|
85
|
-
- Process cleanup now properly handles both SIGTERM and SIGKILL
|
|
86
|
-
- Typo in AGENTS.md: "Security Considerations" fixed (was "Security Considerations")
|
|
87
|
-
|
|
88
|
-
### Deprecated
|
|
89
|
-
- None
|
|
56
|
+
- **`MCPTimeoutError` and `MCPConnectionError` are now actually thrown** — `start()` catches connection errors as `MCPConnectionError`, `wrapError()` detects timeout errors and throws `MCPTimeoutError`
|
|
57
|
+
- **CLI** rewritten to use Commander's native `help` and `version` handling instead of duplicated logic
|
|
58
|
+
- **Example imports** fixed: `../index.js` → `../dist/index.js` (examples now actually run with `npx tsx`)
|
|
59
|
+
- **Matchers** moved from `src/__tests__/matchers.ts` to `src/matchers.ts` and exported publicly
|
|
60
|
+
- **Test helper server path** fixed: `./dist/__tests__/fixtures/mock-server.js` → `./examples/mock-server.js`
|
|
61
|
+
- Husky `prepare` script now handles Node.js v24 incompatibility (`"husky || true"`)
|
|
62
|
+
- `tsconfig.json` excludes `src/__tests__` from compilation — `dist/` now has only library files (28)
|
|
63
|
+
- `toolTextEquals()` now accepts optional `expected` param — can be used as "has any text" check
|
|
90
64
|
|
|
91
65
|
### Removed
|
|
92
|
-
-
|
|
66
|
+
- **`src/__tests__/helpers.ts`** — removed dead code (was only used once, `new MCPClient()` is simpler)
|
|
67
|
+
- **`src/__tests__/helpers-example.test.ts`** — removed (demonstrated unused helpers)
|
|
68
|
+
- **`src/__tests__/matchers.ts`** — moved to `src/matchers.ts` (now a public export)
|
|
69
|
+
- **`CLI.md`** — replaced by `docs/cli.md`
|
|
70
|
+
- **`toBeConnectedClient`** matcher — removed (never had real implementation)
|
|
71
|
+
- All `any` types removed from `mock-server.ts` — replaced with proper TypeScript interfaces
|
|
72
|
+
- Documentation references to removed helpers, old import paths, and stale test counts
|
|
93
73
|
|
|
94
|
-
###
|
|
95
|
-
-
|
|
74
|
+
### Fixed
|
|
75
|
+
- **Two failing tests** in `everything-server.test.ts`:
|
|
76
|
+
- `trigger-long-running-operation`: `duration` parameter is in seconds, not milliseconds
|
|
77
|
+
- `args-prompt`: requires `city` argument, not `name`
|
|
78
|
+
- **MCPClient error handling**: catches in `start()`, `listTools()`, `callTool()`, `listResources()`, `readResource()`, `listPrompts()`, and `getPrompt()` now throw proper error subclasses instead of generic `MCPServerError`
|
|
79
|
+
- **Husky compatibility** with Node.js v24+ (exit code issue)
|
|
80
|
+
- **Test helper import paths** across all test files
|
|
81
|
+
- **CLI version format**: now outputs plain `1.1.0` instead of `mcp-tester v1.1.0`
|
|
82
|
+
- **Package name** in RELEASE.md and CONTRIBUTING.md: `mcp-tester` → `@slbdn/mcp-tester`
|
|
83
|
+
- **Repo URLs** in RELEASE.md and CONTRIBUTING.md: `your-username` → `islobodan`
|
|
96
84
|
|
|
97
85
|
## [1.0.0] - 2026-01-19
|
|
98
86
|
|
|
@@ -103,4 +91,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
103
91
|
- Mock MCP server for unit testing
|
|
104
92
|
- TypeScript support with full type definitions
|
|
105
93
|
- CI/CD pipeline with GitHub Actions
|
|
106
|
-
- Comprehensive documentation and examples
|
|
94
|
+
- Comprehensive documentation and examples
|