@agent-relay/mcp 0.1.0
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/LICENSE +190 -0
- package/README.md +214 -0
- package/dist/bin.d.ts +12 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +127 -0
- package/dist/bin.js.map +1 -0
- package/dist/client.d.ts +68 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +115 -0
- package/dist/client.js.map +1 -0
- package/dist/cloud.d.ts +108 -0
- package/dist/cloud.d.ts.map +1 -0
- package/dist/cloud.js +279 -0
- package/dist/cloud.js.map +1 -0
- package/dist/errors.d.ts +27 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +48 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/install-cli.d.ts +35 -0
- package/dist/install-cli.d.ts.map +1 -0
- package/dist/install-cli.js +157 -0
- package/dist/install-cli.js.map +1 -0
- package/dist/install.d.ts +101 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +398 -0
- package/dist/install.js.map +1 -0
- package/dist/prompts/index.d.ts +2 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +2 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/protocol.d.ts +11 -0
- package/dist/prompts/protocol.d.ts.map +1 -0
- package/dist/prompts/protocol.js +168 -0
- package/dist/prompts/protocol.js.map +1 -0
- package/dist/resources/agents.d.ts +11 -0
- package/dist/resources/agents.d.ts.map +1 -0
- package/dist/resources/agents.js +17 -0
- package/dist/resources/agents.js.map +1 -0
- package/dist/resources/inbox.d.ts +11 -0
- package/dist/resources/inbox.d.ts.map +1 -0
- package/dist/resources/inbox.js +17 -0
- package/dist/resources/inbox.js.map +1 -0
- package/dist/resources/index.d.ts +4 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +4 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/project.d.ts +11 -0
- package/dist/resources/project.d.ts.map +1 -0
- package/dist/resources/project.js +21 -0
- package/dist/resources/project.js.map +1 -0
- package/dist/server.d.ts +19 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +215 -0
- package/dist/server.js.map +1 -0
- package/dist/simple.d.ts +173 -0
- package/dist/simple.d.ts.map +1 -0
- package/dist/simple.js +120 -0
- package/dist/simple.js.map +1 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +10 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/relay-health.d.ts +23 -0
- package/dist/tools/relay-health.d.ts.map +1 -0
- package/dist/tools/relay-health.js +138 -0
- package/dist/tools/relay-health.js.map +1 -0
- package/dist/tools/relay-inbox.d.ts +26 -0
- package/dist/tools/relay-inbox.d.ts.map +1 -0
- package/dist/tools/relay-inbox.js +58 -0
- package/dist/tools/relay-inbox.js.map +1 -0
- package/dist/tools/relay-logs.d.ts +20 -0
- package/dist/tools/relay-logs.d.ts.map +1 -0
- package/dist/tools/relay-logs.js +88 -0
- package/dist/tools/relay-logs.js.map +1 -0
- package/dist/tools/relay-metrics.d.ts +20 -0
- package/dist/tools/relay-metrics.d.ts.map +1 -0
- package/dist/tools/relay-metrics.js +135 -0
- package/dist/tools/relay-metrics.js.map +1 -0
- package/dist/tools/relay-release.d.ts +20 -0
- package/dist/tools/relay-release.d.ts.map +1 -0
- package/dist/tools/relay-release.js +44 -0
- package/dist/tools/relay-release.js.map +1 -0
- package/dist/tools/relay-send.d.ts +29 -0
- package/dist/tools/relay-send.d.ts.map +1 -0
- package/dist/tools/relay-send.js +71 -0
- package/dist/tools/relay-send.js.map +1 -0
- package/dist/tools/relay-spawn.d.ts +36 -0
- package/dist/tools/relay-spawn.d.ts.map +1 -0
- package/dist/tools/relay-spawn.js +73 -0
- package/dist/tools/relay-spawn.js.map +1 -0
- package/dist/tools/relay-status.d.ts +11 -0
- package/dist/tools/relay-status.d.ts.map +1 -0
- package/dist/tools/relay-status.js +43 -0
- package/dist/tools/relay-status.js.map +1 -0
- package/dist/tools/relay-who.d.ts +20 -0
- package/dist/tools/relay-who.d.ts.map +1 -0
- package/dist/tools/relay-who.js +47 -0
- package/dist/tools/relay-who.js.map +1 -0
- package/package.json +69 -0
package/dist/install.js
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Installation System
|
|
3
|
+
*
|
|
4
|
+
* Auto-configures MCP server for different AI editors:
|
|
5
|
+
* - Claude Desktop / Claude Code
|
|
6
|
+
* - Cursor
|
|
7
|
+
* - VS Code (with MCP extension)
|
|
8
|
+
* - Windsurf
|
|
9
|
+
* - Zed
|
|
10
|
+
* - Gemini CLI
|
|
11
|
+
* - OpenCode
|
|
12
|
+
* - Droid (Factory)
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
15
|
+
import { dirname, join } from 'node:path';
|
|
16
|
+
import { homedir, platform } from 'node:os';
|
|
17
|
+
/**
|
|
18
|
+
* Get platform-specific config paths
|
|
19
|
+
*/
|
|
20
|
+
function getConfigPaths() {
|
|
21
|
+
const home = homedir();
|
|
22
|
+
const plat = platform();
|
|
23
|
+
// Platform-specific base paths
|
|
24
|
+
const appSupport = plat === 'darwin'
|
|
25
|
+
? join(home, 'Library', 'Application Support')
|
|
26
|
+
: plat === 'win32'
|
|
27
|
+
? process.env.APPDATA || join(home, 'AppData', 'Roaming')
|
|
28
|
+
: join(home, '.config');
|
|
29
|
+
return {
|
|
30
|
+
claude: {
|
|
31
|
+
name: 'Claude Desktop',
|
|
32
|
+
configPath: plat === 'darwin'
|
|
33
|
+
? join(appSupport, 'Claude', 'claude_desktop_config.json')
|
|
34
|
+
: plat === 'win32'
|
|
35
|
+
? join(appSupport, 'Claude', 'claude_desktop_config.json')
|
|
36
|
+
: join(home, '.config', 'claude', 'claude_desktop_config.json'),
|
|
37
|
+
configKey: 'mcpServers',
|
|
38
|
+
format: 'json',
|
|
39
|
+
},
|
|
40
|
+
'claude-code': {
|
|
41
|
+
name: 'Claude Code',
|
|
42
|
+
configPath: join(home, '.claude.json'),
|
|
43
|
+
configKey: 'mcpServers',
|
|
44
|
+
format: 'json',
|
|
45
|
+
supportsLocal: true,
|
|
46
|
+
},
|
|
47
|
+
cursor: {
|
|
48
|
+
name: 'Cursor',
|
|
49
|
+
configPath: join(home, '.cursor', 'mcp.json'),
|
|
50
|
+
configKey: 'mcpServers',
|
|
51
|
+
format: 'json',
|
|
52
|
+
supportsLocal: true,
|
|
53
|
+
},
|
|
54
|
+
vscode: {
|
|
55
|
+
name: 'VS Code',
|
|
56
|
+
configPath: join(home, '.vscode', 'mcp.json'),
|
|
57
|
+
configKey: 'mcpServers',
|
|
58
|
+
format: 'jsonc',
|
|
59
|
+
supportsLocal: true,
|
|
60
|
+
},
|
|
61
|
+
windsurf: {
|
|
62
|
+
name: 'Windsurf',
|
|
63
|
+
configPath: join(home, '.windsurf', 'mcp.json'),
|
|
64
|
+
configKey: 'mcpServers',
|
|
65
|
+
format: 'json',
|
|
66
|
+
supportsLocal: true,
|
|
67
|
+
},
|
|
68
|
+
zed: {
|
|
69
|
+
name: 'Zed',
|
|
70
|
+
configPath: join(home, '.config', 'zed', 'settings.json'),
|
|
71
|
+
configKey: 'context_servers',
|
|
72
|
+
format: 'jsonc',
|
|
73
|
+
},
|
|
74
|
+
gemini: {
|
|
75
|
+
name: 'Gemini CLI',
|
|
76
|
+
configPath: join(home, '.gemini', 'settings.json'),
|
|
77
|
+
configKey: 'mcpServers',
|
|
78
|
+
format: 'json',
|
|
79
|
+
supportsLocal: true,
|
|
80
|
+
},
|
|
81
|
+
opencode: {
|
|
82
|
+
name: 'OpenCode',
|
|
83
|
+
configPath: join(home, '.config', 'opencode', 'opencode.json'),
|
|
84
|
+
configKey: 'mcp', // OpenCode uses "mcp" not "mcpServers"
|
|
85
|
+
format: 'json',
|
|
86
|
+
supportsLocal: true,
|
|
87
|
+
},
|
|
88
|
+
droid: {
|
|
89
|
+
name: 'Droid',
|
|
90
|
+
configPath: join(home, '.factory', 'mcp.json'),
|
|
91
|
+
configKey: 'mcpServers',
|
|
92
|
+
format: 'json',
|
|
93
|
+
supportsLocal: true,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Default MCP server configuration
|
|
99
|
+
*/
|
|
100
|
+
export function getDefaultServerConfig() {
|
|
101
|
+
return {
|
|
102
|
+
command: 'npx',
|
|
103
|
+
args: ['@agent-relay/mcp', 'serve'],
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Detect which editors are installed by checking for their config directories
|
|
108
|
+
*/
|
|
109
|
+
export function detectInstalledEditors() {
|
|
110
|
+
const editors = getConfigPaths();
|
|
111
|
+
const detected = [];
|
|
112
|
+
for (const [key, config] of Object.entries(editors)) {
|
|
113
|
+
const configDir = dirname(config.configPath);
|
|
114
|
+
if (existsSync(configDir)) {
|
|
115
|
+
detected.push(key);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return detected;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Get editor configuration by key
|
|
122
|
+
*/
|
|
123
|
+
export function getEditorConfig(editorKey) {
|
|
124
|
+
const editors = getConfigPaths();
|
|
125
|
+
return editors[editorKey];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* List all supported editors
|
|
129
|
+
*/
|
|
130
|
+
export function listSupportedEditors() {
|
|
131
|
+
const editors = getConfigPaths();
|
|
132
|
+
return Object.entries(editors).map(([key, config]) => ({
|
|
133
|
+
key,
|
|
134
|
+
name: config.name,
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Strip JSON comments (for JSONC format)
|
|
139
|
+
*/
|
|
140
|
+
function stripJsonComments(content) {
|
|
141
|
+
// Remove single-line comments
|
|
142
|
+
let result = content.replace(/\/\/.*$/gm, '');
|
|
143
|
+
// Remove multi-line comments
|
|
144
|
+
result = result.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Read and parse config file, handling both JSON and JSONC
|
|
149
|
+
*/
|
|
150
|
+
function readConfigFile(configPath, format) {
|
|
151
|
+
if (!existsSync(configPath)) {
|
|
152
|
+
return {};
|
|
153
|
+
}
|
|
154
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
155
|
+
const jsonContent = format === 'jsonc' ? stripJsonComments(content) : content;
|
|
156
|
+
try {
|
|
157
|
+
// Handle empty or whitespace-only files
|
|
158
|
+
const trimmed = jsonContent.trim();
|
|
159
|
+
if (!trimmed) {
|
|
160
|
+
return {};
|
|
161
|
+
}
|
|
162
|
+
return JSON.parse(trimmed);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// Invalid JSON, start fresh
|
|
166
|
+
return {};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Write config file with proper formatting
|
|
171
|
+
*/
|
|
172
|
+
function writeConfigFile(configPath, config) {
|
|
173
|
+
const configDir = dirname(configPath);
|
|
174
|
+
// Ensure directory exists
|
|
175
|
+
if (!existsSync(configDir)) {
|
|
176
|
+
mkdirSync(configDir, { recursive: true });
|
|
177
|
+
}
|
|
178
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get the config path for local (project-specific) installation
|
|
182
|
+
*/
|
|
183
|
+
function getLocalConfigPath(editor, projectDir) {
|
|
184
|
+
if (!editor.supportsLocal) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
// Most editors use .vscode/mcp.json or similar in project root
|
|
188
|
+
switch (editor.name) {
|
|
189
|
+
case 'Claude Code':
|
|
190
|
+
return join(projectDir, '.mcp.json');
|
|
191
|
+
case 'Cursor':
|
|
192
|
+
return join(projectDir, '.cursor', 'mcp.json');
|
|
193
|
+
case 'VS Code':
|
|
194
|
+
return join(projectDir, '.vscode', 'mcp.json');
|
|
195
|
+
case 'Windsurf':
|
|
196
|
+
return join(projectDir, '.windsurf', 'mcp.json');
|
|
197
|
+
case 'Gemini CLI':
|
|
198
|
+
return join(projectDir, '.gemini', 'settings.json');
|
|
199
|
+
case 'OpenCode':
|
|
200
|
+
return join(projectDir, 'opencode.json');
|
|
201
|
+
case 'Droid':
|
|
202
|
+
return join(projectDir, '.factory', 'mcp.json');
|
|
203
|
+
default:
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Install MCP server configuration for a specific editor
|
|
209
|
+
*/
|
|
210
|
+
export function installForEditor(editorKey, options = {}) {
|
|
211
|
+
const editor = getEditorConfig(editorKey);
|
|
212
|
+
if (!editor) {
|
|
213
|
+
return {
|
|
214
|
+
editor: editorKey,
|
|
215
|
+
configPath: '',
|
|
216
|
+
success: false,
|
|
217
|
+
error: `Unknown editor: ${editorKey}`,
|
|
218
|
+
created: false,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
// Determine config path (global vs local)
|
|
222
|
+
let configPath = editor.configPath;
|
|
223
|
+
if (!options.global && options.projectDir && editor.supportsLocal) {
|
|
224
|
+
const localPath = getLocalConfigPath(editor, options.projectDir);
|
|
225
|
+
if (localPath) {
|
|
226
|
+
configPath = localPath;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// Build server config
|
|
230
|
+
const serverConfig = {
|
|
231
|
+
command: options.command || 'npx',
|
|
232
|
+
args: options.args || ['@agent-relay/mcp', 'serve'],
|
|
233
|
+
};
|
|
234
|
+
// Note: We don't set RELAY_PROJECT for local installs because the MCP server
|
|
235
|
+
// will auto-discover the socket from the current working directory.
|
|
236
|
+
// This makes the config portable across machines.
|
|
237
|
+
if (options.dryRun) {
|
|
238
|
+
return {
|
|
239
|
+
editor: editor.name,
|
|
240
|
+
configPath,
|
|
241
|
+
success: true,
|
|
242
|
+
created: !existsSync(configPath),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
// Read existing config
|
|
247
|
+
const config = readConfigFile(configPath, editor.format);
|
|
248
|
+
const created = !existsSync(configPath);
|
|
249
|
+
// Initialize mcpServers if not present
|
|
250
|
+
const configKeyValue = config[editor.configKey];
|
|
251
|
+
if (!configKeyValue || typeof configKeyValue !== 'object') {
|
|
252
|
+
config[editor.configKey] = {};
|
|
253
|
+
}
|
|
254
|
+
// Add agent-relay server config
|
|
255
|
+
const mcpServers = config[editor.configKey];
|
|
256
|
+
mcpServers['agent-relay'] = serverConfig;
|
|
257
|
+
// Write updated config
|
|
258
|
+
writeConfigFile(configPath, config);
|
|
259
|
+
return {
|
|
260
|
+
editor: editor.name,
|
|
261
|
+
configPath,
|
|
262
|
+
success: true,
|
|
263
|
+
created,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
catch (err) {
|
|
267
|
+
return {
|
|
268
|
+
editor: editor.name,
|
|
269
|
+
configPath,
|
|
270
|
+
success: false,
|
|
271
|
+
error: err instanceof Error ? err.message : String(err),
|
|
272
|
+
created: false,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Uninstall MCP server configuration from an editor
|
|
278
|
+
*/
|
|
279
|
+
export function uninstallFromEditor(editorKey, options = {}) {
|
|
280
|
+
const editor = getEditorConfig(editorKey);
|
|
281
|
+
if (!editor) {
|
|
282
|
+
return {
|
|
283
|
+
editor: editorKey,
|
|
284
|
+
configPath: '',
|
|
285
|
+
success: false,
|
|
286
|
+
error: `Unknown editor: ${editorKey}`,
|
|
287
|
+
created: false,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
// Determine config path
|
|
291
|
+
let configPath = editor.configPath;
|
|
292
|
+
if (!options.global && options.projectDir && editor.supportsLocal) {
|
|
293
|
+
const localPath = getLocalConfigPath(editor, options.projectDir);
|
|
294
|
+
if (localPath) {
|
|
295
|
+
configPath = localPath;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (!existsSync(configPath)) {
|
|
299
|
+
return {
|
|
300
|
+
editor: editor.name,
|
|
301
|
+
configPath,
|
|
302
|
+
success: true,
|
|
303
|
+
created: false,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
const config = readConfigFile(configPath, editor.format);
|
|
308
|
+
const mcpServers = config[editor.configKey];
|
|
309
|
+
if (mcpServers && 'agent-relay' in mcpServers) {
|
|
310
|
+
delete mcpServers['agent-relay'];
|
|
311
|
+
writeConfigFile(configPath, config);
|
|
312
|
+
}
|
|
313
|
+
return {
|
|
314
|
+
editor: editor.name,
|
|
315
|
+
configPath,
|
|
316
|
+
success: true,
|
|
317
|
+
created: false,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
catch (err) {
|
|
321
|
+
return {
|
|
322
|
+
editor: editor.name,
|
|
323
|
+
configPath,
|
|
324
|
+
success: false,
|
|
325
|
+
error: err instanceof Error ? err.message : String(err),
|
|
326
|
+
created: false,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Check if agent-relay MCP server is installed for an editor
|
|
332
|
+
*/
|
|
333
|
+
export function isInstalledFor(editorKey, options = {}) {
|
|
334
|
+
const editor = getEditorConfig(editorKey);
|
|
335
|
+
if (!editor) {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
let configPath = editor.configPath;
|
|
339
|
+
if (!options.global && options.projectDir && editor.supportsLocal) {
|
|
340
|
+
const localPath = getLocalConfigPath(editor, options.projectDir);
|
|
341
|
+
if (localPath) {
|
|
342
|
+
configPath = localPath;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
if (!existsSync(configPath)) {
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
try {
|
|
349
|
+
const config = readConfigFile(configPath, editor.format);
|
|
350
|
+
const mcpServers = config[editor.configKey];
|
|
351
|
+
return mcpServers !== undefined && 'agent-relay' in mcpServers;
|
|
352
|
+
}
|
|
353
|
+
catch {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Install MCP server for all detected editors (or specified editors)
|
|
359
|
+
*/
|
|
360
|
+
export function install(options = {}) {
|
|
361
|
+
const results = [];
|
|
362
|
+
// Determine which editors to install for
|
|
363
|
+
const editors = options.editor
|
|
364
|
+
? [options.editor]
|
|
365
|
+
: detectInstalledEditors();
|
|
366
|
+
if (editors.length === 0) {
|
|
367
|
+
return [
|
|
368
|
+
{
|
|
369
|
+
editor: 'none',
|
|
370
|
+
configPath: '',
|
|
371
|
+
success: false,
|
|
372
|
+
error: 'No supported editors detected',
|
|
373
|
+
created: false,
|
|
374
|
+
},
|
|
375
|
+
];
|
|
376
|
+
}
|
|
377
|
+
for (const editorKey of editors) {
|
|
378
|
+
results.push(installForEditor(editorKey, options));
|
|
379
|
+
}
|
|
380
|
+
return results;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Uninstall MCP server from all detected editors (or specified editors)
|
|
384
|
+
*/
|
|
385
|
+
export function uninstall(options = {}) {
|
|
386
|
+
const results = [];
|
|
387
|
+
const editors = options.editor
|
|
388
|
+
? [options.editor]
|
|
389
|
+
: detectInstalledEditors();
|
|
390
|
+
for (const editorKey of editors) {
|
|
391
|
+
results.push(uninstallFromEditor(editorKey, {
|
|
392
|
+
global: options.global,
|
|
393
|
+
projectDir: options.projectDir,
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
396
|
+
return results;
|
|
397
|
+
}
|
|
398
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js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E,CAAC;IAE7B,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE,CAAC;QAChC,OAAO,CAAC,IAAI,CACV,mBAAmB,CAAC,SAAS,EAAE;YAC7B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol Documentation Prompt
|
|
3
|
+
*
|
|
4
|
+
* Provides the full Agent Relay protocol documentation as an MCP prompt.
|
|
5
|
+
* This is included automatically when an agent connects.
|
|
6
|
+
*/
|
|
7
|
+
import type { Prompt } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
+
export declare const protocolPrompt: Prompt;
|
|
9
|
+
export declare const PROTOCOL_DOCUMENTATION = "\n# Agent Relay Protocol\n\nYou are connected to Agent Relay, a real-time messaging system for AI agent coordination.\n\n## Communication Patterns\n\n### Direct Messages\nSend a message to a specific agent by name:\n```\nrelay_send(to=\"Alice\", message=\"Can you review this PR?\")\n```\n\n### Channel Messages\nSend to a channel (prefix with #):\n```\nrelay_send(to=\"#engineering\", message=\"Build complete\")\n```\nChannel messages are visible to all agents subscribed to that channel.\n\n### Broadcast\nSend to all online agents:\n```\nrelay_send(to=\"*\", message=\"System maintenance in 5 minutes\")\n```\nUse sparingly - broadcasts interrupt all agents.\n\n### Threaded Conversations\nFor multi-turn conversations, use thread IDs:\n```\nrelay_send(to=\"Bob\", message=\"Starting task\", thread=\"task-123\")\nrelay_send(to=\"Bob\", message=\"Task update\", thread=\"task-123\")\n```\n\n### Await Response\nBlock and wait for a reply:\n```\nrelay_send(to=\"Worker\", message=\"Process this file\", await_response=true, timeout_ms=60000)\n```\n\n## Spawning Workers\n\nCreate worker agents to parallelize work:\n\n```\nrelay_spawn(\n name=\"TestRunner\",\n cli=\"claude\",\n task=\"Run the test suite in src/tests/ and report any failures\"\n)\n```\n\nWorkers:\n- Run in separate processes\n- Have their own CLI instance\n- Can use relay to communicate back\n- Should be released when done\n\n### Worker Lifecycle\n1. Spawn worker with task\n2. Worker sends ACK when ready\n3. Worker sends progress updates\n4. Worker sends DONE when complete\n5. Lead releases worker\n\n### Release Workers\n```\nrelay_release(name=\"TestRunner\", reason=\"Tests completed\")\n```\n\n## Message Protocol\n\nWhen you receive messages, they follow this format:\n```\nRelay message from Alice [msg-id-123]: Content here\n```\n\nChannel messages include the channel:\n```\nRelay message from Alice [msg-id-456] [#general]: Hello team!\n```\n\n### ACK/DONE Protocol\nWhen assigned a task:\n1. Send ACK immediately: \"ACK: Starting work on X\"\n2. Send progress updates as needed\n3. Send DONE when complete: \"DONE: Completed X with result Y\"\n\nExample:\n```\n# When receiving a task\nrelay_send(to=\"Lead\", message=\"ACK: Starting test suite run\")\n\n# ... do work ...\n\nrelay_send(to=\"Lead\", message=\"DONE: All 42 tests passed\")\n```\n\n## Best Practices\n\n### For Lead Agents\n- Spawn workers for parallelizable tasks\n- Keep track of spawned workers\n- Release workers when done\n- Use channels for team announcements\n\n### For Worker Agents\n- ACK immediately when receiving tasks\n- Send progress updates for long tasks\n- Send DONE with results when complete\n- Ask clarifying questions if needed\n\n### Message Etiquette\n- Keep messages concise\n- Include relevant context\n- Use threads for related messages\n- Don't spam broadcasts\n\n## Checking Messages\n\nProactively check your inbox:\n```\nrelay_inbox()\nrelay_inbox(from=\"Lead\")\nrelay_inbox(channel=\"#urgent\")\n```\n\n## Seeing Who's Online\n\n```\nrelay_who()\n```\n\n## Error Handling\n\nIf relay returns an error:\n- \"Daemon not running\" - The relay daemon needs to be started\n- \"Agent not found\" - Target agent is offline\n- \"Channel not found\" - Channel doesn't exist\n- \"Timeout\" - No response within timeout period\n\n## Multi-Project Communication\n\nIn multi-project setups, specify project:\n```\nrelay_send(to=\"frontend:Designer\", message=\"Need UI mockup\")\n```\n\nSpecial targets:\n- `project:lead` - Lead agent of that project\n- `project:*` - Broadcast to project\n- `*:*` - Broadcast to all projects\n";
|
|
10
|
+
export declare function getProtocolPrompt(): string;
|
|
11
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/prompts/protocol.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAEjE,eAAO,MAAM,cAAc,EAAE,MAI5B,CAAC;AAEF,eAAO,MAAM,sBAAsB,shHAwJlC,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol Documentation Prompt
|
|
3
|
+
*
|
|
4
|
+
* Provides the full Agent Relay protocol documentation as an MCP prompt.
|
|
5
|
+
* This is included automatically when an agent connects.
|
|
6
|
+
*/
|
|
7
|
+
export const protocolPrompt = {
|
|
8
|
+
name: 'relay_protocol',
|
|
9
|
+
description: 'Full Agent Relay protocol documentation',
|
|
10
|
+
arguments: [],
|
|
11
|
+
};
|
|
12
|
+
export const PROTOCOL_DOCUMENTATION = `
|
|
13
|
+
# Agent Relay Protocol
|
|
14
|
+
|
|
15
|
+
You are connected to Agent Relay, a real-time messaging system for AI agent coordination.
|
|
16
|
+
|
|
17
|
+
## Communication Patterns
|
|
18
|
+
|
|
19
|
+
### Direct Messages
|
|
20
|
+
Send a message to a specific agent by name:
|
|
21
|
+
\`\`\`
|
|
22
|
+
relay_send(to="Alice", message="Can you review this PR?")
|
|
23
|
+
\`\`\`
|
|
24
|
+
|
|
25
|
+
### Channel Messages
|
|
26
|
+
Send to a channel (prefix with #):
|
|
27
|
+
\`\`\`
|
|
28
|
+
relay_send(to="#engineering", message="Build complete")
|
|
29
|
+
\`\`\`
|
|
30
|
+
Channel messages are visible to all agents subscribed to that channel.
|
|
31
|
+
|
|
32
|
+
### Broadcast
|
|
33
|
+
Send to all online agents:
|
|
34
|
+
\`\`\`
|
|
35
|
+
relay_send(to="*", message="System maintenance in 5 minutes")
|
|
36
|
+
\`\`\`
|
|
37
|
+
Use sparingly - broadcasts interrupt all agents.
|
|
38
|
+
|
|
39
|
+
### Threaded Conversations
|
|
40
|
+
For multi-turn conversations, use thread IDs:
|
|
41
|
+
\`\`\`
|
|
42
|
+
relay_send(to="Bob", message="Starting task", thread="task-123")
|
|
43
|
+
relay_send(to="Bob", message="Task update", thread="task-123")
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
### Await Response
|
|
47
|
+
Block and wait for a reply:
|
|
48
|
+
\`\`\`
|
|
49
|
+
relay_send(to="Worker", message="Process this file", await_response=true, timeout_ms=60000)
|
|
50
|
+
\`\`\`
|
|
51
|
+
|
|
52
|
+
## Spawning Workers
|
|
53
|
+
|
|
54
|
+
Create worker agents to parallelize work:
|
|
55
|
+
|
|
56
|
+
\`\`\`
|
|
57
|
+
relay_spawn(
|
|
58
|
+
name="TestRunner",
|
|
59
|
+
cli="claude",
|
|
60
|
+
task="Run the test suite in src/tests/ and report any failures"
|
|
61
|
+
)
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
Workers:
|
|
65
|
+
- Run in separate processes
|
|
66
|
+
- Have their own CLI instance
|
|
67
|
+
- Can use relay to communicate back
|
|
68
|
+
- Should be released when done
|
|
69
|
+
|
|
70
|
+
### Worker Lifecycle
|
|
71
|
+
1. Spawn worker with task
|
|
72
|
+
2. Worker sends ACK when ready
|
|
73
|
+
3. Worker sends progress updates
|
|
74
|
+
4. Worker sends DONE when complete
|
|
75
|
+
5. Lead releases worker
|
|
76
|
+
|
|
77
|
+
### Release Workers
|
|
78
|
+
\`\`\`
|
|
79
|
+
relay_release(name="TestRunner", reason="Tests completed")
|
|
80
|
+
\`\`\`
|
|
81
|
+
|
|
82
|
+
## Message Protocol
|
|
83
|
+
|
|
84
|
+
When you receive messages, they follow this format:
|
|
85
|
+
\`\`\`
|
|
86
|
+
Relay message from Alice [msg-id-123]: Content here
|
|
87
|
+
\`\`\`
|
|
88
|
+
|
|
89
|
+
Channel messages include the channel:
|
|
90
|
+
\`\`\`
|
|
91
|
+
Relay message from Alice [msg-id-456] [#general]: Hello team!
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
### ACK/DONE Protocol
|
|
95
|
+
When assigned a task:
|
|
96
|
+
1. Send ACK immediately: "ACK: Starting work on X"
|
|
97
|
+
2. Send progress updates as needed
|
|
98
|
+
3. Send DONE when complete: "DONE: Completed X with result Y"
|
|
99
|
+
|
|
100
|
+
Example:
|
|
101
|
+
\`\`\`
|
|
102
|
+
# When receiving a task
|
|
103
|
+
relay_send(to="Lead", message="ACK: Starting test suite run")
|
|
104
|
+
|
|
105
|
+
# ... do work ...
|
|
106
|
+
|
|
107
|
+
relay_send(to="Lead", message="DONE: All 42 tests passed")
|
|
108
|
+
\`\`\`
|
|
109
|
+
|
|
110
|
+
## Best Practices
|
|
111
|
+
|
|
112
|
+
### For Lead Agents
|
|
113
|
+
- Spawn workers for parallelizable tasks
|
|
114
|
+
- Keep track of spawned workers
|
|
115
|
+
- Release workers when done
|
|
116
|
+
- Use channels for team announcements
|
|
117
|
+
|
|
118
|
+
### For Worker Agents
|
|
119
|
+
- ACK immediately when receiving tasks
|
|
120
|
+
- Send progress updates for long tasks
|
|
121
|
+
- Send DONE with results when complete
|
|
122
|
+
- Ask clarifying questions if needed
|
|
123
|
+
|
|
124
|
+
### Message Etiquette
|
|
125
|
+
- Keep messages concise
|
|
126
|
+
- Include relevant context
|
|
127
|
+
- Use threads for related messages
|
|
128
|
+
- Don't spam broadcasts
|
|
129
|
+
|
|
130
|
+
## Checking Messages
|
|
131
|
+
|
|
132
|
+
Proactively check your inbox:
|
|
133
|
+
\`\`\`
|
|
134
|
+
relay_inbox()
|
|
135
|
+
relay_inbox(from="Lead")
|
|
136
|
+
relay_inbox(channel="#urgent")
|
|
137
|
+
\`\`\`
|
|
138
|
+
|
|
139
|
+
## Seeing Who's Online
|
|
140
|
+
|
|
141
|
+
\`\`\`
|
|
142
|
+
relay_who()
|
|
143
|
+
\`\`\`
|
|
144
|
+
|
|
145
|
+
## Error Handling
|
|
146
|
+
|
|
147
|
+
If relay returns an error:
|
|
148
|
+
- "Daemon not running" - The relay daemon needs to be started
|
|
149
|
+
- "Agent not found" - Target agent is offline
|
|
150
|
+
- "Channel not found" - Channel doesn't exist
|
|
151
|
+
- "Timeout" - No response within timeout period
|
|
152
|
+
|
|
153
|
+
## Multi-Project Communication
|
|
154
|
+
|
|
155
|
+
In multi-project setups, specify project:
|
|
156
|
+
\`\`\`
|
|
157
|
+
relay_send(to="frontend:Designer", message="Need UI mockup")
|
|
158
|
+
\`\`\`
|
|
159
|
+
|
|
160
|
+
Special targets:
|
|
161
|
+
- \`project:lead\` - Lead agent of that project
|
|
162
|
+
- \`project:*\` - Broadcast to project
|
|
163
|
+
- \`*:*\` - Broadcast to all projects
|
|
164
|
+
`;
|
|
165
|
+
export function getProtocolPrompt() {
|
|
166
|
+
return PROTOCOL_DOCUMENTATION;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/prompts/protocol.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,CAAC,MAAM,cAAc,GAAW;IACpC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,yCAAyC;IACtD,SAAS,EAAE,EAAE;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwJrC,CAAC;AAEF,MAAM,UAAU,iBAAiB;IAC/B,OAAO,sBAAsB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agents Resource
|
|
3
|
+
*
|
|
4
|
+
* Provides live list of online agents as an MCP resource.
|
|
5
|
+
* URI: relay://agents
|
|
6
|
+
*/
|
|
7
|
+
import type { Resource } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
+
import type { RelayClient } from '../client.js';
|
|
9
|
+
export declare const agentsResource: Resource;
|
|
10
|
+
export declare function getAgentsResource(client: RelayClient): Promise<string>;
|
|
11
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/resources/agents.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,cAAc,EAAE,QAK5B,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAG5E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agents Resource
|
|
3
|
+
*
|
|
4
|
+
* Provides live list of online agents as an MCP resource.
|
|
5
|
+
* URI: relay://agents
|
|
6
|
+
*/
|
|
7
|
+
export const agentsResource = {
|
|
8
|
+
uri: 'relay://agents',
|
|
9
|
+
name: 'Online Agents',
|
|
10
|
+
description: 'Live list of agents currently connected to relay',
|
|
11
|
+
mimeType: 'application/json',
|
|
12
|
+
};
|
|
13
|
+
export async function getAgentsResource(client) {
|
|
14
|
+
const agents = await client.listAgents({ include_idle: true });
|
|
15
|
+
return JSON.stringify(agents, null, 2);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/resources/agents.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,CAAC,MAAM,cAAc,GAAa;IACtC,GAAG,EAAE,gBAAgB;IACrB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,kDAAkD;IAC/D,QAAQ,EAAE,kBAAkB;CAC7B,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAmB;IACzD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inbox Resource
|
|
3
|
+
*
|
|
4
|
+
* Provides current inbox contents as an MCP resource.
|
|
5
|
+
* URI: relay://inbox
|
|
6
|
+
*/
|
|
7
|
+
import type { Resource } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
+
import type { RelayClient } from '../client.js';
|
|
9
|
+
export declare const inboxResource: Resource;
|
|
10
|
+
export declare function getInboxResource(client: RelayClient): Promise<string>;
|
|
11
|
+
//# sourceMappingURL=inbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/resources/inbox.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,aAAa,EAAE,QAK3B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAG3E"}
|