replicas-mcp 0.2.4 → 0.2.7

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/dist/index.js +259 -24
  2. package/package.json +1 -1
  3. package/src/index.ts +15 -5
package/dist/index.js CHANGED
@@ -1473,7 +1473,7 @@ var require_stringify = __commonJS({
1473
1473
  props.push(doc.directives.tagString(tag));
1474
1474
  return props.join(" ");
1475
1475
  }
1476
- function stringify(item, ctx, onComment, onChompKeep) {
1476
+ function stringify2(item, ctx, onComment, onChompKeep) {
1477
1477
  if (identity.isPair(item))
1478
1478
  return item.toString(ctx, onComment, onChompKeep);
1479
1479
  if (identity.isAlias(item)) {
@@ -1502,7 +1502,7 @@ var require_stringify = __commonJS({
1502
1502
  ${ctx.indent}${str}`;
1503
1503
  }
1504
1504
  exports.createStringifyContext = createStringifyContext;
1505
- exports.stringify = stringify;
1505
+ exports.stringify = stringify2;
1506
1506
  }
1507
1507
  });
1508
1508
 
@@ -1512,7 +1512,7 @@ var require_stringifyPair = __commonJS({
1512
1512
  "use strict";
1513
1513
  var identity = require_identity();
1514
1514
  var Scalar = require_Scalar();
1515
- var stringify = require_stringify();
1515
+ var stringify2 = require_stringify();
1516
1516
  var stringifyComment = require_stringifyComment();
1517
1517
  function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
1518
1518
  const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
@@ -1534,7 +1534,7 @@ var require_stringifyPair = __commonJS({
1534
1534
  });
1535
1535
  let keyCommentDone = false;
1536
1536
  let chompKeep = false;
1537
- let str = stringify.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
1537
+ let str = stringify2.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
1538
1538
  if (!explicitKey && !ctx.inFlow && str.length > 1024) {
1539
1539
  if (simpleKeys)
1540
1540
  throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
@@ -1586,7 +1586,7 @@ ${indent}:`;
1586
1586
  ctx.indent = ctx.indent.substring(2);
1587
1587
  }
1588
1588
  let valueCommentDone = false;
1589
- const valueStr = stringify.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
1589
+ const valueStr = stringify2.stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
1590
1590
  let ws = " ";
1591
1591
  if (keyComment || vsb || vcb) {
1592
1592
  ws = vsb ? "\n" : "";
@@ -1727,7 +1727,7 @@ var require_addPairToJSMap = __commonJS({
1727
1727
  "use strict";
1728
1728
  var log = require_log();
1729
1729
  var merge = require_merge();
1730
- var stringify = require_stringify();
1730
+ var stringify2 = require_stringify();
1731
1731
  var identity = require_identity();
1732
1732
  var toJS = require_toJS();
1733
1733
  function addPairToJSMap(ctx, map, { key, value }) {
@@ -1763,7 +1763,7 @@ var require_addPairToJSMap = __commonJS({
1763
1763
  if (typeof jsKey !== "object")
1764
1764
  return String(jsKey);
1765
1765
  if (identity.isNode(key) && ctx?.doc) {
1766
- const strCtx = stringify.createStringifyContext(ctx.doc, {});
1766
+ const strCtx = stringify2.createStringifyContext(ctx.doc, {});
1767
1767
  strCtx.anchors = /* @__PURE__ */ new Set();
1768
1768
  for (const node of ctx.anchors.keys())
1769
1769
  strCtx.anchors.add(node.anchor);
@@ -1830,12 +1830,12 @@ var require_stringifyCollection = __commonJS({
1830
1830
  "../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports) {
1831
1831
  "use strict";
1832
1832
  var identity = require_identity();
1833
- var stringify = require_stringify();
1833
+ var stringify2 = require_stringify();
1834
1834
  var stringifyComment = require_stringifyComment();
1835
1835
  function stringifyCollection(collection, ctx, options) {
1836
1836
  const flow = ctx.inFlow ?? collection.flow;
1837
- const stringify2 = flow ? stringifyFlowCollection : stringifyBlockCollection;
1838
- return stringify2(collection, ctx, options);
1837
+ const stringify3 = flow ? stringifyFlowCollection : stringifyBlockCollection;
1838
+ return stringify3(collection, ctx, options);
1839
1839
  }
1840
1840
  function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
1841
1841
  const { indent, options: { commentString } } = ctx;
@@ -1860,7 +1860,7 @@ var require_stringifyCollection = __commonJS({
1860
1860
  }
1861
1861
  }
1862
1862
  chompKeep = false;
1863
- let str2 = stringify.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
1863
+ let str2 = stringify2.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
1864
1864
  if (comment2)
1865
1865
  str2 += stringifyComment.lineComment(str2, itemIndent, commentString(comment2));
1866
1866
  if (chompKeep && comment2)
@@ -1927,7 +1927,7 @@ ${indent}${line}` : "\n";
1927
1927
  }
1928
1928
  if (comment)
1929
1929
  reqNewline = true;
1930
- let str = stringify.stringify(item, itemCtx, () => comment = null);
1930
+ let str = stringify2.stringify(item, itemCtx, () => comment = null);
1931
1931
  reqNewline || (reqNewline = lines.length > linesAtValue || str.includes("\n"));
1932
1932
  if (i < items.length - 1) {
1933
1933
  str += ",";
@@ -3288,7 +3288,7 @@ var require_stringifyDocument = __commonJS({
3288
3288
  "../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports) {
3289
3289
  "use strict";
3290
3290
  var identity = require_identity();
3291
- var stringify = require_stringify();
3291
+ var stringify2 = require_stringify();
3292
3292
  var stringifyComment = require_stringifyComment();
3293
3293
  function stringifyDocument(doc, options) {
3294
3294
  const lines = [];
@@ -3303,7 +3303,7 @@ var require_stringifyDocument = __commonJS({
3303
3303
  }
3304
3304
  if (hasDirectives)
3305
3305
  lines.push("---");
3306
- const ctx = stringify.createStringifyContext(doc, options);
3306
+ const ctx = stringify2.createStringifyContext(doc, options);
3307
3307
  const { commentString } = ctx.options;
3308
3308
  if (doc.commentBefore) {
3309
3309
  if (lines.length !== 1)
@@ -3325,7 +3325,7 @@ var require_stringifyDocument = __commonJS({
3325
3325
  contentComment = doc.contents.comment;
3326
3326
  }
3327
3327
  const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
3328
- let body = stringify.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
3328
+ let body = stringify2.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
3329
3329
  if (contentComment)
3330
3330
  body += stringifyComment.lineComment(body, "", commentString(contentComment));
3331
3331
  if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
@@ -3333,7 +3333,7 @@ var require_stringifyDocument = __commonJS({
3333
3333
  } else
3334
3334
  lines.push(body);
3335
3335
  } else {
3336
- lines.push(stringify.stringify(doc.contents, ctx));
3336
+ lines.push(stringify2.stringify(doc.contents, ctx));
3337
3337
  }
3338
3338
  if (doc.directives?.docEnd) {
3339
3339
  if (doc.comment) {
@@ -5468,7 +5468,7 @@ var require_cst_scalar = __commonJS({
5468
5468
  var require_cst_stringify = __commonJS({
5469
5469
  "../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/parse/cst-stringify.js"(exports) {
5470
5470
  "use strict";
5471
- var stringify = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
5471
+ var stringify2 = (cst) => "type" in cst ? stringifyToken(cst) : stringifyItem(cst);
5472
5472
  function stringifyToken(token) {
5473
5473
  switch (token.type) {
5474
5474
  case "block-scalar": {
@@ -5521,7 +5521,7 @@ var require_cst_stringify = __commonJS({
5521
5521
  res += stringifyToken(value);
5522
5522
  return res;
5523
5523
  }
5524
- exports.stringify = stringify;
5524
+ exports.stringify = stringify2;
5525
5525
  }
5526
5526
  });
5527
5527
 
@@ -7251,7 +7251,7 @@ var require_public_api = __commonJS({
7251
7251
  }
7252
7252
  return doc.toJS(Object.assign({ reviver: _reviver }, options));
7253
7253
  }
7254
- function stringify(value, replacer, options) {
7254
+ function stringify2(value, replacer, options) {
7255
7255
  let _replacer = null;
7256
7256
  if (typeof replacer === "function" || Array.isArray(replacer)) {
7257
7257
  _replacer = replacer;
@@ -7276,7 +7276,7 @@ var require_public_api = __commonJS({
7276
7276
  exports.parse = parse;
7277
7277
  exports.parseAllDocuments = parseAllDocuments;
7278
7278
  exports.parseDocument = parseDocument;
7279
- exports.stringify = stringify;
7279
+ exports.stringify = stringify2;
7280
7280
  }
7281
7281
  });
7282
7282
 
@@ -7342,6 +7342,30 @@ function isRecord(value) {
7342
7342
  return typeof value === "object" && value !== null && !Array.isArray(value);
7343
7343
  }
7344
7344
 
7345
+ // ../shared/src/agent.ts
7346
+ var VALID_AGENT_PROVIDERS = ["claude", "codex", "cursor", "relay"];
7347
+ var VALID_CODING_AGENT_PROVIDERS = VALID_AGENT_PROVIDERS.filter(
7348
+ (provider) => provider !== "relay"
7349
+ );
7350
+ function isValidCodingAgentProvider(value) {
7351
+ return VALID_CODING_AGENT_PROVIDERS.some((provider) => provider === value);
7352
+ }
7353
+ function getProviderDisplayName(provider, variant = "short") {
7354
+ switch (provider) {
7355
+ case "codex":
7356
+ return "Codex";
7357
+ case "cursor":
7358
+ return "Cursor";
7359
+ case "relay":
7360
+ return "Relay";
7361
+ case "claude":
7362
+ return variant === "long" ? "Claude Code" : "Claude";
7363
+ }
7364
+ }
7365
+ function getCodingAgentDisplayNames() {
7366
+ return VALID_CODING_AGENT_PROVIDERS.map((provider) => getProviderDisplayName(provider)).join(", ");
7367
+ }
7368
+
7345
7369
  // ../shared/src/event.ts
7346
7370
  var CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE = "claude-partial-message";
7347
7371
  function coerceClaudePartialMessagePayload(payload) {
@@ -7364,6 +7388,10 @@ var CODEX_ASP_ITEM_ID_PAYLOAD_KEY = "codexAspItemId";
7364
7388
  var CODEX_QUOTA_STATUS_EVENT_TYPE = "codex-quota-status";
7365
7389
 
7366
7390
  // ../shared/src/pricing.ts
7391
+ var INTEGRATION_SOURCES = ["slack", "linear", "github", "gitlab"];
7392
+ var SYSTEMIC_SOURCES = ["api", "automation"];
7393
+ var INTEGRATION_SOURCES_SQL = INTEGRATION_SOURCES.map((s) => `'${s}'`).join(", ");
7394
+ var SYSTEMIC_SOURCES_SQL = SYSTEMIC_SOURCES.map((s) => `'${s}'`).join(", ");
7367
7395
  var PLANS = {
7368
7396
  hobby: {
7369
7397
  id: "hobby",
@@ -8957,6 +8985,7 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
8957
8985
  var CLAUDE_OPUS_1M_MODEL = "opus[1m]";
8958
8986
  var LEGACY_CLAUDE_OPUS_1M_MODEL = "opus-1m";
8959
8987
  var DEFAULT_CODEX_MODEL = "gpt-5.5";
8988
+ var DEFAULT_CURSOR_MODEL = "composer-2";
8960
8989
  var MODEL_LABELS = {
8961
8990
  sonnet: "Sonnet 4.5",
8962
8991
  opus: "Opus 4.8",
@@ -8964,6 +8993,8 @@ var MODEL_LABELS = {
8964
8993
  [LEGACY_CLAUDE_OPUS_1M_MODEL]: "Opus 4.8 (1M)",
8965
8994
  haiku: "Haiku 4.5",
8966
8995
  [DEFAULT_CODEX_MODEL]: "GPT-5.5",
8996
+ [DEFAULT_CURSOR_MODEL]: "Composer 2",
8997
+ "composer-2.5": "Composer 2.5",
8967
8998
  "gpt-5.4": "GPT-5.4",
8968
8999
  "gpt-5.4-mini": "GPT-5.4 Mini",
8969
9000
  "gpt-5.3-codex": "GPT-5.3 Codex",
@@ -9309,6 +9340,204 @@ function parseCodexEvents(events) {
9309
9340
  return messages;
9310
9341
  }
9311
9342
 
9343
+ // ../shared/src/display-message/parsers/cursor-parser.ts
9344
+ function getTextContent(value) {
9345
+ if (!Array.isArray(value)) return "";
9346
+ return value.map((block) => isRecord(block) && block.type === "text" && typeof block.text === "string" ? block.text : "").join("");
9347
+ }
9348
+ function stringify(value) {
9349
+ if (value === void 0 || value === null) return void 0;
9350
+ if (typeof value === "string") return value;
9351
+ try {
9352
+ return JSON.stringify(value, null, 2);
9353
+ } catch {
9354
+ return String(value);
9355
+ }
9356
+ }
9357
+ function cursorStatusToDisplayStatus(status) {
9358
+ return status === "completed" || status === "FINISHED" ? "completed" : status === "error" || status === "ERROR" || status === "CANCELLED" || status === "EXPIRED" ? "failed" : "in_progress";
9359
+ }
9360
+ function cursorRunId(event) {
9361
+ const runId = event.payload.run_id;
9362
+ return typeof runId === "string" ? runId : "unknown-run";
9363
+ }
9364
+ function getCursorAssistantText(event) {
9365
+ const message = isRecord(event.payload.message) ? event.payload.message : null;
9366
+ return getTextContent(message?.content);
9367
+ }
9368
+ function getCursorThinkingText(event) {
9369
+ const text = event.payload.text;
9370
+ if (typeof text === "string") return text;
9371
+ const message = isRecord(event.payload.message) ? event.payload.message : null;
9372
+ return typeof message?.text === "string" ? message.text : "";
9373
+ }
9374
+ function isTerminalStatus(status) {
9375
+ return status === "FINISHED" || status === "ERROR" || status === "CANCELLED" || status === "EXPIRED";
9376
+ }
9377
+ function finalizeOpenTools(messages, toolIndexes, status) {
9378
+ for (const index of toolIndexes.values()) {
9379
+ const message = messages[index];
9380
+ if (message?.type === "tool_call" && message.status === "in_progress") {
9381
+ messages[index] = {
9382
+ ...message,
9383
+ status
9384
+ };
9385
+ }
9386
+ }
9387
+ }
9388
+ function parseCursorEvents(events) {
9389
+ const messages = [];
9390
+ const toolIndexes = /* @__PURE__ */ new Map();
9391
+ const runAssistantSegments = /* @__PURE__ */ new Map();
9392
+ const runThinkingSegments = /* @__PURE__ */ new Map();
9393
+ let activeAssistant = null;
9394
+ let activeThinking = null;
9395
+ const finalizeActiveThinking = (status) => {
9396
+ if (!activeThinking) return;
9397
+ const message = messages[activeThinking.index];
9398
+ if (message?.type === "reasoning") {
9399
+ messages[activeThinking.index] = {
9400
+ ...message,
9401
+ status
9402
+ };
9403
+ }
9404
+ };
9405
+ for (const event of events) {
9406
+ if (event.type === "event_msg" && event.payload.type === "user_message") {
9407
+ activeAssistant = null;
9408
+ activeThinking = null;
9409
+ const message = event.payload.message;
9410
+ if (typeof message === "string" && message.trim()) {
9411
+ messages.push({
9412
+ id: `cursor-user-${event.timestamp}-${messages.length}`,
9413
+ type: "user",
9414
+ content: message,
9415
+ timestamp: event.timestamp
9416
+ });
9417
+ }
9418
+ continue;
9419
+ }
9420
+ if (event.type === "cursor-assistant") {
9421
+ const text = getCursorAssistantText(event);
9422
+ if (text) {
9423
+ const runId = cursorRunId(event);
9424
+ if (!activeAssistant || activeAssistant.runId !== runId) {
9425
+ const segment = runAssistantSegments.get(runId) ?? 0;
9426
+ runAssistantSegments.set(runId, segment + 1);
9427
+ activeAssistant = {
9428
+ runId,
9429
+ index: messages.push({
9430
+ id: `cursor-agent-${runId}-${segment}`,
9431
+ type: "agent",
9432
+ content: "",
9433
+ timestamp: event.timestamp
9434
+ }) - 1
9435
+ };
9436
+ }
9437
+ const message = messages[activeAssistant.index];
9438
+ if (message?.type === "agent") {
9439
+ messages[activeAssistant.index] = {
9440
+ ...message,
9441
+ content: `${message.content}${text}`
9442
+ };
9443
+ }
9444
+ }
9445
+ continue;
9446
+ }
9447
+ if (event.type === "cursor-thinking") {
9448
+ const text = getCursorThinkingText(event);
9449
+ if (text.trim()) {
9450
+ const runId = cursorRunId(event);
9451
+ if (!activeThinking || activeThinking.runId !== runId) {
9452
+ const segment = runThinkingSegments.get(runId) ?? 0;
9453
+ runThinkingSegments.set(runId, segment + 1);
9454
+ activeThinking = {
9455
+ runId,
9456
+ index: messages.push({
9457
+ id: `cursor-reasoning-${runId}-${segment}`,
9458
+ type: "reasoning",
9459
+ content: "",
9460
+ status: "in_progress",
9461
+ timestamp: event.timestamp
9462
+ }) - 1
9463
+ };
9464
+ }
9465
+ const message = messages[activeThinking.index];
9466
+ if (message?.type === "reasoning") {
9467
+ messages[activeThinking.index] = {
9468
+ ...message,
9469
+ content: `${message.content}${text}`,
9470
+ status: "in_progress"
9471
+ };
9472
+ }
9473
+ }
9474
+ continue;
9475
+ }
9476
+ if (event.type === "cursor-tool_call") {
9477
+ activeAssistant = null;
9478
+ const callId = typeof event.payload.call_id === "string" ? event.payload.call_id : `cursor-tool-${event.timestamp}-${messages.length}`;
9479
+ const tool = typeof event.payload.name === "string" ? event.payload.name : "tool";
9480
+ const status = cursorStatusToDisplayStatus(event.payload.status);
9481
+ const input = isRecord(event.payload.args) ? event.payload.args : typeof event.payload.args === "string" ? event.payload.args : void 0;
9482
+ const existing = toolIndexes.get(callId);
9483
+ const next = {
9484
+ id: callId,
9485
+ type: "tool_call",
9486
+ server: "cursor",
9487
+ tool,
9488
+ ...input !== void 0 ? { input } : {},
9489
+ output: stringify(event.payload.result),
9490
+ status,
9491
+ timestamp: event.timestamp
9492
+ };
9493
+ if (existing === void 0) {
9494
+ toolIndexes.set(callId, messages.push(next) - 1);
9495
+ } else {
9496
+ messages[existing] = { ...messages[existing], ...next };
9497
+ }
9498
+ continue;
9499
+ }
9500
+ if (event.type === "cursor-task") {
9501
+ activeAssistant = null;
9502
+ const text = event.payload.text;
9503
+ if (typeof text === "string" && text.trim()) {
9504
+ messages.push({
9505
+ id: `cursor-task-${event.timestamp}-${messages.length}`,
9506
+ type: "agent",
9507
+ content: text,
9508
+ timestamp: event.timestamp
9509
+ });
9510
+ }
9511
+ continue;
9512
+ }
9513
+ if (event.type === "cursor-status") {
9514
+ const status = event.payload.status;
9515
+ if (isTerminalStatus(status)) {
9516
+ const displayStatus = cursorStatusToDisplayStatus(status);
9517
+ finalizeActiveThinking(displayStatus);
9518
+ finalizeOpenTools(messages, toolIndexes, displayStatus);
9519
+ activeThinking = null;
9520
+ activeAssistant = null;
9521
+ }
9522
+ continue;
9523
+ }
9524
+ if (event.type === "cursor-error") {
9525
+ finalizeActiveThinking("failed");
9526
+ finalizeOpenTools(messages, toolIndexes, "failed");
9527
+ activeAssistant = null;
9528
+ activeThinking = null;
9529
+ const message = typeof event.payload.message === "string" ? event.payload.message : "Cursor run failed";
9530
+ messages.push({
9531
+ id: `cursor-error-${event.timestamp}-${messages.length}`,
9532
+ type: "error",
9533
+ message,
9534
+ timestamp: event.timestamp
9535
+ });
9536
+ }
9537
+ }
9538
+ return messages;
9539
+ }
9540
+
9312
9541
  // ../shared/src/display-message/task-accumulator.ts
9313
9542
  function mapTaskStatus(status) {
9314
9543
  if (status === "in_progress" || status === "completed") return status;
@@ -9840,6 +10069,9 @@ function parseAgentEvents(events, agentType) {
9840
10069
  if (agentType === "codex") {
9841
10070
  return parseCodexEvents(events);
9842
10071
  }
10072
+ if (agentType === "cursor") {
10073
+ return parseCursorEvents(events);
10074
+ }
9843
10075
  return parseClaudeEvents(events);
9844
10076
  }
9845
10077
 
@@ -9884,9 +10116,12 @@ function result(data, isError = false) {
9884
10116
  }
9885
10117
  var server = new McpServer({
9886
10118
  name: "replicas-mcp",
9887
- version: "0.2.4"
10119
+ version: "0.2.7"
9888
10120
  });
9889
10121
  var registerTool = server.registerTool.bind(server);
10122
+ var codingAgentSchema = z.string().refine(isValidCodingAgentProvider, {
10123
+ message: `Coding agent must be ${getCodingAgentDisplayNames()}`
10124
+ });
9890
10125
  registerTool(
9891
10126
  "create_replica",
9892
10127
  {
@@ -9896,7 +10131,7 @@ registerTool(
9896
10131
  message: z.string(),
9897
10132
  repository_ids: z.array(z.string()).min(1).optional().describe("Repository IDs to include. Mutually exclusive with repository_set_id."),
9898
10133
  repository_set_id: z.string().optional().describe("Repository set ID to use. Mutually exclusive with repository_ids."),
9899
- coding_agent: z.enum(["claude", "codex"]).optional().describe("Coding agent to use (default: claude)"),
10134
+ coding_agent: codingAgentSchema.optional().describe("Coding agent to use (default: claude)"),
9900
10135
  model: z.string().optional().describe("Model to use for the coding agent"),
9901
10136
  lifecycle_policy: z.enum(["default", "delete_when_done", "delete_after_inactivity"]).optional().describe("Lifecycle policy for the workspace")
9902
10137
  }
@@ -9972,7 +10207,7 @@ registerTool(
9972
10207
  inputSchema: {
9973
10208
  id: z.string(),
9974
10209
  message: z.string(),
9975
- coding_agent: z.enum(["claude", "codex"]).optional().describe("Coding agent to use"),
10210
+ coding_agent: codingAgentSchema.optional().describe("Coding agent to use"),
9976
10211
  chat_id: z.string().optional().describe("Chat ID to send the message to (uses default chat if omitted)"),
9977
10212
  model: z.string().optional().describe("Model to use"),
9978
10213
  plan_mode: z.boolean().optional().describe("Whether to use plan mode")
@@ -10055,7 +10290,7 @@ registerTool(
10055
10290
  description: "Create a new chat in a replica workspace",
10056
10291
  inputSchema: {
10057
10292
  id: z.string().describe("Replica ID"),
10058
- provider: z.enum(["claude", "codex"]).describe("Coding agent provider for the chat"),
10293
+ provider: codingAgentSchema.describe("Coding agent provider for the chat"),
10059
10294
  title: z.string().optional().describe("Optional title for the chat")
10060
10295
  }
10061
10296
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-mcp",
3
- "version": "0.2.4",
3
+ "version": "0.2.7",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -2,7 +2,14 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
3
  import { z } from 'zod';
4
4
  import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
5
- import { parseAgentEvents, type AgentProvider, type ReadReplicaHistoryResponse } from '@replicas/shared';
5
+ import {
6
+ getCodingAgentDisplayNames,
7
+ getProviderDisplayName,
8
+ isValidCodingAgentProvider,
9
+ parseAgentEvents,
10
+ type AgentProvider,
11
+ type ReadReplicaHistoryResponse,
12
+ } from '@replicas/shared';
6
13
 
7
14
  const API_URL = process.env.REPLICAS_API_URL || 'https://api.tryreplicas.com';
8
15
  const API_KEY = process.env.REPLICAS_API_KEY;
@@ -57,10 +64,13 @@ type RegisterToolFn = (
57
64
 
58
65
  const server = new McpServer({
59
66
  name: 'replicas-mcp',
60
- version: '0.2.4',
67
+ version: '0.2.7',
61
68
  });
62
69
 
63
70
  const registerTool = server.registerTool.bind(server) as RegisterToolFn;
71
+ const codingAgentSchema = z.string().refine(isValidCodingAgentProvider, {
72
+ message: `Coding agent must be ${getCodingAgentDisplayNames()}`,
73
+ });
64
74
 
65
75
  // ---------------------------------------------------------------------------
66
76
  // Replica CRUD
@@ -75,7 +85,7 @@ registerTool(
75
85
  message: z.string(),
76
86
  repository_ids: z.array(z.string()).min(1).optional().describe('Repository IDs to include. Mutually exclusive with repository_set_id.'),
77
87
  repository_set_id: z.string().optional().describe('Repository set ID to use. Mutually exclusive with repository_ids.'),
78
- coding_agent: z.enum(['claude', 'codex']).optional().describe('Coding agent to use (default: claude)'),
88
+ coding_agent: codingAgentSchema.optional().describe('Coding agent to use (default: claude)'),
79
89
  model: z.string().optional().describe('Model to use for the coding agent'),
80
90
  lifecycle_policy: z.enum(['default', 'delete_when_done', 'delete_after_inactivity']).optional().describe('Lifecycle policy for the workspace'),
81
91
  },
@@ -154,7 +164,7 @@ registerTool(
154
164
  inputSchema: {
155
165
  id: z.string(),
156
166
  message: z.string(),
157
- coding_agent: z.enum(['claude', 'codex']).optional().describe('Coding agent to use'),
167
+ coding_agent: codingAgentSchema.optional().describe('Coding agent to use'),
158
168
  chat_id: z.string().optional().describe('Chat ID to send the message to (uses default chat if omitted)'),
159
169
  model: z.string().optional().describe('Model to use'),
160
170
  plan_mode: z.boolean().optional().describe('Whether to use plan mode'),
@@ -250,7 +260,7 @@ registerTool(
250
260
  description: 'Create a new chat in a replica workspace',
251
261
  inputSchema: {
252
262
  id: z.string().describe('Replica ID'),
253
- provider: z.enum(['claude', 'codex']).describe('Coding agent provider for the chat'),
263
+ provider: codingAgentSchema.describe('Coding agent provider for the chat'),
254
264
  title: z.string().optional().describe('Optional title for the chat'),
255
265
  },
256
266
  },