Skip to content

Add e2e test suite with MCP protocol compliance tests - #29

Merged
jstirnaman merged 8 commits into
mainfrom
e2e-test-suite
Mar 24, 2026
Merged

Add e2e test suite with MCP protocol compliance tests#29
jstirnaman merged 8 commits into
mainfrom
e2e-test-suite

Conversation

@jstirnaman

@jstirnaman jstirnaman commented Mar 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a two-layer test suite using vitest that exercises the real MCP server
    by spawning it as a child process via the MCP SDK client
  • Protocol compliance tests (10 tests, no InfluxDB needed) verify server
    startup, tool/resource/prompt registration, ping, and error handling
  • Integration tests (3 tests, gated behind INFLUX_TEST_ENABLED) verify
    health_check, list_databases, and execute_query against a live instance
  • Add CLAUDE.md with architecture overview and codebase conventions
  • Add Claude Code skills for build/run and testing workflows

Test plan

  • npm run build && npm test passes (10 protocol tests pass, 3 integration tests skip)
  • Run integration tests against a live InfluxDB 3 Core instance
  • Follow-up: add docker-compose.test.yml for local Core testing and CI workflow

Add a two-layer MCP protocol test suite using vitest:
- Protocol compliance tests (10 tests, no InfluxDB needed) verify
  server startup, tool/resource/prompt registration, and error handling
  by spawning the real server as a child process via the MCP SDK client
- Integration tests (3 tests, gated behind INFLUX_TEST_ENABLED) verify
  health_check, list_databases, and execute_query against a live instance

Add CLAUDE.md with architecture overview, key patterns (product-type
branching, dual-plane routing, tool schema duality), and conventions.

Add Claude Code skills for developer workflows:
- build-run-core-enterprise: build, configure, and run against Core/Enterprise
- testing: run tests, analyze failures, extend the test suite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a Vitest-based end-to-end test suite that validates MCP protocol compliance by spawning the built MCP server as a child process, plus optional live InfluxDB integration tests gated by an environment variable. It also adds repository-facing documentation for architecture and testing workflows (including Claude Code guidance).

Changes:

  • Add Vitest configuration and a test harness that spawns build/index.js via the MCP SDK stdio client transport.
  • Add protocol compliance tests (no InfluxDB required) and gated live integration tests.
  • Add/extend documentation and “skills” references describing architecture and testing workflows.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
vitest.config.ts Adds Vitest config (include pattern, setup file, timeouts).
tests/setup.ts Adds a pre-test guard requiring build/index.js to exist.
tests/protocol.test.ts Adds MCP protocol compliance coverage (handshake, list tools/resources/prompts, ping, unknown tool error).
tests/integration.test.ts Adds env-gated tests for health_check, list_databases, and execute_query against a live InfluxDB.
tests/helpers/mcp-client.ts Adds a helper that spawns the built server via StdioClientTransport and connects an MCP SDK Client.
package.json Replaces previous “build smoke test” with Vitest scripts; bumps MCP SDK; adds Vitest dependency.
package-lock.json Updates lockfile for MCP SDK bump + Vitest/Vite dependency graph.
CLAUDE.md Adds architecture overview and codebase conventions guidance.
.claude/skills/testing/references/test-architecture.md Adds detailed reference docs for test approach/design decisions.
.claude/skills/testing/SKILL.md Adds run/debug instructions for protocol + integration tests.
.claude/skills/build-run-core-enterprise/references/mcp-client-configs.md Adds MCP client config examples for local/npx/docker.
.claude/skills/build-run-core-enterprise/SKILL.md Adds build/run/testing workflow documentation for Core/Enterprise.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/integration.test.ts Outdated
Comment thread .claude/skills/testing/SKILL.md
Comment thread package.json
Comment thread package.json
Comment thread tests/setup.ts
Comment thread tests/helpers/mcp-client.ts
Comment thread tests/helpers/mcp-client.ts
jstirnaman and others added 5 commits March 24, 2026 13:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Add docker-compose.test.yml with Core using Docker secrets for admin
  token bootstrapping (--object-store memory, ephemeral containers)
- Add CI workflow with protocol tests (always) and integration tests
  against Core via docker run with bind-mounted admin token file
- Add env.test.example with exported vars for local integration testing
- Add tests/fixtures/admin-token.json (static apiv3_ test token)
- Add test:infra:up/down scripts for local Docker lifecycle
- Raise minimum Node version to >=20.11.0 (vitest 4.x + import.meta.dirname)
- Fix env.test.example: use export for shell sourcing compatibility
- Revert process.env spread in test helper (SDK handles inheritance)
- Update testing skill with Docker workflow and CI architecture docs
- Add future Enterprise testing placeholder in CI workflow
The server-level catch block in CallToolRequest handler was returning
error content without isError: true, inconsistent with handler-level
catch blocks in individual tools. This caused MCP clients to treat
unhandled tool errors as successful responses.
@jstirnaman
jstirnaman requested a review from garylfowler March 24, 2026 19:11

@garylfowler garylfowler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Synchronize version across package.json (was 1.0.0), config.ts (was 1.2.0),
and CHANGELOG.md to 1.3.0.

Add a check-versions CI job that extracts the version from all three
sources and fails if they disagree, preventing future drift.
@jstirnaman
jstirnaman merged commit 27f3bc5 into main Mar 24, 2026
3 checks passed
@jstirnaman
jstirnaman deleted the e2e-test-suite branch March 24, 2026 20:23
@jstirnaman jstirnaman mentioned this pull request Mar 26, 2026
jstirnaman added a commit that referenced this pull request May 18, 2026
## Release v1.3.0

This is the first official release under the @influxdata scope and contains breaking changes, including the package name change to `@influxdata/influxdb3-mcp-server`. However, the MCP tools, resources, and prompts are unchanged.

### Added

- **E2E test suite**: Protocol compliance tests (vitest) — 10 tests verifying server startup, MCP handshake, tool/resource/prompt registration, and error handling. No InfluxDB required.
- **Integration tests**: Live InfluxDB tests for `health_check`, `list_databases`, and `execute_query`, gated behind `INFLUX_TEST_ENABLED`
- **Error-path unit tests**: 7 tests with recorded error fixtures from live Core and Cloud Serverless covering JSON, plain-text, and `{code, message}` error formats
- **CI workflow**: GitHub Actions with protocol tests on every PR, integration tests against Core via Docker, and Cloud Serverless tests via GitHub environment secrets
- **Docker test infrastructure**: `docker-compose.test.yml` for local Core testing with preconfigured admin token
- **Version consistency CI check**: Fails if `package.json`, `config.ts`, and `CHANGELOG.md` versions disagree
- **CLAUDE.md**: Architecture overview and codebase conventions for Claude Code
- **Claude Code skills**: Build/run workflow for Core/Enterprise and testing workflow

### Fixed

- Server-level error catch now sets `isError: true`, consistent with handler-level error responses
- Plain-text error responses from InfluxDB Core (HTTP 500) surfaced in all 4 services
- Query error handler now checks `data.message` for Cloud Serverless `{code, message}` JSON errors
- Query error handler extraction order aligned with other services (`data.message` before `data.error`)

### Changed

- npm package renamed from `influxdb-mcp-server` to `@influxdata/influxdb3-mcp-server`
- Minimum Node.js version raised to v20.11 (Node 18 is EOL)
- `@modelcontextprotocol/sdk` updated from `^1.12.1` to `1.27.1`
- All dependencies updated and pinned to exact versions (no caret ranges)
- Version aligned to 1.3.0 across `package.json`, `config.ts`, and `CHANGELOG.md`

## Verified against live instances

| Target | Tests | Result |
|---|---|---|
| Protocol (no InfluxDB) | 10 protocol + 7 error-path unit | All pass |
| InfluxDB 3 Core (Docker) | 3 happy-path + 2 error-path | All pass |
| InfluxDB Cloud Serverless | 3 happy-path | All pass |

## PRs included

- #29 — E2E test suite, CLAUDE.md, Claude Code skills (merged)
- #31 — fix: add data.message check to query error handler, add error-path tests (merged)
- #24 — fix(query): surface plain-text error responses from InfluxDB Core
- #20 — Bump axios from 1.12.2 to 1.13.5
- #10 — Bump js-yaml from 4.1.0 to 4.1.1
- #26 — Bump flatted from 3.3.3 to 3.4.2
- Dependency updates within semver ranges, then pinned to exact versions
- Version alignment to 1.3.0
- npm package rename to `@influxdata/influxdb3-mcp-server`
- CI workflow with version check, Core integration, and Cloud Serverless integration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants