Purpose: mcp-js (also known as mcp-v8) is a Model Context Protocol server written in Rust that lets AI agents (such as Claude and Cursor) run JavaScript and TypeScript in a sandboxed V8 isolate. It provides only one tool, run_js; agents complete loops, branching, data transformation, and calls to other tools by writing code, which usually consumes fewer tokens than an equivalent chain of tool calls.
Main capabilities: In the default stateful mode, the V8 heap is saved as content-addressed snapshots, allowing state to accumulate across multiple turns; it supports async/await, Promise, and setTimeout/clearTimeout; it captures console output and supports paginated reading; the asynchronous execution model returns an execution ID, allowing status polling, streaming output, and cancellation; it supports WebAssembly and preloaded modules; optional ES module imports from npm:, jsr:, and URLs; and it can compose other MCP servers via mcp.callTool()/mcp.listTools(). Network, filesystem, subprocess, WASM, and module imports are disabled by default and require explicit authorization through OPA/Rego policies; the optional --sandbox-manifest uses a nono capability manifest for kernel-level isolation. It supports stdio, Streamable HTTP, and SSE transports, a REST sidecar, JWKS authentication, and Raft clustering.
Usage: Install to /usr/local/bin; supports Linux x86_64/arm64 and macOS Apple Silicon, and can also be run via nix run github:r33drichards/mcp-js, Docker, or built from source. After adding it to the mcpServers configuration in Claude Desktop/Cursor, agents can run code such as console.log([1,2,3].map(x => x2)). All parameters can be configured in a single TOML/JSON file via --config, with precedence CLI arguments > MCP_V8_ environment variables > configuration file > defaults.
Limitations: It does not provide setInterval; use a loop with await setTimeout; no DOM/browser APIs; TypeScript only performs type stripping rather than type checking, and JSX/TSX is not supported; the legacy SSE transport does not support the MCP tasks extension.