JavaScript Sandbox MCP Server
js-sandbox MCP 服务器
提供安全 JavaScript 执行环境的模型上下文协议服务器。
特征
工具
execute_js- 在隔离环境中执行 JavaScript 代码参数:
code(必需):要执行的 JavaScript 代码timeout(可选):最大执行时间(以毫秒为单位)(100-30000ms)memory(可选):内存限制(以字节为单位)(1MB-100MB)
返回代码执行的结果
安全
在受控环境中隔离代码执行
可配置的执行时间和内存限制
防范恶意代码
Related MCP server: MCP QuickJS Runner
发展
安装依赖项:
npm install构建服务器:
npm run build具有自动重建的开发模式:
npm run watch安装
要与 Claude Desktop 一起使用,请添加服务器配置:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"js-sandbox": {
"command": "/path/to/js-sandbox/build/index.js"
}
}
}调试
由于 MCP 服务器通过 stdio 进行通信,调试起来可能比较困难。我们推荐使用MCP Inspector ,其运行方式如下:
npm run inspector检查器将提供一个 URL 来访问浏览器中的调试工具。
Available Tools
1 toolexecute_jsC
Execute JavaScript code in an isolated environment
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript code to execute | |
| timeout | No | Maximum execution time in milliseconds | |
| memory | No | Memory limit in bytes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions an 'isolated environment', hinting at sandboxing, but fails to detail critical aspects like error handling, output format, security restrictions, or whether the execution is synchronous. This leaves significant gaps for a tool that executes arbitrary code.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, direct sentence with no wasted words, making it highly concise and front-loaded. It efficiently communicates the core functionality without unnecessary elaboration.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of executing JavaScript code and the absence of both annotations and an output schema, the description is insufficient. It lacks details on behavioral traits (e.g., sandboxing limits, return values), making it incomplete for safe and effective use by an AI agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, thoroughly documenting all three parameters (code, timeout, memory) with their purposes and constraints. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Execute') and resource ('JavaScript code in an isolated environment'), making the purpose immediately understandable. It doesn't need to differentiate from siblings since none exist, but it could be more specific about what 'execute' entails (e.g., evaluation, side effects).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or common use cases. It mentions an 'isolated environment' but doesn't explain its implications or limitations, leaving usage context vague.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v1.0.0- Added
execute_js
TDQS
Scored across 1 tool
With only one tool, there is no possibility of confusion or overlap between tools. The tool's purpose is clearly defined as executing JavaScript code in isolation, making it distinct by default.
The single tool name 'execute_js' follows a clear verb_noun pattern (execute + js). Since there is only one tool, consistency is inherently perfect with no deviations to assess.
A single tool is too few for a server named 'JavaScript Sandbox MCP Server', which implies broader functionality like evaluating expressions, managing contexts, or handling errors. This minimal set feels thin and under-scoped for the apparent domain.
The tool surface is severely incomplete for a JavaScript sandbox domain. It lacks essential operations such as evaluating expressions, clearing contexts, handling errors, or managing state, which are typical for such environments, leading to significant gaps in functionality.
Maintenance
Related MCP Connectors
Execute code in 8 languages (Python, JS, TS, Go, Java, C++, C, Bash) in gVisor sandboxes.
- mcp-serverOAuthai.cdbx
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Host static HTML pages, generate PDFs, screenshots, scrape JS sites, run sandboxed JavaScript.
Run Python code in a secure sandbox without local setup. Declare inline dependencies and execute s…
Related MCP Servers
- AlicenseAqualityFmaintenanceA secure JavaScript REPL server that enables executing code snippets in a sandboxed environment with memory protection, timeout handling, and comprehensive error reporting.111 npm120MIT
- FlicenseNot gradedqualityDmaintenanceProvides 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.4-
- AlicenseNot gradedqualityBmaintenanceProvides sandboxed code execution for AI agents with support for Python, JavaScript, and shell commands. Includes comprehensive safety features like destructive pattern blocking, timeout protection, and restricted file access for secure production use.16 npm89 PyPIMIT
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to safely execute Python, JavaScript, and Bash code in an isolated Docker sandbox with strict security constraints.1-