@atbash/atbash-mcp 0.0.6-dev.0 → 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/dist/index.js +29 -47
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -49,17 +49,14 @@ function registerPolicyResource(server2, agent2, endpoint2) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// src/tools/judge.ts
|
|
52
|
-
import {
|
|
53
|
-
checkAgentExists,
|
|
54
|
-
createAtbashClient
|
|
55
|
-
} from "@atbash/sdk";
|
|
52
|
+
import { Atbash } from "@atbash/sdk";
|
|
56
53
|
import { z as z2 } from "zod";
|
|
57
54
|
|
|
58
55
|
// src/utils.ts
|
|
59
56
|
function createClientOpts(agent2, endpoint2, orgName2) {
|
|
57
|
+
void agent2;
|
|
60
58
|
const opts = {};
|
|
61
59
|
if (endpoint2) opts.endpoint = endpoint2;
|
|
62
|
-
if (agent2) opts.auth = agent2;
|
|
63
60
|
if (orgName2) opts.orgName = orgName2;
|
|
64
61
|
return Object.keys(opts).length > 0 ? opts : void 0;
|
|
65
62
|
}
|
|
@@ -81,11 +78,7 @@ function toErrorContent(error) {
|
|
|
81
78
|
// src/tools/judge.ts
|
|
82
79
|
function registerJudgeTools(server2, agent2, endpoint2, orgName2) {
|
|
83
80
|
const opts = createClientOpts(agent2, endpoint2, orgName2);
|
|
84
|
-
const client =
|
|
85
|
-
keyPair: { privKey: agent2.privkey, pubKey: agent2.pubkey },
|
|
86
|
-
judge: endpoint2 ? { endpoint: endpoint2 } : void 0,
|
|
87
|
-
orgName: orgName2
|
|
88
|
-
});
|
|
81
|
+
const client = new Atbash(agent2.privkey, opts);
|
|
89
82
|
server2.registerTool(
|
|
90
83
|
"atbash_judge",
|
|
91
84
|
{
|
|
@@ -113,12 +106,12 @@ function registerJudgeTools(server2, agent2, endpoint2, orgName2) {
|
|
|
113
106
|
context: `${action} \u2014 ${context}`
|
|
114
107
|
});
|
|
115
108
|
if (decision.verdict === "HOLD") {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
});
|
|
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") });
|
|
122
115
|
}
|
|
123
116
|
return toJsonContent(decision);
|
|
124
117
|
} catch (error) {
|
|
@@ -153,12 +146,12 @@ Reason: ${decision.reason ?? ""}`
|
|
|
153
146
|
context: `${action} \u2014 ${context}`
|
|
154
147
|
});
|
|
155
148
|
if (result.verdict === "HOLD") {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
});
|
|
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") });
|
|
162
155
|
}
|
|
163
156
|
return toJsonContent(result);
|
|
164
157
|
} catch (error) {
|
|
@@ -177,7 +170,7 @@ Reason: ${result.reason ?? ""}`
|
|
|
177
170
|
async ({ pubkey }) => {
|
|
178
171
|
try {
|
|
179
172
|
const selectedPubkey = pubkey ?? agent2.pubkey;
|
|
180
|
-
const registered = await checkAgentExists(selectedPubkey
|
|
173
|
+
const registered = await client.checkAgentExists(selectedPubkey);
|
|
181
174
|
return toJsonContent({ registered, pubkey: selectedPubkey });
|
|
182
175
|
} catch (error) {
|
|
183
176
|
return toErrorContent(error);
|
|
@@ -187,25 +180,14 @@ Reason: ${result.reason ?? ""}`
|
|
|
187
180
|
}
|
|
188
181
|
|
|
189
182
|
// src/tools/queries.ts
|
|
190
|
-
import {
|
|
191
|
-
getAgentDetail,
|
|
192
|
-
getAgentPolicy,
|
|
193
|
-
getAgentToolCalls,
|
|
194
|
-
getHeldActionReviews,
|
|
195
|
-
getOrgSubscription,
|
|
196
|
-
getOrgToolCalls,
|
|
197
|
-
getPendingHeldActions,
|
|
198
|
-
getSafetyStats,
|
|
199
|
-
getToolCallCount,
|
|
200
|
-
getToolCallFull,
|
|
201
|
-
getToolCalls
|
|
202
|
-
} from "@atbash/sdk";
|
|
183
|
+
import { Atbash as Atbash2 } from "@atbash/sdk";
|
|
203
184
|
import { z as z3 } from "zod";
|
|
204
185
|
function defaultMaxCount(value) {
|
|
205
186
|
return value ?? 20;
|
|
206
187
|
}
|
|
207
188
|
function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
208
189
|
const opts = createClientOpts(agent2, endpoint2, orgName2);
|
|
190
|
+
const client = new Atbash2(agent2.privkey, opts);
|
|
209
191
|
server2.registerTool(
|
|
210
192
|
"atbash_get_policy",
|
|
211
193
|
{
|
|
@@ -216,7 +198,7 @@ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
|
216
198
|
},
|
|
217
199
|
async ({ pubkey }) => {
|
|
218
200
|
try {
|
|
219
|
-
return toJsonContent(await getAgentPolicy(pubkey ?? agent2.pubkey
|
|
201
|
+
return toJsonContent(await client.getAgentPolicy(pubkey ?? agent2.pubkey));
|
|
220
202
|
} catch (error) {
|
|
221
203
|
return toErrorContent(error);
|
|
222
204
|
}
|
|
@@ -232,7 +214,7 @@ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
|
232
214
|
},
|
|
233
215
|
async ({ pubkey }) => {
|
|
234
216
|
try {
|
|
235
|
-
return toJsonContent(await getAgentDetail(pubkey ?? agent2.pubkey
|
|
217
|
+
return toJsonContent(await client.getAgentDetail(pubkey ?? agent2.pubkey));
|
|
236
218
|
} catch (error) {
|
|
237
219
|
return toErrorContent(error);
|
|
238
220
|
}
|
|
@@ -248,7 +230,7 @@ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
|
248
230
|
},
|
|
249
231
|
async ({ max_count }) => {
|
|
250
232
|
try {
|
|
251
|
-
return toJsonContent(await getToolCalls(defaultMaxCount(max_count)
|
|
233
|
+
return toJsonContent(await client.getToolCalls(defaultMaxCount(max_count)));
|
|
252
234
|
} catch (error) {
|
|
253
235
|
return toErrorContent(error);
|
|
254
236
|
}
|
|
@@ -266,7 +248,7 @@ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
|
266
248
|
async ({ pubkey, max_count }) => {
|
|
267
249
|
try {
|
|
268
250
|
return toJsonContent(
|
|
269
|
-
await getAgentToolCalls(pubkey ?? agent2.pubkey, defaultMaxCount(max_count)
|
|
251
|
+
await client.getAgentToolCalls(pubkey ?? agent2.pubkey, defaultMaxCount(max_count))
|
|
270
252
|
);
|
|
271
253
|
} catch (error) {
|
|
272
254
|
return toErrorContent(error);
|
|
@@ -284,7 +266,7 @@ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
|
284
266
|
},
|
|
285
267
|
async ({ org_name, max_count }) => {
|
|
286
268
|
try {
|
|
287
|
-
return toJsonContent(await getOrgToolCalls(org_name, defaultMaxCount(max_count)
|
|
269
|
+
return toJsonContent(await client.getOrgToolCalls(org_name, defaultMaxCount(max_count)));
|
|
288
270
|
} catch (error) {
|
|
289
271
|
return toErrorContent(error);
|
|
290
272
|
}
|
|
@@ -300,7 +282,7 @@ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
|
300
282
|
},
|
|
301
283
|
async ({ tool_call_id }) => {
|
|
302
284
|
try {
|
|
303
|
-
return toJsonContent(await getToolCallFull(tool_call_id
|
|
285
|
+
return toJsonContent(await client.getToolCallFull(tool_call_id));
|
|
304
286
|
} catch (error) {
|
|
305
287
|
return toErrorContent(error);
|
|
306
288
|
}
|
|
@@ -314,7 +296,7 @@ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
|
314
296
|
},
|
|
315
297
|
async () => {
|
|
316
298
|
try {
|
|
317
|
-
return toJsonContent({ count: await getToolCallCount(
|
|
299
|
+
return toJsonContent({ count: await client.getToolCallCount() });
|
|
318
300
|
} catch (error) {
|
|
319
301
|
return toErrorContent(error);
|
|
320
302
|
}
|
|
@@ -330,7 +312,7 @@ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
|
330
312
|
},
|
|
331
313
|
async ({ org_name }) => {
|
|
332
314
|
try {
|
|
333
|
-
return toJsonContent(await getOrgSubscription(org_name
|
|
315
|
+
return toJsonContent(await client.getOrgSubscription(org_name));
|
|
334
316
|
} catch (error) {
|
|
335
317
|
return toErrorContent(error);
|
|
336
318
|
}
|
|
@@ -348,7 +330,7 @@ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
|
348
330
|
async ({ org_name, max_count }) => {
|
|
349
331
|
try {
|
|
350
332
|
return toJsonContent(
|
|
351
|
-
await getPendingHeldActions(org_name, defaultMaxCount(max_count)
|
|
333
|
+
await client.getPendingHeldActions(org_name, defaultMaxCount(max_count))
|
|
352
334
|
);
|
|
353
335
|
} catch (error) {
|
|
354
336
|
return toErrorContent(error);
|
|
@@ -366,7 +348,7 @@ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
|
366
348
|
},
|
|
367
349
|
async ({ org_name, max_count }) => {
|
|
368
350
|
try {
|
|
369
|
-
return toJsonContent(await getHeldActionReviews(org_name, defaultMaxCount(max_count)
|
|
351
|
+
return toJsonContent(await client.getHeldActionReviews(org_name, defaultMaxCount(max_count)));
|
|
370
352
|
} catch (error) {
|
|
371
353
|
return toErrorContent(error);
|
|
372
354
|
}
|
|
@@ -380,7 +362,7 @@ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
|
|
|
380
362
|
},
|
|
381
363
|
async () => {
|
|
382
364
|
try {
|
|
383
|
-
return toJsonContent(await getSafetyStats(
|
|
365
|
+
return toJsonContent(await client.getSafetyStats());
|
|
384
366
|
} catch (error) {
|
|
385
367
|
return toErrorContent(error);
|
|
386
368
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atbash/atbash-mcp",
|
|
3
|
-
"version": "0.0.6-dev.
|
|
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
|
},
|