MCP QuickJS Runner

MCP QuickJS Runner

Provides secure execution of arbitrary JavaScript code within a sandboxed QuickJS WASM environment, allowing language models or other MCP clients to safely run JavaScript code snippets without compromising the host system.

Category
Visit Server

README

MCP QuickJS Runner

A server implementing the Model Context Protocol (MCP) that provides a tool to securely execute arbitrary JavaScript code within a QuickJS engine compiled to WebAssembly (WASM) and run using Node.js's built-in WASI implementation.

Description

This server acts as an MCP tool provider. It exposes a single tool, run_javascript_code, which takes a string of JavaScript code as input. The code is then executed inside a sandboxed QuickJS WASM environment. The server captures the standard output (stdout) and standard error (stderr) streams from the execution and returns them, along with any execution errors, back to the MCP client.

This allows language models or other MCP clients to safely execute potentially untrusted JavaScript code snippets without compromising the host system.

Features

  • Secure Execution: Runs JavaScript in a WASM sandbox using QuickJS and Node.js WASI.
  • Standard I/O Capture: Captures stdout and stderr from the executed JavaScript code.
  • Error Reporting: Reports runtime errors from QuickJS and non-zero exit codes.
  • MCP Integration: Exposes functionality as a standard MCP tool over stdio.
  • Built with TypeScript: Provides type safety during development.

How it Works

  1. WASM Module: Uses a pre-compiled QuickJS engine (qjs-wasi.wasm) targeting the WebAssembly System Interface (WASI).
  2. Node.js WASI: Leverages the node:wasi module in Node.js to instantiate and run the WASM module.
  3. Stdio Redirection (Temporary Files): To capture stdout and stderr from the WASM environment, the server currently relies on the standard approach compatible with node:wasi:
    • A temporary directory is created on the host filesystem using node:fs/promises and node:os.
    • Temporary files for stdout and stderr are opened within this directory.
    • The real OS file descriptors for these files are passed to the WASI instance during initialization (stdout: fd, stderr: fd).
    • The QuickJS WASM module writes its output to these descriptors, which gets routed by WASI to the temporary files.
    • After execution finishes, the server closes the file handles and reads the content of the temporary files.
    • The temporary directory and files are cleaned up.
    • (Note: Attempts to use in-memory pipes or virtual filesystems like memfs were unsuccessful because node:wasi currently requires real OS file descriptors for stdio.)
  4. MCP Communication: The server uses @modelcontextprotocol/sdk to listen for MCP requests via stdio and respond with the execution results formatted according to the protocol.

Prerequisites

  • Node.js (v23.x or later recommended, check node:wasi compatibility for your specific version)
  • npm or yarn
  • The QuickJS WASM file (qjs-wasi.wasm) must be present in the same directory as the compiled server script (e.g., ./dist/qjs-wasi.wasm relative to ./dist/server.js). You may need to obtain or compile this separately.

Installation

  1. Clone the repository (if applicable).
  2. Install dependencies:
    npm install
    

Usage

node server.ts

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured