Examples
Use these examples when you want a runnable starting point for the main library adoption paths.
Run everything
Section titled “Run everything”npm installnpm run buildnpm run examplesExample index
Section titled “Example index”| Example | What it shows | When to start here |
|---|---|---|
execbox-basic.ts | Resolve a provider and execute guest code with QuickJS. | You want the smallest end-to-end example. |
execbox-worker.ts | Run the same provider flow with QuickJS hosted in a worker thread. | You want QuickJS off the main thread without leaving the process. |
execbox-mcp-provider.ts | Wrap MCP tools into a provider and execute against them. | You want guest code to call upstream MCP tools as code. |
execbox-mcp-server.ts | Expose mcp_search_tools, mcp_execute_code, and mcp_code. | You want downstream MCP clients to execute code against a wrapped tool namespace. |
What to read next
Section titled “What to read next”- Getting Started for the minimal QuickJS install path
- Providers & Tools for provider and schema guidance
- Runtime Choices for inline and worker-hosted QuickJS
- MCP Integration for MCP-backed flows