@prismnetwork/mcp 0.3.0 → 0.4.0

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 +23 -0
  2. package/package.json +2 -2
  3. package/server.mjs +105 -2
package/README.md CHANGED
@@ -23,6 +23,11 @@ real prices. Leasing spends money, so those tools ask for a wallet and say so.
23
23
  | `prism_lease` | yes |
24
24
  | `prism_run` | yes |
25
25
  | `prism_end_lease` | yes |
26
+ | `prism_vault_store` | yes |
27
+ | `prism_vault_list` | yes |
28
+ | `prism_vault_read` | yes |
29
+ | `prism_vault_delete` | yes |
30
+ | `prism_vault_release` | yes |
26
31
 
27
32
  - `prism_wallet`: the agent's address and USDG/ETH balances.
28
33
  - `prism_list_gpus`: GPUs available to lease, with price per second and per hour.
@@ -30,6 +35,24 @@ real prices. Leasing spends money, so those tools ask for a wallet and say so.
30
35
  - `prism_lease`: lease a GPU and keep it; returns a `lease_id` and SSH access.
31
36
  - `prism_run`: run a command on an existing lease.
32
37
  - `prism_end_lease`: release a lease.
38
+ - `prism_vault_store`: seal private data under the wallet-derived key.
39
+ - `prism_vault_list`: list sealed items; values are never returned.
40
+ - `prism_vault_read`: decrypt one item in this process.
41
+ - `prism_vault_delete`: permanently delete an item.
42
+ - `prism_vault_release`: authorize an item into a lease that clears its trust floor.
43
+
44
+ ## Vault
45
+
46
+ An agent that handles a card, an identity document or a credential should not
47
+ write it into a leased workspace. `prism_vault_store` seals it under a key
48
+ derived from the agent's wallet inside this server process; Prism receives
49
+ ciphertext and holds no way to read it.
50
+
51
+ Each item names the weakest workspace trust class it may ever be released into,
52
+ and new items default to `confidential` — above anything the network serves
53
+ today. `prism_vault_release` is therefore refused on current capacity instead of
54
+ handing a secret to a host that can read it. Lowering an item's floor is a
55
+ deliberate act, and allowed releases are recorded against the account.
33
56
 
34
57
  ## Configure
35
58
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismnetwork/mcp",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "MCP server for leasing and running on Prism Network GPUs.",
5
5
  "mcpName": "io.github.prismnetwork-tech/mcp",
6
6
  "type": "module",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@modelcontextprotocol/sdk": "^1.0.0",
19
- "@prismnetwork/agent-sdk": "^0.2.0",
19
+ "@prismnetwork/agent-sdk": "^0.3.0",
20
20
  "viem": "^2"
21
21
  },
22
22
  "keywords": [
package/server.mjs CHANGED
@@ -5,7 +5,7 @@
5
5
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
6
6
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
7
7
  import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
8
- import { DEFAULT_IMAGE, PrismAgent, TRUST_CLASSES } from "@prismnetwork/agent-sdk";
8
+ import { DEFAULT_IMAGE, DEFAULT_TRUST_FLOOR, PrismAgent, TRUST_CLASSES } from "@prismnetwork/agent-sdk";
9
9
 
10
10
  const IMAGE = process.env.PRISM_DEFAULT_IMAGE ?? DEFAULT_IMAGE;
11
11
 
@@ -80,7 +80,7 @@ const TOOLS = [
80
80
  },
81
81
  {
82
82
  name: "prism_list_gpus",
83
- description: "List GPUs currently available to lease on Prism Network, with model, VRAM, price per second in USDG, and trust class. Trust class runs open < isolated < attested < confidential; on an 'open' supplier the host operator can read anything the workload touches, so never send secrets, credentials or private model weights to one.",
83
+ description: "List GPUs currently available to lease on Prism Network, with model, VRAM, price per second in USDG, and trust class. Trust class runs open < isolated < attested < confidential; on an 'open' supplier the host operator can read anything the workload touches. Keep secrets and credentials in prism_vault_store rather than on the box, and raise min_trust when the workload itself must not be readable.",
84
84
  inputSchema: {
85
85
  type: "object",
86
86
  properties: {
@@ -148,6 +148,58 @@ const TOOLS = [
148
148
  required: ["lease_id"],
149
149
  },
150
150
  },
151
+ {
152
+ name: "prism_vault_store",
153
+ description: "Store private data — a card, an identity document, an API credential — encrypted under a key derived from this agent's wallet on this machine. Prism receives ciphertext only and cannot read it. Use this instead of writing a secret into a workspace or a file. Returns an item_id; the value is not recoverable without the wallet.",
154
+ inputSchema: {
155
+ type: "object",
156
+ properties: {
157
+ value: { type: "string", description: "The data to seal. Encrypted before it leaves this process." },
158
+ label: { type: "string", description: "Optional plain-text name so the item is findable. Stored unencrypted, so keep it non-revealing (e.g. 'billing card', not the number)." },
159
+ trust_floor: {
160
+ type: "string",
161
+ enum: TRUST_CLASSES,
162
+ description: "The weakest workspace this item may ever be released into. Defaults to 'confidential', which is above anything the network serves today, so the item cannot reach a rented GPU at all. Only lower it deliberately.",
163
+ },
164
+ },
165
+ required: ["value"],
166
+ },
167
+ },
168
+ {
169
+ name: "prism_vault_list",
170
+ description: "List the agent's sealed vault items: item_id, label, version and trust floor. Values are not returned and are not readable by Prism.",
171
+ inputSchema: { type: "object", properties: {} },
172
+ },
173
+ {
174
+ name: "prism_vault_read",
175
+ description: "Decrypt and return one vault item, in this process, using the wallet-derived key. The plaintext exists only here — do not echo it into a leased workspace, a log, or a message.",
176
+ inputSchema: {
177
+ type: "object",
178
+ properties: { item_id: { type: "string", description: "The item_id from prism_vault_store or prism_vault_list." } },
179
+ required: ["item_id"],
180
+ },
181
+ },
182
+ {
183
+ name: "prism_vault_delete",
184
+ description: "Permanently delete a vault item. The ciphertext is removed and the value cannot be recovered.",
185
+ inputSchema: {
186
+ type: "object",
187
+ properties: { item_id: { type: "string" } },
188
+ required: ["item_id"],
189
+ },
190
+ },
191
+ {
192
+ name: "prism_vault_release",
193
+ description: "Authorize a vault item into a lease you hold and return its plaintext for use there. Refused when the lease's trust class is below the item's trust floor, which is what stops a secret reaching a host that can read it. Every allowed release is recorded against the account.",
194
+ inputSchema: {
195
+ type: "object",
196
+ properties: {
197
+ item_id: { type: "string" },
198
+ lease_id: { type: "integer", description: "A lease from prism_lease." },
199
+ },
200
+ required: ["item_id", "lease_id"],
201
+ },
202
+ },
151
203
  ];
152
204
 
153
205
  async function handle(name, args) {
@@ -216,6 +268,57 @@ async function handle(name, args) {
216
268
  }
217
269
  return { lease_id: id, released: Boolean(lease) };
218
270
  }
271
+ if (name.startsWith("prism_vault_")) return handleVault(name, args);
272
+ throw new Error(`unknown tool ${name}`);
273
+ }
274
+
275
+ // The vault key is derived here from the wallet signature and stays in this
276
+ // process. Nothing in this function sends a key or a plaintext to Prism.
277
+ async function handleVault(name, args) {
278
+ const vault = requireWallet(name).vault;
279
+ await ensureAuth();
280
+ if (!vault.unlocked) await vault.unlock();
281
+
282
+ if (name === "prism_vault_store") {
283
+ if (typeof args.value !== "string" || args.value.length === 0) {
284
+ throw new Error("value is required");
285
+ }
286
+ const item = await vault.put(args.value, {
287
+ label: args.label ?? "",
288
+ trustFloor: args.trust_floor ?? DEFAULT_TRUST_FLOOR,
289
+ });
290
+ return {
291
+ item_id: item.item_id,
292
+ version: item.version,
293
+ label: item.label,
294
+ trust_floor: item.min_trust_class,
295
+ stored: "sealed on this machine; Prism holds ciphertext only",
296
+ };
297
+ }
298
+ if (name === "prism_vault_list") {
299
+ const items = await vault.list();
300
+ return {
301
+ count: items.length,
302
+ items: items.map((item) => ({
303
+ item_id: item.item_id,
304
+ label: item.label,
305
+ version: item.version,
306
+ trust_floor: item.min_trust_class,
307
+ updated_at: item.updated_at,
308
+ })),
309
+ };
310
+ }
311
+ if (name === "prism_vault_read") {
312
+ return { item_id: args.item_id, value: await vault.get(args.item_id) };
313
+ }
314
+ if (name === "prism_vault_delete") {
315
+ await vault.remove(args.item_id);
316
+ return { item_id: args.item_id, deleted: true };
317
+ }
318
+ if (name === "prism_vault_release") {
319
+ const id = leaseId(args.lease_id);
320
+ return { item_id: args.item_id, lease_id: id, value: await vault.releaseInto(id, args.item_id) };
321
+ }
219
322
  throw new Error(`unknown tool ${name}`);
220
323
  }
221
324