agent-tool-hub 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 +216 -0
- package/dist/N8nLocalAdapter-6RKQJXJP.js +4 -0
- package/dist/N8nLocalAdapter-6RKQJXJP.js.map +1 -0
- package/dist/N8nLocalAdapter-MDWME5ZG.cjs +13 -0
- package/dist/N8nLocalAdapter-MDWME5ZG.cjs.map +1 -0
- package/dist/chunk-2CEY2WAM.js +5270 -0
- package/dist/chunk-2CEY2WAM.js.map +1 -0
- package/dist/chunk-GD4JXJHB.cjs +5335 -0
- package/dist/chunk-GD4JXJHB.cjs.map +1 -0
- package/dist/chunk-MHEFFZBB.js +134 -0
- package/dist/chunk-MHEFFZBB.js.map +1 -0
- package/dist/chunk-NTTBDQUF.cjs +118 -0
- package/dist/chunk-NTTBDQUF.cjs.map +1 -0
- package/dist/chunk-X53WXBKX.cjs +136 -0
- package/dist/chunk-X53WXBKX.cjs.map +1 -0
- package/dist/chunk-YSYEED4K.js +114 -0
- package/dist/chunk-YSYEED4K.js.map +1 -0
- package/dist/index.cjs +591 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +552 -0
- package/dist/index.d.ts +552 -0
- package/dist/index.js +357 -0
- package/dist/index.js.map +1 -0
- package/dist/toolhub-runtime-CQkP4QVW.d.cts +1564 -0
- package/dist/toolhub-runtime-CQkP4QVW.d.ts +1564 -0
- package/dist/toolhub-runtime.cjs +29 -0
- package/dist/toolhub-runtime.cjs.map +1 -0
- package/dist/toolhub-runtime.d.cts +4 -0
- package/dist/toolhub-runtime.d.ts +4 -0
- package/dist/toolhub-runtime.js +4 -0
- package/dist/toolhub-runtime.js.map +1 -0
- package/package.json +71 -0
package/README.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Agent Tool Hub
|
|
2
|
+
|
|
3
|
+
Agent Tool Hub is a multi-protocol tool registry + PTC runtime that unifies discovery, governance, and execution for tools across MCP, LangChain, n8n, SKILL, and built-in core tools.
|
|
4
|
+
|
|
5
|
+
## What We Support
|
|
6
|
+
|
|
7
|
+
### Protocols / Tool Types
|
|
8
|
+
|
|
9
|
+
| Type | How it’s discovered/connected | Typical use |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| MCP | `mcp.json` (stdio or SSE/HTTP) | Remote tool servers / ecosystem tools |
|
|
12
|
+
| LangChain Tool | `index.js/.mjs` or `langchain/` directory | Local code tools |
|
|
13
|
+
| n8n Workflow | `workflow.json` | Automation workflows |
|
|
14
|
+
| SKILL (Anthropic) | `SKILL.md` (optional `handler.js/.mjs`) | Instructional skills / subflows |
|
|
15
|
+
| Core Tools (built-in) | `roots: coreTools` | Safe FS / HTTP / Utils |
|
|
16
|
+
|
|
17
|
+
### Core Capabilities
|
|
18
|
+
|
|
19
|
+
- Unified ToolSpec abstraction with JSON Schema
|
|
20
|
+
- PTC runtime: validation, policy gating, budgets/retries, evidence
|
|
21
|
+
- Multi-root discovery with namespaces and optional hot-reload
|
|
22
|
+
- Security baseline: sandbox paths, allowlists, SSRF protections
|
|
23
|
+
- Observability: events, metrics, tracing
|
|
24
|
+
- Async workflows for n8n
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm i agent-tool-hub
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- Node >= 18
|
|
35
|
+
- Optional peers: `@langchain/core`, `@modelcontextprotocol/sdk`
|
|
36
|
+
|
|
37
|
+
### Configure via `toolhub.yaml`
|
|
38
|
+
|
|
39
|
+
Agent Tool Hub is configured by a YAML file. Keep it simple:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
discovery:
|
|
43
|
+
roots:
|
|
44
|
+
- path: ./tools
|
|
45
|
+
namespace: app
|
|
46
|
+
- path: coreTools
|
|
47
|
+
namespace: core
|
|
48
|
+
config:
|
|
49
|
+
sandboxRoot: /tmp/toolhub-sandbox
|
|
50
|
+
allowedHosts:
|
|
51
|
+
- api.github.com
|
|
52
|
+
- "*.example.com"
|
|
53
|
+
|
|
54
|
+
adapters:
|
|
55
|
+
n8n:
|
|
56
|
+
mode: api
|
|
57
|
+
api:
|
|
58
|
+
apiBaseUrl: http://localhost:5678
|
|
59
|
+
apiKey: ""
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Your framework can load this config and initialize Agent Tool Hub accordingly.
|
|
63
|
+
|
|
64
|
+
### Initialize from a config file path
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { createAgentToolHub } from "agent-tool-hub";
|
|
68
|
+
|
|
69
|
+
const hub = await createAgentToolHub("./toolhub.yaml");
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### List tools
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
const tools = hub.listToolMetadata();
|
|
76
|
+
// [{ name, description }, ...]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Invoke a tool
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
const result = await hub.invokeTool(
|
|
83
|
+
"core/http.fetchJson",
|
|
84
|
+
{ url: "https://api.github.com" },
|
|
85
|
+
{
|
|
86
|
+
permissions: ["network", "read:web"],
|
|
87
|
+
budget: { timeoutMs: 10_000, maxRetries: 1 },
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
if (!result.ok) {
|
|
92
|
+
console.error(result.error);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Tool Discovery Rules
|
|
97
|
+
|
|
98
|
+
- All subdirectories under each `roots` entry are scanned.
|
|
99
|
+
- Tool kind is inferred by marker files:
|
|
100
|
+
`SKILL.md` / `workflow.json` / `mcp.json` / `index.js(.mjs)`
|
|
101
|
+
- Avoid mixing multiple marker files in the same folder.
|
|
102
|
+
|
|
103
|
+
Example structure:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
tools/
|
|
107
|
+
weather/
|
|
108
|
+
mcp.json
|
|
109
|
+
notify/
|
|
110
|
+
workflow.json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Add a New Tool (Recommended)
|
|
114
|
+
|
|
115
|
+
### 1) Create a tool folder
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
./tools/my-tool/
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 2) Add the tool implementation by kind
|
|
122
|
+
|
|
123
|
+
#### MCP tool
|
|
124
|
+
|
|
125
|
+
Add `mcp.json`:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{ "command": "npx", "args": ["-y", "your-mcp-server"] }
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
or remote:
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{ "url": "https://mcp.example.com" }
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### LangChain tool
|
|
138
|
+
|
|
139
|
+
Create `index.js/.mjs` that implements LangChain's interface (e.g., `StructuredTool`):
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
import { StructuredTool } from "@langchain/core/tools";
|
|
143
|
+
import { z } from "zod";
|
|
144
|
+
|
|
145
|
+
class CalculatorTool extends StructuredTool {
|
|
146
|
+
name = "calculator";
|
|
147
|
+
description = "Evaluates simple arithmetic expressions";
|
|
148
|
+
|
|
149
|
+
schema = z.object({
|
|
150
|
+
expression: z.string(),
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
async _call({ expression }) {
|
|
154
|
+
const sanitized = expression.replace(/[^0-9+\\-*/().% ]/g, "");
|
|
155
|
+
if (sanitized !== expression) {
|
|
156
|
+
throw new Error("Invalid characters in expression");
|
|
157
|
+
}
|
|
158
|
+
const result = Function(`\"use strict\"; return (${sanitized})`)();
|
|
159
|
+
return String(result);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export default new CalculatorTool();
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### n8n workflow
|
|
167
|
+
|
|
168
|
+
Add `workflow.json` with a `nodes` array:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{ "id": "wf-123", "name": "send-slack", "nodes": [] }
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
- Set `adapters.n8n.mode: api | local` in `toolhub.yaml`.
|
|
175
|
+
- Local mode auto-imports/syncs workflows.
|
|
176
|
+
|
|
177
|
+
#### SKILL
|
|
178
|
+
|
|
179
|
+
Add `SKILL.md` (Anthropic Skills format):
|
|
180
|
+
|
|
181
|
+
```md
|
|
182
|
+
---
|
|
183
|
+
name: send-email
|
|
184
|
+
description: Sends a confirmation email when user completes checkout.
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
Instructions go here.
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Optional `handler.js/.mjs` can provide executable logic.
|
|
191
|
+
|
|
192
|
+
## Core Tools (Built-in)
|
|
193
|
+
|
|
194
|
+
- FS: `core/fs.readText`, `core/fs.writeText`, `core/fs.listDir`, `core/fs.searchText`, `core/fs.sha256`, `core/fs.deletePath`
|
|
195
|
+
- HTTP: `core/http.fetchText`, `core/http.fetchJson`, `core/http.downloadFile`, `core/http.head`
|
|
196
|
+
- Utils: `core/util.jsonSelect`, `core/util.truncate`, `core/util.hashText`, `core/util.now`, `core/util.templateRender`
|
|
197
|
+
|
|
198
|
+
Enable via `roots` entry `coreTools` and provide `sandboxRoot` + `allowedHosts`.
|
|
199
|
+
|
|
200
|
+
## Permissions and Capabilities
|
|
201
|
+
|
|
202
|
+
Common capabilities:
|
|
203
|
+
|
|
204
|
+
- `read:web`, `network`
|
|
205
|
+
- `read:fs`, `write:fs`
|
|
206
|
+
- `read:db`, `write:db`
|
|
207
|
+
- `workflow`, `gpu`
|
|
208
|
+
- `danger:destructive`
|
|
209
|
+
|
|
210
|
+
Pass `permissions` when invoking tools to satisfy policy gates.
|
|
211
|
+
|
|
212
|
+
## Publishing (maintainers)
|
|
213
|
+
|
|
214
|
+
Releases are automated via GitHub Actions (`.github/workflows/release.yml`). On push to `master`, tests and build run, then [semantic-release](https://github.com/semantic-release/semantic-release) publishes to npm (patch-only).
|
|
215
|
+
|
|
216
|
+
**Required:** Add `NPM_TOKEN` in the repo’s **Settings → Secrets and variables → Actions**. The token must be a [granular access token](https://docs.npmjs.com/creating-and-viewing-access-tokens) with **“bypass 2fa”** (or an automation token) so CI can publish; otherwise npm returns 403.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"N8nLocalAdapter-6RKQJXJP.js"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkX53WXBKX_cjs = require('./chunk-X53WXBKX.cjs');
|
|
4
|
+
require('./chunk-NTTBDQUF.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "N8nLocalAdapter", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkX53WXBKX_cjs.N8nLocalAdapter; }
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=N8nLocalAdapter-MDWME5ZG.cjs.map
|
|
13
|
+
//# sourceMappingURL=N8nLocalAdapter-MDWME5ZG.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"N8nLocalAdapter-MDWME5ZG.cjs"}
|