@atbash/atbash-mcp 0.0.3-dev.0 → 0.0.3-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.
Files changed (3) hide show
  1. package/README.md +5 -2
  2. package/dist/index.js +48 -26
  3. 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
@@ -51,14 +51,17 @@ function registerPolicyResource(server2, agent2, endpoint2) {
51
51
  // src/tools/judge.ts
52
52
  import {
53
53
  checkAgentExists,
54
- createAtbashClient,
55
- logToolCall
54
+ createAtbashClient
56
55
  } from "@atbash/sdk";
57
56
  import { z as z2 } from "zod";
58
57
 
59
58
  // src/utils.ts
60
- function createClientOpts(endpoint2) {
61
- return endpoint2 ? { endpoint: endpoint2 } : void 0;
59
+ function createClientOpts(agent2, endpoint2, orgName2) {
60
+ const opts = {};
61
+ if (endpoint2) opts.endpoint = endpoint2;
62
+ if (agent2) opts.auth = agent2;
63
+ if (orgName2) opts.orgName = orgName2;
64
+ return Object.keys(opts).length > 0 ? opts : void 0;
62
65
  }
63
66
  function safeErrorMessage(error) {
64
67
  return error instanceof Error ? error.message : String(error);
@@ -76,11 +79,12 @@ function toErrorContent(error) {
76
79
  }
77
80
 
78
81
  // src/tools/judge.ts
79
- function registerJudgeTools(server2, agent2, endpoint2) {
80
- const opts = createClientOpts(endpoint2);
82
+ function registerJudgeTools(server2, agent2, endpoint2, orgName2) {
83
+ const opts = createClientOpts(agent2, endpoint2, orgName2);
81
84
  const client = createAtbashClient({
82
85
  keyPair: { privKey: agent2.privkey, pubKey: agent2.pubkey },
83
- judge: endpoint2 ? { endpoint: endpoint2 } : void 0
86
+ judge: endpoint2 ? { endpoint: endpoint2 } : void 0,
87
+ orgName: orgName2
84
88
  });
85
89
  server2.registerTool(
86
90
  "atbash_judge",
@@ -108,8 +112,15 @@ function registerJudgeTools(server2, agent2, endpoint2) {
108
112
  args: parsedArgs ?? { action },
109
113
  context: `${action} \u2014 ${context}`
110
114
  });
111
- const normalized = decision.verdict === "HOLD" ? { ...decision, verdict: "ALLOW", allow: true } : decision;
112
- return toJsonContent(normalized);
115
+ if (decision.verdict === "HOLD") {
116
+ return toJsonContent({
117
+ ...decision,
118
+ allow: false,
119
+ reason: `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.
120
+ Reason: ${decision.reason ?? ""}`
121
+ });
122
+ }
123
+ return toJsonContent(decision);
113
124
  } catch (error) {
114
125
  return toErrorContent(error);
115
126
  }
@@ -128,17 +139,27 @@ function registerJudgeTools(server2, agent2, endpoint2) {
128
139
  },
129
140
  async ({ action, context, tool_name, tool_args_json }) => {
130
141
  try {
131
- const result = await logToolCall(
132
- action,
133
- context,
134
- agent2,
135
- void 0,
136
- {
137
- toolName: tool_name,
138
- toolArgsJson: tool_args_json
139
- },
140
- opts
141
- );
142
+ let parsedArgs = void 0;
143
+ if (tool_args_json) {
144
+ try {
145
+ parsedArgs = JSON.parse(tool_args_json);
146
+ } catch {
147
+ parsedArgs = tool_args_json;
148
+ }
149
+ }
150
+ const result = await client.auditToolCall({
151
+ toolName: tool_name ?? "mcp_log",
152
+ args: parsedArgs ?? { action },
153
+ context: `${action} \u2014 ${context}`
154
+ });
155
+ if (result.verdict === "HOLD") {
156
+ return toJsonContent({
157
+ ...result,
158
+ allow: false,
159
+ reason: `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.
160
+ Reason: ${result.reason ?? ""}`
161
+ });
162
+ }
142
163
  return toJsonContent(result);
143
164
  } catch (error) {
144
165
  return toErrorContent(error);
@@ -171,7 +192,7 @@ import {
171
192
  getAgentPolicy,
172
193
  getAgentToolCalls,
173
194
  getHeldActionReviews,
174
- getOrgTierInfo,
195
+ getOrgSubscription,
175
196
  getOrgToolCalls,
176
197
  getPendingHeldActions,
177
198
  getSafetyStats,
@@ -183,8 +204,8 @@ import { z as z3 } from "zod";
183
204
  function defaultMaxCount(value) {
184
205
  return value ?? 20;
185
206
  }
186
- function registerQueryTools(server2, agent2, endpoint2) {
187
- const opts = createClientOpts(endpoint2);
207
+ function registerQueryTools(server2, agent2, endpoint2, orgName2) {
208
+ const opts = createClientOpts(agent2, endpoint2, orgName2);
188
209
  server2.registerTool(
189
210
  "atbash_get_policy",
190
211
  {
@@ -309,7 +330,7 @@ function registerQueryTools(server2, agent2, endpoint2) {
309
330
  },
310
331
  async ({ org_name }) => {
311
332
  try {
312
- return toJsonContent(await getOrgTierInfo(org_name, opts));
333
+ return toJsonContent(await getOrgSubscription(org_name, opts));
313
334
  } catch (error) {
314
335
  return toErrorContent(error);
315
336
  }
@@ -436,6 +457,7 @@ if (!privkey) {
436
457
  }
437
458
  var agent = loadAgent(privkey);
438
459
  var endpoint = process.env.ATBASH_ENDPOINT;
460
+ var orgName = process.env.ATBASH_ORG_NAME;
439
461
  setupTelemetry({ enabled: true, source: "plugin:mcp" });
440
462
  process.once("beforeExit", () => shutdownTelemetry());
441
463
  process.once("SIGINT", () => shutdownTelemetry().finally(() => process.exit(0)));
@@ -444,9 +466,9 @@ var server = new McpServer({
444
466
  name: "atbash-safety",
445
467
  version: "1.0.0"
446
468
  });
447
- registerJudgeTools(server, agent, endpoint);
469
+ registerJudgeTools(server, agent, endpoint, orgName);
448
470
  registerStatusTools(server, agent.pubkey, endpoint);
449
- registerQueryTools(server, agent, endpoint);
471
+ registerQueryTools(server, agent, endpoint, orgName);
450
472
  registerPolicyResource(server, agent, endpoint);
451
473
  registerSafetyPrompt(server);
452
474
  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-dev.0",
3
+ "version": "0.0.3-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": "dev",
44
+ "@atbash/sdk": "0.3.11-dev.17",
45
45
  "@modelcontextprotocol/sdk": "^1.12.3",
46
46
  "zod": "^3.25.76"
47
47
  },