@hoststack.dev/mcp 0.1.2 → 0.2.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.
@@ -585,8 +585,8 @@ defineTool({
585
585
  handler: async (args2, ctx) => {
586
586
  const teamId = await ctx.resolveTeamId();
587
587
  const response = await ctx.hoststack.deploys.list(teamId, args2.service_id);
588
- const data = shapeList(response, "deploys", shapeDeploy);
589
- const summary = data.items.length === 0 ? `No deploys yet for service ${args2.service_id}.` : `Found ${data.items.length} deploy${data.items.length === 1 ? "" : "s"} for service ${args2.service_id}.`;
588
+ const data = shapeList(response, "data", shapeDeploy);
589
+ const summary = data.items.length === 0 ? `No deploys yet for service ${args2.service_id}.` : `Found ${data.items.length} deploy${data.items.length === 1 ? "" : "s"} for service ${args2.service_id} (page ${response.page} of ${response.totalPages}, ${response.total} total).`;
590
590
  return respond({ summary, data });
591
591
  }
592
592
  });
@@ -692,22 +692,32 @@ defineTool({
692
692
  " - service_id: publicId of the service.",
693
693
  " - deploy_id: publicId of the deploy.",
694
694
  "",
695
- "Returns: { logs: string } \u2014 full build output as a single string. May be truncated by the API if the deploy is still in progress.",
695
+ "Returns: { logs: string, lineCount: number, nextAfterId: number | null } \u2014 flattened build output joined with newlines, line count, and a cursor for pagination (pass back as after_id to fetch the next page).",
696
696
  "",
697
- 'Example: get_deploy_logs({ service_id: "svc_abc", deploy_id: "dpl_xyz" }) \u2192 { logs: "Building\u2026\\nStep 1/8\u2026\\n\u2026" }'
697
+ 'Example: get_deploy_logs({ service_id: "svc_abc", deploy_id: "dpl_xyz" }) \u2192 { logs: "Building\u2026\\nStep 1/8\u2026\\n\u2026", lineCount: 42, nextAfterId: 1234 }'
698
698
  ].join("\n"),
699
699
  input: {
700
700
  service_id: z5.string().describe("Service publicId."),
701
- deploy_id: z5.string().describe("Deploy publicId.")
701
+ deploy_id: z5.string().describe("Deploy publicId."),
702
+ after_id: z5.number().int().optional().describe("Pagination cursor from a previous response\u2019s nextAfterId."),
703
+ limit: z5.number().int().min(1).max(5e3).optional().describe("Max log entries to fetch (default 500, hard cap 5000).")
702
704
  },
703
705
  handler: async (args2, ctx) => {
704
706
  const teamId = await ctx.resolveTeamId();
705
- const response = await ctx.hoststack.deploys.getLogs(teamId, args2.service_id, args2.deploy_id);
706
- const logs = typeof response.logs === "string" ? response.logs : "";
707
- const lines = logs ? logs.split("\n").length : 0;
707
+ const response = await ctx.hoststack.deploys.getLogs(
708
+ teamId,
709
+ args2.service_id,
710
+ args2.deploy_id,
711
+ {
712
+ ...args2.after_id !== void 0 ? { afterId: args2.after_id } : {},
713
+ ...args2.limit !== void 0 ? { limit: args2.limit } : {}
714
+ }
715
+ );
716
+ const entries = response.logs;
717
+ const logs = entries.map((e) => e.message).join("\n");
708
718
  return respond({
709
- summary: `Fetched ${lines} log line${lines === 1 ? "" : "s"} for deploy ${args2.deploy_id}.`,
710
- data: { logs }
719
+ summary: `Fetched ${entries.length} log line${entries.length === 1 ? "" : "s"} for deploy ${args2.deploy_id}.`,
720
+ data: { logs, lineCount: entries.length, nextAfterId: response.nextAfterId }
711
721
  });
712
722
  }
713
723
  });
@@ -1233,52 +1243,79 @@ defineTool({
1233
1243
  name: "update_service_config",
1234
1244
  category: "services",
1235
1245
  description: [
1236
- "Update build/runtime configuration for a service: build command, start command, branch, root directory, dockerfile path, auto-deploy flag, instance count, plan tier. All fields optional \u2014 pass only what you want to change.",
1246
+ "Update build/runtime configuration for a service: build command, start command, install command, branch, root directory, dockerfile path, auto-deploy flag, instance count. All fields optional \u2014 pass only what you want to change.",
1237
1247
  "",
1238
- "When to use: the user wants to tweak how a service builds or runs without redeploying manually. Updating any field marked dispatch-eligible (branch, build/start command, plan, root, dockerfile) typically triggers a follow-up deploy automatically; instance count scales without redeploying.",
1248
+ "When to use: the user wants to tweak how a service builds or runs. Build/runtime fields (branch, install/build/start command, root, dockerfile) take effect on the next deploy \u2014 call trigger_deploy after if you need them applied immediately. instance_count rescales without a redeploy.",
1239
1249
  "",
1240
1250
  "Inputs:",
1241
1251
  " - service_id: publicId of the service.",
1242
- " - build_command, start_command (optional): shell commands.",
1252
+ " - install_command, build_command, start_command (optional): shell commands. Pass null to clear.",
1243
1253
  " - branch (optional): git branch to track.",
1244
- " - root_directory, dockerfile_path (optional): build context overrides.",
1254
+ " - root_directory (optional): build context root inside the repo.",
1255
+ " - dockerfile_path (optional): path to Dockerfile relative to root_directory. Pass null to clear.",
1245
1256
  " - auto_deploy (optional): boolean \u2014 auto-deploy on git push.",
1246
- " - instance_count (optional): integer \u22651 \u2014 manual scale.",
1247
- ' - plan (optional): plan tier slug (e.g. "starter", "standard", "pro").',
1257
+ " - instance_count (optional): integer \u22651 \u2014 pin both min and max instances to this value.",
1248
1258
  "",
1249
- "Returns: { config: ServiceConfig } \u2014 the updated config record.",
1259
+ "Returns: { service?: Service, config?: ServiceConfig } \u2014 whichever rows were touched.",
1250
1260
  "",
1251
- 'Example: update_service_config({ service_id: "svc_abc", instance_count: 3 }) \u2192 { config: { instanceCount: 3, \u2026 } }'
1261
+ 'Example: update_service_config({ service_id: "svc_abc", start_command: "bun apps/api/src/index.ts" }) \u2192 { service: { startCommand: "bun apps/api/src/index.ts", \u2026 } }'
1252
1262
  ].join("\n"),
1253
1263
  input: {
1254
1264
  service_id: z9.string().describe("Service publicId."),
1255
- build_command: z9.string().optional().describe("Build shell command."),
1256
- start_command: z9.string().optional().describe("Start shell command."),
1265
+ install_command: z9.string().nullable().optional().describe("Install shell command. Null clears."),
1266
+ build_command: z9.string().nullable().optional().describe("Build shell command. Null clears."),
1267
+ start_command: z9.string().nullable().optional().describe("Start shell command. Null clears."),
1257
1268
  branch: z9.string().optional().describe("Git branch to track."),
1258
1269
  root_directory: z9.string().optional().describe("Build context root."),
1259
- dockerfile_path: z9.string().optional().describe("Path to Dockerfile relative to root."),
1270
+ dockerfile_path: z9.string().nullable().optional().describe("Path to Dockerfile relative to root. Null clears."),
1260
1271
  auto_deploy: z9.boolean().optional().describe("Auto-deploy on push."),
1261
- instance_count: z9.number().int().positive().optional().describe("Manual scale (\u22651)."),
1262
- plan: z9.string().optional().describe("Plan tier slug.")
1272
+ instance_count: z9.number().int().positive().max(50).optional().describe("Pin min and max instances to this value (1\u201350).")
1263
1273
  },
1264
1274
  handler: async (args2, ctx) => {
1265
1275
  const teamId = await ctx.resolveTeamId();
1266
- const input = {};
1267
- if (args2.build_command !== void 0) input["buildCommand"] = args2.build_command;
1268
- if (args2.start_command !== void 0) input["startCommand"] = args2.start_command;
1269
- if (args2.branch !== void 0) input["branch"] = args2.branch;
1270
- if (args2.root_directory !== void 0) input["rootDirectory"] = args2.root_directory;
1271
- if (args2.dockerfile_path !== void 0) input["dockerfilePath"] = args2.dockerfile_path;
1272
- if (args2.auto_deploy !== void 0) input["autoDeploy"] = args2.auto_deploy;
1273
- if (args2.instance_count !== void 0) input["instanceCount"] = args2.instance_count;
1274
- if (args2.plan !== void 0) input["plan"] = args2.plan;
1275
- if (Object.keys(input).length === 0) {
1276
+ const serviceUpdate = {};
1277
+ if (args2.install_command !== void 0)
1278
+ serviceUpdate["installCommand"] = args2.install_command;
1279
+ if (args2.build_command !== void 0) serviceUpdate["buildCommand"] = args2.build_command;
1280
+ if (args2.start_command !== void 0) serviceUpdate["startCommand"] = args2.start_command;
1281
+ if (args2.dockerfile_path !== void 0)
1282
+ serviceUpdate["dockerfilePath"] = args2.dockerfile_path;
1283
+ if (args2.branch !== void 0) serviceUpdate["branch"] = args2.branch;
1284
+ if (args2.root_directory !== void 0)
1285
+ serviceUpdate["rootDirectory"] = args2.root_directory;
1286
+ if (args2.auto_deploy !== void 0) serviceUpdate["autoDeploy"] = args2.auto_deploy;
1287
+ const configUpdate = {};
1288
+ if (args2.instance_count !== void 0) {
1289
+ configUpdate["minInstances"] = args2.instance_count;
1290
+ configUpdate["maxInstances"] = args2.instance_count;
1291
+ }
1292
+ if (Object.keys(serviceUpdate).length === 0 && Object.keys(configUpdate).length === 0) {
1276
1293
  return respond({ summary: "No fields to update.", data: {} });
1277
1294
  }
1278
- const response = await ctx.hoststack.services.updateConfig(teamId, args2.service_id, input);
1279
- const data = { config: shape(response.config) };
1280
- const fields = Object.keys(input).join(", ");
1281
- return respond({ summary: `Updated ${fields} on service ${args2.service_id}.`, data });
1295
+ const data = {};
1296
+ const touchedFields = [];
1297
+ if (Object.keys(serviceUpdate).length > 0) {
1298
+ const serviceResponse = await ctx.hoststack.services.update(
1299
+ teamId,
1300
+ args2.service_id,
1301
+ serviceUpdate
1302
+ );
1303
+ data["service"] = shape(serviceResponse.service);
1304
+ touchedFields.push(...Object.keys(serviceUpdate));
1305
+ }
1306
+ if (Object.keys(configUpdate).length > 0) {
1307
+ const configResponse = await ctx.hoststack.services.updateConfig(
1308
+ teamId,
1309
+ args2.service_id,
1310
+ configUpdate
1311
+ );
1312
+ data["config"] = shape(configResponse.config);
1313
+ touchedFields.push(...Object.keys(configUpdate));
1314
+ }
1315
+ return respond({
1316
+ summary: `Updated ${touchedFields.join(", ")} on service ${args2.service_id}.`,
1317
+ data
1318
+ });
1282
1319
  }
1283
1320
  });
1284
1321
  defineTool({