@reaatech/mcp-load-test-core
Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.
Canonical TypeScript types, Zod schemas, utility functions, and structured logging for the @reaatech/mcp-load-test-* ecosystem. This package is the single source of truth for all MCP load test domain shapes.
Installation
npm install @reaatech/mcp-load-test-core
# or
pnpm add @reaatech/mcp-load-test-core
Feature Overview
30+ exported types — every domain entity has a TypeScript interface or type alias
Zod schemas — runtime validation for all configuration shapes (profiles, patterns, auth, engine options)
Utility library — percentile calculation, stats aggregation, retry with backoff, URL validation, timing helpers
Structured logging — pre-configured Pino logger with opt-in pretty printing via MCP_LT_PRETTY_LOGS
Zero cross-package dependencies — lightweight foundation for the entire ecosystem
Quick Start
import {
type LoadProfile,
type ToolCallPattern,
type LoadEngineOptions,
loadEngineOptionsSchema,
} from "@reaatech/mcp-load-test-core" ;
// Define a ramp profile
const profile : LoadProfile = {
type: "ramp" ,
minConcurrency: 1 ,
maxConcurrency: 100 ,
rampDurationMs: 300000 ,
holdDurationMs: 120000 ,
};
// Validate runtime configuration with Zod
const options = loadEngineOptionsSchema. parse ({
endpoint: "https://api.example.com/mcp" ,
transport: "http" ,
profile,
patterns: [{ name: "explore-then-act" , weight: 1 , thinkTimeMs: 100 , onStepError: "continue" , steps: [{ tool: "tools/list" , args: {} }] }],
});
Exports
Domain Types (types/domain.ts)
Export Description GradeLetter grade: A" | "B" | "C" | "D" | "F TransportTypeTransport protocol: stdio" | "sse" | "http" | "auto AuthModeAuthentication mode: none" | "api-key" | "bearer" | "oauth ToolDefinitionMCP tool descriptor with name, description, inputSchema LatencyMetricsPercentile summary: p50, p90, p95, p99, min, max, mean, samples ToolLatencyMetricsPer-tool latency with toolName and latency: LatencyMetrics ErrorSummaryError aggregation: totalErrors, errorRate, breakdowns by category and tool ThroughputMetricsThroughput snapshot: averageRps, peakRps, success/failure tallies BreakingPointResultDetection result: detected, concurrencyAtBreak, recoveryTimeMs BaselineComparisonComparison deltas: grade change, latency/error/throughput deltas LoadTestReportFull test output: grade, breaking point, latencies, errors, throughput, recommendations
Profile Types
Export Description RampProfileLinear ramp from min → max concurrency SoakProfileSustained constant-concurrency load SpikeProfileAlternating baseline/spike cycles CustomProfileArbitrary concurrency curve via concurrencyCurve LoadProfileDiscriminated union of all four profile types
Pattern Types
Export Description PatternStepA single tool call: { tool: string; args: Record<string, unknown> } ToolCallPatternMulti-step sequence with weight, think time, and error policy
Configuration Types
Export Description AuthOptionsAuth configuration for API key, bearer token, or OAuth LoadEngineOptionsComplete test configuration (endpoint, transport, profile, patterns) SessionStatePer-session mutable state (id, client, context, counters, status) MCPClientInterface contract for transport-layer abstraction
Zod Schemas (types/schemas.ts)
Every domain type has a corresponding Zod schema for runtime validation:
Schema Validates loadProfileSchemaUnion of rampProfileSchema, soakProfileSchema, spikeProfileSchema, customProfileSchema toolCallPatternSchemaPattern definition with step count ≥ 1 authOptionsSchemaAuth mode and credentials loadEngineOptionsSchemaFull test configuration
Utilities (utils/index.ts)
Export Description generateUUID()RFC 9562 UUID v4 generateId()8-character random identifier now()ISO 8601 UTC timestamp measureTimeAsync(fn)Wraps an async function and returns { result, durationMs } sleep(ms)Promise-based delay retryWithBackoff(fn, maxRetries?, baseDelay?, multiplier?)Exponential backoff retry loop percentile(sortedValues, p)Interpolated percentile calculation calculateStats(values)Full stats object (p50/p90/p95/p99/min/max/mean/samples) isValidURL(value)URL string validation isPrivateURL(url)RFC 1918 / loopback / link-local detection
Logging (observability/logger.ts)
Export Description loggerPre-configured Pino logger instance. Level controlled by LOG_LEVEL env (default info). Pretty output enabled when MCP_LT_PRETTY_LOGS=1.
Version (version.ts)
Export Description getProgramVersion()Returns the package version from package.json (cached)
Related Packages
@reaatech/mcp-load-test-metrics — Latency histograms and throughput collection
@reaatech/mcp-load-test-patterns — Tool call patterns and executor
@reaatech/mcp-load-test-profiles — Concurrency profile generators
@reaatech/mcp-load-test-analysis — Breaking point detection and grading
@reaatech/mcp-load-test-client — MCP transport clients
License
MIT