@easynet/agent-tool 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +26 -51
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,58 +1,58 @@
1
1
  # Agent Tool
2
2
 
3
- **自动把你任意的 function SKILL,转换为 tool,链接到任何 LLM model agent。**
3
+ **Turns your arbitrary functions and SKILLs into tools and connects them to any LLM model and agent.**
4
4
 
5
5
  ---
6
6
 
7
- ## 支持什么
7
+ ## What's Supported
8
8
 
9
- | 来源 | 写法 |
10
- |------|------|
11
- | **任意函数** | 添加 `@tool` annotation 秒变 MCP tool |
12
- | **SKILL** | 全面支持 [SKILL](docs/AGENT_SKILLS_SPEC.md),不再依赖 Claude,支持任意 LLM |
13
- | **mcp.json** | 桥接其他 MCP |
9
+ | Source | How |
10
+ |--------|-----|
11
+ | **Arbitrary functions** | Add `@tool` annotation to turn them into MCP tools |
12
+ | **SKILL** | Full support for [SKILL](docs/AGENT_SKILLS_SPEC.md); no Claude dependency, works with any LLM |
13
+ | **mcp.json** | Bridge other MCPs |
14
14
 
15
15
  ---
16
16
 
17
- ## 快速启动
17
+ ## Quick Start
18
18
 
19
- 1. **安装**(Node 18+)
19
+ 1. **Install** (Node 18+)
20
20
 
21
21
  ```bash
22
22
  npm install @easynet/agent-tool
23
23
  ```
24
24
 
25
- 2. **编译**:在项目目录执行,输出到 `dist/`
25
+ 2. **Build**: from project directory, output goes to `dist/`
26
26
 
27
27
  ```bash
28
28
  agent-tool build
29
29
  ```
30
30
 
31
- 3. **发布**(可选):进 `dist/` 发布为自己的 npm
31
+ 3. **Publish** (optional): from `dist/` publish as your own npm package
32
32
 
33
33
  ```bash
34
34
  cd dist && npm publish
35
35
  ```
36
36
 
37
- 4. **运行**:进 `dist/` 后按正常 `npm start` 启动 MCP
37
+ 4. **Run**: from `dist/` start MCP as usual with `npm start`
38
38
 
39
39
  ```bash
40
40
  cd dist && npm install && npm start
41
41
  ```
42
42
 
43
- 5. **安装自己的包**:发布后可在任意项目 `npm install <你的包名>` 安装使用。
43
+ 5. **Install your package**: after publishing, use it anywhere with `npm install <your-package-name>`.
44
44
 
45
- Cursor / Claude MCP 客户端连 `mcp.json` 即可。
45
+ Connect with Cursor / Claude or any MCP client using `mcp.json`.
46
46
 
47
47
  ---
48
48
 
49
- ## 代码示例
49
+ ## Code Examples
50
50
 
51
- **@toolTypeScript)**
51
+ **@tool (TypeScript)**
52
52
 
53
53
  ```ts
54
54
  /**
55
- * 两数相加。
55
+ * Add two numbers.
56
56
  * @tool
57
57
  */
58
58
  export async function add(a: number, b: number): Promise<number> {
@@ -60,44 +60,19 @@ export async function add(a: number, b: number): Promise<number> {
60
60
  }
61
61
  ```
62
62
 
63
- 生成的 MCP 工具:
64
- - 名:`example.add`(文件 `src/tools/example.ts` 时为 `src.tools.example.add`)
65
- - 描述:两数相加
66
- - 入参:`a` (number)、`b` (number)
63
+ Generated MCP tool:
64
+ - Name: `example.add` (or `src.tools.example.add` when file is `src/tools/example.ts`)
65
+ - Description: Add two numbers
66
+ - Params: `a` (number), `b` (number)
67
67
 
68
- 工具名由路径+函数名决定,如 `src/tools/math.ts` 的 `add` → `src.tools.math.add`。
68
+ Tool name is derived from path + function name, e.g. `add` in `src/tools/math.ts` → `src.tools.math.add`.
69
69
 
70
70
  **SKILL**
71
71
 
72
- 目录内放 `SKILL.md`(YAML 头:namedescription)和可选的 `handler.js`。详见 [AGENT_SKILLS_SPEC](docs/AGENT_SKILLS_SPEC.md)
72
+ Put `SKILL.md` (YAML frontmatter: name, description) and optional `handler.js` in a directory. See [AGENT_SKILLS_SPEC](docs/AGENT_SKILLS_SPEC.md).
73
73
 
74
- **示例与扩展**
74
+ **Examples and Extensions**
75
75
 
76
- - 示例脚本与参考内容:`extensions/examples/`(ReAct 股票报告脚本、instruction-only skillMCP 配置)。
77
- - 示例工具扩展(core 风格):`extensions/example-tools/`(Yahoo Finance quote + chartFS/HTTP builtin-tools)。
76
+ - Example scripts and reference: `extensions/examples/` (ReAct stock report script, instruction-only skill, MCP config).
77
+ - Example tools extension (core style): `extensions/example-tools/` (Yahoo Finance quote + chart; FS/HTTP use builtin-tools).
78
78
 
79
- **运行 Agent(CLI 一条命令)**
80
-
81
- ```bash
82
- # 需配置 OPENAI_API_KEY;MCP 模式需项目根或 MCP_CONFIG_PATH 下有 mcp.json
83
- agent-tool run "你的任务" # 默认 local(builtin + example 工具)
84
- agent-tool run "你的任务" --mode mcp # MCP 模式(mcp.json 里的工具)
85
- agent-tool run "任务" -c agent.yaml # 用 YAML 指定要加载的 tool 名字
86
- agent-tool run "任务" --mode mcp --report out.html
87
- ```
88
-
89
- - `run`:执行 ReAct agent,第一个参数为任务,`--mode local|mcp` 选工具来源,`--config` / `-c` 指定 agent YAML,`--report` 指定报告路径。
90
- - **Agent YAML**:在 `agent.yaml` 里写 `mode` 和要加载的 **tool 名字**,framework 自动按名加载。示例见 `agent.yaml.example`:
91
- - `tools: [core/fs.readText, core/fs.listDir, example/finance.yahoo.quote]` 只加载列出的工具;
92
- - 支持 npm 描述符:`npm:@scope/package#toolPath`,如 `npm:@easynet/agent-tool-builtin-tools#fs.readText` → `core/fs.readText`;
93
- - 或 `tools: { builtin: [fs, http], example: true }` 按组加载。
94
- - `serve`:启动生成的 MCP 服务(stdio,用于测试):`agent-tool serve` 或 `agent-tool serve -p ./dist`。
95
- - 股票示例:`npm run agent:stock AAPL`(需先 `npm run build`)。
96
-
97
- **MCP 模式**:`agent-tool run "任务" --mode mcp`。Framework 读取当前目录或 `MCP_CONFIG_PATH` 下的 `mcp.json`,按配置用 stdio 启动 MCP server 并连接,将 MCP 工具转为 LangChain 工具供 agent 使用。
98
-
99
- - **用法**:`npm run agent -- --mode mcp "任务" [report.html]`。mcp.json 由用户配置(command、args、cwd),指向你要用的 MCP server。
100
- - **mcp.json**:`scripts/mcp.json` 为 Cursor 格式示例;裸配置见 `scripts/mcp-agent-tool.json`。将 `command`/`args` 改为你的 MCP 启动命令即可。
101
- - 环境变量:`AGENT_MODE`、`MCP_CONFIG_PATH`、`AGENT_TASK`、`AGENT_SYSTEM`、`OPENAI_API_KEY` 等。
102
-
103
- **Release (npmjs.org)**:Publish runs when you **push to branch `master`**, or manually: open **Actions** → select **Release** → **Run workflow**. Add **NPM_TOKEN** (npm Automation or Publish token for @easynet) in repo **Settings → Secrets and variables → Actions**.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easynet/agent-tool",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "MCP build: init → build → run. Turn your project (@tool, SKILL, n8n) into a standalone MCP npm server (no framework embedding, no package conflict).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",