JIT Tool Synthesis v2
LLM-powered on-demand tool generation with human-in-the-loop approval and safe execution.
Overview
This system generates TypeScript tools dynamically using an LLM, requires human approval before execution, and runs them in a sandboxed environment.
Architecture
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Synthesizer │────▶│ Approval │────▶│ Sandbox │
│ (LLM) │ │ (Human Gate) │ │ (Execution) │
└─────────────┘ └──────────────┘ └─────────────┘
│ │ │
▼ ▼ ▼
Generates TS Waits for Runs in
tool code human approval isolated env
Components
| File | Purpose |
|---|---|
synthesizer.ts |
Generates TypeScript code using OpenRouter LLM |
approval.ts |
Human-in-the-loop gate — requires approval before execution |
sandbox.ts |
Safe execution environment for generated code |
registry.ts |
Tool persistence and storage |
server.ts |
MCP server integration |
Setup
# Install dependencies
npm install
# Copy environment template
cp .env.example .env
# Add your OpenRouter API key to .env
OPENROUTER_API_KEY=your_key_here
Usage
Start the MCP Server
npm run dev
Claude Desktop Integration
Import the config:
# Copy Claude Desktop config
cat claude-desktop-config.json
Add the JSON to your Claude Desktop settings under mcpServers.
CLI Commands
# Generate and approve a tool
npm run cli -- synthesize "Create a weather tool that fetches from wttr.in"
# List available tools
npm run cli -- list
# Execute a tool
npm run cli -- execute <tool-id>
Workflow
- Request — User asks for a tool (e.g., "create a weather fetcher")
- Synthesize — LLM generates TypeScript code
- Approve — Human reviews and approves the code
- Execute — Tool runs in sandboxed environment
- Store — Approved tools persist in registry
Environment Variables
| Variable | Description |
|---|---|
OPENROUTER_API_KEY |
API key for LLM tool generation |
PORT |
Server port (default: 3000) |
Status
In Progress — MVP complete, end-to-end testing in progress.