cloudgpu-mcp 0.16.6 → 0.16.8

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/README.md CHANGED
@@ -182,6 +182,7 @@ The server also provides a `train_on_cloudgpu` prompt.
182
182
  - **Bounded local MCP inputs.** A tool call may contain at most 10,000 combined array entries and object members, including nested values. Larger calls are rejected before tool-schema validation or API/SSH handlers. This includes inline ComfyUI workflows; simplify oversized workflows rather than splitting a paid operation or silently dropping fields. The stdio transport also retains its 10 MiB buffered-input limit. These are local MCP limits, not a claim about the remote service.
183
183
 
184
184
  - **A quote first.** `create_instance` only takes a `quote_id` from `estimate_cost` and `user_confirmed=true`.
185
+ - **Restoring a Workspace on a new rental.** Set `workspace_restore_required: true` in `estimate_cost` and use its confirmed quote for `create_instance`. A `workspace_route_unavailable` response means review another configuration or region before renting. Transfer rates vary by route. Managed Jobs bind this requirement automatically when given `workspace_version_id`.
185
186
  - **Server-side limits.** Every instance is created with `max_spend_usd`, `max_hours` and an idle limit (60 minutes by default). CloudGPU's servers check them and destroy the instance when one is hit, even if your client has disconnected or your laptop is asleep.
186
187
  - **Your own ceiling.** `CLOUDGPU_MAX_SPEND_USD` and `CLOUDGPU_MAX_HOURS` cap what the agent may set.
187
188
  - **Results before shutdown.** After commands have run, `stop_instance` refuses until something has been downloaded, unless the user confirms `force=true`.
@@ -442,7 +443,7 @@ Use `prepare_job_batch` to review every command, fresh compute quote, deadline a
442
443
 
443
444
  REST equivalents: `POST /v1/job-batches` with `Idempotency-Key`, `total_budget_usd` and 1–32 `jobs`; `GET /v1/job-batches/{batch_id}`; `POST /v1/job-batches/{batch_id}/cancel`. The MCP reviewed manifest remains capped at eight children. Replaying the identical key/body returns the existing children. Existing `run_job_batch` retains its explicitly non-atomic client submission behavior for compatibility; the server tool never falls back to it.
444
445
 
445
- For whole-hour Jobs, call `estimate_cost` for the exact configuration and accept the minimum/billing period. Supply its `billing_quote_id` plus `billing_accepted=true` to `run_job` or each batch child, in addition to the compute `quote_id` and execution approval. Each allocation needs a separate current billing quote. The Job cap must cover the minimum; elapsed portions of a started hour are not voluntarily refunded. Billing quotes last five minutes: an expired queued Job fails without allocation and requires a new reviewed request. It is never silently renewed or routed under different billing terms. Recovery uses durable provider receipts and independent upstream presence checks; ambiguous intents remain `needs_attention`.
446
+ For whole-hour Jobs, call `quote_compute` and compare the estimated task totals and minimum charges in `job_billing_options`. Then call `quote_job_billing` with the chosen period and exact Job configuration. Show the current quote and get explicit approval. Pass its `billing_quote_id` and `billing_accepted=true` to `run_job` with the exact GPU, spending cap and time limit. A legacy minute-only `quote_id` is optional when using this billing quote. Each allocation needs its own current billing quote. The Job cap must cover the minimum charge, and unused parts of a started hour are charged. Billing quotes expire after five minutes. An expired queued Job fails without allocation and requires new approval.
446
447
 
447
448
  ### Regional facts before a compute decision
448
449
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudgpu-mcp",
3
- "version": "0.16.6",
3
+ "version": "0.16.8",
4
4
  "mcpName": "io.github.cloudgpu-app/cloudgpu-mcp",
5
5
  "description": "MCP server and command-line tool for cloudgpu.app: let Claude Code, Cursor, Cline, opencode, goose and other MCP clients (or you, from a terminal) rent a GPU with explicit billing quotes, run a job, fetch the results and shut it down, with spending limits the platform enforces.",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -42,7 +42,7 @@ import {
42
42
  shq,
43
43
  } from "./guards.js";
44
44
 
45
- const VERSION = "0.16.6";
45
+ const VERSION = "0.16.8";
46
46
  const HERE = path.dirname(fileURLToPath(import.meta.url));
47
47
  const RULES = fs.readFileSync(path.join(HERE, "..", "rules", "cloudgpu.md"), "utf8");
48
48
 
@@ -162,15 +162,38 @@ server.registerTool("get_compute_catalog", {
162
162
  inputSchema: {}, annotations: { readOnlyHint: true, openWorldHint: true },
163
163
  }, wrap(async () => ok(await api.catalog())));
164
164
  server.registerTool("quote_compute", {
165
- title: "Server-side compute quote", description: "Five-minute server quote: separates estimated task cost from required starting balance and marks supports_jobs. No GPU is started. Pass its quote_id to run_job.",
165
+ title: "Server-side compute quote", description: "Compare minute and whole-hour Job estimates, minimum charges and starting balances. No GPU is started. Use job_billing_options to compare cost for your duration, then call quote_job_billing for the selected period. The legacy quote_id still supports minute-only Jobs.",
166
166
  inputSchema: { min_vram_gb: z.number().int().min(0).default(0), gpu_model: z.string().optional(), gpu_count: z.number().int().min(1).max(8).default(1),
167
167
  template: z.string().optional(), disk_gb: z.number().int().optional(), estimated_duration_seconds: z.number().int().positive(), max_budget_usd: z.number().positive() },
168
168
  annotations: { readOnlyHint: true, openWorldHint: true },
169
169
  }, wrap(async ({ estimated_duration_seconds, max_budget_usd, ...requirements }) => {
170
- const q = await api.quote({ requirements, estimated_duration_seconds, max_budget_usd });
170
+ const q = await api.quote({ requirements, estimated_duration_seconds, max_budget_usd, include_job_billing_options: true });
171
171
  return ok({ ...q, quote_id: q.id });
172
172
  }));
173
173
 
174
+ server.registerTool("quote_job_billing", {
175
+ title: "Quote the selected Job billing period",
176
+ description: "Read-only. Use the exact Job configuration and selected billing period from quote_compute. Show the returned billing period, minimum charge and hourly total. Obtain explicit approval before sending billingQuoteId as billing_quote_id with billing_accepted=true to run_job.",
177
+ inputSchema: {
178
+ gpu_model: z.string().min(1), gpu_count: z.number().int().min(1).max(8).default(1),
179
+ template: z.string().optional(), disk_gb: z.number().int().optional(),
180
+ billing_increment_seconds: z.union([z.literal(60), z.literal(3600)]),
181
+ workspace_restore_required: z.boolean().optional(),
182
+ },
183
+ annotations: { readOnlyHint: true, openWorldHint: true },
184
+ }, wrap(async ({ gpu_model, gpu_count, template, disk_gb, billing_increment_seconds, workspace_restore_required }) => {
185
+ const quote = await api.rentalBillingQuote({
186
+ gpuModel: gpu_model, gpuCount: gpu_count, ...(template ? { templateId: template } : {}),
187
+ ...(disk_gb ? { diskGb: disk_gb } : {}), ...(workspace_restore_required ? { workspaceRestoreRequired: true } : {}),
188
+ jobBillingQuote: true, billingIncrementSeconds: billing_increment_seconds,
189
+ });
190
+ if (!quote?.billingQuoteId || quote.incrementSeconds !== billing_increment_seconds
191
+ || (workspace_restore_required && quote.workspaceRestoreRequired !== true)) {
192
+ return fail("The requested Job billing period could not be verified. No Job was started.");
193
+ }
194
+ return ok({ ...quote, billing_quote_id: quote.billingQuoteId });
195
+ }));
196
+
174
197
  server.registerTool(
175
198
  "get_account",
176
199
  {
@@ -239,11 +262,12 @@ server.registerTool(
239
262
  gpu_model: z.string().describe("GPU model exactly as list_gpus returns it"),
240
263
  gpu_count: z.number().int().min(1).max(8).default(1),
241
264
  hours: z.number().positive().describe("Expected run time in hours"),
265
+ workspace_restore_required: z.boolean().optional().describe("Reserve a rental for restoring a saved Workspace. Excludes suppliers with known impaired restore routes."),
242
266
  template: z.string().optional().describe("Template id from list_templates; omit for a plain GPU with Python and CUDA"),
243
267
  },
244
268
  annotations: { readOnlyHint: true, openWorldHint: true },
245
269
  },
246
- wrap(async ({ gpu_model, gpu_count = 1, hours, template, continent }) => {
270
+ wrap(async ({ gpu_model, gpu_count = 1, hours, template, continent, workspace_restore_required }) => {
247
271
  const [offers, account] = await Promise.all([api.offers(), api.account().catch(() => null)]);
248
272
  const offer = offers.find((o) => String(o.gpu_model).toLowerCase() === gpu_model.toLowerCase());
249
273
  if (!offer) {
@@ -252,7 +276,10 @@ server.registerTool(
252
276
  if (gpu_count < (offer.min_gpu_count || 1)) {
253
277
  return fail(`${offer.gpu_model} is rented in groups of at least ${offer.min_gpu_count} GPUs.`);
254
278
  }
255
- const billing = await api.rentalBillingQuote({gpuModel:offer.gpu_model,gpuCount:gpu_count,...(continent?{continent}:{}),...(template?{templateId:template}:{})});
279
+ const billing = await api.rentalBillingQuote({gpuModel:offer.gpu_model,gpuCount:gpu_count,...(continent?{continent}:{}),...(template?{templateId:template}:{}),...(workspace_restore_required?{workspaceRestoreRequired:true}:{})});
280
+ if (workspace_restore_required && billing.workspaceRestoreRequired !== true) {
281
+ return fail("workspace_route_unavailable: Select another configuration or region before renting for this Workspace.");
282
+ }
256
283
  if(continent&&billing.continent!==continent)return fail("The billing quote did not bind the requested continent. No rental was started.");
257
284
  const {hourly,increment,estimate}=rentalBilling(billing,hours);
258
285
  const balance = account ? Number(account.balance_usd) : null;
@@ -267,6 +294,7 @@ server.registerTool(
267
294
  const quote_id = quotes.put({ continent, gpu_model: offer.gpu_model, gpu_count, template, hourly, hours, estimate, billingQuoteId:billing.billingQuoteId, billingExpiresAt:billing.expiresAt, minimumChargeUsd:Number(billing.minimumChargeUsd), billingIncrementSeconds:increment });
268
295
  return ok({
269
296
  quote_id,
297
+ ...(workspace_restore_required?{workspace_restore_required:true}:{}),
270
298
  continent:continent||null,
271
299
  gpu_model: offer.gpu_model,
272
300
  gpu_count,