Skip to main content
Glama

JIT 工具合成 v4

基于 LLM 的按需工具生成系统,具备人工审核机制和安全执行环境。

概述

本系统利用 LLM 动态生成 TypeScript 工具,在执行前需要人工批准,并运行在沙箱环境中。

Related MCP server: Code Mode MCP Server

架构

┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│ Synthesizer │────▶│   Approval   │────▶│  Sandbox    │
│   (LLM)     │     │ (Human Gate) │     │ (Execution) │
└─────────────┘     └──────────────┘     └─────────────┘
       │                   │                    │
       ▼                   ▼                    ▼
  Generates TS        Waits for            Runs in
  tool code          human approval       isolated env

组件

文件

用途

synthesizer.ts

使用任何兼容 OpenAI 的 LLM 生成工具代码

approval.ts

人工审核门控 — 执行前必须获得批准

sandbox.ts

生成代码的安全执行环境

registry.ts

工具持久化与存储

server.ts

MCP 服务器集成

config.ts

运行时配置管理

提供商无关性

本工具适用于任何兼容 OpenAI 的 LLM API:

  • OpenRouter — 100+ 模型 (Claude, GPT, Llama 等)

  • OpenAI — GPT-4o, o3 等

  • Ollama — 本地模型 (Llama, Qwen 等)

  • LM Studio — 带 GUI 的本地模型

  • Groq — 快速推理

  • 任何其他兼容 OpenAI 的 API

设置

# Install dependencies
npm install

# Copy environment template
cp .env.example .env

配置您的 LLM 提供商

编辑 .env 文件并填入您的提供商详情:

# Option 1: OpenRouter (default - 100+ models)
LLM_API_KEY=your-openrouter-key
LLM_BASE_URL=https://openrouter.ai/api/v1
LLM_MODEL=anthropic/claude-sonnet-4-6

# Option 2: OpenAI direct
LLM_API_KEY=sk-...
LLM_BASE_URL=https://api.openai.com/v1
LLM_MODEL=gpt-5.4

# Option 3: Ollama (local)
LLM_BASE_URL=http://localhost:11434/v1
LLM_MODEL=llama-3.3

# Option 4: Groq
LLM_API_KEY=gsk_...
LLM_BASE_URL=https://api.groq.com/openai/v1
LLM_MODEL=llama-3.3-70b-versatile

使用方法

构建

npm run build

使用 MCP Inspector 测试

验证一切是否正常的快捷方式:

npx @modelcontextprotocol/inspector node dist/server.js

连接到 MCP 客户端

本服务器适用于任何 MCP 客户端。配置示例:

Claude Desktop — 添加到您的 Claude Desktop MCP 设置中:

{
  "mcpServers": {
    "jit-tool-synthesis": {
      "command": "node",
      "args": ["/absolute/path/to/jit-tool-synthesis/dist/server.js"],
      "env": {
        "LLM_API_KEY": "your-api-key",
        "LLM_BASE_URL": "https://openrouter.ai/api/v1",
        "LLM_MODEL": "anthropic/claude-sonnet-4-6"
      }
    }
  }
}

Claude Code:

claude mcp add jit-tools node /absolute/path/to/jit-tool-synthesis/dist/server.js

VS Code (Copilot):

code --add-mcp '{"name":"jit-tools","type":"stdio","command":"node","args":["/absolute/path/to/jit-tool-synthesis/dist/server.js"]}'

Cursor — 添加到 .cursor/mcp.json

{
  "mcpServers": {
    "jit-tools": {
      "command": "node",
      "args": ["/absolute/path/to/jit-tool-synthesis/dist/server.js"],
      "env": { "LLM_API_KEY": "your-api-key" }
    }
  }
}

运行时配置

您无需重启即可更改 LLM 提供商:

# View current config
get_config

# Change model at runtime
set_config model=openai/gpt-5.4

MCP 工具

工具

描述

synthesize_tool

通过自然语言生成新工具

test_tool

在批准前使用示例参数测试待定工具

approve_tool

激活待定工具

reject_tool

丢弃待定工具

execute_tool

运行已批准的工具

list_generated_tools

列出所有已批准的工具

get_tool

查看工具详情

remove_tool

删除工具

list_pending

列出等待批准的工具

get_config

查看 LLM 配置

set_config

在运行时更改 LLM 提供商/模型

工作流程

  1. 请求 — 用户提出工具需求(例如:“创建一个颜色转换器”)

  2. 合成 — LLM 生成工具代码

  3. 测试 — 在提交前使用示例参数进行验证

  4. 批准 — 人工审查并批准代码

  5. 执行 — 工具在沙箱环境中运行

  6. 存储 — 已批准的工具在会话间持久保存

环境变量

变量

描述

默认值

LLM_API_KEY

提供商的 API 密钥

(云端必需)

LLM_BASE_URL

API 端点

https://openrouter.ai/api/v1

LLM_MODEL

使用的模型

anthropic/claude-sonnet-4-6

同时支持(旧版):OPENROUTER_API_KEY, OPENAI_API_KEY, OPENAI_BASE_URL, SYNTHESIZER_MODEL

安全性

  • 生成的代码运行在隔离的 VM 沙箱中

  • 拦截模式可防止危险代码(process, require, eval 等)

  • API 密钥不会存储在配置文件中

状态

生产就绪 — 第一阶段已完成。

Install Server
F
license - not found
C
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    F
    maintenance
    Enables AI models to dynamically create and execute their own custom tools through a meta-function architecture, supporting JavaScript, Python, and Shell runtimes with sandboxed security and human approval flows.
    5
    10
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables LLMs to interact with MCP servers by writing TypeScript/JavaScript code instead of direct tool calls. Provides a code execution sandbox that accesses MCP servers through HTTP proxy endpoints.
    20
    123
    Apache 2.0
  • F
    license
    A
    quality
    Not graded
    maintenance
    Enables execution of TypeScript code to call MCP tools instead of direct tool calls, reducing token usage by up to 98% while orchestrating complex multi-tool workflows through secure sandboxed code execution.
    1
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI-powered generation of production-ready CTP (ConveniencePro Tool Protocol) tools from natural language descriptions, including tool definitions, implementations, tests, and TypeScript validation.
    5
    12
    MIT

View all related MCP servers

Related MCP Connectors

  • Runtime permission, approval, and audit layer for AI agent tool execution.

  • Create and manage AI agents that collaborate and solve problems through natural language interacti…

  • See, price, and control every tool call your AI agents make: policy checks, cost, and audit tools.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/EyeSeeThru/jit-tool-synthesis'

If you have feedback or need assistance with the MCP directory API, please join our Discord server