Enclave
БесплатноНе проверенA secure JavaScript sandbox designed for safe AI agent code execution. Protects against code injection, prototype pollution, and sandbox escapes. The security l
Описание
A secure JavaScript sandbox designed for safe AI agent code execution. Protects against code injection, prototype pollution, and sandbox escapes. The security layer that makes AI-generated code safe to run.
README
Enclave
Secure sandbox runtime for AI agents
npm ast-guard
npm @enclave-vm/core
npm @enclave-vm/broker
npm @enclave-vm/client
npm @enclave-vm/react
Node
License
Why Enclave?
- Extensive security testing - See security audit for details
- Defense in depth - 6 security layers for LLM-generated code
- Streaming runtime - Real-time event streaming with tool call support
- Zero-config - Works out of the box with sensible defaults
- TypeScript-first - Full type safety and excellent DX
Install
Core Packages
npm install @enclave-vm/core # Secure JS sandbox
npm install ast-guard # AST security validation
Streaming Runtime
npm install @enclave-vm/broker # Tool broker & session management
npm install @enclave-vm/client # Browser/Node client SDK
npm install @enclave-vm/react # React hooks & components
Packages
| Package | Description |
|---|---|
| @enclave-vm/core | Secure JavaScript sandbox with 6 security layers |
| @enclave-vm/broker | Tool registry, secrets management, session API |
| @enclave-vm/client | Browser & Node.js client for streaming sessions |
| @enclave-vm/react | React hooks: useEnclaveSession, EnclaveProvider |
| @enclave-vm/runtime | Deployable runtime worker (Lambda, Vercel, etc.) |
| @enclave-vm/types | TypeScript types & Zod schemas |
| @enclave-vm/stream | NDJSON streaming, encryption, reconnection |
| ast-guard | AST-based security validator |
Quick Start
import { Enclave } from '@enclave-vm/core';
const enclave = new Enclave({
securityLevel: 'SECURE',
toolHandler: async (name, args) => {
if (name === 'getUser') return { id: args.id, name: 'Alice' };
throw new Error(`Unknown tool: ${name}`);
},
});
const result = await enclave.run(`
const user = await callTool('getUser', { id: 123 });
return { greeting: 'Hello, ' + user.name };
`);
if (result.success) {
console.log(result.value); // { greeting: 'Hello, Alice' }
}
enclave.dispose();
React Integration
import { EnclaveProvider, useEnclaveSession } from '@enclave-vm/react';
function App() {
return (
<EnclaveProvider brokerUrl="https://your-server.com">
<CodeRunner />
</EnclaveProvider>
);
}
function CodeRunner() {
const { execute, state, result, stdout } = useEnclaveSession();
const runCode = () =>
execute(`
const data = await callTool('fetchData', { id: 123 });
return data;
`);
return (
<div>
<button onClick={runCode} disabled={state === 'running'}>
{state === 'running' ? 'Running...' : 'Run Code'}
</button>
{stdout && <pre>{stdout}</pre>}
{result && <pre>{JSON.stringify(result, null, 2)}</pre>}
</div>
);
}
Architecture
See README-ARCHITECTURE.md for detailed architecture documentation covering:
- Deployment scenarios (embedded vs extracted runtime)
- Streaming protocol (NDJSON)
- Tool broker pattern
- Reference sidecar & auto-ref
- Security & encryption
Demos
Enclave Demo (basic sandbox)
npx nx serve enclave-demo
A CLI script that demonstrates core sandbox features: arithmetic, loops, tool calls, and security blocking of disallowed operations.
Streaming Demo (full architecture)
npx nx demo streaming-demo
Starts a 3-server architecture with a web UI, covering embedded, lambda, and direct execution modes:
- Client (port 4100) — Web UI
- Broker (port 4101) — Tool execution & session management
- Runtime (port 4102) — Sandboxed code execution
License
Установка Enclave
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/agentfront/enclaveFAQ
Enclave MCP бесплатный?
Да, Enclave MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Enclave?
Нет, Enclave работает без API-ключей и переменных окружения.
Enclave — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Enclave в Claude Desktop, Claude Code или Cursor?
Открой Enclave на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
GitHub
PRs, issues, code search, CI status
автор: GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
автор: mcpdotdirectCompare Enclave with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development
