replicas-mcp 0.1.2 → 0.1.3
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/dist/index.js +586 -155
- package/package.json +4 -3
- package/tsup.config.ts +24 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,186 +1,617 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
#!/usr/bin/env node
|
|
3
|
+
|
|
4
|
+
// src/index.ts
|
|
5
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
// ../shared/src/display-message/parsers/codex-parser.ts
|
|
10
|
+
function safeJsonParse(str, fallback) {
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(str);
|
|
13
|
+
} catch {
|
|
14
|
+
return fallback;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function getStatusFromExitCode(exitCode) {
|
|
18
|
+
return exitCode === 0 ? "completed" : "failed";
|
|
19
|
+
}
|
|
20
|
+
function findLastMessageByType(messages, type) {
|
|
21
|
+
return messages.findLast((m) => m.type === type);
|
|
22
|
+
}
|
|
23
|
+
function parsePatch(input) {
|
|
24
|
+
const operations = [];
|
|
25
|
+
const lines = input.split("\n");
|
|
26
|
+
let currentOp = null;
|
|
27
|
+
let diffLines = [];
|
|
28
|
+
for (let i = 0; i < lines.length; i++) {
|
|
29
|
+
const line = lines[i];
|
|
30
|
+
if (line.startsWith("*** Add File:")) {
|
|
31
|
+
if (currentOp) {
|
|
32
|
+
if (diffLines.length > 0) currentOp.diff = diffLines.join("\n");
|
|
33
|
+
operations.push(currentOp);
|
|
34
|
+
diffLines = [];
|
|
35
|
+
}
|
|
36
|
+
currentOp = {
|
|
37
|
+
action: "add",
|
|
38
|
+
path: line.replace("*** Add File:", "").trim()
|
|
39
|
+
};
|
|
40
|
+
} else if (line.startsWith("*** Update File:")) {
|
|
41
|
+
if (currentOp) {
|
|
42
|
+
if (diffLines.length > 0) currentOp.diff = diffLines.join("\n");
|
|
43
|
+
operations.push(currentOp);
|
|
44
|
+
diffLines = [];
|
|
45
|
+
}
|
|
46
|
+
currentOp = {
|
|
47
|
+
action: "update",
|
|
48
|
+
path: line.replace("*** Update File:", "").trim()
|
|
49
|
+
};
|
|
50
|
+
} else if (line.startsWith("*** Delete File:")) {
|
|
51
|
+
if (currentOp) {
|
|
52
|
+
if (diffLines.length > 0) currentOp.diff = diffLines.join("\n");
|
|
53
|
+
operations.push(currentOp);
|
|
54
|
+
diffLines = [];
|
|
55
|
+
}
|
|
56
|
+
currentOp = {
|
|
57
|
+
action: "delete",
|
|
58
|
+
path: line.replace("*** Delete File:", "").trim()
|
|
59
|
+
};
|
|
60
|
+
} else if (line.startsWith("*** Move to:")) {
|
|
61
|
+
if (currentOp) {
|
|
62
|
+
currentOp.moveTo = line.replace("*** Move to:", "").trim();
|
|
63
|
+
}
|
|
64
|
+
} else if (line.startsWith("*** Begin Patch") || line.startsWith("*** End Patch")) {
|
|
65
|
+
continue;
|
|
66
|
+
} else if (currentOp && (line.startsWith("+") || line.startsWith("-") || line.startsWith("@@") || line.trim() === "")) {
|
|
67
|
+
diffLines.push(line);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (currentOp) {
|
|
71
|
+
if (diffLines.length > 0) currentOp.diff = diffLines.join("\n");
|
|
72
|
+
operations.push(currentOp);
|
|
73
|
+
}
|
|
74
|
+
return operations;
|
|
75
|
+
}
|
|
76
|
+
function parseCodexEvents(events) {
|
|
77
|
+
const messages = [];
|
|
78
|
+
const pendingPatches = /* @__PURE__ */ new Map();
|
|
79
|
+
events.forEach((event) => {
|
|
80
|
+
if (event.type === "event_msg" && event.payload?.type === "user_message") {
|
|
81
|
+
messages.push({
|
|
82
|
+
id: `user-${event.timestamp}`,
|
|
83
|
+
type: "user",
|
|
84
|
+
content: event.payload.message || "",
|
|
85
|
+
timestamp: event.timestamp
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (event.type === "event_msg" && event.payload?.type === "agent_reasoning") {
|
|
89
|
+
messages.push({
|
|
90
|
+
id: `reasoning-${event.timestamp}-${messages.length}`,
|
|
91
|
+
type: "reasoning",
|
|
92
|
+
content: event.payload.text || "",
|
|
93
|
+
status: "completed",
|
|
94
|
+
timestamp: event.timestamp
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (event.type === "response_item") {
|
|
98
|
+
const payloadType = event.payload?.type;
|
|
99
|
+
if (payloadType === "message" && event.payload?.role === "assistant") {
|
|
100
|
+
const content = event.payload.content || [];
|
|
101
|
+
const textContent = content.filter((c) => c.type === "output_text").map((c) => c.text || "").join("\n");
|
|
102
|
+
if (textContent) {
|
|
103
|
+
messages.push({
|
|
104
|
+
id: `agent-${event.timestamp}`,
|
|
105
|
+
type: "agent",
|
|
106
|
+
content: textContent,
|
|
107
|
+
timestamp: event.timestamp
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (payloadType === "function_call" && event.payload?.name === "shell") {
|
|
112
|
+
const args = safeJsonParse(event.payload.arguments || "{}", {});
|
|
113
|
+
const command = Array.isArray(args.command) ? args.command.join(" ") : args.command || "";
|
|
114
|
+
messages.push({
|
|
115
|
+
id: `command-${event.timestamp}`,
|
|
116
|
+
type: "command",
|
|
117
|
+
command,
|
|
118
|
+
output: "",
|
|
119
|
+
// Will be filled by function_call_output
|
|
120
|
+
status: "in_progress",
|
|
121
|
+
timestamp: event.timestamp
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (payloadType === "function_call_output") {
|
|
125
|
+
const output = safeJsonParse(
|
|
126
|
+
event.payload.output || "{}",
|
|
127
|
+
{}
|
|
128
|
+
);
|
|
129
|
+
if (output.output !== void 0 && output.metadata) {
|
|
130
|
+
const commandMsg = findLastMessageByType(messages, "command");
|
|
131
|
+
if (commandMsg) {
|
|
132
|
+
commandMsg.output = output.output || "";
|
|
133
|
+
commandMsg.exitCode = output.metadata?.exit_code;
|
|
134
|
+
commandMsg.status = getStatusFromExitCode(output.metadata?.exit_code);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (payloadType === "custom_tool_call") {
|
|
139
|
+
const callId = event.payload.call_id;
|
|
140
|
+
const name = event.payload.name;
|
|
141
|
+
const input = event.payload.input || "";
|
|
142
|
+
const status = event.payload.status || "in_progress";
|
|
143
|
+
if (name === "apply_patch") {
|
|
144
|
+
const operations = parsePatch(input);
|
|
145
|
+
pendingPatches.set(callId, { input, status, timestamp: event.timestamp, operations });
|
|
146
|
+
} else {
|
|
147
|
+
messages.push({
|
|
148
|
+
id: `toolcall-${event.timestamp}`,
|
|
149
|
+
type: "tool_call",
|
|
150
|
+
server: "custom",
|
|
151
|
+
tool: name,
|
|
152
|
+
status,
|
|
153
|
+
timestamp: event.timestamp
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (payloadType === "custom_tool_call_output") {
|
|
158
|
+
const callId = event.payload.call_id;
|
|
159
|
+
const output = safeJsonParse(
|
|
160
|
+
event.payload.output || "{}",
|
|
161
|
+
{}
|
|
162
|
+
);
|
|
163
|
+
const pendingPatch = pendingPatches.get(callId);
|
|
164
|
+
if (pendingPatch) {
|
|
165
|
+
messages.push({
|
|
166
|
+
id: `patch-${pendingPatch.timestamp}`,
|
|
167
|
+
type: "patch",
|
|
168
|
+
operations: pendingPatch.operations,
|
|
169
|
+
output: output.output || "",
|
|
170
|
+
exitCode: output.metadata?.exit_code,
|
|
171
|
+
status: getStatusFromExitCode(output.metadata?.exit_code),
|
|
172
|
+
timestamp: pendingPatch.timestamp
|
|
173
|
+
});
|
|
174
|
+
pendingPatches.delete(callId);
|
|
175
|
+
} else {
|
|
176
|
+
const toolCallMsg = findLastMessageByType(messages, "tool_call");
|
|
177
|
+
if (toolCallMsg) {
|
|
178
|
+
toolCallMsg.status = getStatusFromExitCode(output.metadata?.exit_code);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (payloadType === "function_call" && event.payload?.name === "update_plan") {
|
|
183
|
+
const args = safeJsonParse(
|
|
184
|
+
event.payload.arguments || "{}",
|
|
185
|
+
{}
|
|
186
|
+
);
|
|
187
|
+
if (args.plan && Array.isArray(args.plan)) {
|
|
188
|
+
const todoItems = args.plan.map((item) => ({
|
|
189
|
+
text: item.step,
|
|
190
|
+
completed: item.status === "completed"
|
|
191
|
+
}));
|
|
192
|
+
messages.push({
|
|
193
|
+
id: `todo-${event.timestamp}`,
|
|
194
|
+
type: "todo_list",
|
|
195
|
+
items: todoItems,
|
|
196
|
+
status: "completed",
|
|
197
|
+
timestamp: event.timestamp
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
return messages;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// ../shared/src/display-message/parsers/claude-parser.ts
|
|
207
|
+
function safeJsonParse2(str, fallback) {
|
|
208
|
+
try {
|
|
209
|
+
return JSON.parse(str);
|
|
210
|
+
} catch {
|
|
211
|
+
return fallback;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function extractToolResultContent(content) {
|
|
215
|
+
if (!content) return "";
|
|
216
|
+
if (typeof content === "string") return content;
|
|
217
|
+
if (Array.isArray(content)) {
|
|
218
|
+
return content.filter((item) => item.type === "text").map((item) => item.text || "").join("\n");
|
|
219
|
+
}
|
|
220
|
+
return "";
|
|
221
|
+
}
|
|
222
|
+
function parseClaudeEvents(events, parentToolUseId) {
|
|
223
|
+
const messages = [];
|
|
224
|
+
const filterValue = parentToolUseId !== void 0 ? parentToolUseId : null;
|
|
225
|
+
const filteredEvents = events.filter(
|
|
226
|
+
(e) => e.payload.parent_tool_use_id === filterValue
|
|
227
|
+
);
|
|
228
|
+
const toolCallMap = /* @__PURE__ */ new Map();
|
|
229
|
+
filteredEvents.forEach((event) => {
|
|
230
|
+
if (event.type === "claude-user") {
|
|
231
|
+
const content = event.payload.message?.content || [];
|
|
232
|
+
const toolResult = content.find((c) => c.type === "tool_result");
|
|
233
|
+
if (toolResult && toolResult.tool_use_id) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const textContent = content.filter((c) => c.type === "text").map((c) => c.text || "").join("\n");
|
|
237
|
+
const images = content.filter((c) => c.type === "image" && c.source).map((c) => {
|
|
238
|
+
const source = c.source;
|
|
239
|
+
return {
|
|
240
|
+
type: "image",
|
|
241
|
+
mediaType: source.media_type || "image/png",
|
|
242
|
+
data: source.data || ""
|
|
243
|
+
};
|
|
244
|
+
}).filter((img) => img.data);
|
|
245
|
+
if (textContent || images.length > 0) {
|
|
246
|
+
messages.push({
|
|
247
|
+
id: `user-${event.timestamp}`,
|
|
248
|
+
type: "user",
|
|
249
|
+
content: textContent || (images.length > 0 ? `[${images.length} image${images.length > 1 ? "s" : ""} attached]` : ""),
|
|
250
|
+
images: images.length > 0 ? images : void 0,
|
|
251
|
+
timestamp: event.timestamp
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (event.type === "claude-assistant") {
|
|
256
|
+
const contentBlocks = event.payload.message?.content || [];
|
|
257
|
+
contentBlocks.forEach((block) => {
|
|
258
|
+
if (block.type === "text" && block.text) {
|
|
259
|
+
messages.push({
|
|
260
|
+
id: `agent-${event.timestamp}-${messages.length}`,
|
|
261
|
+
type: "agent",
|
|
262
|
+
content: block.text,
|
|
263
|
+
timestamp: event.timestamp
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
if (block.type === "thinking" && block.text) {
|
|
267
|
+
messages.push({
|
|
268
|
+
id: `reasoning-${event.timestamp}-${messages.length}`,
|
|
269
|
+
type: "reasoning",
|
|
270
|
+
content: block.text,
|
|
271
|
+
status: "completed",
|
|
272
|
+
timestamp: event.timestamp
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
if (block.type === "tool_use" && block.id) {
|
|
276
|
+
const toolName = block.name || "unknown";
|
|
277
|
+
const toolInput = block.input || {};
|
|
278
|
+
const toolUseId = block.id;
|
|
279
|
+
toolCallMap.set(toolUseId, {
|
|
280
|
+
messageIndex: messages.length,
|
|
281
|
+
toolName,
|
|
282
|
+
input: toolInput
|
|
283
|
+
});
|
|
284
|
+
if (toolName === "Task") {
|
|
285
|
+
const inputObj = typeof toolInput === "string" ? safeJsonParse2(toolInput, {}) : toolInput;
|
|
286
|
+
const nestedEvents = events.filter((e) => e.payload.parent_tool_use_id === toolUseId).map((e) => ({
|
|
287
|
+
timestamp: e.timestamp,
|
|
288
|
+
type: e.type,
|
|
289
|
+
payload: e.payload
|
|
290
|
+
}));
|
|
291
|
+
messages.push({
|
|
292
|
+
id: `subagent-${event.timestamp}-${messages.length}`,
|
|
293
|
+
type: "subagent",
|
|
294
|
+
toolUseId,
|
|
295
|
+
description: inputObj.description || "Subagent Task",
|
|
296
|
+
prompt: inputObj.prompt || "",
|
|
297
|
+
subagentType: inputObj.subagent_type || "general",
|
|
298
|
+
model: inputObj.model,
|
|
299
|
+
status: "in_progress",
|
|
300
|
+
nestedEvents,
|
|
301
|
+
timestamp: event.timestamp
|
|
302
|
+
});
|
|
303
|
+
} else if (toolName === "Bash" || toolName === "bash" || toolName === "shell") {
|
|
304
|
+
const inputObj = typeof toolInput === "string" ? safeJsonParse2(toolInput, {}) : toolInput;
|
|
305
|
+
const command = inputObj.command || "";
|
|
306
|
+
messages.push({
|
|
307
|
+
id: `command-${event.timestamp}-${messages.length}`,
|
|
308
|
+
type: "command",
|
|
309
|
+
command,
|
|
310
|
+
output: "",
|
|
311
|
+
status: "in_progress",
|
|
312
|
+
timestamp: event.timestamp
|
|
313
|
+
});
|
|
314
|
+
} else if (toolName === "Write" || toolName === "Edit") {
|
|
315
|
+
const inputObj = typeof toolInput === "string" ? safeJsonParse2(toolInput, {}) : toolInput;
|
|
316
|
+
const filePath = inputObj.file_path || "";
|
|
317
|
+
const action = toolName === "Write" ? "add" : "update";
|
|
318
|
+
messages.push({
|
|
319
|
+
id: `file-${event.timestamp}-${messages.length}`,
|
|
320
|
+
type: "file_change",
|
|
321
|
+
changes: [{
|
|
322
|
+
path: filePath,
|
|
323
|
+
kind: action
|
|
324
|
+
}],
|
|
325
|
+
status: "in_progress",
|
|
326
|
+
timestamp: event.timestamp
|
|
327
|
+
});
|
|
328
|
+
} else if (toolName === "TodoWrite") {
|
|
329
|
+
const inputObj = typeof toolInput === "string" ? safeJsonParse2(toolInput, {}) : toolInput;
|
|
330
|
+
const todos = inputObj.todos || [];
|
|
331
|
+
const todoItems = todos.map((todo) => ({
|
|
332
|
+
text: todo.content,
|
|
333
|
+
completed: todo.status === "completed"
|
|
334
|
+
}));
|
|
335
|
+
if (todoItems.length > 0) {
|
|
336
|
+
messages.push({
|
|
337
|
+
id: `todo-${event.timestamp}-${messages.length}`,
|
|
338
|
+
type: "todo_list",
|
|
339
|
+
items: todoItems,
|
|
340
|
+
status: "completed",
|
|
341
|
+
timestamp: event.timestamp
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
} else if (toolName === "WebSearch") {
|
|
345
|
+
const inputObj = typeof toolInput === "string" ? safeJsonParse2(toolInput, {}) : toolInput;
|
|
346
|
+
const query = inputObj.query || "";
|
|
347
|
+
messages.push({
|
|
348
|
+
id: `search-${event.timestamp}-${messages.length}`,
|
|
349
|
+
type: "web_search",
|
|
350
|
+
query,
|
|
351
|
+
status: "in_progress",
|
|
352
|
+
timestamp: event.timestamp
|
|
353
|
+
});
|
|
354
|
+
} else {
|
|
355
|
+
messages.push({
|
|
356
|
+
id: `toolcall-${event.timestamp}-${messages.length}`,
|
|
357
|
+
type: "tool_call",
|
|
358
|
+
server: "claude",
|
|
359
|
+
tool: toolName,
|
|
360
|
+
input: toolInput,
|
|
361
|
+
status: "in_progress",
|
|
362
|
+
timestamp: event.timestamp
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
if (event.type === "claude-result") {
|
|
369
|
+
const payload = event.payload;
|
|
370
|
+
if (payload.is_error || payload.subtype !== "success") {
|
|
371
|
+
const errorList = payload.errors || [];
|
|
372
|
+
const errorMessage = errorList.length > 0 ? errorList.join("\n") : "Claude session encountered an unexpected error.";
|
|
373
|
+
messages.push({
|
|
374
|
+
id: `error-${event.timestamp}`,
|
|
375
|
+
type: "error",
|
|
376
|
+
message: errorMessage,
|
|
377
|
+
timestamp: event.timestamp
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
filteredEvents.forEach((event) => {
|
|
383
|
+
if (event.type === "claude-user") {
|
|
384
|
+
const content = event.payload.message?.content || [];
|
|
385
|
+
const toolResult = content.find((c) => c.type === "tool_result");
|
|
386
|
+
if (toolResult && toolResult.tool_use_id) {
|
|
387
|
+
const toolInfo = toolCallMap.get(toolResult.tool_use_id);
|
|
388
|
+
if (!toolInfo) return;
|
|
389
|
+
const resultContent = extractToolResultContent(toolResult.content);
|
|
390
|
+
const isError = toolResult.is_error || false;
|
|
391
|
+
const status = isError ? "failed" : "completed";
|
|
392
|
+
const message = messages[toolInfo.messageIndex];
|
|
393
|
+
if (!message) return;
|
|
394
|
+
if (message.type === "command") {
|
|
395
|
+
message.output = resultContent;
|
|
396
|
+
message.status = status;
|
|
397
|
+
const exitCodeMatch = resultContent.match(/exit code:?\s*(\d+)/i);
|
|
398
|
+
if (exitCodeMatch) {
|
|
399
|
+
message.exitCode = parseInt(exitCodeMatch[1], 10);
|
|
400
|
+
} else {
|
|
401
|
+
message.exitCode = isError ? 1 : 0;
|
|
402
|
+
}
|
|
403
|
+
} else if (message.type === "file_change") {
|
|
404
|
+
message.status = status;
|
|
405
|
+
} else if (message.type === "web_search") {
|
|
406
|
+
message.status = status;
|
|
407
|
+
} else if (message.type === "tool_call") {
|
|
408
|
+
message.output = resultContent;
|
|
409
|
+
message.status = status;
|
|
410
|
+
} else if (message.type === "subagent") {
|
|
411
|
+
message.output = resultContent;
|
|
412
|
+
message.status = status;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
return messages;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// ../shared/src/display-message/parsers/index.ts
|
|
421
|
+
function parseAgentEvents(events, agentType) {
|
|
422
|
+
if (agentType === "codex") {
|
|
423
|
+
return parseCodexEvents(events);
|
|
424
|
+
} else if (agentType === "claude") {
|
|
425
|
+
return parseClaudeEvents(events);
|
|
426
|
+
}
|
|
427
|
+
return [];
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// src/index.ts
|
|
431
|
+
var API_URL = process.env.REPLICAS_API_URL || "https://api.replicas.dev";
|
|
432
|
+
var API_KEY = process.env.REPLICAS_API_KEY;
|
|
8
433
|
if (!API_KEY) {
|
|
9
|
-
|
|
10
|
-
|
|
434
|
+
console.error("REPLICAS_API_KEY environment variable required");
|
|
435
|
+
process.exit(1);
|
|
11
436
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Makes an authenticated request to the Replicas API.
|
|
14
|
-
*/
|
|
15
437
|
async function api(method, path, body) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
438
|
+
const res = await fetch(`${API_URL}${path}`, {
|
|
439
|
+
method,
|
|
440
|
+
headers: {
|
|
441
|
+
"Authorization": `Bearer ${API_KEY}`,
|
|
442
|
+
"Content-Type": "application/json"
|
|
443
|
+
},
|
|
444
|
+
body: body ? JSON.stringify(body) : void 0
|
|
445
|
+
});
|
|
446
|
+
if (!res.ok) {
|
|
447
|
+
const text = await res.text();
|
|
448
|
+
throw new Error(`API error ${res.status}: ${text}`);
|
|
449
|
+
}
|
|
450
|
+
return res.json();
|
|
29
451
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Creates a tool result with text content.
|
|
32
|
-
*/
|
|
33
452
|
function result(data, isError = false) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
453
|
+
return {
|
|
454
|
+
content: [{
|
|
455
|
+
type: "text",
|
|
456
|
+
text: typeof data === "string" ? data : JSON.stringify(data, null, 2)
|
|
457
|
+
}],
|
|
458
|
+
...isError && { isError: true }
|
|
459
|
+
};
|
|
41
460
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
461
|
+
var server = new McpServer({
|
|
462
|
+
name: "replicas-mcp",
|
|
463
|
+
version: "0.1.1"
|
|
45
464
|
});
|
|
46
|
-
|
|
47
|
-
registerTool(
|
|
48
|
-
|
|
465
|
+
var registerTool = server.registerTool.bind(server);
|
|
466
|
+
registerTool(
|
|
467
|
+
"create_replica",
|
|
468
|
+
{
|
|
469
|
+
description: "Create a new replica workspace and send initial message",
|
|
49
470
|
inputSchema: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
}, async (args) => {
|
|
57
|
-
try {
|
|
58
|
-
const body = {
|
|
59
|
-
name: args.name,
|
|
60
|
-
message: args.message,
|
|
61
|
-
repository: args.repository,
|
|
62
|
-
};
|
|
63
|
-
if (args.instance_type)
|
|
64
|
-
body.instance_type = args.instance_type;
|
|
65
|
-
if (args.coding_agent)
|
|
66
|
-
body.coding_agent = args.coding_agent;
|
|
67
|
-
return result(await api('POST', '/v1/replica', body));
|
|
471
|
+
name: z.string(),
|
|
472
|
+
message: z.string(),
|
|
473
|
+
repository: z.string(),
|
|
474
|
+
instance_type: z.enum(["standard", "large", "power"]).optional(),
|
|
475
|
+
coding_agent: z.enum(["claude", "codex"]).optional()
|
|
68
476
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
registerTool('list_replicas', {
|
|
74
|
-
description: 'List all replicas',
|
|
75
|
-
inputSchema: {
|
|
76
|
-
page: z.number().optional(),
|
|
77
|
-
limit: z.number().optional(),
|
|
78
|
-
},
|
|
79
|
-
}, async (args) => {
|
|
477
|
+
},
|
|
478
|
+
async (args) => {
|
|
80
479
|
try {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
480
|
+
const body = {
|
|
481
|
+
name: args.name,
|
|
482
|
+
message: args.message,
|
|
483
|
+
repository: args.repository
|
|
484
|
+
};
|
|
485
|
+
if (args.instance_type) body.instance_type = args.instance_type;
|
|
486
|
+
if (args.coding_agent) body.coding_agent = args.coding_agent;
|
|
487
|
+
return result(await api("POST", "/v1/replica", body));
|
|
488
|
+
} catch (e) {
|
|
489
|
+
return result(e instanceof Error ? e.message : String(e), true);
|
|
88
490
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
description:
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
registerTool(
|
|
494
|
+
"list_replicas",
|
|
495
|
+
{
|
|
496
|
+
description: "List all replicas",
|
|
95
497
|
inputSchema: {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}, async (args) => {
|
|
99
|
-
try {
|
|
100
|
-
return result(await api('GET', `/v1/replica/${args.id}`));
|
|
498
|
+
page: z.number().optional(),
|
|
499
|
+
limit: z.number().optional()
|
|
101
500
|
}
|
|
102
|
-
|
|
103
|
-
|
|
501
|
+
},
|
|
502
|
+
async (args) => {
|
|
503
|
+
try {
|
|
504
|
+
const params = new URLSearchParams();
|
|
505
|
+
if (args.page) params.set("page", String(args.page));
|
|
506
|
+
if (args.limit) params.set("limit", String(args.limit));
|
|
507
|
+
const q = params.toString();
|
|
508
|
+
return result(await api("GET", `/v1/replica${q ? "?" + q : ""}`));
|
|
509
|
+
} catch (e) {
|
|
510
|
+
return result(e instanceof Error ? e.message : String(e), true);
|
|
104
511
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
registerTool(
|
|
515
|
+
"get_replica",
|
|
516
|
+
{
|
|
517
|
+
description: "Get replica by ID",
|
|
108
518
|
inputSchema: {
|
|
109
|
-
|
|
110
|
-
message: z.string(),
|
|
111
|
-
coding_agent: z.enum(['claude', 'codex']).optional(),
|
|
112
|
-
},
|
|
113
|
-
}, async (args) => {
|
|
114
|
-
try {
|
|
115
|
-
const body = { message: args.message };
|
|
116
|
-
if (args.coding_agent)
|
|
117
|
-
body.coding_agent = args.coding_agent;
|
|
118
|
-
return result(await api('POST', `/v1/replica/${args.id}/send`, body));
|
|
519
|
+
id: z.string()
|
|
119
520
|
}
|
|
120
|
-
|
|
121
|
-
|
|
521
|
+
},
|
|
522
|
+
async (args) => {
|
|
523
|
+
try {
|
|
524
|
+
return result(await api("GET", `/v1/replica/${args.id}`));
|
|
525
|
+
} catch (e) {
|
|
526
|
+
return result(e instanceof Error ? e.message : String(e), true);
|
|
122
527
|
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
528
|
+
}
|
|
529
|
+
);
|
|
530
|
+
registerTool(
|
|
531
|
+
"send_replica_message",
|
|
532
|
+
{
|
|
533
|
+
description: "Send message to a replica",
|
|
126
534
|
inputSchema: {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
535
|
+
id: z.string(),
|
|
536
|
+
message: z.string(),
|
|
537
|
+
coding_agent: z.enum(["claude", "codex"]).optional()
|
|
538
|
+
}
|
|
539
|
+
},
|
|
540
|
+
async (args) => {
|
|
130
541
|
try {
|
|
131
|
-
|
|
542
|
+
const body = { message: args.message };
|
|
543
|
+
if (args.coding_agent) body.coding_agent = args.coding_agent;
|
|
544
|
+
return result(await api("POST", `/v1/replica/${args.id}/send`, body));
|
|
545
|
+
} catch (e) {
|
|
546
|
+
return result(e instanceof Error ? e.message : String(e), true);
|
|
132
547
|
}
|
|
133
|
-
|
|
134
|
-
|
|
548
|
+
}
|
|
549
|
+
);
|
|
550
|
+
registerTool(
|
|
551
|
+
"delete_replica",
|
|
552
|
+
{
|
|
553
|
+
description: "Delete a replica",
|
|
554
|
+
inputSchema: {
|
|
555
|
+
id: z.string()
|
|
135
556
|
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
description: 'List available repositories',
|
|
139
|
-
}, async () => {
|
|
557
|
+
},
|
|
558
|
+
async (args) => {
|
|
140
559
|
try {
|
|
141
|
-
|
|
560
|
+
return result(await api("DELETE", `/v1/replica/${args.id}`));
|
|
561
|
+
} catch (e) {
|
|
562
|
+
return result(e instanceof Error ? e.message : String(e), true);
|
|
142
563
|
}
|
|
143
|
-
|
|
144
|
-
|
|
564
|
+
}
|
|
565
|
+
);
|
|
566
|
+
registerTool(
|
|
567
|
+
"list_repositories",
|
|
568
|
+
{
|
|
569
|
+
description: "List available repositories"
|
|
570
|
+
},
|
|
571
|
+
async () => {
|
|
572
|
+
try {
|
|
573
|
+
return result(await api("GET", "/v1/repositories"));
|
|
574
|
+
} catch (e) {
|
|
575
|
+
return result(e instanceof Error ? e.message : String(e), true);
|
|
145
576
|
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
577
|
+
}
|
|
578
|
+
);
|
|
579
|
+
registerTool(
|
|
580
|
+
"read_replica_history",
|
|
581
|
+
{
|
|
582
|
+
description: "Read conversation history of a replica. Returns parsed DisplayMessage objects (user messages, agent responses, commands, file changes, tool calls, etc). If the workspace is sleeping, it will be woken and you should retry in 30-90 seconds.",
|
|
149
583
|
inputSchema: {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
},
|
|
584
|
+
id: z.string(),
|
|
585
|
+
limit: z.number().optional().describe("Maximum number of events to return"),
|
|
586
|
+
offset: z.number().optional().describe("Number of events to skip from the end")
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
async (args) => {
|
|
155
590
|
try {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const response = await api('GET', `/v1/replica/${args.id}/read${q ? '?' + q : ''}`);
|
|
163
|
-
if (response.waking) {
|
|
164
|
-
return result({
|
|
165
|
-
status: 'waking',
|
|
166
|
-
message: 'Workspace is waking from sleep. Retry in 30-90 seconds.',
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
// Parse raw events into DisplayMessage format
|
|
170
|
-
const agentType = (response.coding_agent || 'claude');
|
|
171
|
-
const messages = parseAgentEvents(response.events, agentType);
|
|
591
|
+
const params = new URLSearchParams();
|
|
592
|
+
if (args.limit) params.set("limit", String(args.limit));
|
|
593
|
+
if (args.offset) params.set("offset", String(args.offset));
|
|
594
|
+
const q = params.toString();
|
|
595
|
+
const response = await api("GET", `/v1/replica/${args.id}/read${q ? "?" + q : ""}`);
|
|
596
|
+
if (response.waking) {
|
|
172
597
|
return result({
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
total: response.total,
|
|
176
|
-
hasMore: response.hasMore,
|
|
177
|
-
messages,
|
|
598
|
+
status: "waking",
|
|
599
|
+
message: "Workspace is waking from sleep. Retry in 30-90 seconds."
|
|
178
600
|
});
|
|
601
|
+
}
|
|
602
|
+
const agentType = response.coding_agent || "claude";
|
|
603
|
+
const messages = parseAgentEvents(response.events, agentType);
|
|
604
|
+
return result({
|
|
605
|
+
thread_id: response.thread_id,
|
|
606
|
+
coding_agent: response.coding_agent,
|
|
607
|
+
total: response.total,
|
|
608
|
+
hasMore: response.hasMore,
|
|
609
|
+
messages
|
|
610
|
+
});
|
|
611
|
+
} catch (e) {
|
|
612
|
+
return result(e instanceof Error ? e.message : String(e), true);
|
|
179
613
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
});
|
|
184
|
-
const transport = new StdioServerTransport();
|
|
614
|
+
}
|
|
615
|
+
);
|
|
616
|
+
var transport = new StdioServerTransport();
|
|
185
617
|
await server.connect(transport);
|
|
186
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "replicas-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,16 +8,17 @@
|
|
|
8
8
|
"replicas-mcp": "dist/index.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "
|
|
11
|
+
"build": "tsup",
|
|
12
12
|
"start": "node dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@modelcontextprotocol/sdk": "^1.25.0",
|
|
16
|
-
"@replicas/shared": "*",
|
|
17
16
|
"zod": "^3.25.0"
|
|
18
17
|
},
|
|
19
18
|
"devDependencies": {
|
|
19
|
+
"@replicas/shared": "*",
|
|
20
20
|
"@types/node": "^20.11.17",
|
|
21
|
+
"tsup": "^8.5.0",
|
|
21
22
|
"typescript": "^5.9.3"
|
|
22
23
|
}
|
|
23
24
|
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
entry: ['src/index.ts'],
|
|
3
|
+
format: ['esm'],
|
|
4
|
+
bundle: true,
|
|
5
|
+
noExternal: ['@replicas/shared'],
|
|
6
|
+
dts: false,
|
|
7
|
+
clean: true,
|
|
8
|
+
outDir: 'dist',
|
|
9
|
+
banner: {
|
|
10
|
+
js: '#!/usr/bin/env node',
|
|
11
|
+
},
|
|
12
|
+
outExtension() {
|
|
13
|
+
return {
|
|
14
|
+
js: '.js',
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
esbuildOptions(options: { alias?: Record<string, string> }) {
|
|
18
|
+
options.alias = {
|
|
19
|
+
'@replicas/shared': '../shared/src',
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default config;
|
package/dist/index.d.ts
DELETED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAmD,MAAM,kBAAkB,CAAC;AAErG,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,0BAA0B,CAAC;AAC3E,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;AAE7C,IAAI,CAAC,OAAO,EAAE,CAAC;IACb,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;IAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,GAAG,CAAI,MAAc,EAAE,IAAY,EAAE,IAAc;IAChE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,GAAG,IAAI,EAAE,EAAE;QAC3C,MAAM;QACN,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,OAAO,EAAE;YACpC,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAA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