@paraloncloud/mcp 1.4.0 → 1.6.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 +21 -4
  2. package/package.json +1 -1
  3. package/server.js +32 -6
package/README.md CHANGED
@@ -27,8 +27,9 @@ 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 rental with JupyterLab or SSH (`type: "ssh"`) (async → poll) | **spends credits** |
31
- | `get_rental` | Status + the JupyterLab URL or the SSH command once running | free |
30
+ | `list_templates` | Apps a rental can start with (ComfyUI, Open WebUI with Ollama, Unsloth Studio), their version and minimums | free |
31
+ | `create_rental` | Start a rental with JupyterLab or SSH (`type: "ssh"`), optionally with an app installed (`template: "comfyui"`, `"openwebui"` or `"unsloth"`; an app with its own sign-in returns it in `app.login`) (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 | — |
34
35
  | `list_ssh_keys` | The SSH public keys an SSH rental installs | free |
@@ -113,6 +114,12 @@ polls `get_rental` for the Jupyter URL. Say "stop it" and it calls `destroy_rent
113
114
  The agent makes a key with `ssh-keygen`, saves it with `add_ssh_key`, picks a node with
114
115
  `ssh: true`, starts it with `type: "ssh"`, runs the command `get_rental` returns, and stops it.
115
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
+
116
123
  As a provider:
117
124
 
118
125
  > "How are my nodes doing? Is any GPU running hot?"
@@ -126,6 +133,9 @@ As a provider:
126
133
  - `create_rental` and `destroy_rental` change what you're billed — your MCP client will ask you
127
134
  to approve them (Claude Code/Desktop confirm tool calls by default). Keep that on.
128
135
  - `create_rental` auto-generates an idempotency key, so a retried call never starts a second GPU.
136
+ - `create_rental` takes `max_price_per_hour`, the price the agent read in `list_gpus`. If the
137
+ node costs more when the rental starts, nothing is started or charged (`price_changed`), and the
138
+ agent is told to ask you before renting at the new price.
129
139
  - Pass `hours` so a rental auto-stops even if the agent forgets to.
130
140
  - The key's `max_active_rentals` limit (set in the Console) caps concurrency regardless.
131
141
  - The node tools that change something (`add_node`, `set_node_available`, `set_node_price`,
@@ -138,12 +148,19 @@ As a provider:
138
148
  ## Test
139
149
 
140
150
  ```bash
141
- npm install
151
+ npm ci
142
152
  PARALON_API_KEY=prlc_your_key_here node smoke-test.mjs
143
153
  ```
144
154
 
145
155
  It calls the read-only tools, and the node tools only on a node that does not exist, so it
146
- changes nothing.
156
+ changes nothing. Without a key it only starts the server and checks the tool list (what CI runs).
157
+
158
+ ## Releases
159
+
160
+ Releases are published from GitHub Actions with npm provenance, never from a laptop: bump the
161
+ version in `package.json`, `server.json` and `server.js`, commit, then push an annotated tag
162
+ `vX.Y.Z`. The `publish` workflow runs the check and publishes. The npm page shows the commit it
163
+ was built from.
147
164
 
148
165
  ## Run locally (dev)
149
166
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraloncloud/mcp",
3
- "version": "1.4.0",
3
+ "version": "1.6.1",
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
@@ -89,7 +89,7 @@ function reply(result, note) {
89
89
  }
90
90
 
91
91
  const server = new Server(
92
- { name: "paraloncloud", version: "1.4.0" },
92
+ { name: "paraloncloud", version: "1.6.1" },
93
93
  { capabilities: { tools: {} } }
94
94
  );
95
95
 
@@ -97,7 +97,13 @@ const TOOLS = [
97
97
  {
98
98
  name: "list_gpus",
99
99
  description:
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'.",
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.",
101
107
  inputSchema: { type: "object", properties: {}, additionalProperties: false },
102
108
  },
103
109
  {
@@ -109,7 +115,7 @@ const TOOLS = [
109
115
  {
110
116
  name: "create_rental",
111
117
  description:
112
- "Start renting a GPU. SPENDS CREDITS (per-minute billing) — confirm with the user before calling. Asynchronous: returns a rental_id with status 'pending'. Provisioning + the secure tunnel take ~20-40 seconds. After creating, call get_rental ONCE to fetch the connection URL — it waits internally for startup and returns when ready, so do NOT poll it in a tight loop. DURATION: the rental is open-ended by default (runs until the user stops it with destroy_rental) — use open-ended as the default. When starting one, briefly tell the user it's open-ended and bills per minute until stopped, and that they can set an 'hours' auto-stop cap instead if they prefer; only pass 'hours' when the user asks for a time limit. An idempotency key is generated automatically so accidental repeats don't start a second GPU.",
118
+ "Start renting a GPU. SPENDS CREDITS (per-minute billing) — confirm with the user before calling. Asynchronous: returns a rental_id with status 'pending'. Provisioning + the secure tunnel take ~20-40 seconds. After creating, call get_rental ONCE to fetch the connection URL — it waits internally for startup and returns when ready, so do NOT poll it in a tight loop. DURATION: the rental is open-ended by default (runs until the user stops it with destroy_rental) — use open-ended as the default. When starting one, briefly tell the user it's open-ended and bills per minute until stopped, and that they can set an 'hours' auto-stop cap instead if they prefer; only pass 'hours' when the user asks for a time limit. An idempotency key is generated automatically so accidental repeats don't start a second GPU. PRICE: always pass max_price_per_hour = the price_per_hour you read for this node in list_gpus (the price you told the user). If the node now costs more, nothing is started or charged and the error is price_changed with the new price_per_hour: tell the user the new price and only retry with it as the new max_price_per_hour if they agree.",
113
119
  inputSchema: {
114
120
  type: "object",
115
121
  properties: {
@@ -125,7 +131,16 @@ const TOOLS = [
125
131
  maximum: 720,
126
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.",
127
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
+ },
128
138
  name: { type: "string", description: "Optional label for the rental." },
139
+ max_price_per_hour: {
140
+ type: "number",
141
+ exclusiveMinimum: 0,
142
+ description: "The highest price per hour (USD) to rent at: the price_per_hour list_gpus gave for this node. If the node costs more when the rental starts, it is refused with price_changed and nothing is started or charged.",
143
+ },
129
144
  },
130
145
  required: ["node_id"],
131
146
  additionalProperties: false,
@@ -134,7 +149,7 @@ const TOOLS = [
134
149
  {
135
150
  name: "get_rental",
136
151
  description:
137
- "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). 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.",
152
+ "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.",
138
153
  inputSchema: {
139
154
  type: "object",
140
155
  properties: { rental_id: { type: "string" } },
@@ -360,6 +375,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
360
375
  case "get_balance":
361
376
  return reply(await api("GET", "/balance"));
362
377
 
378
+ case "list_templates":
379
+ return reply(await api("GET", "/templates"));
380
+
363
381
  case "create_rental": {
364
382
  if (!args.node_id) {
365
383
  return reply({ ok: false, data: { error: "invalid_request", message: "node_id is required (see list_gpus)." } });
@@ -367,6 +385,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
367
385
  const body = { node_id: args.node_id, type: args.type || "jupyter" };
368
386
  if (args.hours != null) body.hours = args.hours;
369
387
  if (args.name) body.name = args.name;
388
+ if (args.template) body.template = args.template;
389
+ if (args.max_price_per_hour != null) body.max_price_per_hour = args.max_price_per_hour;
370
390
  const result = await api("POST", "/rentals", {
371
391
  body,
372
392
  headers: { "Idempotency-Key": randomUUID() },
@@ -374,9 +394,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
374
394
  return reply(
375
395
  result,
376
396
  result.ok
377
- ? (body.type === "ssh"
397
+ ? (body.template
398
+ ? `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.`
399
+ : body.type === "ssh"
378
400
  ? "Rental is provisioning. Call get_rental with this rental_id until status is 'running' to get the SSH command."
379
401
  : "Rental is provisioning. Call get_rental with this rental_id until status is 'running' to get the connection URL.")
402
+ : result.data && result.data.error === "price_changed"
403
+ ? `Not rented: the price changed to $${result.data.price_per_hour}/h (the ceiling was $${body.max_price_per_hour}/h). Nothing was started or charged. Tell the user the new price; retry with max_price_per_hour ${result.data.price_per_hour} only if they agree.`
380
404
  : undefined
381
405
  );
382
406
  }
@@ -390,9 +414,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
390
414
  // "pending" that makes the agent hammer this tool, wait here: poll every
391
415
  // 3s for up to ~24s and return as soon as the connection is ready (or the
392
416
  // budget runs out). One or two calls cover the whole startup.
417
+ // A template's app comes up after the machine: wait for it the same way.
418
+ const appPending = (d) => !!d?.app && d.status === "running" && (d.app.state === "installing" || d.app.state === "starting");
393
419
  let result = await api("GET", path);
394
420
  let waited = 0;
395
- while (result.ok && result.data && result.data.connection_pending === true && waited < 24000) {
421
+ while (result.ok && result.data && (result.data.connection_pending === true || appPending(result.data)) && waited < 24000) {
396
422
  await sleep(3000);
397
423
  waited += 3000;
398
424
  result = await api("GET", path);