npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@reaatech/mcp-load-test-engine

v0.1.0

Published

Orchestration engine and session manager for MCP load testing

Readme

@reaatech/mcp-load-test-engine

npm version License: MIT CI

Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.

Orchestration engine and session manager for MCP load testing. Ties together profiles, patterns, metrics, breaking point detection, and grading into a single LoadEngine.run() call — producing a complete LoadTestReport.

Installation

npm install @reaatech/mcp-load-test-engine
# or
pnpm add @reaatech/mcp-load-test-engine

Feature Overview

  • Single run() entry point — one async call executes the full test lifecycle
  • Session pool managementPromise.allSettled scaling with individual-failure tolerance
  • Closed-loop concurrency — long-lived sessions continuously execute weighted-random patterns
  • Breaking point monitoring — integrated detection with recovery tracking during test execution
  • Auto-grading — letter grades and recommendations embedded in the final report
  • SIGINT/SIGTERM-safe — abort controllers for clean shutdown and partial report generation

Quick Start

import { LoadEngine } from "@reaatech/mcp-load-test-engine";

const engine = new LoadEngine({
  endpoint: "https://api.example.com/mcp",
  transport: "http",
  profile: {
    type: "ramp",
    minConcurrency: 1,
    maxConcurrency: 50,
    rampDurationMs: 30000,
    holdDurationMs: 10000,
  },
  patterns: [
    {
      name: "explore-then-act",
      weight: 1,
      thinkTimeMs: 100,
      onStepError: "continue",
      steps: [
        { tool: "tools/list", args: {} },
        { tool: "tools/call", args: { name: "echo", arguments: {} } },
      ],
    },
  ],
  breakingPointDetection: true,
  outputFormat: "console",
});

const report = await engine.run();

console.log(`Grade: ${report.grade}`);
console.log(`P99 Latency: ${report.toolLatencies[0]?.latency.p99}ms`);
console.log(`Peak RPS: ${report.throughput.peakRps}`);

API Reference

LoadEngine

The main orchestrator class.

class LoadEngine {
  constructor(options: LoadEngineOptions);
  run(): Promise<LoadTestReport>;
}

Execution Flow

  1. Records start time and generates a test UUID
  2. Starts MetricsCollector and SessionManager
  3. Executes the profile generator, adjusting session pool size each second
  4. Checks breaking point on each tick (if enabled)
  5. Stops session manager and metrics collector
  6. Builds and returns LoadTestReport with grade and recommendations

LoadEngineOptions

| Property | Type | Description | |----------|------|-------------| | endpoint | string | MCP server URL or stdio command | | transport | TransportType | "stdio" \| "sse" \| "http" \| "auto" | | auth | AuthOptions | Optional authentication | | profile | LoadProfile | Ramp, soak, spike, or custom profile | | patterns | ToolCallPattern[] | At least one pattern | | breakingPointDetection | boolean | Enable breaking point monitoring | | outputFormat | OutputFormat | "console" \| "markdown" \| "json" |

SessionManager

Manages a dynamic pool of MCP sessions with weighted-random pattern execution.

class SessionManager {
  constructor(options: SessionManagerOptions);

  start(): Promise<void>;                  // Enable session loop
  stop(): Promise<void>;                   // Destroy all sessions
  createPool(targetConcurrency: number): Promise<void>;  // Scale sessions up/down
  getActiveSessions(): SessionState[];     // Current session list
  getSessionCount(): number;               // Current pool size
  setSessionStatus(status: SessionState["status"]): void;  // Update all session states
}

Session Lifecycle

  1. CreatecreatePool(n) spawns n sessions via Promise.allSettled (individual failures don't abort pool expansion)
  2. Connect — each session runs client.connect()initialize handshake
  3. Loop — each session enters an infinite loop of weighted-random pattern selection → execution, yielding on AbortSignal
  4. Destroystop() or pool reduction calls client.disconnect() and aborts the loop

SessionState

interface SessionState {
  id: string;
  client: MCPClient;
  context: Record<string, unknown>;  // Multi-turn state (lastResult, etc.)
  currentPatternIndex: number;
  currentStepIndex: number;
  createdAt: number;
  lastActiveAt: number;
  requestCount: number;
  errorCount: number;
  status: "warming_up" | "active" | "cooling_down" | "error" | "completed";
}

Usage Patterns

Programmatic Report Processing

const engine = new LoadEngine(options);
const report = await engine.run();

if (report.breakingPoint?.detected) {
  console.warn(`Server broke at ${report.breakingPoint.concurrencyAtBreak} sessions`);
  console.warn(`Recovery took ${report.breakingPoint.recoveryTimeMs}ms`);
}

if (report.grade === "D" || report.grade === "F") {
  process.exit(1);
}

Abort-Aware Testing

const engine = new LoadEngine(options);

process.on("SIGINT", () => {
  // The engine handles abort internally;
  // partial reports are still generated
});

const report = await engine.run();
// Report is always returned, even on interrupt

Related Packages

License

MIT