@slbdn/mcp-tester 1.0.1 → 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 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
- ## [Unreleased]
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
- - Pre-commit hooks via Husky + lint-staged (runs `eslint --fix` and `prettier --write` on staged `.ts` files)
27
- - `RetryOptions` type exported from client index
28
- - Code review findings added to TODO.md as items 40-48
29
- - Configurable logging system with multiple log levels (debug, info, warn, error, none)
30
- - Custom error classes (MCPClientError, MCPTimeoutError, MCPConnectionError, MCPNotStartedError, MCPAlreadyStartedError, MCPServerError)
31
- - Retry logic with exponential backoff for failed requests
32
- - Protocol logging option for debugging MCP communication
33
- - `setLogLevel()` method to dynamically change log level at runtime
34
- - `logLevel`, `enableProtocolLogging`, `retries`, `retryDelay`, and `startupDelay` configuration options
35
- - Comprehensive JSDoc comments for all public APIs
36
- - Utility functions for environment variable filtering and merging
37
- - Better process cleanup with SIGTERM and SIGKILL
38
- - Comprehensive AGENTS.md documentation (557 lines) for AI agents working with the codebase
39
- - Detailed TODO.md roadmap (719 lines) with 38 improvement tasks organized by priority
40
- - Progress tracking system in TODO.md with status indicators ([ ] not started, [/] in progress, [x] completed)
41
- - Package metadata for npm publishing: repository, bugs, homepage fields added to package.json
42
- - .npmignore file created to control what files are published to npm
43
- - Roadmap section in AGENTS.md linking to TODO.md for planned improvements
44
- - "For AI Agents" section added to README.md with comprehensive description and link to AGENTS.md
45
- - AGENTS.md link added to README.md Table of Contents and Additional Resources section
46
- - Dependabot configuration (.github/dependabot.yml) for automated npm dependency updates
47
- - Weekly dependency update schedule with Monday 05:00 UTC check
48
- - Automatic PRs for dependency updates with "dependencies", "npm", and "dependabot" labels
49
- - Additional npm badges added to README.md:
50
- - npm downloads badge (monthly download count)
51
- - npm license badge
52
- - Updated GitHub Actions test status badge to use correct repository URL
53
- - Test helpers and custom matchers for Jest:
54
- - `src/__tests__/matchers.ts` with custom Jest matchers:
55
- - `toHaveTool(toolName)` - Check if tool exists
56
- - `toHaveResource(uri)` - Check if resource exists
57
- - `toHavePrompt(promptName)` - Check if prompt exists
58
- - `toHaveToolWithSchema(toolName)` - Check if tool has schema
59
- - `src/__tests__/helpers.ts` with test utilities:
60
- - `createTestClient(options?)` - Create client with defaults
61
- - `createTestSuite(config, options?)` - Auto setup/teardown
62
- - `setupTestServer(config, options?)` - Manual server setup
63
- - `teardownTestServer(client)` - Manual server cleanup
64
- - `waitForClientState(client, isConnected, timeout?)` - Wait for state
65
- - `createMockServerConfig(args?)` - Create server config
66
- - `runWithTimeout(fn, timeout?)` - Run with timeout
67
- - `retryUntil(fn, attempts?, delay?)` - Retry until success
68
- - `callTool(client, toolName, args?)` - Tool call helper
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
- - Replaced all `any` types with proper TypeScript interfaces
76
- - Improved error messages with error codes
77
- - Enhanced timeout handling with customizable delays
78
- - Better TypeScript type safety throughout the codebase
79
- - Improved server process management and cleanup
80
- - Environment variable handling now uses utility functions
81
- - Updated package.json with repository, bugs, and homepage fields for npm registry
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
- - None
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
- ### Security
95
- - None
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