Commit 681d493
feat: add MCP server example for sandboxed JavaScript execution (#35)
* feat: add MCP server example for sandboxed JavaScript execution
Add an MCP (Model Context Protocol) server that exposes an
execute_javascript tool, allowing AI agents to run arbitrary JavaScript
inside an isolated Hyperlight micro-VM sandbox with strict CPU time
limits and automatic snapshot/restore recovery after timeouts.
Includes server implementation, demo scripts (PowerShell and Bash),
vitest test suite, and documentation.
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* fix: address review comments on MCP server example
- Factor NDJSON transport helpers into shared tests/helpers.js module
to eliminate duplicated reader logic across all 4 test files (#1)
- Remove confusing BBP parenthetical comment; the implementation uses
Machin's formula throughout (#9)
- Replace Math.random() with seeded PRNG (mulberry32) in test code
constants for deterministic, non-flaky test results (#10)
- Tighten timing assertion from executeMs > 0 to > 1 for meaningful
validation (#10)
Note: Issues #2-8 and #11 from the review were already addressed in
the current code (setScratchSize, safe JSON.stringify, shell script
portability, PowerShell cleanup, timing log correctness, u32 bounds
check, Node >= 20 in README + engines, correct JSDoc path).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* copilot review changes
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* fix formatting
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* review feedback
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
---------
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 9c6c15c commit 681d493
14 files changed
Lines changed: 7046 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
0 commit comments