Enclave MCP server
Commit Nov 13, 2026Provides a secure JavaScript sandbox runtime to safely execute LLM-generated code with multiple security layers.
Also known as agentfront/enclave
- Stars
- 6
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 13, 2026
- License
- Apache-2.0
What is Enclave MCP?
Enclave provides a secure JavaScript sandbox runtime to safely execute LLM-generated code with multiple security layers.
Summary generated from the project's README
About Enclave MCP server
Enclave provides a secure JavaScript sandbox designed specifically for executing code generated by large language models. It uses six distinct security layers to protect environments from potentially malicious or unintended AI outputs. Developers can integrate this runtime into Node.js or browser-based applications using various specialized packages like @enclave-vm/core for the sandbox and ast-guard for AST-based security validation.
The system supports real-time event streaming through an NDJSON protocol, allowing for live updates during code execution. For complex setups, the architecture includes a tool broker for session management and secrets, a client SDK for connecting to streaming sessions, and a deployable runtime worker suitable for environments like Lambda or Vercel. This modular approach allows for both embedded execution and distributed three-server architectures involving a client, a broker, and a runtime.
Users can manage tool calls within the sandbox, enabling the AI to interact with external functions through a controlled tool handler. The framework is built with a TypeScript-first approach to ensure type safety and provides React hooks such as useEnclaveSession for easy integration into web interfaces.
What you can do with it
- 1Execute untrusted AI codeRun JavaScript code generated by an LLM within a protected environment to prevent system compromise.
- 2Stream real-time execution dataMonitor code execution progress and tool calls through a live streaming interface.
Written from the project's README. Every use case is checked against a quote from it.
Automated checks
Ran Nov 15, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachableagentfront/enclave is public and reachablegithub.com/agentfront/enclave ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-13github.com/agentfront/enclave ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubEnclave
Secure sandbox runtime for AI agents
Documentation | Live Demo | FrontMCP Framework
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 MCP questions
What makes Enclave secure for AI agents?
It uses a defense in depth approach with 6 security layers specifically designed for LLM-generated code to protect against injection and sandbox escapes.
Can Enclave handle tool calls?
Yes, it supports real-time event streaming with tool call support and includes a tool broker for session management.
Does Enclave support React applications?
Yes, there is a dedicated package providing React hooks like useEnclaveSession and an EnclaveProvider component.