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

@gonzalomonzonc/mcp-transport

v0.1.0

Published

LUMEN binary transport for Model Context Protocol (MCP) — drop-in replacement for JSON-RPC transports

Readme

@lumen/mcp-transport

LUMEN binary transport for the Model Context Protocol (MCP) SDK.

Architecture

┌─────────────────────────────────────────────────┐
│  MCP Client / Server (your code)                 │
│  ┌───────────────────────────────────────────┐   │
│  │  @modelcontextprotocol/sdk                 │   │
│  │  ┌─────────────────────────────────────┐  │   │
│  │  │  Transport interface                 │  │   │
│  │  │  ┌───────────────────────────────┐  │  │   │
│  │  │  │  @lumen/mcp-transport  ← YOU  │  │  │   │
│  │  │  │  LumenStdioTransport           │  │  │   │
│  │  │  │  LumenWebSocketTransport       │  │  │   │
│  │  │  └───────────────────────────────┘  │  │   │
│  │  └─────────────────────────────────────┘  │   │
│  └───────────────────────────────────────────┘   │
└─────────────────────────────────────────────────┘

Protocol Negotiation (Handshake)

When a LUMEN transport starts, it sends a capability probe before the MCP initialize handshake:

Client → Server:  [LUMEN_PROBE frame]  (binary)
  - TYPE: 0x0F (PROBE)
  - FLAGS: 0x00
  - PAYLOAD: {"v":1,"caps":["compression","streaming"]}

Server → Client:  [LUMEN_ACK frame]  (binary)
  - TYPE: 0x10 (PROBE_ACK)
  - FLAGS: 0x00
  - PAYLOAD: {"v":1,"caps":["compression","streaming"]}


  ... OR ...

Server does not respond with LUMEN_ACK within 500ms →
Client falls back to JSON-RPC transparently.

Usage

import { LumenStdioTransport } from "@lumen/mcp-transport";
import { Client } from "@modelcontextprotocol/sdk/client/index.js";

// Drop-in replacement — same API as StdioClientTransport
const transport = new LumenStdioTransport({
  command: "python",
  args: ["mcp_server.py"],
  // Optional: force JSON-RPC (skip LUMEN negotiation)
  // forceJsonRpc: true,
});

const client = new Client(
  { name: "my-client", version: "1.0.0" },
  { capabilities: {} }
);

await client.connect(transport);
// If the server speaks LUMEN → binary frames (~3× faster)
// If not → falls back to JSON-RPC automatically

API

LumenStdioTransport

Drop-in replacement for StdioClientTransport from @modelcontextprotocol/sdk.

class LumenStdioTransport implements Transport {
  constructor(options: {
    command: string;
    args?: string[];
    env?: Record<string, string>;
    cwd?: string;
    /** Skip LUMEN negotiation, use JSON-RPC directly */
    forceJsonRpc?: boolean;
    /** Probe timeout in ms (default: 500) */
    probeTimeoutMs?: number;
  });

  // Transport interface (compatible with MCP SDK)
  start(): Promise<void>;
  send(message: JSONRPCMessage): Promise<void>;
  close(): Promise<void>;
  onmessage: ((message: JSONRPCMessage) => void) | null;
  onerror: ((error: Error) => void) | null;
  onclose: (() => void) | null;
}

LumenWebSocketTransport

WebSocket transport with LUMEN binary frames. Ideal for cloud gateways (Cadencia → API Gateway → MCP servers).

class LumenWebSocketTransport implements Transport {
  constructor(url: string, options?: {
    forceJsonRpc?: boolean;
    probeTimeoutMs?: number;
  });
  // ... same Transport interface
}

Package structure

implementations/typescript/
├── README.md              ← this file
├── package.json
├── tsconfig.json
├── bench_results_full.json← cached benchmark results (122 entries)
└── src/
    ├── index.ts           ← public exports
    ├── transport.ts       ← LumenStdioTransport, LumenWebSocketTransport
    ├── negotiation.ts     ← LUMEN probe/ack handshake + fallback
    ├── hyb128.ts          ← Hyb128 encode/decode
    ├── frame.ts           ← Frame builder/parser
    ├── frame-assembler.ts ← Zero-allocation streaming frame reassembler
    ├── dict.ts            ← Dictionary (128 static + 127 session IDs, O(1) lookup)
    ├── compress.ts        ← Compact binary payload codec
    ├── compress_ffi.ts    ← FFI wrapper (Rust → Node via koffi, 4.4× faster)
    ├── shm_ffi.ts         ← SHM zero-copy transport (Level 2, FFI)
    ├── dgram.ts           ← Datagram UDP/multicast (Level 3)
    ├── zeroalloc.ts       ← ZeroAllocDecompressor (54% less GC)
    ├── cadencia.ts        ← Cadencia sidecar bridge client
    ├── bench.ts           ← Benchmark suite (122 benchmarks, 18 categories)
    ├── frame-assembler.test.ts  ← 17 stress tests
    ├── zeroalloc.test.ts        ← 79 correctness + safety tests
    ├── dgram.test.ts            ← 13 datagram tests (Level 3)
    ├── shm_ffi.test.ts          ← 10 SHM integration tests (Level 2)
    ├── e2e.test.ts              ← 217 cross-implementation E2E tests
    └── cadencia.integration.test.ts ← 3 integration tests (needs Rust binary)

Status

| Component | Status | |-----------|--------| | hyb128.ts | 🟢 Done — encode/decode, mode 00/10/11, LEB128 fallback | | frame.ts | 🟢 Done — build/parse, all 12 frame types + flags | | frame-assembler.ts | 🟢 Done — zero-alloc streaming parser, 1.2 GB/s saturation | | dict.ts | 🟢 Done — 128 static + 127 session IDs, O(1) resolve + lookup | | compress.ts | 🟢 Done — 8 value tags, dict compression, 47-55% wire savings | | compress_ffi.ts | 🟢 Done — Rust FFI via koffi, 4.4× faster encode | | shm_ffi.ts | 🟢 Done — Level 2 SHM zero-copy, 10/10 tests | | dgram.ts | 🟢 Done — Level 3 Datagram UDP/multicast, 13/13 tests | | zeroalloc.ts | 🟢 Done — 54% less GC vs naive decoder (3.7× vs JSON) | | negotiation.ts | 🟢 Done — probe/ack handshake, 500ms fallback to JSON-RPC | | transport.ts | 🟢 Done — Stdio + WebSocket, auto LUMEN negotiation | | cadencia.ts (sidecar) | 🟢 Prototyped — Rust cadencia-bridge + TS client |

Benchmarks

122 benchmarks in 18 categories covering encode/decode speed, wire size, GC pressure, framing parse, string escape, and dict lookup. Run with:

node --expose-gc --import tsx src/bench.ts

Key results from the root README:

  • Wire size: 47–55% smaller than JSON for MCP payloads
  • String escape: 1.1–2.2× faster than JSON.stringify on hostile strings
  • GC pressure: ZeroAllocDecompressor = 1,401 KB heap Δ vs 3,033 KB naive (54% reduction)
  • Framing: Hyb128 parse 3.6–8× faster than Content-Length

Test Suite

Core TS-only tests (96/96):

node --import tsx --test src/zeroalloc.test.ts src/frame-assembler.test.ts

Full suite (requires compiled Rust cadencia-bridge binary + lumen.dll):

node --import tsx --test src/*.test.ts   # +3 CadenciaBridge, +10 SHM FFI
node --test dist/dgram.test.js           # 13 datagram (Level 3)
node --test dist/e2e.test.js             # 217 cross-implementation E2E