@frontmcp/plugin-codecall

中文文档
1.12.2发布于 2026/11/15Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 7673

CodeCall plugin for FrontMCP: puts many tools behind search, describe, invoke and execute meta-tools, and runs scripts that call them in a sandbox

原始使用文档
文档目录10 节
  1. Install
  2. Usage
  3. The tools CodeCall adds
  4. Modes
  5. Options
  6. Limits
  7. Docs
  8. Related packages
  9. Contributing
  10. License

@frontmcp/plugin-codecall

A FrontMCP plugin for servers with more tools than a model can usefully read. Instead of every tool and its schema, tools/list shows CodeCall's meta-tools. The model searches your tools with codecall:search, reads the schemas of the ones it picked with codecall:describe, and calls them: one at a time with codecall:invoke, or several in one request with codecall:execute, which runs a short program written in AgentScript, a restricted subset of JavaScript, in a sandbox on the server. A script can loop over results, filter and join them, so only the answer goes back to the model.

npm License

Install

npm install @frontmcp/plugin-codecall @frontmcp/plugin-cache @frontmcp/sdk

Requires Node.js 24 or later. @frontmcp/plugin-cache is a required peer dependency: install it next to this package, at the same version. CodeCall registers the cache plugin itself, so you don't list it in plugins. Keep @frontmcp/sdk on the same version too.

For embedding: { strategy: 'ml' }, also install @huggingface/transformers, an optional peer dependency of vectoriadb, which CodeCall uses for search.

Usage

Register the plugin with init(), in the plugins of an @App or of @FrontMcp:

import { CodeCallPlugin } from '@frontmcp/plugin-codecall';
import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';

@Tool({
  name: 'list_tickets',
  description: 'List support tickets',
  inputSchema: { status: z.enum(['open', 'closed']) },
})
class ListTickets extends ToolContext {
  async execute({ status }: { status: 'open' | 'closed' }) {
    return { tickets: [{ id: 'T-1', status, customerId: 'C-7' }] };
  }
}

@Tool({ name: 'get_customer', description: 'Get a customer by id', inputSchema: { id: z.string() } })
class GetCustomer extends ToolContext {
  async execute({ id }: { id: string }) {
    return { id, name: 'Ada', plan: 'pro' };
  }
}

@App({
  id: 'help-desk',
  name: 'Help Desk',
  tools: [ListTickets, GetCustomer],
  plugins: [CodeCallPlugin.init({ mode: 'codecall_only' })],
})
class HelpDeskApp {}

@FrontMcp({ info: { name: 'help-desk', version: '1.0.0' }, apps: [HelpDeskApp] })
export default class Server {}

tools/list now shows only the codecall:* tools. Registered on one app, CodeCall still hides every app's tools (unless you set appIds), and its tools search and call every app's tools.

Every option is optional: CodeCallPlugin.init() and plugins: [CodeCallPlugin] use the defaults. init() checks the options when your module is imported, and throws a ZodError naming a wrong one.

The tools CodeCall adds

ToolWhat it does
codecall:searchFinds tools for short queries (queries: 1 to 10 phrases).
codecall:describeReturns tools' input and output schemas, with usage examples.
codecall:invokeCalls one tool and returns its result.
codecall:executeRuns an AgentScript program that calls tools.
codecall:searchSkillsFinds skills that call tools.
codecall:searchKnowledgeFinds skills that are only instructions.

They're listed in every mode, and neither codecall:invoke nor a script can call them.

Modes

modeIn tools/listWhat CodeCall may use
'codecall_only' (default)CodeCall's tools, and tools with codecall: { visibleInListTools: true }Every tool, except those with enabledInCodeCall: false
'codecall_opt_in'Every tool, except those with visibleInListTools: falseOnly tools with codecall: { enabledInCodeCall: true }
'metadata_driven'Every tool, except those with visibleInListTools: falseEvery tool, except those with enabledInCodeCall: false

A client that calls a tool CodeCall takes out of tools/list gets Tool "…" not found (TOOL_NOT_FOUND). Calls from the server, through CodeCall's own tools or this.callTool(), still reach it. In codecall_only, a tool a client or widget calls directly needs visibleInListTools: true.

The plugin adds a codecall field to @Tool:

@Tool({
  name: 'delete_customer',
  description: 'Delete a customer and all their tickets',
  inputSchema: { id: z.string() },
  codecall: { enabledInCodeCall: false, visibleInListTools: true },
})

Options

OptionDefaultDescription
mode'codecall_only'Which tools tools/list shows, and which CodeCall may use. See Modes.
appIdsevery appIn codecall_only, hide only these apps' tools from tools/list. It doesn't limit what CodeCall searches or calls.
includeTools(tool) => boolean. A tool it returns false for isn't searched, described, invoked or callable from scripts.
directCallsunset{ enabled, allowedTools?, filter? }, limits what codecall:invoke may call.
vm{ preset: 'secure' }The sandbox's limits: preset ('locked_down', 'secure', 'balanced', 'experimental'), timeoutMs, maxSteps, allowLoops, and others.
embeddingTF-IDFHow codecall:search ranks tools: strategy ('tfidf' or 'ml'), modelName, cacheDir, useHNSW, synonymExpansion.
sidecar{ enabled: false }Allows scripts longer than 64 KB.
topK8Results per query when a codecall:search call doesn't give its own topK.
maxDefinitions8Most tools one codecall:describe call may name.
CodeCallPlugin.init({
  mode: 'codecall_opt_in',
  directCalls: { enabled: true, allowedTools: ['get_customer'] },
  vm: { preset: 'secure', timeoutMs: 3500 },
  embedding: { strategy: 'ml' },
});

Limits

  • Script time and calls. Under the default secure preset, a script times out after 3.5 seconds (vm.timeoutMs) and may call tools up to 5,000 times (vm.maxSteps). Loops are limited to for…of, and for (…; …; …) with vm.allowLoops: true. The other presets set other limits.
  • Calls to one tool. More than vm.rapidEnumerationThreshold calls (default 30) to one tool within about 2 seconds stop the script with [RAPID_ENUMERATION]; calls made through parallel() count. Set per-tool values with vm.rapidEnumerationOverrides ({ 'users:get': 100 }). The sandbox's message says "in 5s", but it keeps only the last 2 seconds of calls.
  • Embedding model. With embedding.strategy: 'ml', CodeCall loads a local model (Xenova/all-MiniLM-L6-v2 by default), downloading it into embedding.cacheDir if it isn't there. When the model can't be loaded or used (offline with nothing cached, @huggingface/transformers missing, or embedding the tools fails), CodeCall logs one warning and searches with TF-IDF. A tool whose metadata can't be read is skipped with a warning; the others stay searchable.

Docs

Contributing

Source: plugins/plugin-codecall. Issues and pull requests are welcome; see CONTRIBUTING.md.

License

Apache-2.0. See LICENSE.

版本与发布记录

@frontmcp/plugin-codecall 共发布 112 个版本,首次发布于 2026/01/09;过去 12 个月发布了 112 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.12.2latest2026/11/151 天前
1.12.12026/11/132 天前
1.12.02026/11/114 天前
1.12.0-rc.1rc2026/11/114 天前
1.11.32026/11/106 天前
1.11.22026/11/096 天前

其他发布通道:beta → 1.1.2-beta.1,rc → 1.12.0-rc.1。

关于 @frontmcp/plugin-codecall 的常见问题

@frontmcp/plugin-codecall 是什么?

CodeCall plugin for FrontMCP: puts many tools behind search, describe, invoke and execute meta-tools, and runs scripts that call them in a sandbox

如何安装 @frontmcp/plugin-codecall?

在项目目录运行 npm install @frontmcp/plugin-codecall,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@frontmcp/sdk(1.12.2)、@frontmcp/lazy-zod(1.12.2)、@frontmcp/plugin-cache(1.12.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@frontmcp/plugin-codecall 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@frontmcp/plugin-codecall 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@frontmcp/plugin-codecall 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@frontmcp/plugin-codecall 可以商用吗?

@frontmcp/plugin-codecall 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@frontmcp/plugin-codecall 的下载量有多少?

根据 npm 官方下载统计,@frontmcp/plugin-codecall 在 2026/10/16 – 2026/11/14 这 30 天内被下载 7,673 次,日均约 256 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@frontmcp/plugin-codecall 还在维护吗?

最新版本 1.12.2 发布于 2026/11/15(1 天前);至今共发布 112 个版本,其中过去 12 个月发布了 112 个;首次发布于 2026/01/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。