@ax-llm/ax-tools

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

Ax 工具包

中文使用文档
文档目录18 节
  1. 概览
  2. 特征
  3. MCP 工具
  4. 持续事件运行时间存储
  5. 函数工具
  6. 安装
  7. 使用量
  8. MCP 基础运输
  9. 有工厂功能
  10. JavaScript 代码执行
  11. 配置选项
  12. 实例
  13. 内存服务器
  14. 清理
  15. API 参考
  16. AxMCPSTDio 运输
  17. ax 创建MCPSTDio 运输
  18. 许可证

@ ax-llm/ ax-工具

Ax LLM框架的节点.js特有工具.

概览

此软件包提供了无法包含的 Node.js 特定功能 主体 @ax-llm/ax 由于浏览器兼容性要求,软件包。 这个 主软件包设计在节点.js和浏览器环境中同时工作,同时 此软件包提供Node.js- only特性.

特征

MCP 工具

AxMCPSTDio 运输

与 MCP 通信的示范背景协议的传输 通过 stdin/ stdout 服务器。 这样可以将本地 MCP 服务器作为孩子运行 进程.

持续事件运行时间存储

@ax-llm/ax-tools/event/sqlite 出口 AxSQLiteEventStore 财务报告和审定财务报表 AX_SQLITE_EVENT_STANDARD_RETENTION。它支持合作节点进程 共享本地 SQLite 文件。 它不用于网络文件系统 .

函数工具

AxJSRuntime 已移动到 @ax-llm/ax。 。 。 .

安装

npm install @ax-llm/ax-tools

使用量

MCP 基础运输

import { ax, AxMCPClient } from "@ax-llm/ax";
import { AxMCPStdioTransport } from "@ax-llm/ax-tools";

// Create a stdio transport for an MCP server
const transport = new AxMCPStdioTransport({
  command: "npx",
  args: ["-y", "@modelcontextprotocol/server-memory"],
  env: process.env,
});

// Create MCP client
const client = new AxMCPClient(transport, { debug: true });
await client.init();

// Attach the live client natively to AxGen, AxAgent, or AxFlow.
const program = ax('question:string -> answer:string', { mcp: client });

有工厂功能

import { axCreateMCPStdioTransport } from "@ax-llm/ax-tools";

const transport = axCreateMCPStdioTransport({
  command: "uvx",
  args: ["blender-mcp"],
});

JavaScript 代码执行

使用 AxJSRuntime 从 @ax-llm/ax数字 :

import { ai, AxJSRuntime, AxJSRuntimePermission } from "@ax-llm/ax";

配置选项

MCP 运输

interface StdioTransportConfig {
  command: string; // The command to execute
  args?: string[]; // Optional arguments
  env?: NodeJS.ProcessEnv; // Optional environment variables
}

JS 口译员权限

见 @ax-llm/ax 文档 AxJSRuntimePermission。 。 。 .

实例

内存服务器

import { ai, AxAgent, AxMCPClient } from "@ax-llm/ax";
import { AxMCPStdioTransport } from "@ax-llm/ax-tools";

// Initialize MCP client with memory server
const transport = new AxMCPStdioTransport({
  command: "npx",
  args: ["-y", "@modelcontextprotocol/server-memory"],
});

const client = new AxMCPClient(transport, { debug: false });
await client.init();

// Create agent with memory capabilities
const agent = new AxAgent({
  name: "MemoryAgent",
  description: "An agent that can remember information",
  signature: "userMessage -> response",
  functions: [client],
});

// Use with AI
const ai = ai({
  name: "openai",
  apiKey: process.env.OPENAI_APIKEY!,
});

const result = await agent.forward(ai, {
  userMessage: "Remember that my favorite color is blue",
});

清理

完成后总是清理运输:

// Terminate the child process
await transport.terminate();

API 参考

AxMCPSTDio 运输

构造器

new AxMCPStdioTransport(config: StdioTransportConfig)

方法

  • send(message: AxMCPJSONRPCRequest): Promise<AxMCPJSONRPCResponse> - 发送一个 请求
  • sendNotification(message: AxMCPJSONRPCNotification): Promise<void> - 发送一个 通知
  • connect(): Promise<void> - 连接(Stdio不开放)
  • terminate(): Promise<void> - 终止儿童程序

ax 创建MCPSTDio 运输

创建新运输实例的工厂功能:

axCreateMCPStdioTransport(config: StdioTransportConfig): AxMCPStdioTransport

许可证

阿帕奇 - 2.0

版本与发布记录

@ax-llm/ax-tools 共发布 269 个版本,首次发布于 2025/07/15;过去 12 个月发布了 217 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
25.4.9latest2026/11/07今天
25.4.82026/11/034 天前
25.4.72026/10/299 天前
25.4.62026/10/2612 天前
25.4.52026/10/2117 天前
25.4.42026/10/2117 天前

关于 @ax-llm/ax-tools 的常见问题

@ax-llm/ax-tools 是什么?

Ax 工具包

如何安装 @ax-llm/ax-tools?

在项目目录运行 npm install @ax-llm/ax-tools,或使用 pnpm add / yarn add / bun add。

@ax-llm/ax-tools 支持 TypeScript 吗?

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

@ax-llm/ax-tools 支持 ESM 还是 CommonJS?

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

@ax-llm/ax-tools 可以商用吗?

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

@ax-llm/ax-tools 的下载量有多少?

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

@ax-llm/ax-tools 还在维护吗?

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