Conversation
Stand up the wrapper package's offline test tiers, reusing the repo's Vitest setup (auto-discovered by the existing run-tests CI job, no workflow change): - Unit scaffold (tokenManager.test.ts) — network-mocked, it.todo for MCP-539. - Integration harness: an in-process fake remote MCP server (src/testHelpers/fakeRemote.ts, excluded from dist) driven via the MCP SDK client over a spawned wrapper (WRAPPER_CLI_PATH override); one live sanity test plus it.todo scenarios for MCP-539. - Add @modelcontextprotocol/sdk, express, @types/express devDeps + pretest compile so dist/cli.js exists for the harness. - Document wrapper unit/integration testing in CONTRIBUTING.md. Builds and runs green without any wrapper logic (cli.ts is still a stub).
…upport SSE+JSON (MCP-538) - Rename the test double from 'fake' to 'mock' (file, type, function, literals). - Rewrite comments in plain language; add a reason to the eslint-disable. - Mock remote now defaults to SSE (matching cloud-dev per MCP-542) with a responseMode: 'json' option; notifications return 202.
Replace the ASCII diagram with a short verbal description of how the integration tests are wired.
1 task
Contributor
There was a problem hiding this comment.
Pull request overview
Adds unit + integration test scaffolding for the upcoming mongodb-mcp-remote wrapper package, aligning it with the repo’s existing Vitest/CI tooling and providing an in-process mock remote MCP server for deterministic end-to-end testing.
Changes:
- Introduces placeholder unit/integration tests plus an in-process mock remote server (token +
/mcpendpoints, SSE/JSON response modes). - Wires the new package into repo tooling (compile-on-test, Knip entry points, dependency updates).
- Documents how to run the wrapper package tests.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds new dev dependencies for the wrapper package test scaffolding. |
| packages/mongodb-mcp-remote/tsconfig.json | Excludes src/testHelpers/** from build output to keep test helpers out of dist. |
| packages/mongodb-mcp-remote/src/wrapper.integration.test.ts | Adds integration-test harness + initial mock-remote healthcheck test and it.todo placeholders. |
| packages/mongodb-mcp-remote/src/tokenManager.test.ts | Adds unit-test skeleton for a future token manager with timer cleanup conventions. |
| packages/mongodb-mcp-remote/src/testHelpers/mockRemote.ts | Implements an in-process mock remote MCP server + token endpoint for deterministic integration tests. |
| packages/mongodb-mcp-remote/package.json | Adds pretest compile step and test-time dependencies used by the scaffolding. |
| knip.json | Adds wrapper workspace entry points so dependency checks include tests + helpers. |
| CONTRIBUTING.md | Documents how to run wrapper package tests and what unit vs integration tests do. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comment on lines
+27
to
+41
| async function connectClientToWrapper(remote: MockRemote): Promise<Client> { | ||
| const client = new Client({ name: "integration-test", version: "0.0.0" }); | ||
| const transport = new StdioClientTransport({ | ||
| command: process.execPath, // node | ||
| args: [CLI_PATH], | ||
| env: { | ||
| MDB_MCP_API_CLIENT_ID: "mock-id", | ||
| MDB_MCP_API_CLIENT_SECRET: "mock-secret", | ||
| MDB_MCP_API_BASE_URL: remote.url, | ||
| MDB_MCP_REMOTE_URL: `${remote.url}/mcp`, | ||
| }, | ||
| }); | ||
| await client.connect(transport); | ||
| return client; | ||
| } |
Comment on lines
+92
to
+96
| // Return a session id on the first (initialize) call | ||
| res.setHeader("Mcp-Session-Id", "mock-session-1"); | ||
|
|
||
| if (method === "initialize") { | ||
| sendRpc(res, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sets up the test foundation (MCP-538) for the new mongodb-mcp-remote wrapper package, on the repo's existing Vitest setup. The wrapper itself (MCP-536) and the test bodies (MCP-539) come later — this PR adds the structure and a working mock.
Proposed changes
Ticket: MCP-538
Out of scope: wrapper implementation (MCP-536), test bodies (MCP-539), cloud-dev e2e + CI secrets (separate PR).
Checklist