@atbash/atbash-mcp 0.0.5 → 0.0.6-dev.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 +5 -2
- package/dist/index.js +59 -55
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,7 +33,8 @@ Add to your `claude_desktop_config.json`:
|
|
|
33
33
|
"command": "npx",
|
|
34
34
|
"args": ["-y", "@atbash/mcp"],
|
|
35
35
|
"env": {
|
|
36
|
-
"ATBASH_AGENT_PRIVKEY": "your_agent_private_key_here"
|
|
36
|
+
"ATBASH_AGENT_PRIVKEY": "your_agent_private_key_here",
|
|
37
|
+
"ATBASH_ORG_NAME": "your_org_name"
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -51,6 +52,7 @@ const transport = new StdioClientTransport({
|
|
|
51
52
|
env: {
|
|
52
53
|
...process.env,
|
|
53
54
|
ATBASH_AGENT_PRIVKEY: process.env.ATBASH_AGENT_PRIVKEY,
|
|
55
|
+
ATBASH_ORG_NAME: process.env.ATBASH_ORG_NAME,
|
|
54
56
|
},
|
|
55
57
|
});
|
|
56
58
|
```
|
|
@@ -60,6 +62,7 @@ const transport = new StdioClientTransport({
|
|
|
60
62
|
| Variable | Required | Description |
|
|
61
63
|
|---|---|---|
|
|
62
64
|
| `ATBASH_AGENT_PRIVKEY` | Yes | Your Atbash agent private key |
|
|
65
|
+
| `ATBASH_ORG_NAME` | Recommended | Your organization name. The SDK resolves the correct chain from it; without it, calls fall back to the default public chain. |
|
|
63
66
|
| `ATBASH_ENDPOINT` | No | Override the default Atbash endpoint (`https://atbash.ai`) |
|
|
64
67
|
|
|
65
68
|
## Tools
|
|
@@ -157,5 +160,5 @@ A runnable example is in [`examples/mcp-runtime-agent/`](./examples/mcp-runtime-
|
|
|
157
160
|
|
|
158
161
|
```bash
|
|
159
162
|
npm install && npm run build
|
|
160
|
-
ATBASH_AGENT_PRIVKEY=your_key_here node examples/mcp-runtime-agent/client.mjs
|
|
163
|
+
ATBASH_AGENT_PRIVKEY=your_key_here ATBASH_ORG_NAME=your_org node examples/mcp-runtime-agent/client.mjs
|
|
161
164
|
```
|
package/dist/index.js
CHANGED
|
@@ -49,16 +49,16 @@ function registerPolicyResource(server2, agent2, endpoint2) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// src/tools/judge.ts
|
|
52
|
-
import {
|
|
53
|
-
checkAgentExists,
|
|
54
|
-
createAtbashClient,
|
|
55
|
-
logToolCall
|
|
56
|
-
} from "@atbash/sdk";
|
|
52
|
+
import { Atbash } from "@atbash/sdk";
|
|
57
53
|
import { z as z2 } from "zod";
|
|
58
54
|
|
|
59
55
|
// src/utils.ts
|
|
60
|
-
function createClientOpts(endpoint2) {
|
|
61
|
-
|
|
56
|
+
function createClientOpts(agent2, endpoint2, orgName2) {
|
|
57
|
+
void agent2;
|
|
58
|
+
const opts = {};
|
|
59
|
+
if (endpoint2) opts.endpoint = endpoint2;
|
|
60
|
+
if (orgName2) opts.orgName = orgName2;
|
|
61
|
+
return Object.keys(opts).length > 0 ? opts : void 0;
|
|
62
62
|
}
|
|
63
63
|
function safeErrorMessage(error) {
|
|
64
64
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -76,12 +76,9 @@ function toErrorContent(error) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
// src/tools/judge.ts
|
|
79
|
-
function registerJudgeTools(server2, agent2, endpoint2) {
|
|
80
|
-
const opts = createClientOpts(endpoint2);
|
|
81
|
-
const client =
|
|
82
|
-
keyPair: { privKey: agent2.privkey, pubKey: agent2.pubkey },
|
|
83
|
-
judge: endpoint2 ? { endpoint: endpoint2 } : void 0
|
|
84
|
-
});
|
|
79
|
+
function registerJudgeTools(server2, agent2, endpoint2, orgName2) {
|
|
80
|
+
const opts = createClientOpts(agent2, endpoint2, orgName2);
|
|
81
|
+
const client = new Atbash(agent2.privkey, opts);
|
|
85
82
|
server2.registerTool(
|
|
86
83
|
"atbash_judge",
|
|
87
84
|
{
|
|
@@ -108,8 +105,15 @@ function registerJudgeTools(server2, agent2, endpoint2) {
|
|
|
108
105
|
args: parsedArgs ?? { action },
|
|
109
106
|
context: `${action} \u2014 ${context}`
|
|
110
107
|
});
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
if (decision.verdict === "HOLD") {
|
|
109
|
+
const holdParts = [
|
|
110
|
+
"Action held for operator review. The agent will not be jailed \u2014 please approve or reject this request from the Atbash dashboard, then ask the agent to try again.",
|
|
111
|
+
`Reason: ${decision.reason ?? ""}`
|
|
112
|
+
];
|
|
113
|
+
if (decision.toolCallId) holdParts.push(`Tool Call ID: ${decision.toolCallId}`);
|
|
114
|
+
return toJsonContent({ ...decision, allow: false, reason: holdParts.join("\n") });
|
|
115
|
+
}
|
|
116
|
+
return toJsonContent(decision);
|
|
113
117
|
} catch (error) {
|
|
114
118
|
return toErrorContent(error);
|
|
115
119
|
}
|
|
@@ -128,17 +132,27 @@ function registerJudgeTools(server2, agent2, endpoint2) {
|
|
|
128
132
|
},
|
|
129
133
|
async ({ action, context, tool_name, tool_args_json }) => {
|
|
130
134
|
try {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
let parsedArgs = void 0;
|
|
136
|
+
if (tool_args_json) {
|
|
137
|
+
try {
|
|
138
|
+
parsedArgs = JSON.parse(tool_args_json);
|
|
139
|
+
} catch {
|
|
140
|
+
parsedArgs = tool_args_json;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const result = await client.auditToolCall({
|
|
144
|
+
toolName: tool_name ?? "mcp_log",
|
|
145
|
+
args: parsedArgs ?? { action },
|
|
146
|
+
context: `${action} \u2014 ${context}`
|
|
147
|
+
});
|
|
148
|
+
if (result.verdict === "HOLD") {
|
|
149
|
+
const holdParts = [
|
|
150
|
+
"Action held for operator review. The agent will not be jailed \u2014 please approve or reject this request from the Atbash dashboard, then ask the agent to try again.",
|
|
151
|
+
`Reason: ${result.reason ?? ""}`
|
|
152
|
+
];
|
|
153
|
+
if (result.toolCallId) holdParts.push(`Tool Call ID: ${result.toolCallId}`);
|
|
154
|
+
return toJsonContent({ ...result, allow: false, reason: holdParts.join("\n") });
|
|
155
|
+
}
|
|
142
156
|
return toJsonContent(result);
|
|
143
157
|
} catch (error) {
|
|
144
158
|
return toErrorContent(error);
|
|
@@ -156,7 +170,7 @@ function registerJudgeTools(server2, agent2, endpoint2) {
|
|
|
156
170
|
async ({ pubkey }) => {
|
|
157
171
|
try {
|
|
158
172
|
const selectedPubkey = pubkey ?? agent2.pubkey;
|
|
159
|
-
const registered = await checkAgentExists(selectedPubkey
|
|
173
|
+
const registered = await client.checkAgentExists(selectedPubkey);
|
|
160
174
|
return toJsonContent({ registered, pubkey: selectedPubkey });
|
|
161
175
|
} catch (error) {
|
|
162
176
|
return toErrorContent(error);
|
|
@@ -166,25 +180,14 @@ function registerJudgeTools(server2, agent2, endpoint2) {
|
|
|
166
180
|
}
|
|
167
181
|
|
|
168
182
|
// src/tools/queries.ts
|
|
169
|
-
import {
|
|
170
|
-
getAgentDetail,
|
|
171
|
-
getAgentPolicy,
|
|
172
|
-
getAgentToolCalls,
|
|
173
|
-
getHeldActionReviews,
|
|
174
|
-
getOrgTierInfo,
|
|
175
|
-
getOrgToolCalls,
|
|
176
|
-
getPendingHeldActions,
|
|
177
|
-
getSafetyStats,
|
|
178
|
-
getToolCallCount,
|
|
179
|
-
getToolCallFull,
|
|
180
|
-
getToolCalls
|
|
181
|
-
} from "@atbash/sdk";
|
|
183
|
+
import { Atbash as Atbash2 } from "@atbash/sdk";
|
|
182
184
|
import { z as z3 } from "zod";
|
|
183
185
|
function defaultMaxCount(value) {
|
|
184
186
|
return value ?? 20;
|
|
185
187
|
}
|
|
186
|
-
function registerQueryTools(server2, agent2, endpoint2) {
|
|
187
|
-
const opts = createClientOpts(endpoint2);
|
|
188
|
+
function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
189
|
+
const opts = createClientOpts(agent2, endpoint2, orgName2);
|
|
190
|
+
const client = new Atbash2(agent2.privkey, opts);
|
|
188
191
|
server2.registerTool(
|
|
189
192
|
"atbash_get_policy",
|
|
190
193
|
{
|
|
@@ -195,7 +198,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
|
|
|
195
198
|
},
|
|
196
199
|
async ({ pubkey }) => {
|
|
197
200
|
try {
|
|
198
|
-
return toJsonContent(await getAgentPolicy(pubkey ?? agent2.pubkey
|
|
201
|
+
return toJsonContent(await client.getAgentPolicy(pubkey ?? agent2.pubkey));
|
|
199
202
|
} catch (error) {
|
|
200
203
|
return toErrorContent(error);
|
|
201
204
|
}
|
|
@@ -211,7 +214,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
|
|
|
211
214
|
},
|
|
212
215
|
async ({ pubkey }) => {
|
|
213
216
|
try {
|
|
214
|
-
return toJsonContent(await getAgentDetail(pubkey ?? agent2.pubkey
|
|
217
|
+
return toJsonContent(await client.getAgentDetail(pubkey ?? agent2.pubkey));
|
|
215
218
|
} catch (error) {
|
|
216
219
|
return toErrorContent(error);
|
|
217
220
|
}
|
|
@@ -227,7 +230,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
|
|
|
227
230
|
},
|
|
228
231
|
async ({ max_count }) => {
|
|
229
232
|
try {
|
|
230
|
-
return toJsonContent(await getToolCalls(defaultMaxCount(max_count)
|
|
233
|
+
return toJsonContent(await client.getToolCalls(defaultMaxCount(max_count)));
|
|
231
234
|
} catch (error) {
|
|
232
235
|
return toErrorContent(error);
|
|
233
236
|
}
|
|
@@ -245,7 +248,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
|
|
|
245
248
|
async ({ pubkey, max_count }) => {
|
|
246
249
|
try {
|
|
247
250
|
return toJsonContent(
|
|
248
|
-
await getAgentToolCalls(pubkey ?? agent2.pubkey, defaultMaxCount(max_count)
|
|
251
|
+
await client.getAgentToolCalls(pubkey ?? agent2.pubkey, defaultMaxCount(max_count))
|
|
249
252
|
);
|
|
250
253
|
} catch (error) {
|
|
251
254
|
return toErrorContent(error);
|
|
@@ -263,7 +266,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
|
|
|
263
266
|
},
|
|
264
267
|
async ({ org_name, max_count }) => {
|
|
265
268
|
try {
|
|
266
|
-
return toJsonContent(await getOrgToolCalls(org_name, defaultMaxCount(max_count)
|
|
269
|
+
return toJsonContent(await client.getOrgToolCalls(org_name, defaultMaxCount(max_count)));
|
|
267
270
|
} catch (error) {
|
|
268
271
|
return toErrorContent(error);
|
|
269
272
|
}
|
|
@@ -279,7 +282,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
|
|
|
279
282
|
},
|
|
280
283
|
async ({ tool_call_id }) => {
|
|
281
284
|
try {
|
|
282
|
-
return toJsonContent(await getToolCallFull(tool_call_id
|
|
285
|
+
return toJsonContent(await client.getToolCallFull(tool_call_id));
|
|
283
286
|
} catch (error) {
|
|
284
287
|
return toErrorContent(error);
|
|
285
288
|
}
|
|
@@ -293,7 +296,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
|
|
|
293
296
|
},
|
|
294
297
|
async () => {
|
|
295
298
|
try {
|
|
296
|
-
return toJsonContent({ count: await getToolCallCount(
|
|
299
|
+
return toJsonContent({ count: await client.getToolCallCount() });
|
|
297
300
|
} catch (error) {
|
|
298
301
|
return toErrorContent(error);
|
|
299
302
|
}
|
|
@@ -309,7 +312,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
|
|
|
309
312
|
},
|
|
310
313
|
async ({ org_name }) => {
|
|
311
314
|
try {
|
|
312
|
-
return toJsonContent(await
|
|
315
|
+
return toJsonContent(await client.getOrgSubscription(org_name));
|
|
313
316
|
} catch (error) {
|
|
314
317
|
return toErrorContent(error);
|
|
315
318
|
}
|
|
@@ -327,7 +330,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
|
|
|
327
330
|
async ({ org_name, max_count }) => {
|
|
328
331
|
try {
|
|
329
332
|
return toJsonContent(
|
|
330
|
-
await getPendingHeldActions(org_name, defaultMaxCount(max_count)
|
|
333
|
+
await client.getPendingHeldActions(org_name, defaultMaxCount(max_count))
|
|
331
334
|
);
|
|
332
335
|
} catch (error) {
|
|
333
336
|
return toErrorContent(error);
|
|
@@ -345,7 +348,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
|
|
|
345
348
|
},
|
|
346
349
|
async ({ org_name, max_count }) => {
|
|
347
350
|
try {
|
|
348
|
-
return toJsonContent(await getHeldActionReviews(org_name, defaultMaxCount(max_count)
|
|
351
|
+
return toJsonContent(await client.getHeldActionReviews(org_name, defaultMaxCount(max_count)));
|
|
349
352
|
} catch (error) {
|
|
350
353
|
return toErrorContent(error);
|
|
351
354
|
}
|
|
@@ -359,7 +362,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
|
|
|
359
362
|
},
|
|
360
363
|
async () => {
|
|
361
364
|
try {
|
|
362
|
-
return toJsonContent(await getSafetyStats(
|
|
365
|
+
return toJsonContent(await client.getSafetyStats());
|
|
363
366
|
} catch (error) {
|
|
364
367
|
return toErrorContent(error);
|
|
365
368
|
}
|
|
@@ -436,6 +439,7 @@ if (!privkey) {
|
|
|
436
439
|
}
|
|
437
440
|
var agent = loadAgent(privkey);
|
|
438
441
|
var endpoint = process.env.ATBASH_ENDPOINT;
|
|
442
|
+
var orgName = process.env.ATBASH_ORG_NAME;
|
|
439
443
|
setupTelemetry({ enabled: true, source: "plugin:mcp" });
|
|
440
444
|
process.once("beforeExit", () => shutdownTelemetry());
|
|
441
445
|
process.once("SIGINT", () => shutdownTelemetry().finally(() => process.exit(0)));
|
|
@@ -444,9 +448,9 @@ var server = new McpServer({
|
|
|
444
448
|
name: "atbash-safety",
|
|
445
449
|
version: "1.0.0"
|
|
446
450
|
});
|
|
447
|
-
registerJudgeTools(server, agent, endpoint);
|
|
451
|
+
registerJudgeTools(server, agent, endpoint, orgName);
|
|
448
452
|
registerStatusTools(server, agent.pubkey, endpoint);
|
|
449
|
-
registerQueryTools(server, agent, endpoint);
|
|
453
|
+
registerQueryTools(server, agent, endpoint, orgName);
|
|
450
454
|
registerPolicyResource(server, agent, endpoint);
|
|
451
455
|
registerSafetyPrompt(server);
|
|
452
456
|
var transport = new StdioServerTransport();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atbash/atbash-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6-dev.1",
|
|
4
4
|
"description": "Atbash safety judge exposed as a standalone MCP server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"publish:dev": "node scripts/publish-dev.mjs"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@atbash/sdk": "
|
|
44
|
+
"@atbash/sdk": "0.5.3-dev.0",
|
|
45
45
|
"@modelcontextprotocol/sdk": "^1.12.3",
|
|
46
46
|
"zod": "^3.25.76"
|
|
47
47
|
},
|