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-client

v0.1.0

Published

MCP transport clients (stdio, SSE, StreamableHTTP) for load testing

Readme

@reaatech/mcp-load-test-client

npm version License: MIT CI

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

Session-scoped MCP transport clients with auto-negotiation across stdio, SSE, and StreamableHTTP. Handles JSON-RPC handshakes, authentication header construction, tool discovery, and tool invocation — purpose-built for concurrent load-test sessions.

Installation

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

Feature Overview

  • Auto-negotiationtransport: "auto" tries StreamableHTTP first, falls back to SSE on connect failure, or spawns a stdio subprocess for non-URL endpoints
  • Three transportsStreamableHTTPTransport, SSETransport, StdioTransport — each conforming to a shared interface
  • MCP handshake — automatic initializenotifications/initialized handshake on connect
  • Auth support — API key (X-Api-Key header), Bearer token, and OAuth client credentials (Basic auth header or env vars for stdio)
  • Session lifecycleconnect(), disconnect(), sendRequest(), callTool(), listTools()
  • Timeout handling — configurable per-transport request timeouts with clean rejection
  • Private-endpoint warnings — logs warnings for RFC 1918 / loopback endpoints (once per endpoint)

Quick Start

import { createSessionClient } from "@reaatech/mcp-load-test-client";

// Auto-detect transport from endpoint
const client = createSessionClient("http://localhost:3000", {
  transport: "auto",
  timeout: 30000,
});

await client.connect();

const tools = await client.listTools();
console.log(`${tools.length} tools discovered`);

const result = await client.callTool("echo", { text: "hello" });
console.log(result);

await client.disconnect();

API Reference

createSessionClient(endpoint, options)

Factory that returns an MCPClient-conforming instance. Handles transport negotiation.

function createSessionClient(
  endpoint: string,
  options: SessionClientOptions,
): MCPClient;

SessionClientOptions

| Property | Type | Default | Description | |----------|------|---------|-------------| | transport | TransportType | (required) | "stdio", "sse", "http", or "auto" | | timeout | number | 30000 | Request timeout in ms | | auth | AuthOptions | — | Optional auth configuration |

MCPClient Interface

interface MCPClient {
  connect(): Promise<void>;
  disconnect(): Promise<void>;
  sendRequest(method: string, params?: unknown): Promise<unknown>;
  callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
  listTools(): Promise<ToolDefinition[]>;
}

Transport Classes

StreamableHTTPTransport

Full-duplex HTTP transport with session tracking via mcp-session-id header.

class StreamableHTTPTransport {
  constructor(options: StreamableHTTPTransportOptions);
  connect(): Promise<void>;     // OPTIONS preflight check
  sendRequest(method, params?): Promise<unknown>;
  disconnect(): Promise<void>;  // DELETE to release session
  sendNotification(method, params?): Promise<void>;
  getSessionId(): string | null;
}

SSETransport

Long-lived SSE connection for server-pushed responses, fetch POST for requests.

class SSETransport {
  constructor(options: SSETransportOptions);
  connect(): Promise<void>;     // Open SSE stream, listen for endpoint event
  sendRequest(method, params?): Promise<unknown>;
  disconnect(): Promise<void>;  // Close EventSource, fail pending requests
  sendNotification(method, params?): Promise<void>;
}

StdioTransport

Spawns a child process and communicates via JSON-RPC over stdin/stdout.

class StdioTransport {
  constructor(options: StdioTransportOptions);
  connect(): Promise<void>;     // Spawn process, wait for spawn event
  sendRequest(method, params?): Promise<unknown>;
  disconnect(): Promise<void>;  // Kill process, fail pending requests
  sendNotification(method, params?): Promise<void>;
}

TransportError

class TransportError extends Error {
  constructor(message: string, code?: number, data?: unknown);
  readonly code?: number;
  readonly data?: unknown;
}

Usage Patterns

Auth with API Key

const client = createSessionClient("https://api.example.com/mcp", {
  transport: "http",
  timeout: 30000,
  auth: { mode: "api-key", apiKey: "sk-secret" },
});
// Sends X-Api-Key: sk-secret on every request

Auth with Bearer Token

const client = createSessionClient("https://api.example.com/mcp", {
  transport: "http",
  timeout: 30000,
  auth: { mode: "bearer", bearerToken: "tok-abc123" },
});
// Sends Authorization: Bearer tok-abc123

Stdio Transport with Env Vars

const client = createSessionClient("npx my-mcp-server", {
  transport: "stdio",
  timeout: 30000,
  auth: { mode: "api-key", apiKey: "sk-secret" },
});
// Sets MCP_API_KEY=sk-secret in child process environment

Auto-Fallback from HTTP to SSE

When transport: "auto" is set and the endpoint is a URL, createSessionClient tries StreamableHTTP first. If that fails, it falls back to SSE automatically — useful for servers that advertise SSE capability without HTTP.

Related Packages

License

MIT