@paraloncloud/mcp 1.3.1 → 1.5.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 +22 -2
  2. package/package.json +1 -1
  3. package/server.js +84 -8
package/README.md CHANGED
@@ -27,10 +27,19 @@ using natural language.
27
27
  | --- | --- | --- |
28
28
  | `list_gpus` | List rentable GPUs with price, VRAM, compute capability, country | free |
29
29
  | `get_balance` | Your credit balance | free |
30
- | `create_rental` | Start a Jupyter rental (async → poll) | **spends credits** |
31
- | `get_rental` | Status + connection URL once running | free |
30
+ | `list_templates` | Apps a rental can start with (ComfyUI), their version and minimums | free |
31
+ | `create_rental` | Start a rental with JupyterLab or SSH (`type: "ssh"`), optionally with an app installed (`template: "comfyui"`) (async → poll) | **spends credits** |
32
+ | `get_rental` | Status + the JupyterLab URL or the SSH command once running, and an app's link (`connection.app_url`) | free |
32
33
  | `list_rentals` | Your active rentals (`status: "all"` for history) | free |
33
34
  | `destroy_rental` | Stop a rental and stop billing | — |
35
+ | `list_ssh_keys` | The SSH public keys an SSH rental installs | free |
36
+ | `add_ssh_key` | Save an SSH public key (the `.pub` line, never the private key) | free |
37
+ | `delete_ssh_key` | Delete a saved key; new SSH rentals stop accepting it | free |
38
+
39
+ An SSH rental installs every saved key, so the agent can make its own key, add it, rent with
40
+ `type: "ssh"`, and run commands on the machine. Connecting needs
41
+ [cloudflared](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/)
42
+ on the computer that holds the private key: `get_rental` returns the command.
34
43
 
35
44
  ### Your nodes, for GPU providers (key needs the `nodes` scope)
36
45
 
@@ -100,6 +109,17 @@ Optional env: `PARALON_BASE_URL` (defaults to `https://paraloncloud.com/api/v1`)
100
109
  The agent calls `list_gpus`, picks a node, and calls `create_rental` with `hours: 2`. It then
101
110
  polls `get_rental` for the Jupyter URL. Say "stop it" and it calls `destroy_rental`.
102
111
 
112
+ > "Rent a 4090 over SSH, run nvidia-smi on it, then stop it."
113
+
114
+ The agent makes a key with `ssh-keygen`, saves it with `add_ssh_key`, picks a node with
115
+ `ssh: true`, starts it with `type: "ssh"`, runs the command `get_rental` returns, and stops it.
116
+
117
+ > "Start ComfyUI on a GPU with 24 GB for an hour and give me the link."
118
+
119
+ The agent calls `list_templates`, picks a node whose `templates` has `comfyui`, starts it with
120
+ `template: "comfyui"` and `hours: 1`, and hands you `connection.app_url` from `get_rental` once the
121
+ app answers, a minute or two after the machine.
122
+
103
123
  As a provider:
104
124
 
105
125
  > "How are my nodes doing? Is any GPU running hot?"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraloncloud/mcp",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "mcpName": "io.github.ParalonCloud/paralon-mcp",
5
5
  "description": "ParalonCloud MCP server: rent GPUs, and as a GPU provider manage your own nodes, prices and earnings, from an AI agent.",
6
6
  "license": "MIT",
package/server.js CHANGED
@@ -2,7 +2,9 @@
2
2
  // MCP server for the ParalonCloud Rental API and Provider API.
3
3
  //
4
4
  // Exposes the REST API (https://paraloncloud.com/api/v1) as MCP tools so an AI
5
- // agent can browse GPUs, rent one, poll it for a connection URL, and stop it;
5
+ // agent can browse GPUs, rent one with JupyterLab or SSH, poll it for the
6
+ // connection, and stop it; register the SSH public keys an SSH rental logs in
7
+ // with;
6
8
  // and, for a GPU provider, manage their own nodes: list them with live GPU
7
9
  // load and temperature, add one and get its install command, take it off the
8
10
  // market and back, set its price, reclaim a spot node, and read earnings.
@@ -87,7 +89,7 @@ function reply(result, note) {
87
89
  }
88
90
 
89
91
  const server = new Server(
90
- { name: "paraloncloud", version: "1.3.1" },
92
+ { name: "paraloncloud", version: "1.5.0" },
91
93
  { capabilities: { tools: {} } }
92
94
  );
93
95
 
@@ -95,7 +97,13 @@ const TOOLS = [
95
97
  {
96
98
  name: "list_gpus",
97
99
  description:
98
- "List GPU nodes available to rent right now, with price per hour, GPU model, VRAM, CUDA compute capability, and country. Rent by the returned node_id. reserved_for_you: true marks a node its provider keeps for this key's person or organization: such nodes come first and nobody else sees them. Read-only, no cost. For modern LLM work prefer compute_cap >= 8.9 (FP8). spot: true marks a spot node: cheaper (list_price_per_hour is the on-demand price), but its provider can take it back with two minutes' notice, so avoid it for long unattended jobs. restricted_internet: true means the node's own network cannot reach the services in unreachable_services (e.g. GitHub, Hugging Face, PyPI, Docker Hub), so git clone, pip install and model or image downloads fail there; prefer a node where it is false when the job downloads anything (null means not checked yet).",
100
+ "List GPU nodes available to rent right now, with price per hour, GPU model, VRAM, CUDA compute capability, and country. Rent by the returned node_id. reserved_for_you: true marks a node its provider keeps for this key's person or organization: such nodes come first and nobody else sees them. Read-only, no cost. For modern LLM work prefer compute_cap >= 8.9 (FP8). spot: true marks a spot node: cheaper (list_price_per_hour is the on-demand price), but its provider can take it back with two minutes' notice, so avoid it for long unattended jobs. restricted_internet: true means the node's own network cannot reach the services in unreachable_services (e.g. GitHub, Hugging Face, PyPI, Docker Hub), so git clone, pip install and model or image downloads fail there; prefer a node where it is false when the job downloads anything (null means not checked yet). ssh: true means create_rental can start it with type 'ssh'. templates lists the apps create_rental can install on that node (e.g. [\"comfyui\"]); see list_templates.",
101
+ inputSchema: { type: "object", properties: {}, additionalProperties: false },
102
+ },
103
+ {
104
+ name: "list_templates",
105
+ description:
106
+ "List the apps a rental can start with, installed and running and opened in the browser by its own link: today ComfyUI (node-based image and video generation: Flux, SDXL, Wan). Each has a slug for create_rental's template, the version a rental gets (tested and pinned), and what a machine needs (min_vram_gb per GPU, min_disk_gb). Pick a node whose templates in list_gpus contains the slug. Read-only, no cost. Use it when the user wants to generate images or video, or names one of these apps.",
99
107
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
100
108
  },
101
109
  {
@@ -114,8 +122,8 @@ const TOOLS = [
114
122
  node_id: { type: "string", description: "Node UUID from list_gpus." },
115
123
  type: {
116
124
  type: "string",
117
- enum: ["jupyter"],
118
- description: "Environment to start. Only 'jupyter' is supported.",
125
+ enum: ["jupyter", "ssh"],
126
+ description: "How to reach the machine. 'jupyter' (default): JupyterLab in the browser, get_rental returns a URL with its token. 'ssh': a root shell over SSH, for running commands, scp/rsync and VS Code Remote-SSH; only on a node where list_gpus says ssh: true, and it needs an SSH public key saved first (list_ssh_keys / add_ssh_key), since every saved key is installed on the machine. Prefer 'ssh' when you will run commands on the machine yourself.",
119
127
  },
120
128
  hours: {
121
129
  type: "integer",
@@ -123,6 +131,10 @@ const TOOLS = [
123
131
  maximum: 720,
124
132
  description: "Optional auto-stop cap: the rental stops itself after this many whole hours. Omit (the default) for an open-ended rental that runs until stopped with destroy_rental.",
125
133
  },
134
+ template: {
135
+ type: "string",
136
+ description: "Optional app to install and start on the machine, by slug from list_templates (e.g. 'comfyui'). Only on a node whose templates in list_gpus contains it. The rental is still JupyterLab or SSH as type says, at the same price; the app comes up a minute or two after the machine answers, and get_rental then returns connection.app_url (its own link with a token). It starts empty: the user downloads models from inside the app.",
137
+ },
126
138
  name: { type: "string", description: "Optional label for the rental." },
127
139
  },
128
140
  required: ["node_id"],
@@ -132,7 +144,7 @@ const TOOLS = [
132
144
  {
133
145
  name: "get_rental",
134
146
  description:
135
- "Get one rental's status and connection details (Jupyter URL + token). After create_rental, call this to get the URL. It WAITS internally (up to ~24s) for the rental to finish coming up and returns as soon as it's ready — so you usually only need ONE call, at most two. Do NOT call it repeatedly in a tight loop. Provisioning plus the secure tunnel take ~20-40 seconds total; the URL is ready when connection_pending is false. Read-only.",
147
+ "Get one rental's status and connection details: for a JupyterLab rental connection.access_url (URL with its token), for an SSH rental connection.ssh_command (run it from the computer holding the private key; it needs cloudflared installed, and -i <private key> when the key is not in ~/.ssh). A rental started with a template also has app (name, version, state installing / starting / ready / failed, step) and, once the app answers, connection.app_url: the link that opens it, with its token; treat it like a password. state failed means the app did not start while the machine runs and bills: say so and offer to stop it. After create_rental, call this to get the URL. It WAITS internally (up to ~24s) for the rental to finish coming up and returns as soon as it's ready — so you usually only need ONE call, at most two. Do NOT call it repeatedly in a tight loop. Provisioning plus the secure tunnel take ~20-40 seconds total; the URL is ready when connection_pending is false. Read-only.",
136
148
  inputSchema: {
137
149
  type: "object",
138
150
  properties: { rental_id: { type: "string" } },
@@ -164,6 +176,38 @@ const TOOLS = [
164
176
  },
165
177
  },
166
178
 
179
+ {
180
+ name: "list_ssh_keys",
181
+ description:
182
+ "List the SSH public keys saved for this API key's person: every one of them is installed on each SSH rental they start. Read-only, no cost.",
183
+ inputSchema: { type: "object", properties: {}, additionalProperties: false },
184
+ },
185
+ {
186
+ name: "add_ssh_key",
187
+ description:
188
+ "Save an SSH public key so SSH rentals accept it (the key also shows on the account's SSH keys page). Pass the PUBLIC key line, e.g. the contents of ~/.ssh/id_ed25519.pub; never a private key. To make one: ssh-keygen -t ed25519 -N '' -f ~/.ssh/paralon_ed25519, then add the .pub file's line and connect with -i ~/.ssh/paralon_ed25519. A key added after a rental started is not on that rental. No cost.",
189
+ inputSchema: {
190
+ type: "object",
191
+ properties: {
192
+ public_key: { type: "string", description: "One OpenSSH public key line: 'ssh-ed25519 AAAA… comment' (ed25519, ecdsa or rsa ≥2048)." },
193
+ name: { type: "string", description: "Optional label, e.g. 'laptop' or 'claude-agent'. Defaults to the key's comment." },
194
+ },
195
+ required: ["public_key"],
196
+ additionalProperties: false,
197
+ },
198
+ },
199
+ {
200
+ name: "delete_ssh_key",
201
+ description:
202
+ "Delete a saved SSH public key by its id (from list_ssh_keys). New SSH rentals no longer accept it; a rental already running keeps it until it stops. Confirm with the user unless they asked for it.",
203
+ inputSchema: {
204
+ type: "object",
205
+ properties: { key_id: { type: "string" } },
206
+ required: ["key_id"],
207
+ additionalProperties: false,
208
+ },
209
+ },
210
+
167
211
  // ---- Provider tools: the account's own nodes (key needs the 'nodes' scope)
168
212
  {
169
213
  name: "list_my_nodes",
@@ -326,6 +370,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
326
370
  case "get_balance":
327
371
  return reply(await api("GET", "/balance"));
328
372
 
373
+ case "list_templates":
374
+ return reply(await api("GET", "/templates"));
375
+
329
376
  case "create_rental": {
330
377
  if (!args.node_id) {
331
378
  return reply({ ok: false, data: { error: "invalid_request", message: "node_id is required (see list_gpus)." } });
@@ -333,6 +380,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
333
380
  const body = { node_id: args.node_id, type: args.type || "jupyter" };
334
381
  if (args.hours != null) body.hours = args.hours;
335
382
  if (args.name) body.name = args.name;
383
+ if (args.template) body.template = args.template;
336
384
  const result = await api("POST", "/rentals", {
337
385
  body,
338
386
  headers: { "Idempotency-Key": randomUUID() },
@@ -340,7 +388,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
340
388
  return reply(
341
389
  result,
342
390
  result.ok
343
- ? "Rental is provisioning. Call get_rental with this rental_id until status is 'running' to get the connection URL."
391
+ ? (body.template
392
+ ? `Rental is provisioning with ${body.template}. Call get_rental with this rental_id: the machine answers first, the app a minute or two later; connection.app_url is its link.`
393
+ : body.type === "ssh"
394
+ ? "Rental is provisioning. Call get_rental with this rental_id until status is 'running' to get the SSH command."
395
+ : "Rental is provisioning. Call get_rental with this rental_id until status is 'running' to get the connection URL.")
344
396
  : undefined
345
397
  );
346
398
  }
@@ -354,9 +406,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
354
406
  // "pending" that makes the agent hammer this tool, wait here: poll every
355
407
  // 3s for up to ~24s and return as soon as the connection is ready (or the
356
408
  // budget runs out). One or two calls cover the whole startup.
409
+ // A template's app comes up after the machine: wait for it the same way.
410
+ const appPending = (d) => !!d?.app && d.status === "running" && (d.app.state === "installing" || d.app.state === "starting");
357
411
  let result = await api("GET", path);
358
412
  let waited = 0;
359
- while (result.ok && result.data && result.data.connection_pending === true && waited < 24000) {
413
+ while (result.ok && result.data && (result.data.connection_pending === true || appPending(result.data)) && waited < 24000) {
360
414
  await sleep(3000);
361
415
  waited += 3000;
362
416
  result = await api("GET", path);
@@ -376,6 +430,28 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
376
430
  return reply(await api("DELETE", `/rentals/${encodeURIComponent(args.rental_id)}`));
377
431
  }
378
432
 
433
+ case "list_ssh_keys":
434
+ return reply(await api("GET", "/ssh-keys"));
435
+
436
+ case "add_ssh_key": {
437
+ if (!args.public_key) {
438
+ return reply({ ok: false, data: { error: "invalid_request", message: "public_key is required: the line of a .pub file." } });
439
+ }
440
+ if (/PRIVATE KEY/.test(args.public_key)) {
441
+ return reply({ ok: false, data: { error: "invalid_request", message: "That is a private key. Never send it; pass the public key (the .pub file)." } });
442
+ }
443
+ const body = { public_key: args.public_key };
444
+ if (args.name) body.name = args.name;
445
+ return reply(await api("POST", "/ssh-keys", { body }));
446
+ }
447
+
448
+ case "delete_ssh_key": {
449
+ if (!args.key_id) {
450
+ return reply({ ok: false, data: { error: "invalid_request", message: "key_id is required (see list_ssh_keys)." } });
451
+ }
452
+ return reply(await api("DELETE", `/ssh-keys/${encodeURIComponent(args.key_id)}`));
453
+ }
454
+
379
455
  // ---- Provider tools
380
456
  case "list_my_nodes":
381
457
  return reply(await api("GET", "/nodes"));