RC

rocket-connect/mcp-sandbox

Developer tools公式

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

5 stars 3 forks 品質 50 トレンド 13MIT

Turn any JavaScript module into a sandboxed MCP (Model Context Protocol) server with automatic reflection and type inference.

概要

MCP Sandbox automatically converts JavaScript modules into MCP (Model Context Protocol) compatible servers, making any JavaScript function accessible to AI systems. It uses VM sandboxing for security, automatic type inference, and generates proper MCP configurations. - 🔍 - Analyzes JS modules and extracts function signatures - 🛡️ - Executes code in isolated VM contexts with timeouts - 🧠 - Detects parameter types from defaults and naming patterns - 📚 - Extracts documentation from function comments - 📡 - Full JSON-RPC 2.0 and SSE support - 🌐 - Legacy REST endpoints for easy testing - ⚙️ - Full type safety and IntelliSense support Running mcp-sandbox start math-utils.js automatically: 1. 🔍 Reflects the module and discovers functions 2. 📊 Generates type schemas from parameters 3. 🚀 Starts MCP server at http://localhost:3000 4. 💾 Creates mcp-config.

README

以下は原文 README の抜粋です。原文を見る。

MCP Sandbox

Turn any JavaScript module into a sandboxed MCP (Model Context Protocol) server with automatic reflection and type inference.

🎯 What is MCP Sandbox?

MCP Sandbox automatically converts JavaScript modules into MCP (Model Context Protocol) compatible servers, making any JavaScript function accessible to AI systems. It uses VM sandboxing for security, automatic type inference, and generates proper MCP configurations.

✨ Features

  • 🔍 Automatic Reflection - Analyzes JS modules and extracts function signatures
  • 🛡️ Secure Sandboxing - Executes code in isolated VM contexts with timeouts
  • 🧠 Smart Type Inference - Detects parameter types from defaults and naming patterns
  • 📚 JSDoc Integration - Extracts documentation from function comments
  • 📡 MCP Protocol - Full JSON-RPC 2.0 and SSE support
  • 🌐 REST API - Legacy REST endpoints for easy testing
  • ⚙️ TypeScript - Full type safety and IntelliSense support

🚀 Quick Start

Installation

# Install globally for CLI usage
npm install -g @mcp-sandbox/cli

# Or use in a project
npm install @mcp-sandbox/core @mcp-sandbox/cli

Basic Usage

# Start MCP server for a JavaScript module
$ mcp-sandbox start ./math-utils.js

🏗️  Initializing MCP Sandbox...
🔍 Reflecting module
📊 Discovered 2 tools:
  - circleArea: Calculate area of a circle
  - fibonacci: Generate Fibonacci sequence
🚀 MCP Sandbox server running at http://localhost:3000
📋 MCP Tools: http://localhost:3000/mcp/tools
⚡ MCP Execute: http://localhost:3000/mcp/execute
🔄 MCP SSE: http://localhost:3000/sse
📡 MCP JSON-RPC: http://localhost:3000/mcp/jsonrpc
⚙️  MCP Config: http://localhost:3000/mcp-config
💡 For MCP Inspector, use: http://localhost:3000/sse

Example Module

/**
 * Calculate the area of a circle
 * @param radius The radius of the circle
 */
function circleArea(radius = 1) {
  return Math.PI * radius * radius;
}

/**
 * Generate fibonacci sequence
 * @param count Number of fibonacci numbers to generate
 */
function fibonacci(count = 10) {
  const seq = [0, 1];
  for (let i = 2; i < count; i++) {
    seq[i] = seq[i - 1] + seq[i - 2];
  }
  return seq.slice(0, count);
}

module.exports = { circleArea, fibonacci };

Running mcp-sandbox start math-utils.js automatically:

  1. 🔍 Reflects the module and discovers functions
  2. 📊 Generates type schemas from parameters
  3. 🚀 Starts MCP server at http://localhost:3000
  4. 💾 Creates mcp-config.json for MCP clients

📡 API Endpoints

GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →