js-sandbox MCP Server logo

js-sandbox MCP Server

by garc33

A Model Context Protocol server that provides a secure JavaScript execution environment. It allows execution of JavaScript code in an isolated environment with configurable time and memory limits.

View on GitHub

Last updated: N/A

What is js-sandbox MCP Server?

This is a Model Context Protocol (MCP) server designed to execute JavaScript code in a secure and isolated environment. It provides a controlled setting for running potentially untrusted code, mitigating risks associated with malicious scripts.

How to use js-sandbox MCP Server?

To use the server with Claude Desktop, add the provided server configuration to the claude_desktop_config.json file in the appropriate directory for your operating system (MacOS or Windows). Ensure the command path points to the correct location of the built index.js file. You can debug using the MCP Inspector.

Key features of js-sandbox MCP Server

  • Isolated code execution

  • Configurable execution time limits

  • Configurable memory limits

  • Protection against malicious code

  • execute_js tool for running JavaScript code

Use cases of js-sandbox MCP Server

  • Safely executing untrusted JavaScript code

  • Testing JavaScript code in a controlled environment

  • Running JavaScript code with resource constraints

  • Integrating JavaScript execution into other applications

FAQ from js-sandbox MCP Server

What is the default timeout for code execution?

The README doesn't specify a default timeout. It's configurable between 100-30000ms.

What is the default memory limit?

The README doesn't specify a default memory limit. It's configurable between 1MB-100MB.

How do I install the server?

Clone the repository, install dependencies with npm install, and build the server with npm run build.

How do I debug the server?

Use the MCP Inspector by running npm run inspector. This provides a URL to access debugging tools in your browser.

What is the execute_js tool?

The execute_js tool allows you to execute JavaScript code within the isolated environment. It takes the code, optional timeout, and memory limit as parameters and returns the result of the execution.