Skip to content

Commit af78ba6

Browse files
committed
Merge pull request #25 from mcpc-tech/feat/plugin-code-execution
docs: rebrand README to plugin and update code examples
2 parents cdb35d6 + 2a76cf6 commit af78ba6

File tree

1 file changed

+42
-39
lines changed

1 file changed

+42
-39
lines changed

packages/plugin-code-execution/README.md

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# @mcpc/agentic-js-sandbox
1+
# @mcpc/plugin-code-execution
2+
3+
[![JSR](https://jsr.io/badges/@mcpc/plugin-code-execution)](https://jsr.io/@mcpc/plugin-code-execution)
4+
[![npm](https://img.shields.io/npm/v/@mcpc-tech/plugin-code-execution)](https://www.npmjs.com/package/@mcpc-tech/plugin-code-execution)
25

36
Secure JavaScript code execution sandbox using Deno for MCPC agents. This
47
package provides a safe environment to execute user-provided JavaScript code
@@ -10,19 +13,20 @@ with MCP tool access via JSON-RPC IPC.
1013
execution
1114
- 🔌 **JSON-RPC IPC**: Tool calls are transmitted via JSON-RPC between sandbox
1215
and host
13-
- 🚀 **Easy Integration**: Drop-in replacement for the built-in code execution
14-
mode
16+
- 🚀 **Easy Integration**: Plugin-based integration with MCPC
1517
- 📦 **Zero Config**: Automatically locates Deno binary from npm package
1618
- 🛡️ **Resource Limits**: Configurable timeouts and memory limits
1719

1820
## Installation
1921

2022
```bash
21-
npm install @mcpc/agentic-js-sandbox
22-
# or
23-
pnpm add @mcpc/agentic-js-sandbox
24-
# or
25-
yarn add @mcpc/agentic-js-sandbox
23+
# npm
24+
npm install @mcpc-tech/plugin-code-execution
25+
pnpm add @mcpc-tech/plugin-code-execution
26+
27+
# jsr
28+
npx jsr add @mcpc/plugin-code-execution
29+
pnpm add jsr:@mcpc/plugin-code-execution
2630
```
2731

2832
## Usage
@@ -31,7 +35,7 @@ yarn add @mcpc/agentic-js-sandbox
3135

3236
```typescript
3337
import { mcpc } from "@mcpc/core";
34-
import { createSandboxExecutor } from "@mcpc/agentic-js-sandbox";
38+
import { createCodeExecutionPlugin } from "@mcpc/plugin-code-execution/plugin";
3539

3640
const server = await mcpc(
3741
[{ name: "my-agent", version: "1.0.0" }, {
@@ -53,13 +57,17 @@ const server = await mcpc(
5357
},
5458
},
5559
},
56-
options: {
57-
mode: "code_execution",
58-
// Use custom sandbox executor
59-
customExecutor: createSandboxExecutor({
60-
timeout: 30000, // 30 seconds
61-
memoryLimit: 512, // 512 MB
60+
plugins: [
61+
createCodeExecutionPlugin({
62+
sandbox: {
63+
timeout: 30000, // 30 seconds
64+
memoryLimit: 512, // 512 MB
65+
permissions: [], // No extra permissions
66+
},
6267
}),
68+
],
69+
options: {
70+
mode: "custom",
6371
},
6472
}],
6573
);
@@ -83,16 +91,20 @@ passing Deno permission flags directly:
8391

8492
```typescript
8593
// No permissions - can only call MCP tools
86-
createSandboxExecutor();
94+
createCodeExecutionPlugin();
8795

8896
// Allow network access to specific domains
89-
createSandboxExecutor({
90-
permissions: ["--allow-net=github.com,api.example.com"],
97+
createCodeExecutionPlugin({
98+
sandbox: {
99+
permissions: ["--allow-net=github.com,api.example.com"],
100+
},
91101
});
92102

93103
// Allow reading specific directories
94-
createSandboxExecutor({
95-
permissions: ["--allow-read=/tmp,/var/log"],
104+
createCodeExecutionPlugin({
105+
sandbox: {
106+
permissions: ["--allow-read=/tmp,/var/log"],
107+
},
96108
});
97109
```
98110

@@ -109,13 +121,15 @@ interface SandboxConfig {
109121
Example with custom permissions:
110122

111123
```typescript
112-
createSandboxExecutor({
113-
timeout: 60000,
114-
permissions: [
115-
"--allow-net=api.example.com",
116-
"--allow-read=/tmp",
117-
"--allow-env=HOME,USER",
118-
],
124+
createCodeExecutionPlugin({
125+
sandbox: {
126+
timeout: 60000,
127+
permissions: [
128+
"--allow-net=api.example.com",
129+
"--allow-read=/tmp",
130+
"--allow-env=HOME,USER",
131+
],
132+
},
119133
});
120134
```
121135

@@ -138,22 +152,11 @@ createSandboxExecutor({
138152
└─────────────────┘
139153
```
140154

141-
## Comparison with Built-in Executor
142-
143-
| Feature | Built-in (`new Function`) | Sandbox (`npm:deno`) |
144-
| ----------- | ------------------------- | --------------------------- |
145-
| Security | Low (same process) | High (isolated) |
146-
| Performance | Fast | Slower (IPC overhead) |
147-
| Permissions | Full Node.js access | Restricted |
148-
| Setup | Zero deps | Requires `deno` npm package |
149-
150155
## Examples
151156

152157
See `examples/` directory for complete examples:
153158

154-
- `basic-usage.ts` - Simple code execution
155-
- `file-operations.ts` - Working with filesystem MCP tools
156-
- `custom-permissions.ts` - Custom Deno permissions
159+
- `basic-usage.ts` - Simple code execution with plugin integration
157160

158161
## Development
159162

0 commit comments

Comments
 (0)