@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.
- package/README.md +26 -51
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
# Agent Tool
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
|
12
|
-
| **SKILL** |
|
|
13
|
-
| **mcp.json** |
|
|
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.
|
|
19
|
+
1. **Install** (Node 18+)
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
npm install @easynet/agent-tool
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
2.
|
|
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.
|
|
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.
|
|
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.
|
|
43
|
+
5. **Install your package**: after publishing, use it anywhere with `npm install <your-package-name>`.
|
|
44
44
|
|
|
45
|
-
|
|
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
|
-
**@tool
|
|
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
|
-
→
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
-
|
|
77
|
-
-
|
|
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.
|
|
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",
|