@drak-marketing/mcp-test-harness
v0.2.0
Published
Shared test harness for MCP server repos. Parameterized test suites for build integrity, smoke tests, protocol conformance, security, and more.
Maintainers
Readme
@drak-marketing/mcp-test-harness
Shared test harness for MCP server repos. One call registers 40+ parameterized tests covering build integrity, smoke, protocol conformance, credential security, resilience, and adversarial inputs.
Install
npm install --save-dev @drak-marketing/mcp-test-harness vitestvitest is a peer dependency — your repo supplies its own version.
Usage
Add a single test file (e.g. src/harness.test.ts) to your MCP server repo:
import { registerMcpTests } from "@drak-marketing/mcp-test-harness";
import { fileURLToPath } from "url";
import path from "path";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
registerMcpTests({
name: "mcp-example",
repoRoot: path.resolve(__dirname, ".."),
toolPrefix: "example_",
minTools: 10,
requiredTools: ["example_get_context", "example_list_items"],
binEntries: { "mcp-example": "dist/index.js" },
hasAuthCli: false,
hasCredentials: true,
hasResilience: true,
hasPlatform: true,
requiredEnvVars: ["EXAMPLE_API_KEY"],
envPrefix: "EXAMPLE_",
startupEnv: { EXAMPLE_API_KEY: "fake-key" },
});Run with your normal vitest command:
npm testWhat you get
Suites are selected based on the capabilities you declare in the config:
- Always on: build integrity, smoke, cross-platform, MCP protocol, dependency health, version/publish checks, observability, input sanitization, output contract, concurrency, adversarial (Ralph/Ender/Mayhem)
hasCredentials: true→ credential security, token lifecycle, backward-compathasResilience: true→ network failure scenariosrequiredEnvVars.length > 0→ config loadingstartupEnvprovided → graceful shutdown
See src/types.ts for the full config shape.
License
MIT
