@swarmify/agents-mcp 0.2.13 → 0.2.14

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/README.md CHANGED
@@ -69,6 +69,29 @@ You control the cost tradeoffs. Expensive models for planning, fast models for e
69
69
 
70
70
  ## Quick Start
71
71
 
72
+ ```bash
73
+ npm install -g @swarmify/agents-mcp
74
+ ```
75
+
76
+ That's it. The installer auto-detects Claude, Codex, and Gemini CLIs and registers with each:
77
+
78
+ ```
79
+ @swarmify/agents-mcp - Auto-registering with detected agents...
80
+
81
+ Registered with:
82
+ + Claude Code
83
+ + Codex
84
+ + Gemini CLI
85
+
86
+ Restart your agent to use Swarm tools.
87
+ ```
88
+
89
+ Uninstalling (`npm uninstall -g @swarmify/agents-mcp`) automatically unregisters from all agents.
90
+
91
+ ### Manual Registration
92
+
93
+ If auto-registration doesn't work or you need to register with a specific agent:
94
+
72
95
  ```bash
73
96
  # Claude Code
74
97
  claude mcp add --scope user Swarm -- npx -y @swarmify/agents-mcp
@@ -77,15 +100,12 @@ claude mcp add --scope user Swarm -- npx -y @swarmify/agents-mcp
77
100
  codex mcp add swarm -- npx -y @swarmify/agents-mcp@latest
78
101
 
79
102
  # Gemini CLI
80
- gemini mcp add Swarm -- npx -y @swarmify/agents-mcp
103
+ gemini mcp add Swarm "npx -y @swarmify/agents-mcp@latest"
81
104
 
82
- # OpenCode
83
- opencode mcp add
84
- # Name: Swarm, Command: npx -y @swarmify/agents-mcp
105
+ # Cursor / OpenCode
106
+ # Add manually via their MCP config - Name: Swarm, Command: npx -y @swarmify/agents-mcp
85
107
  ```
86
108
 
87
- The server auto-discovers which agent CLIs you have installed. Once connected, your agent gains the ability to spawn and coordinate other agents.
88
-
89
109
  ## What It Costs
90
110
 
91
111
  This server is free and open source.
@@ -241,7 +261,7 @@ Orchestrator SubAgent
241
261
  | |
242
262
  | writes to stdout
243
263
  | |
244
- | ~/.agents/agents/{id}/stdout.log
264
+ | ~/.agents/swarm/agents/{id}/stdout.log
245
265
  | |
246
266
  +-- Status -----------------> reads log, parses events
247
267
  | |
@@ -253,7 +273,7 @@ Orchestrator SubAgent
253
273
  Each agent writes to its own log file (`stdout.log`). The Status tool reads these logs, normalizes events across different agent formats, and returns a summary. This design means:
254
274
 
255
275
  - **Persistence**: Agents survive IDE restarts. Reconnect via Status/Tasks.
256
- - **Debugging**: Full logs available at `~/.agents/agents/{id}/`
276
+ - **Debugging**: Full logs available at `~/.agents/swarm/agents/{id}/`
257
277
  - **No shared state**: Agents don't talk to each other directly. The orchestrator coordinates.
258
278
 
259
279
  ### Storage
@@ -281,7 +301,7 @@ Data lives at `~/.agents/`:
281
301
 
282
302
  ## Configuration
283
303
 
284
- Config lives at `~/.agents/config.json`. See [AGENTS.md](./AGENTS.md) for full config reference.
304
+ Config lives at `~/.agents/swarm/config.json`. See [AGENTS.md](./AGENTS.md) for full config reference.
285
305
 
286
306
  ## Environment Variables
287
307
 
@@ -1,2 +1,2 @@
1
- export declare function printHelloWorld(): void;
1
+ export {};
2
2
  //# sourceMappingURL=hello-world.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hello-world.d.ts","sourceRoot":"","sources":["../src/hello-world.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
1
+ {"version":3,"file":"hello-world.d.ts","sourceRoot":"","sources":["../src/hello-world.ts"],"names":[],"mappings":""}
@@ -1,7 +1,5 @@
1
1
  import { pathToFileURL } from 'url';
2
- export function printHelloWorld() {
3
- console.log('hello world');
4
- }
2
+ import { printHelloWorld } from './hello.js';
5
3
  const invokedPath = process.argv[1];
6
4
  if (invokedPath) {
7
5
  const invokedFileUrl = pathToFileURL(invokedPath).href;
@@ -1 +1 @@
1
- {"version":3,"file":"hello-world.js","sourceRoot":"","sources":["../src/hello-world.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEpC,IAAI,WAAW,EAAE,CAAC;IAChB,MAAM,cAAc,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;IAEvD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,cAAc,EAAE,CAAC;QACvC,eAAe,EAAE,CAAC;IACpB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"hello-world.js","sourceRoot":"","sources":["../src/hello-world.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEpC,IAAI,WAAW,EAAE,CAAC;IAChB,MAAM,cAAc,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;IAEvD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,cAAc,EAAE,CAAC;QACvC,eAAe,EAAE,CAAC;IACpB,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"hello.d.ts","sourceRoot":"","sources":["../src/hello.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
1
+ {"version":3,"file":"hello.d.ts","sourceRoot":"","sources":["../src/hello.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
package/dist/hello.js CHANGED
@@ -1,4 +1,12 @@
1
+ import { pathToFileURL } from 'url';
1
2
  export function printHelloWorld() {
2
3
  console.log('hello world');
3
4
  }
5
+ const invokedPath = process.argv[1];
6
+ if (invokedPath) {
7
+ const invokedFileUrl = pathToFileURL(invokedPath).href;
8
+ if (import.meta.url === invokedFileUrl) {
9
+ printHelloWorld();
10
+ }
11
+ }
4
12
  //# sourceMappingURL=hello.js.map
package/dist/hello.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hello.js","sourceRoot":"","sources":["../src/hello.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC7B,CAAC"}
1
+ {"version":3,"file":"hello.js","sourceRoot":"","sources":["../src/hello.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEpC,IAAI,WAAW,EAAE,CAAC;IAChB,MAAM,cAAc,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;IAEvD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,cAAc,EAAE,CAAC;QACvC,eAAe,EAAE,CAAC;IACpB,CAAC;AACH,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare function printHelloWorld(): void;
1
+ export {};
2
2
  //# sourceMappingURL=hello_world.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hello_world.d.ts","sourceRoot":"","sources":["../src/hello_world.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
1
+ {"version":3,"file":"hello_world.d.ts","sourceRoot":"","sources":["../src/hello_world.ts"],"names":[],"mappings":""}
@@ -1,7 +1,5 @@
1
1
  import { pathToFileURL } from 'url';
2
- export function printHelloWorld() {
3
- console.log('hello world');
4
- }
2
+ import { printHelloWorld } from './hello.js';
5
3
  const invokedPath = process.argv[1];
6
4
  if (invokedPath) {
7
5
  const invokedFileUrl = pathToFileURL(invokedPath).href;
@@ -1 +1 @@
1
- {"version":3,"file":"hello_world.js","sourceRoot":"","sources":["../src/hello_world.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEpC,IAAI,WAAW,EAAE,CAAC;IAChB,MAAM,cAAc,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;IAEvD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,cAAc,EAAE,CAAC;QACvC,eAAe,EAAE,CAAC;IACpB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"hello_world.js","sourceRoot":"","sources":["../src/hello_world.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEpC,IAAI,WAAW,EAAE,CAAC;IAChB,MAAM,cAAc,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;IAEvD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,cAAc,EAAE,CAAC;QACvC,eAAe,EAAE,CAAC;IACpB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarmify/agents-mcp",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "description": "True multi-agent coding in your IDE. Spawn Claude, Codex, Gemini, and Cursor agents from a single MCP server.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,8 @@
8
8
  "agents-mcp": "dist/index.js"
9
9
  },
10
10
  "files": [
11
- "dist"
11
+ "dist",
12
+ "scripts"
12
13
  ],
13
14
  "type": "module",
14
15
  "repository": {
@@ -23,6 +24,8 @@
23
24
  "scripts": {
24
25
  "build": "tsc",
25
26
  "prepublishOnly": "tsc",
27
+ "postinstall": "node scripts/postinstall.js",
28
+ "preuninstall": "node scripts/preuninstall.js",
26
29
  "start": "node dist/index.js",
27
30
  "test": "bun test",
28
31
  "hello": "bun run src/hello-world.ts"
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+ # Build and install the Swarm MCP server
3
+
4
+ set -e
5
+
6
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+ SWARM_DIR="$(dirname "$SCRIPT_DIR")"
8
+
9
+ echo "Building Swarm MCP server..."
10
+ cd "$SWARM_DIR"
11
+
12
+ # Install dependencies
13
+ bun install
14
+
15
+ # Build TypeScript
16
+ bun run build
17
+
18
+ echo "Build complete: $SWARM_DIR/dist/"
19
+ echo ""
20
+ echo "To use this MCP server, add to your Claude Code config:"
21
+ echo " command: bun"
22
+ echo " args: [\"run\", \"$SWARM_DIR/dist/server.js\"]"
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Postinstall script for @swarmify/agents-mcp
5
+ * Detects installed agent CLIs and registers this MCP server with each.
6
+ */
7
+
8
+ import { execSync, spawnSync } from 'child_process';
9
+
10
+ const MCP_NAME = 'Swarm';
11
+ const MCP_COMMAND = 'npx -y @swarmify/agents-mcp@latest';
12
+
13
+ // Agent configurations: CLI name, detection command, register command
14
+ const AGENTS = {
15
+ claude: {
16
+ name: 'Claude Code',
17
+ cli: 'claude',
18
+ register: `claude mcp add --scope user ${MCP_NAME} -- ${MCP_COMMAND}`,
19
+ unregister: `claude mcp remove ${MCP_NAME} --scope user`,
20
+ },
21
+ codex: {
22
+ name: 'Codex',
23
+ cli: 'codex',
24
+ register: `codex mcp add ${MCP_NAME.toLowerCase()} -- ${MCP_COMMAND}`,
25
+ unregister: `codex mcp remove ${MCP_NAME.toLowerCase()}`,
26
+ },
27
+ gemini: {
28
+ name: 'Gemini CLI',
29
+ cli: 'gemini',
30
+ register: `gemini mcp add ${MCP_NAME} "${MCP_COMMAND}"`,
31
+ unregister: `gemini mcp remove ${MCP_NAME}`,
32
+ },
33
+ };
34
+
35
+ function isCliInstalled(cli) {
36
+ try {
37
+ execSync(`which ${cli}`, { stdio: 'ignore' });
38
+ return true;
39
+ } catch {
40
+ return false;
41
+ }
42
+ }
43
+
44
+ function registerWithAgent(agentId, config) {
45
+ try {
46
+ const result = spawnSync('sh', ['-c', config.register], {
47
+ stdio: 'pipe',
48
+ timeout: 30000,
49
+ });
50
+
51
+ if (result.status === 0) {
52
+ return { success: true };
53
+ } else {
54
+ const stderr = result.stderr?.toString() || '';
55
+ if (stderr.includes('already exists') || stderr.includes('already registered')) {
56
+ return { success: true, alreadyExists: true };
57
+ }
58
+ return { success: false, error: stderr || 'Unknown error' };
59
+ }
60
+ } catch (err) {
61
+ return { success: false, error: err.message };
62
+ }
63
+ }
64
+
65
+ function main() {
66
+ if (process.env.CI || process.env.CONTINUOUS_INTEGRATION) {
67
+ return;
68
+ }
69
+
70
+ if (process.env.AGENTS_MCP_SKIP_POSTINSTALL === '1') {
71
+ return;
72
+ }
73
+
74
+ console.log('\n@swarmify/agents-mcp - Auto-registering with detected agents...\n');
75
+
76
+ const detected = [];
77
+ const registered = [];
78
+ const skipped = [];
79
+ const failed = [];
80
+
81
+ for (const [agentId, config] of Object.entries(AGENTS)) {
82
+ if (isCliInstalled(config.cli)) {
83
+ detected.push(config.name);
84
+ const result = registerWithAgent(agentId, config);
85
+
86
+ if (result.success) {
87
+ if (result.alreadyExists) {
88
+ skipped.push(`${config.name} (already registered)`);
89
+ } else {
90
+ registered.push(config.name);
91
+ }
92
+ } else {
93
+ failed.push(`${config.name}: ${result.error}`);
94
+ }
95
+ }
96
+ }
97
+
98
+ if (detected.length === 0) {
99
+ console.log(' No supported agent CLIs detected.');
100
+ console.log(' Install Claude, Codex, or Gemini CLI, then run:');
101
+ console.log(' npx @swarmify/agents-mcp --register\n');
102
+ return;
103
+ }
104
+
105
+ if (registered.length > 0) {
106
+ console.log(' Registered with:');
107
+ for (const name of registered) {
108
+ console.log(` + ${name}`);
109
+ }
110
+ }
111
+
112
+ if (skipped.length > 0) {
113
+ console.log(' Already registered:');
114
+ for (const name of skipped) {
115
+ console.log(` - ${name}`);
116
+ }
117
+ }
118
+
119
+ if (failed.length > 0) {
120
+ console.log(' Failed:');
121
+ for (const msg of failed) {
122
+ console.log(` x ${msg}`);
123
+ }
124
+ }
125
+
126
+ console.log('\n Restart your agent to use Swarm tools.\n');
127
+ }
128
+
129
+ main();
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Preuninstall script for @swarmify/agents-mcp
5
+ * Unregisters this MCP server from all detected agents.
6
+ */
7
+
8
+ import { execSync, spawnSync } from 'child_process';
9
+
10
+ const MCP_NAME = 'Swarm';
11
+
12
+ const AGENTS = {
13
+ claude: {
14
+ name: 'Claude Code',
15
+ cli: 'claude',
16
+ unregister: `claude mcp remove ${MCP_NAME} --scope user`,
17
+ },
18
+ codex: {
19
+ name: 'Codex',
20
+ cli: 'codex',
21
+ unregister: `codex mcp remove ${MCP_NAME.toLowerCase()}`,
22
+ },
23
+ gemini: {
24
+ name: 'Gemini CLI',
25
+ cli: 'gemini',
26
+ unregister: `gemini mcp remove ${MCP_NAME}`,
27
+ },
28
+ };
29
+
30
+ function isCliInstalled(cli) {
31
+ try {
32
+ execSync(`which ${cli}`, { stdio: 'ignore' });
33
+ return true;
34
+ } catch {
35
+ return false;
36
+ }
37
+ }
38
+
39
+ function unregisterFromAgent(config) {
40
+ try {
41
+ const result = spawnSync('sh', ['-c', config.unregister], {
42
+ stdio: 'pipe',
43
+ timeout: 30000,
44
+ });
45
+ return { success: result.status === 0 };
46
+ } catch {
47
+ return { success: false };
48
+ }
49
+ }
50
+
51
+ function main() {
52
+ if (process.env.CI || process.env.CONTINUOUS_INTEGRATION) {
53
+ return;
54
+ }
55
+
56
+ if (process.env.AGENTS_MCP_SKIP_PREUNINSTALL === '1') {
57
+ return;
58
+ }
59
+
60
+ console.log('\n@swarmify/agents-mcp - Unregistering from agents...\n');
61
+
62
+ const removed = [];
63
+
64
+ for (const [agentId, config] of Object.entries(AGENTS)) {
65
+ if (isCliInstalled(config.cli)) {
66
+ const result = unregisterFromAgent(config);
67
+ if (result.success) {
68
+ removed.push(config.name);
69
+ }
70
+ }
71
+ }
72
+
73
+ if (removed.length > 0) {
74
+ console.log(' Unregistered from:');
75
+ for (const name of removed) {
76
+ console.log(` - ${name}`);
77
+ }
78
+ console.log('');
79
+ }
80
+ }
81
+
82
+ main();
@@ -0,0 +1,51 @@
1
+ #!/bin/bash
2
+ # Build and publish the Swarm MCP server package to npm
3
+
4
+ set -euo pipefail
5
+
6
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+ SWARM_DIR="$(dirname "$SCRIPT_DIR")"
8
+
9
+ cd "$SWARM_DIR"
10
+
11
+ if [[ $# -ne 1 ]]; then
12
+ echo "Usage: $0 x.y.z"
13
+ exit 1
14
+ fi
15
+
16
+ VERSION="$1"
17
+ if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
18
+ echo "Invalid version: $VERSION"
19
+ echo "Expected format: x.y.z"
20
+ exit 1
21
+ fi
22
+
23
+ if ! command -v bun >/dev/null 2>&1; then
24
+ echo "bun is required but was not found in PATH"
25
+ exit 1
26
+ fi
27
+
28
+ if ! command -v npm >/dev/null 2>&1; then
29
+ echo "npm is required but was not found in PATH"
30
+ exit 1
31
+ fi
32
+
33
+ # Ensure dependencies are installed
34
+ bun install
35
+
36
+ # Build TypeScript output
37
+ rm -rf dist
38
+ bun run build
39
+
40
+ # Bump package version without git tagging
41
+ npm version "$VERSION" --no-git-tag-version
42
+
43
+ # Verify npm auth before publishing
44
+ if ! npm whoami >/dev/null 2>&1; then
45
+ echo "npm login required before publishing"
46
+ exit 1
47
+ fi
48
+
49
+ npm publish --access public
50
+
51
+ echo "Publish complete"