What is mcp-v8?
mcp-v8 is a Model Context Protocol server, written in Rust, that lets an AI agent run JavaScript and TypeScript in a sandboxed V8 isolate. Instead of wiring up dozens of narrow tools, it gives the agent one tool—run_js—and the agent writes code that can loop, branch, transform data, and call other tools. It is designed for AI agents that need a flexible, stateful code execution environment.
How to use mcp-v8?
Install the server via the provided curl script (install.sh) or use nix run, Docker, or build from source. Connect an MCP client by adding mcp-v8 with flags like --stateless or --directory-path to the client's mcpServers configuration. The server can also run over HTTP using mcp-v8 --stateless --http-port 8080. Configuration can be done entirely through CLI flags or a single TOML/JSON config file.
Key features of mcp-v8
- One
run_js tool that executes JavaScript/TypeScript in an isolated V8 engine.
- Async execution model with execution IDs, polling, and cancellation.
- Content-addressed heap snapshots for persistent state across calls (local FS, S3, or cache).
- Policy-gated capabilities:
fetch, filesystem, subprocess, and external imports controlled via OPA/Rego.
- Multiple transports: stdio, Streamable HTTP, legacy HTTP+SSE, plus a REST sidecar.
- JWKS authentication and optional Raft clustering for horizontal scaling.
- MCP tasks support for long-running executions (SEP-1319).
Use cases of mcp-v8
- AI agents performing complex data transformations that require looping and branching.
- Building stateful multi-turn workflows where variables and objects persist across calls.
- Running custom JavaScript or TypeScript scripts fetched from the server filesystem.
- Composing multiple MCP servers by calling upstream tools from within the sandboxed code.
- Long-running background computations with async polling and cancellation via tasks.
评论