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

shack-wasm-interpreter

v0.1.0

Published

MCP server that compiles and runs WebAssembly modules in an isolated, fuel-bounded sandbox

Downloads

20

Readme

shack-wasm-interpreter (TypeScript)

An MCP server that compiles and executes WebAssembly modules in a sandboxed, timeout-bounded environment. Speaks JSON-RPC 2.0 over stdio (STDOUT carries only protocol messages; all diagnostic logs go to STDERR).

What it does

  • Accepts WebAssembly modules as WAT text (compiled via wabt) or base64-encoded .wasm binary.
  • Each execution runs in a dedicated Worker thread. A wall-clock timeout (5 s) forcibly terminates the worker if it does not respond in time, preventing non-terminating modules from hanging the server.
  • The sandbox has no access to the host filesystem, network, or memory beyond the WebAssembly linear memory of the module itself — no host imports are satisfied.
  • Exposes run_wasm (instantiate and call an exported function) and validate_wasm (parse, validate, and list exports without executing).

MCP tools

| Tool | Arguments | Description | |---|---|---| | run_wasm | wasm_base64 (string, base64 .wasm), wat (string, WAT source), function (string, export name; defaults to first), args (number[], integer values) | Instantiate a WebAssembly module and invoke an exported function. Execution runs in a Worker thread with a 5 s wall-clock timeout. | | validate_wasm | wasm_base64 (string, base64 .wasm), wat (string, WAT source) | Check that a module parses and validates without executing it, and return its exports. |

Configuration

| Parameter | Default | Description | |---|---|---| | Timeout | 5000 ms | Wall-clock timeout before the Worker thread is terminated; hardcoded in the binary. |

There are no CLI flags. Launch the server and pipe JSON-RPC messages to its STDIN.

Note: The TypeScript implementation does not have instruction-level fuel metering (the standard WebAssembly API does not expose this). The fuel_consumed field in the response is always 0; the wall-clock timeout is the only bound against non-terminating modules.

Install and build

npm install
npm run build

Run

node dist/server.js

Tests

npm test

The test suite covers: success paths (add, constant result, round-trip from WAT to base64 wasm, function name in response), error paths (bad base64, invalid WAT, missing export, no exports, wrong arity, garbage bytes), timeout via wall-clock (infinite loop), and validate_wasm success/error cases including multi-export modules.

Usage example

Below is a concrete JSON-RPC interaction. The client sends a tools/call request for run_wasm with a WAT module that adds two integers.

Request (sent to STDIN, one line):

{"jsonrpc":"2.0","method":"tools/call","params":{"name":"run_wasm","arguments":{"wat":"(module (func (export \"add\") (param i32 i32) (result i32) local.get 0 local.get 1 i32.add))","function":"add","args":[17,25]}},"id":1}

Response (read from STDOUT):

{"jsonrpc":"2.0","result":{"content":[{"type":"text","text":"{\"function\":\"add\",\"results\":[42],\"fuel_consumed\":0}"}]},"id":1}

The results array contains the return values of the called function. fuel_consumed is always 0 in the TypeScript implementation.