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

@shukoi/mcp

v1.0.4

Published

Model Context Protocol (MCP) Streamable HTTP and backpressure-safe sterile STDIO transports for Shukoi.

Readme

@shukoi/mcp

Protocol Module B: Model Context Protocol (MCP) Streamable HTTP & Sterile STDIO Transports

npm version License: MIT

@shukoi/mcp connects LLM coding agents (such as Claude Desktop, Cursor, OpenCode, and Antigravity IDE) directly to Shukoi actions over the official Model Context Protocol (MCP 2024-11-05 & Streamable HTTP specification). It provides native, specification-pure support for Tools, Resources, and Prompts with dual subpath exports:

  1. @shukoi/mcp/http: Stateless, DNS-rebinding protected Streamable HTTP server for cloud and serverless platforms.
  2. @shukoi/mcp/stdio: Backpressure-safe, anti-zombie STDIO server for local developer workflows.

Core MCP Primitives Supported

Shukoi actions declared with mcp: { enabled: true, entityType: 'tool' | 'resource' | 'prompt' } are compiled once at startup into an immutable catalog:

| MCP Primitive | Protocol Methods | Capabilities & Architecture | | :------------ | :------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Tools | tools/list, tools/call | TypeBox input schemas exported as standard JSON Schema; executes actions with composite cancellation; supports multimodal content blocks (text, image with Base64, raw strings) and enforces maxMcpOutputBytes. | | Resources | resources/list, resources/templates/list, resources/read | Exposes read-only assets via static URIs (resource://${name}) or dynamic RFC 6570 URI templates (e.g. cluster://{clusterId}/nodes/{nodeId}). Template parameters are automatically parsed and passed to the action input. | | Prompts | prompts/list, prompts/get | Pre-engineered prompt workflows. Argument schemas (name, description, required) are introspected automatically from action.input, returning standardized MCP messages: [{ role, content }]. |


Dual Subpath Architecture

1. @shukoi/mcp/http (Streamable HTTP)

  • Pure Web Standard (Zero node:* Imports): 100% compatible with Cloudflare Workers V8 isolates, AWS Lambda, and Bun.
  • DNS-Rebinding Defense: Validates incoming Host against config.security.allowedHosts and Origin against allowedOrigins, rejecting mismatches with HTTP 403 Forbidden.
  • Scoped Server Factory (createScopedMcpServer): Eliminates the fatal singleton _transport overwrite race condition by instantiating lightweight, isolated server instances per incoming HTTP request (ADR-002).
  • Stateless Session Teardown (DELETE /mcp): Responds to HTTP DELETE requests with HTTP 204 No Content for clean client session disconnection.
  • Header Negotiation: Seamlessly negotiates Accept: application/json, text/event-stream sent by official MCP clients.
  • Hono Co-Hosting (mountMcpHttpRoutes): Mounts the MCP HTTP handler onto a Hono application instance (e.g. app.all('/mcp', ...)), enabling co-hosting REST and MCP on the same port.
  • Output Byte Ceiling (maxMcpOutputBytes): Prevents client OOM crashes by rejecting oversized tool, resource, or prompt payloads with HTTP 413.

2. @shukoi/mcp/stdio (Local Standard I/O)

  • Strict stdout Sterility: Automatically redirects console.log, info, warn, and debug to process.stderr, preserving File Descriptor 1 (process.stdout) exclusively for clean JSON-RPC 2.0 frames (ADR-005).
  • Pure Stdin Readline: Configures readline.createInterface without specifying an output stream, guaranteeing readline internal mechanisms never write control characters to stdout.
  • FIFO Outbound Serialization Queue (enqueueFrameWrite): Queues all stdout writes through an asynchronous serialization chain with kernel backpressure drain safety, eliminating frame interleaving between concurrent progress notifications and tool completions.
  • Anti-Zombie Process Watchdog: Monitors process.stdin (end, close), process.stdout (EPIPE), and POSIX signals (SIGINT, SIGTERM), ensuring the child process terminates cleanly (code 0) within 200 ms if the host IDE crashes.
  • Remote Bridge Mode (bridgeStdioToHttp): Relays local STDIO JSON-RPC streams to a remote @shukoi/mcp/http cloud endpoint over the network.

Zero External Runtime Dependency Overhead

@shukoi/mcp implements the complete Model Context Protocol natively over JSON-RPC 2.0. The official @modelcontextprotocol/sdk is declared strictly as an optional peer dependency (peerDependenciesMeta: { "@modelcontextprotocol/sdk": { "optional": true } }). Shukoi requires zero external MCP packages at runtime.


Installation

pnpm add @shukoi/mcp @shukoi/core
# or
npm install @shukoi/mcp @shukoi/core
# or
bun add @shukoi/mcp @shukoi/core

Usage Examples

Running over HTTP (Cloudflare, Bun, Node)

import { compileMcpCatalog, createMcpHttpHandler } from '@shukoi/mcp/http';
import { createDefaultConfig } from '@shukoi/core';
import { myAction } from './actions/myAction.js';

const config = createDefaultConfig({
  security: { allowedHosts: ['localhost'] },
});

const catalog = compileMcpCatalog([myAction]);
export const mcpHandler = createMcpHttpHandler(catalog, config);

// In standard Web Fetch: export default { fetch: (req) => mcpHandler(req) };

Co-Hosting REST API & MCP HTTP on the Same Hono Server

import { createRestRouter } from '@shukoi/api';
import { compileMcpCatalog, mountMcpHttpRoutes } from '@shukoi/mcp/http';
import { createDefaultConfig } from '@shukoi/core';
import { actions } from './actions/index.js';

const config = createDefaultConfig();
const app = createRestRouter(actions, config);
const catalog = compileMcpCatalog(actions);

// Mount MCP HTTP on /mcp
mountMcpHttpRoutes(app, '/mcp', catalog, config);

export default app;

Running over Local STDIO (Claude Desktop / Cursor)

import { compileMcpCatalog } from '@shukoi/mcp';
import { startStdioServer } from '@shukoi/mcp/stdio';
import { createDefaultConfig } from '@shukoi/core';
import { myAction } from './actions/myAction.js';

const config = createDefaultConfig();
const catalog = compileMcpCatalog([myAction]);

// Automatically hijacks console to stderr, handles drain backpressure, and listens to stdin
export const server = startStdioServer(catalog, config);

Connecting Claude Desktop or Cursor (claude_desktop_config.json)

{
  "mcpServers": {
    "my-shukoi-service": {
      "command": "node",
      "args": ["dist/entries/mcp-stdio.js"]
    }
  }
}

Related Documentation & Architecture


License

MIT © Shukoi Contributors