@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.
Files changed (103) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +214 -0
  3. package/dist/bin.d.ts +12 -0
  4. package/dist/bin.d.ts.map +1 -0
  5. package/dist/bin.js +127 -0
  6. package/dist/bin.js.map +1 -0
  7. package/dist/client.d.ts +68 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/client.js +115 -0
  10. package/dist/client.js.map +1 -0
  11. package/dist/cloud.d.ts +108 -0
  12. package/dist/cloud.d.ts.map +1 -0
  13. package/dist/cloud.js +279 -0
  14. package/dist/cloud.js.map +1 -0
  15. package/dist/errors.d.ts +27 -0
  16. package/dist/errors.d.ts.map +1 -0
  17. package/dist/errors.js +48 -0
  18. package/dist/errors.js.map +1 -0
  19. package/dist/index.d.ts +10 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +16 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/install-cli.d.ts +35 -0
  24. package/dist/install-cli.d.ts.map +1 -0
  25. package/dist/install-cli.js +157 -0
  26. package/dist/install-cli.js.map +1 -0
  27. package/dist/install.d.ts +101 -0
  28. package/dist/install.d.ts.map +1 -0
  29. package/dist/install.js +398 -0
  30. package/dist/install.js.map +1 -0
  31. package/dist/prompts/index.d.ts +2 -0
  32. package/dist/prompts/index.d.ts.map +1 -0
  33. package/dist/prompts/index.js +2 -0
  34. package/dist/prompts/index.js.map +1 -0
  35. package/dist/prompts/protocol.d.ts +11 -0
  36. package/dist/prompts/protocol.d.ts.map +1 -0
  37. package/dist/prompts/protocol.js +168 -0
  38. package/dist/prompts/protocol.js.map +1 -0
  39. package/dist/resources/agents.d.ts +11 -0
  40. package/dist/resources/agents.d.ts.map +1 -0
  41. package/dist/resources/agents.js +17 -0
  42. package/dist/resources/agents.js.map +1 -0
  43. package/dist/resources/inbox.d.ts +11 -0
  44. package/dist/resources/inbox.d.ts.map +1 -0
  45. package/dist/resources/inbox.js +17 -0
  46. package/dist/resources/inbox.js.map +1 -0
  47. package/dist/resources/index.d.ts +4 -0
  48. package/dist/resources/index.d.ts.map +1 -0
  49. package/dist/resources/index.js +4 -0
  50. package/dist/resources/index.js.map +1 -0
  51. package/dist/resources/project.d.ts +11 -0
  52. package/dist/resources/project.d.ts.map +1 -0
  53. package/dist/resources/project.js +21 -0
  54. package/dist/resources/project.js.map +1 -0
  55. package/dist/server.d.ts +19 -0
  56. package/dist/server.d.ts.map +1 -0
  57. package/dist/server.js +215 -0
  58. package/dist/server.js.map +1 -0
  59. package/dist/simple.d.ts +173 -0
  60. package/dist/simple.d.ts.map +1 -0
  61. package/dist/simple.js +120 -0
  62. package/dist/simple.js.map +1 -0
  63. package/dist/tools/index.d.ts +10 -0
  64. package/dist/tools/index.d.ts.map +1 -0
  65. package/dist/tools/index.js +10 -0
  66. package/dist/tools/index.js.map +1 -0
  67. package/dist/tools/relay-health.d.ts +23 -0
  68. package/dist/tools/relay-health.d.ts.map +1 -0
  69. package/dist/tools/relay-health.js +138 -0
  70. package/dist/tools/relay-health.js.map +1 -0
  71. package/dist/tools/relay-inbox.d.ts +26 -0
  72. package/dist/tools/relay-inbox.d.ts.map +1 -0
  73. package/dist/tools/relay-inbox.js +58 -0
  74. package/dist/tools/relay-inbox.js.map +1 -0
  75. package/dist/tools/relay-logs.d.ts +20 -0
  76. package/dist/tools/relay-logs.d.ts.map +1 -0
  77. package/dist/tools/relay-logs.js +88 -0
  78. package/dist/tools/relay-logs.js.map +1 -0
  79. package/dist/tools/relay-metrics.d.ts +20 -0
  80. package/dist/tools/relay-metrics.d.ts.map +1 -0
  81. package/dist/tools/relay-metrics.js +135 -0
  82. package/dist/tools/relay-metrics.js.map +1 -0
  83. package/dist/tools/relay-release.d.ts +20 -0
  84. package/dist/tools/relay-release.d.ts.map +1 -0
  85. package/dist/tools/relay-release.js +44 -0
  86. package/dist/tools/relay-release.js.map +1 -0
  87. package/dist/tools/relay-send.d.ts +29 -0
  88. package/dist/tools/relay-send.d.ts.map +1 -0
  89. package/dist/tools/relay-send.js +71 -0
  90. package/dist/tools/relay-send.js.map +1 -0
  91. package/dist/tools/relay-spawn.d.ts +36 -0
  92. package/dist/tools/relay-spawn.d.ts.map +1 -0
  93. package/dist/tools/relay-spawn.js +73 -0
  94. package/dist/tools/relay-spawn.js.map +1 -0
  95. package/dist/tools/relay-status.d.ts +11 -0
  96. package/dist/tools/relay-status.d.ts.map +1 -0
  97. package/dist/tools/relay-status.js +43 -0
  98. package/dist/tools/relay-status.js.map +1 -0
  99. package/dist/tools/relay-who.d.ts +20 -0
  100. package/dist/tools/relay-who.d.ts.map +1 -0
  101. package/dist/tools/relay-who.js +47 -0
  102. package/dist/tools/relay-who.js.map +1 -0
  103. package/package.json +69 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 Agent Workforce Incorporated
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ # @agent-relay/mcp
2
+
3
+ MCP (Model Context Protocol) server for Agent Relay - gives AI agents native tools for inter-agent communication.
4
+
5
+ ## Quick Start
6
+
7
+ The fastest way to get started with Agent Relay and MCP:
8
+
9
+ ```bash
10
+ # Install Agent Relay globally
11
+ npm install -g agent-relay
12
+
13
+ # Run the setup wizard
14
+ agent-relay init
15
+ ```
16
+
17
+ The wizard will:
18
+ 1. Configure MCP for your AI editors (Claude Code, Cursor)
19
+ 2. Offer to start the daemon
20
+ 3. Show you how to use the relay tools
21
+
22
+ ## Manual Installation
23
+
24
+ ### Install MCP for Editors
25
+
26
+ ```bash
27
+ # Auto-detect and configure all supported editors
28
+ npx @agent-relay/mcp install
29
+
30
+ # Or configure specific editors
31
+ npx @agent-relay/mcp install --editor claude # Claude Code
32
+ npx @agent-relay/mcp install --editor cursor # Cursor
33
+ npx @agent-relay/mcp install --editor vscode # VS Code
34
+ npx @agent-relay/mcp install --editor windsurf # Windsurf
35
+ ```
36
+
37
+ ### Start the Daemon
38
+
39
+ ```bash
40
+ # Start with dashboard
41
+ agent-relay up
42
+
43
+ # Or just the daemon
44
+ agent-relay up --no-dashboard
45
+ ```
46
+
47
+ ### Verify It Works
48
+
49
+ Open Claude Code (or Cursor) and ask:
50
+ > "Use relay_who to see online agents"
51
+
52
+ You should see yourself listed!
53
+
54
+ ## Available Tools
55
+
56
+ Once configured, AI agents have access to these tools:
57
+
58
+ ### `relay_send` - Send Messages
59
+ ```
60
+ relay_send(to="Alice", message="Hello!") # Direct message
61
+ relay_send(to="#general", message="Team update") # Channel message
62
+ relay_send(to="*", message="Announcement") # Broadcast
63
+ relay_send(to="Worker", message="Do this", await_response=true) # Wait for reply
64
+ ```
65
+
66
+ ### `relay_inbox` - Check Messages
67
+ ```
68
+ relay_inbox() # Get unread messages
69
+ relay_inbox(from="Lead", limit=5) # Filter by sender
70
+ relay_inbox(channel="#general") # Filter by channel
71
+ ```
72
+
73
+ ### `relay_who` - List Agents
74
+ ```
75
+ relay_who() # List all online agents
76
+ relay_who(include_idle=false) # Only active agents
77
+ ```
78
+
79
+ ### `relay_spawn` - Create Workers
80
+ ```
81
+ relay_spawn(name="TestRunner", cli="claude", task="Run the test suite")
82
+ relay_spawn(name="Reviewer", cli="codex", task="Review this PR", model="gpt-4")
83
+ ```
84
+
85
+ ### `relay_release` - Stop Workers
86
+ ```
87
+ relay_release(name="TestRunner")
88
+ relay_release(name="TestRunner", reason="Tests completed")
89
+ ```
90
+
91
+ ### `relay_status` - Connection Info
92
+ ```
93
+ relay_status() # Shows: connected, agent name, project, daemon version
94
+ ```
95
+
96
+ ## Troubleshooting
97
+
98
+ ### "Daemon not running" error
99
+
100
+ The relay daemon must be running for MCP tools to work:
101
+
102
+ ```bash
103
+ # Check status
104
+ agent-relay status
105
+
106
+ # Start daemon
107
+ agent-relay up
108
+ ```
109
+
110
+ ### Tools not showing in editor
111
+
112
+ 1. Restart your editor after installing MCP
113
+ 2. Check the MCP configuration was created:
114
+ - Claude Code: `~/.claude/settings.json`
115
+ - Cursor: `~/.cursor/mcp.json`
116
+
117
+ ### Check installation status
118
+
119
+ ```bash
120
+ npx @agent-relay/mcp install --status
121
+ ```
122
+
123
+ ## CLI Reference
124
+
125
+ ```bash
126
+ # Installation
127
+ npx @agent-relay/mcp install # Auto-detect editors
128
+ npx @agent-relay/mcp install --editor X # Specific editor
129
+ npx @agent-relay/mcp install --status # Show status
130
+ npx @agent-relay/mcp install --list # List supported editors
131
+ npx @agent-relay/mcp install --uninstall # Remove configuration
132
+ npx @agent-relay/mcp install --dry-run # Preview changes
133
+
134
+ # Server (used by editors)
135
+ npx @agent-relay/mcp serve
136
+ ```
137
+
138
+ ## Resources & Prompts
139
+
140
+ The MCP server provides:
141
+
142
+ **Resources** (live data):
143
+ - `relay://agents` - Online agents list
144
+ - `relay://inbox` - Your inbox contents
145
+ - `relay://project` - Project configuration
146
+
147
+ **Prompts** (documentation):
148
+ - `relay_protocol` - Full protocol documentation
149
+
150
+ ## Environment Variables
151
+
152
+ | Variable | Description |
153
+ |----------|-------------|
154
+ | `RELAY_SOCKET` | Override daemon socket path |
155
+ | `RELAY_PROJECT` | Override project name |
156
+ | `RELAY_AGENT_NAME` | Override agent name |
157
+ | `DEBUG` or `RELAY_DEBUG` | Enable debug logging |
158
+
159
+ ## Cloud Workspaces
160
+
161
+ In cloud environments (with `WORKSPACE_ID` set), MCP is pre-configured and uses workspace-specific sockets automatically.
162
+
163
+ ## Programmatic Usage
164
+
165
+ Use relay tools directly in your code (no MCP protocol needed):
166
+
167
+ ```typescript
168
+ import { createTools } from '@agent-relay/mcp';
169
+
170
+ const tools = createTools('MyAgent');
171
+
172
+ // Send messages
173
+ await tools.send('OtherAgent', 'Hello!');
174
+ await tools.send('#general', 'Channel message');
175
+ await tools.send('*', 'Broadcast');
176
+
177
+ // Check inbox
178
+ const messages = await tools.inbox();
179
+ for (const msg of messages) {
180
+ console.log(`${msg.from}: ${msg.content}`);
181
+ }
182
+
183
+ // List online agents
184
+ const agents = await tools.who();
185
+
186
+ // Spawn workers
187
+ await tools.spawn({
188
+ name: 'Worker1',
189
+ cli: 'claude',
190
+ task: 'Run tests',
191
+ });
192
+
193
+ // Release workers
194
+ await tools.release('Worker1');
195
+ ```
196
+
197
+ ### One-liners
198
+
199
+ ```typescript
200
+ import { send, inbox, who } from '@agent-relay/mcp/simple';
201
+
202
+ await send('MyAgent', 'Bob', 'Hello!');
203
+ const messages = await inbox('MyAgent');
204
+ const agents = await who();
205
+ ```
206
+
207
+ ## Requirements
208
+
209
+ - Node.js 18+
210
+ - Agent Relay daemon running
211
+
212
+ ## License
213
+
214
+ MIT
package/dist/bin.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @agent-relay/mcp CLI
4
+ *
5
+ * Main entry point for the MCP package CLI.
6
+ *
7
+ * Usage:
8
+ * npx @agent-relay/mcp install - Install MCP server for editors
9
+ * npx @agent-relay/mcp serve - Run MCP server (used by editors)
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG"}
package/dist/bin.js ADDED
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @agent-relay/mcp CLI
4
+ *
5
+ * Main entry point for the MCP package CLI.
6
+ *
7
+ * Usage:
8
+ * npx @agent-relay/mcp install - Install MCP server for editors
9
+ * npx @agent-relay/mcp serve - Run MCP server (used by editors)
10
+ */
11
+ import { parseArgs } from 'node:util';
12
+ import { runInstall, validateEditor, getValidEditors } from './install-cli.js';
13
+ const { values, positionals } = parseArgs({
14
+ allowPositionals: true,
15
+ options: {
16
+ help: { type: 'boolean', short: 'h' },
17
+ version: { type: 'boolean', short: 'v' },
18
+ editor: { type: 'string', short: 'e' },
19
+ global: { type: 'boolean', short: 'g' },
20
+ 'dry-run': { type: 'boolean', short: 'n' },
21
+ uninstall: { type: 'boolean', short: 'u' },
22
+ list: { type: 'boolean', short: 'l' },
23
+ status: { type: 'boolean', short: 's' },
24
+ quiet: { type: 'boolean', short: 'q' },
25
+ },
26
+ });
27
+ const command = positionals[0];
28
+ const VERSION = '0.1.0';
29
+ function showHelp() {
30
+ console.log(`
31
+ @agent-relay/mcp v${VERSION} - MCP Server for Agent Relay
32
+
33
+ Usage:
34
+ npx @agent-relay/mcp <command> [options]
35
+
36
+ Commands:
37
+ install Install MCP server configuration for your editor
38
+ serve Run the MCP server (used internally by editors)
39
+
40
+ Install Options:
41
+ -e, --editor <name> Editor to configure (auto-detect if not specified)
42
+ -g, --global Install globally (not project-specific)
43
+ -n, --dry-run Show what would be done without making changes
44
+ -u, --uninstall Remove MCP server configuration
45
+ -l, --list List supported editors
46
+ -s, --status Show installation status
47
+ -q, --quiet Minimal output
48
+
49
+ Supported Editors:
50
+ ${getValidEditors().join(', ')}
51
+
52
+ Examples:
53
+ npx @agent-relay/mcp install # Auto-detect editors
54
+ npx @agent-relay/mcp install --editor claude # Claude Desktop only
55
+ npx @agent-relay/mcp install --editor cursor # Cursor only
56
+ npx @agent-relay/mcp install --global # Global config
57
+ npx @agent-relay/mcp install --list # List editors
58
+ npx @agent-relay/mcp install --status # Show status
59
+ npx @agent-relay/mcp install --uninstall # Remove config
60
+ npx @agent-relay/mcp serve # Run server (for editors)
61
+ `);
62
+ }
63
+ // Handle --help at top level
64
+ if (values.help && !command) {
65
+ showHelp();
66
+ process.exit(0);
67
+ }
68
+ // Handle --version
69
+ if (values.version) {
70
+ console.log(VERSION);
71
+ process.exit(0);
72
+ }
73
+ // No command provided
74
+ if (!command) {
75
+ showHelp();
76
+ process.exit(0);
77
+ }
78
+ // Validate editor if specified
79
+ if (values.editor && !validateEditor(values.editor)) {
80
+ console.error(`Error: Unknown editor '${values.editor}'`);
81
+ console.error(`Valid editors: ${getValidEditors().join(', ')}`);
82
+ process.exit(1);
83
+ }
84
+ switch (command) {
85
+ case 'install':
86
+ runInstall({
87
+ editor: values.editor,
88
+ global: values.global,
89
+ dryRun: values['dry-run'],
90
+ uninstall: values.uninstall,
91
+ list: values.list,
92
+ status: values.status,
93
+ quiet: values.quiet,
94
+ });
95
+ break;
96
+ case 'serve':
97
+ // Dynamic import to avoid loading server code when not needed
98
+ (async () => {
99
+ try {
100
+ const { createRelayClient, runMCPServer, discoverSocket } = await import('./index.js');
101
+ // Discover socket or use default agent name
102
+ const discovery = discoverSocket();
103
+ const agentName = process.env.RELAY_AGENT_NAME || `mcp-${process.pid}`;
104
+ // Create client and run server
105
+ const client = createRelayClient({
106
+ agentName,
107
+ socketPath: discovery?.socketPath,
108
+ project: discovery?.project,
109
+ });
110
+ await runMCPServer(client);
111
+ }
112
+ catch (err) {
113
+ const message = err instanceof Error ? err.message : String(err);
114
+ console.error('Failed to start MCP server:', message);
115
+ process.exit(1);
116
+ }
117
+ })();
118
+ break;
119
+ case 'help':
120
+ showHelp();
121
+ break;
122
+ default:
123
+ console.error(`Unknown command: ${command}`);
124
+ console.error('Run with --help for usage');
125
+ process.exit(1);
126
+ }
127
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE/E,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IACxC,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;QACrC,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;QACxC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE;QACtC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;QACvC,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;QAC1C,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EA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gBACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;QACL,MAAM;IAER,KAAK,MAAM;QACT,QAAQ,EAAE,CAAC;QACX,MAAM;IAER;QACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * RelayClient - Client for connecting to the Agent Relay daemon
3
+ */
4
+ export interface RelayClient {
5
+ send(to: string, message: string, options?: {
6
+ thread?: string;
7
+ }): Promise<void>;
8
+ sendAndWait(to: string, message: string, options?: {
9
+ thread?: string;
10
+ timeoutMs?: number;
11
+ }): Promise<{
12
+ from: string;
13
+ content: string;
14
+ thread?: string;
15
+ }>;
16
+ spawn(options: {
17
+ name: string;
18
+ cli: string;
19
+ task: string;
20
+ model?: string;
21
+ cwd?: string;
22
+ }): Promise<{
23
+ success: boolean;
24
+ error?: string;
25
+ }>;
26
+ release(name: string, reason?: string): Promise<{
27
+ success: boolean;
28
+ error?: string;
29
+ }>;
30
+ getStatus(): Promise<{
31
+ connected: boolean;
32
+ agentName: string;
33
+ project: string;
34
+ socketPath: string;
35
+ daemonVersion?: string;
36
+ uptime?: string;
37
+ }>;
38
+ getInbox(options?: {
39
+ limit?: number;
40
+ unread_only?: boolean;
41
+ from?: string;
42
+ channel?: string;
43
+ }): Promise<Array<{
44
+ id: string;
45
+ from: string;
46
+ content: string;
47
+ channel?: string;
48
+ thread?: string;
49
+ }>>;
50
+ listAgents(options?: {
51
+ include_idle?: boolean;
52
+ project?: string;
53
+ }): Promise<Array<{
54
+ name: string;
55
+ cli: string;
56
+ idle?: boolean;
57
+ parent?: string;
58
+ }>>;
59
+ }
60
+ export interface RelayClientOptions {
61
+ agentName: string;
62
+ socketPath?: string;
63
+ project?: string;
64
+ timeout?: number;
65
+ }
66
+ export declare function createRelayClient(options: RelayClientOptions): RelayClient;
67
+ export default createRelayClient;
68
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChF,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzJ,KAAK,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzI,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtF,SAAS,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC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