@swarmify/agents-mcp 0.2.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 +21 -0
- package/README.md +131 -0
- package/dist/agents.d.ts +85 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/agents.js +663 -0
- package/dist/agents.js.map +1 -0
- package/dist/api.d.ts +68 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +219 -0
- package/dist/api.js.map +1 -0
- package/dist/file_ops.d.ts +6 -0
- package/dist/file_ops.d.ts.map +1 -0
- package/dist/file_ops.js +59 -0
- package/dist/file_ops.js.map +1 -0
- package/dist/hello.d.ts +3 -0
- package/dist/hello.d.ts.map +1 -0
- package/dist/hello.js +13 -0
- package/dist/hello.js.map +1 -0
- package/dist/hello_world.d.ts +2 -0
- package/dist/hello_world.d.ts.map +1 -0
- package/dist/hello_world.js +12 -0
- package/dist/hello_world.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/parsers.d.ts +5 -0
- package/dist/parsers.d.ts.map +1 -0
- package/dist/parsers.js +704 -0
- package/dist/parsers.js.map +1 -0
- package/dist/persistence.d.ts +10 -0
- package/dist/persistence.d.ts.map +1 -0
- package/dist/persistence.js +103 -0
- package/dist/persistence.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +244 -0
- package/dist/server.js.map +1 -0
- package/dist/summarizer.d.ts +58 -0
- package/dist/summarizer.d.ts.map +1 -0
- package/dist/summarizer.js +766 -0
- package/dist/summarizer.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Muqsit Nawaz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# @swarmify/agents-mcp
|
|
2
|
+
|
|
3
|
+
True multi-agent coding in your IDE. Spawn Claude, Codex, Gemini, and Cursor agents from a single MCP server.
|
|
4
|
+
|
|
5
|
+
This [Model Context Protocol](https://modelcontextprotocol.io/) server gives your AI coding agent the ability to spawn, orchestrate, and manage other AI agents. CLI-first, token-optimized, and works with any MCP-compatible host.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Claude Code
|
|
11
|
+
claude mcp add swarmify-agents -- npx -y @swarmify/agents-mcp
|
|
12
|
+
|
|
13
|
+
# Gemini CLI
|
|
14
|
+
gemini mcp add swarmify-agents -- npx -y @swarmify/agents-mcp
|
|
15
|
+
|
|
16
|
+
# OpenCode (interactive)
|
|
17
|
+
opencode mcp add
|
|
18
|
+
# Name: swarmify-agents
|
|
19
|
+
# Type: Local
|
|
20
|
+
# Command: npx -y @swarmify/agents-mcp
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The server auto-discovers which agent CLIs you have installed and only exposes those in the `spawn` tool.
|
|
24
|
+
|
|
25
|
+
## Tools
|
|
26
|
+
|
|
27
|
+
| Tool | Description |
|
|
28
|
+
|------|-------------|
|
|
29
|
+
| `spawn` | Start an agent on a task. Returns immediately with agent ID. |
|
|
30
|
+
| `status` | Get agent progress: files changed, commands run, last messages. |
|
|
31
|
+
| `stop` | Stop one agent or all agents in a task. |
|
|
32
|
+
| `tasks` | List all tasks with their agents and activity. |
|
|
33
|
+
|
|
34
|
+
### spawn
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
spawn(task_name, agent_type, prompt, mode?, cwd?, effort?)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
| Parameter | Required | Description |
|
|
41
|
+
|-----------|----------|-------------|
|
|
42
|
+
| `task_name` | Yes | Groups related agents (e.g., "auth-feature") |
|
|
43
|
+
| `agent_type` | Yes | `claude`, `codex`, `gemini`, or `cursor` |
|
|
44
|
+
| `prompt` | Yes | The task for the agent |
|
|
45
|
+
| `mode` | No | `plan` (read-only, default) or `edit` (can write files) |
|
|
46
|
+
| `cwd` | No | Working directory for the agent |
|
|
47
|
+
| `effort` | No | `medium` (default) or `high` for max-capability models |
|
|
48
|
+
|
|
49
|
+
### status
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
status(task_name, filter?)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
| Parameter | Required | Description |
|
|
56
|
+
|-----------|----------|-------------|
|
|
57
|
+
| `task_name` | Yes | Task to check |
|
|
58
|
+
| `filter` | No | `running` (default), `completed`, `failed`, `stopped`, or `all` |
|
|
59
|
+
|
|
60
|
+
Returns files created/modified/read/deleted, bash commands executed, and last messages.
|
|
61
|
+
|
|
62
|
+
### stop
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
stop(task_name, agent_id?)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Stop all agents in a task, or a specific agent by ID.
|
|
69
|
+
|
|
70
|
+
### tasks
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
tasks(limit?)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
List all tasks sorted by most recent activity.
|
|
77
|
+
|
|
78
|
+
## Token Optimization
|
|
79
|
+
|
|
80
|
+
This server is designed to minimize token usage for the calling agent:
|
|
81
|
+
|
|
82
|
+
| Optimization | Benefit |
|
|
83
|
+
|--------------|---------|
|
|
84
|
+
| Status defaults to `filter='running'` | Only shows active agents, not completed history |
|
|
85
|
+
| Bash commands truncated to 120 chars | Heredocs collapsed to `cat <<EOF > path` |
|
|
86
|
+
| Last 5 messages only | Not full conversation history |
|
|
87
|
+
| File operations deduplicated | Sets of created/modified/read/deleted paths |
|
|
88
|
+
| Spawn returns immediately | No blocking, poll with status later |
|
|
89
|
+
|
|
90
|
+
## Supported Agents
|
|
91
|
+
|
|
92
|
+
The server auto-discovers installed CLIs at startup:
|
|
93
|
+
|
|
94
|
+
| Agent | CLI | Best For |
|
|
95
|
+
|-------|-----|----------|
|
|
96
|
+
| Claude | `claude` | Maximum capability, research, exploration |
|
|
97
|
+
| Codex | `codex` | Fast, cheap. Self-contained features |
|
|
98
|
+
| Gemini | `gemini` | Complex multi-system features, architectural changes |
|
|
99
|
+
| Cursor | `cursor-agent` | Debugging, bug fixes, tracing through codebases |
|
|
100
|
+
|
|
101
|
+
Install the CLIs you want to use. The server reports available and missing agents on startup.
|
|
102
|
+
|
|
103
|
+
## Modes
|
|
104
|
+
|
|
105
|
+
| Mode | File Access | Use Case |
|
|
106
|
+
|------|-------------|----------|
|
|
107
|
+
| `plan` | Read-only | Research, exploration, code review |
|
|
108
|
+
| `edit` | Read + Write | Implementation, refactoring, fixes |
|
|
109
|
+
|
|
110
|
+
Default is `plan` for safety. Pass `mode='edit'` when agents need to modify files.
|
|
111
|
+
|
|
112
|
+
Data & config are stored under `~/.swarmify` (with a legacy fallback to `~/.agent-swarm`; if neither is writable, it falls back to your temp dir).
|
|
113
|
+
|
|
114
|
+
Requires Node.js >= 18.17 (ESM, fs.rm, etc.).
|
|
115
|
+
|
|
116
|
+
## Effort Levels
|
|
117
|
+
|
|
118
|
+
| Level | Models Used |
|
|
119
|
+
|-------|-------------|
|
|
120
|
+
| `medium` | Balanced models (default) |
|
|
121
|
+
| `high` | Max-capability models per agent |
|
|
122
|
+
|
|
123
|
+
## Environment Variables
|
|
124
|
+
|
|
125
|
+
| Variable | Description |
|
|
126
|
+
|----------|-------------|
|
|
127
|
+
| `AGENT_SWARM_DEFAULT_MODE` | Set default mode (`plan` or `edit`) |
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
MIT
|
package/dist/agents.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { AgentType } from './parsers.js';
|
|
2
|
+
export declare enum AgentStatus {
|
|
3
|
+
RUNNING = "running",
|
|
4
|
+
COMPLETED = "completed",
|
|
5
|
+
FAILED = "failed",
|
|
6
|
+
STOPPED = "stopped"
|
|
7
|
+
}
|
|
8
|
+
export type { AgentType } from './parsers.js';
|
|
9
|
+
export declare const AGENT_COMMANDS: Record<AgentType, string[]>;
|
|
10
|
+
export type EffortLevel = 'medium' | 'high';
|
|
11
|
+
export declare const EFFORT_MODEL_MAP: Record<EffortLevel, Record<AgentType, string>>;
|
|
12
|
+
declare const VALID_MODES: readonly ["plan", "edit"];
|
|
13
|
+
type Mode = typeof VALID_MODES[number];
|
|
14
|
+
export declare function resolveMode(requestedMode: string | null | undefined, defaultMode?: Mode): Mode;
|
|
15
|
+
export declare function checkCliAvailable(agentType: AgentType): [boolean, string | null];
|
|
16
|
+
export declare function checkAllClis(): Record<string, {
|
|
17
|
+
installed: boolean;
|
|
18
|
+
path: string | null;
|
|
19
|
+
error: string | null;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function getAgentsDir(): Promise<string>;
|
|
22
|
+
export declare class AgentProcess {
|
|
23
|
+
agentId: string;
|
|
24
|
+
taskName: string;
|
|
25
|
+
agentType: AgentType;
|
|
26
|
+
prompt: string;
|
|
27
|
+
cwd: string | null;
|
|
28
|
+
mode: Mode;
|
|
29
|
+
pid: number | null;
|
|
30
|
+
status: AgentStatus;
|
|
31
|
+
startedAt: Date;
|
|
32
|
+
completedAt: Date | null;
|
|
33
|
+
private eventsCache;
|
|
34
|
+
private lastReadPos;
|
|
35
|
+
private baseDir;
|
|
36
|
+
constructor(agentId: string, taskName: string, agentType: AgentType, prompt: string, cwd?: string | null, mode?: Mode, pid?: number | null, status?: AgentStatus, startedAt?: Date, completedAt?: Date | null, baseDir?: string | null);
|
|
37
|
+
get isEditMode(): boolean;
|
|
38
|
+
getAgentDir(): Promise<string>;
|
|
39
|
+
getStdoutPath(): Promise<string>;
|
|
40
|
+
getMetaPath(): Promise<string>;
|
|
41
|
+
toDict(): any;
|
|
42
|
+
duration(): string | null;
|
|
43
|
+
get events(): any[];
|
|
44
|
+
/**
|
|
45
|
+
* Return the latest timestamp we have seen in the agent's events.
|
|
46
|
+
* Falls back to null when none are available.
|
|
47
|
+
*/
|
|
48
|
+
private getLatestEventTime;
|
|
49
|
+
readNewEvents(): Promise<void>;
|
|
50
|
+
saveMeta(): Promise<void>;
|
|
51
|
+
static loadFromDisk(agentId: string, baseDir?: string | null): Promise<AgentProcess | null>;
|
|
52
|
+
isProcessAlive(): boolean;
|
|
53
|
+
updateStatusFromProcess(): Promise<void>;
|
|
54
|
+
private reapProcess;
|
|
55
|
+
}
|
|
56
|
+
export declare class AgentManager {
|
|
57
|
+
private agents;
|
|
58
|
+
private maxAgents;
|
|
59
|
+
private maxConcurrent;
|
|
60
|
+
private agentsDir;
|
|
61
|
+
private filterByCwd;
|
|
62
|
+
private cleanupAgeDays;
|
|
63
|
+
private defaultMode;
|
|
64
|
+
private constructorAgentsDir;
|
|
65
|
+
constructor(maxAgents?: number, maxConcurrent?: number, agentsDir?: string | null, defaultMode?: Mode | null, filterByCwd?: string | null, cleanupAgeDays?: number);
|
|
66
|
+
private initialize;
|
|
67
|
+
getDefaultMode(): Mode;
|
|
68
|
+
private loadExistingAgents;
|
|
69
|
+
spawn(taskName: string, agentType: AgentType, prompt: string, cwd?: string | null, mode?: Mode | null, effort?: EffortLevel): Promise<AgentProcess>;
|
|
70
|
+
private buildCommand;
|
|
71
|
+
private applyEditMode;
|
|
72
|
+
get(agentId: string): Promise<AgentProcess | null>;
|
|
73
|
+
listAll(): Promise<AgentProcess[]>;
|
|
74
|
+
listRunning(): Promise<AgentProcess[]>;
|
|
75
|
+
listCompleted(): Promise<AgentProcess[]>;
|
|
76
|
+
listByTask(taskName: string): Promise<AgentProcess[]>;
|
|
77
|
+
stopByTask(taskName: string): Promise<{
|
|
78
|
+
stopped: string[];
|
|
79
|
+
alreadyStopped: string[];
|
|
80
|
+
}>;
|
|
81
|
+
stop(agentId: string): Promise<boolean>;
|
|
82
|
+
private cleanupPartialAgent;
|
|
83
|
+
private cleanupOldAgents;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAMA,OAAO,EAAmB,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,CAKtD,CAAC;AAGF,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;AAM5C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