nexus-agents 2.0.0 → 2.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/README.md +404 -0
- package/dist/{chunk-3VJOPTVX.js → chunk-PSABUXMP.js} +15310 -9169
- package/dist/chunk-PSABUXMP.js.map +1 -0
- package/dist/chunk-U6PLZTD6.js +280 -0
- package/dist/chunk-U6PLZTD6.js.map +1 -0
- package/dist/cli.d.ts +104 -0
- package/dist/cli.js +9182 -33
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +9298 -4825
- package/dist/index.js +4826 -38
- package/dist/index.js.map +1 -1
- package/dist/pr-reviewer-helpers-44LFL3AT.js +33 -0
- package/dist/pr-reviewer-helpers-44LFL3AT.js.map +1 -0
- package/dist/workflows/templates/refactoring.yaml +101 -0
- package/dist/workflows/templates/security-audit.yaml +129 -0
- package/dist/workflows/templates/test-generation.yaml +129 -0
- package/package.json +17 -4
- package/src/workflows/templates/refactoring.yaml +101 -0
- package/src/workflows/templates/security-audit.yaml +129 -0
- package/src/workflows/templates/test-generation.yaml +129 -0
- package/dist/chunk-3VJOPTVX.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
# Nexus Agents
|
|
2
|
+
|
|
3
|
+
> Multi-agent orchestration MCP server with model diversity and workflow automation
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
[](https://www.typescriptlang.org)
|
|
8
|
+
[](https://modelcontextprotocol.io)
|
|
9
|
+
[](https://www.npmjs.com/package/nexus-agents)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Nexus Agents is an MCP (Model Context Protocol) server that coordinates multiple AI experts to handle software development tasks. It provides a unified interface for different AI models and enables multi-agent collaboration through a Tech Lead and specialized experts.
|
|
16
|
+
|
|
17
|
+
### Key Capabilities
|
|
18
|
+
|
|
19
|
+
- **Multi-Agent Orchestration** - Tech Lead coordinates specialized experts for complex tasks
|
|
20
|
+
- **Model Diversity** - Support for Claude, OpenAI, Gemini, and Ollama
|
|
21
|
+
- **Workflow Automation** - YAML-based templates for repeatable processes
|
|
22
|
+
- **Security-First Design** - Defense in depth with secrets vault and input validation
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Install the package
|
|
32
|
+
npm install nexus-agents
|
|
33
|
+
|
|
34
|
+
# Or install globally for CLI usage
|
|
35
|
+
npm install -g nexus-agents
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### CLI Usage
|
|
39
|
+
|
|
40
|
+
Start the MCP server:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# If installed globally
|
|
44
|
+
nexus-agents
|
|
45
|
+
|
|
46
|
+
# Or with npx
|
|
47
|
+
npx nexus-agents
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Programmatic Usage
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import {
|
|
54
|
+
createServer,
|
|
55
|
+
startStdioServer,
|
|
56
|
+
TechLead,
|
|
57
|
+
createClaudeAdapter,
|
|
58
|
+
ExpertFactory,
|
|
59
|
+
} from 'nexus-agents';
|
|
60
|
+
|
|
61
|
+
// Start MCP server
|
|
62
|
+
const result = await startStdioServer({
|
|
63
|
+
name: 'my-server',
|
|
64
|
+
version: '1.0.0',
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Or use programmatically
|
|
68
|
+
const adapter = createClaudeAdapter({
|
|
69
|
+
model: 'claude-sonnet-4-20250514',
|
|
70
|
+
});
|
|
71
|
+
const techLead = new TechLead({ adapter });
|
|
72
|
+
|
|
73
|
+
// Create experts dynamically
|
|
74
|
+
const factory = new ExpertFactory(adapter);
|
|
75
|
+
const codeExpert = factory.create({ type: 'code' });
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Claude Desktop Integration
|
|
79
|
+
|
|
80
|
+
Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"nexus-agents": {
|
|
86
|
+
"command": "npx",
|
|
87
|
+
"args": ["nexus-agents"],
|
|
88
|
+
"env": {
|
|
89
|
+
"ANTHROPIC_API_KEY": "sk-ant-..."
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Features
|
|
99
|
+
|
|
100
|
+
### Multi-Agent Orchestration
|
|
101
|
+
|
|
102
|
+
The Tech Lead agent analyzes incoming tasks and delegates to specialized experts:
|
|
103
|
+
|
|
104
|
+
| Expert | Specialization |
|
|
105
|
+
| ------------------------ | ------------------------------------------------------ |
|
|
106
|
+
| **Code Expert** | Implementation, debugging, optimization, refactoring |
|
|
107
|
+
| **Architecture Expert** | System design, patterns, trade-offs, scalability |
|
|
108
|
+
| **Security Expert** | Vulnerability analysis, secure coding, threat modeling |
|
|
109
|
+
| **Documentation Expert** | Technical writing, API docs, code comments |
|
|
110
|
+
| **Testing Expert** | Test strategies, coverage analysis, test generation |
|
|
111
|
+
|
|
112
|
+
Experts can collaborate on complex tasks. The Tech Lead combines their outputs into a single response.
|
|
113
|
+
|
|
114
|
+
### Model Adapters
|
|
115
|
+
|
|
116
|
+
Use different AI models through unified interfaces:
|
|
117
|
+
|
|
118
|
+
| Provider | Models | Best For |
|
|
119
|
+
| ---------- | ----------------------- | -------------------------- |
|
|
120
|
+
| **Claude** | Haiku, Sonnet, Opus | General coding, analysis |
|
|
121
|
+
| **OpenAI** | GPT-4o, GPT-4o-mini, o1 | Reasoning, code generation |
|
|
122
|
+
| **Gemini** | Pro, Ultra | Long context, multimodal |
|
|
123
|
+
| **Ollama** | Llama, CodeLlama, etc. | Local inference, privacy |
|
|
124
|
+
|
|
125
|
+
Model selection uses semantic classification with tier escalation:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
Fast (quick queries) -> Balanced (most tasks) -> Powerful (complex reasoning)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Workflow Engine
|
|
132
|
+
|
|
133
|
+
Define reusable workflows in YAML:
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
name: code-review
|
|
137
|
+
description: Comprehensive code review workflow
|
|
138
|
+
steps:
|
|
139
|
+
- agent: security_expert
|
|
140
|
+
action: scan_vulnerabilities
|
|
141
|
+
output: security_report
|
|
142
|
+
|
|
143
|
+
- agent: code_expert
|
|
144
|
+
action: review_quality
|
|
145
|
+
input: ${security_report}
|
|
146
|
+
output: quality_report
|
|
147
|
+
|
|
148
|
+
- agent: testing_expert
|
|
149
|
+
action: analyze_coverage
|
|
150
|
+
parallel: true
|
|
151
|
+
|
|
152
|
+
- agent: documentation_expert
|
|
153
|
+
action: check_documentation
|
|
154
|
+
parallel: true
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### MCP Tools
|
|
158
|
+
|
|
159
|
+
The server exposes these MCP tools for integration:
|
|
160
|
+
|
|
161
|
+
| Tool | Description |
|
|
162
|
+
| --------------- | -------------------------------------------- |
|
|
163
|
+
| `orchestrate` | Analyze task and coordinate expert execution |
|
|
164
|
+
| `create_expert` | Dynamically create a specialized expert |
|
|
165
|
+
| `run_workflow` | Execute a predefined workflow template |
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Architecture
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
nexus-agents/
|
|
173
|
+
├── packages/
|
|
174
|
+
│ └── nexus-agents/ # Main package
|
|
175
|
+
│ ├── src/
|
|
176
|
+
│ │ ├── core/ # Shared types, Result<T,E>, errors, logger
|
|
177
|
+
│ │ ├── config/ # Configuration loading and validation
|
|
178
|
+
│ │ ├── adapters/ # Model adapters (Claude, OpenAI, Gemini, Ollama)
|
|
179
|
+
│ │ ├── agents/ # Agent framework (TechLead, Experts)
|
|
180
|
+
│ │ ├── workflows/ # Workflow engine and templates
|
|
181
|
+
│ │ ├── mcp/ # MCP server and tool definitions
|
|
182
|
+
│ │ ├── cli-adapters/ # External CLI integration (Claude/Gemini/Codex CLIs)
|
|
183
|
+
│ │ ├── context/ # Token counting, work balancing, memory
|
|
184
|
+
│ │ ├── consensus/ # Multi-agent voting and decisions
|
|
185
|
+
│ │ ├── index.ts # Main exports
|
|
186
|
+
│ │ └── cli.ts # CLI entry point
|
|
187
|
+
│ └── package.json
|
|
188
|
+
├── .claude/
|
|
189
|
+
│ ├── rules/ # Claude Code rules
|
|
190
|
+
│ └── skills/ # Project-specific skills
|
|
191
|
+
└── pnpm-workspace.yaml
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
See [ARCHITECTURE.md](./ARCHITECTURE.md) for detailed module descriptions.
|
|
195
|
+
|
|
196
|
+
### Dependency Flow
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
MCP Server (external boundary)
|
|
200
|
+
↓
|
|
201
|
+
Workflow Engine (orchestrates execution)
|
|
202
|
+
↓
|
|
203
|
+
Agents Layer (TechLead, Experts)
|
|
204
|
+
↓
|
|
205
|
+
Adapters Layer (Claude, OpenAI, Gemini, Ollama)
|
|
206
|
+
↓
|
|
207
|
+
Core Layer (Types, Result<T,E>, Errors, Logger)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Core Interfaces
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
// Unified model interaction
|
|
214
|
+
interface IModelAdapter {
|
|
215
|
+
complete(request: CompletionRequest): Promise<Result<Response, ModelError>>;
|
|
216
|
+
stream(request: CompletionRequest): AsyncIterable<StreamChunk>;
|
|
217
|
+
countTokens(text: string): Promise<number>;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Base agent contract
|
|
221
|
+
interface IAgent {
|
|
222
|
+
readonly id: string;
|
|
223
|
+
readonly role: AgentRole;
|
|
224
|
+
execute(task: Task): Promise<Result<TaskResult, AgentError>>;
|
|
225
|
+
handleMessage(msg: AgentMessage): Promise<Result<AgentResponse, AgentError>>;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Workflow execution
|
|
229
|
+
interface IWorkflowEngine {
|
|
230
|
+
loadTemplate(path: string): Promise<Result<WorkflowDefinition, ParseError>>;
|
|
231
|
+
execute(
|
|
232
|
+
workflow: WorkflowDefinition,
|
|
233
|
+
inputs: unknown
|
|
234
|
+
): Promise<Result<WorkflowResult, WorkflowError>>;
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Configuration
|
|
241
|
+
|
|
242
|
+
### Environment Variables
|
|
243
|
+
|
|
244
|
+
| Variable | Description | Required |
|
|
245
|
+
| ------------------- | --------------------------------- | ------------------------------------- |
|
|
246
|
+
| `ANTHROPIC_API_KEY` | Claude API key | Yes (for Claude) |
|
|
247
|
+
| `OPENAI_API_KEY` | OpenAI API key | For OpenAI models |
|
|
248
|
+
| `GOOGLE_AI_API_KEY` | Google AI API key | For Gemini models |
|
|
249
|
+
| `OLLAMA_HOST` | Ollama server URL | For Ollama (default: localhost:11434) |
|
|
250
|
+
| `NEXUS_LOG_LEVEL` | Log level (debug/info/warn/error) | No |
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## API Reference
|
|
255
|
+
|
|
256
|
+
### Adapters
|
|
257
|
+
|
|
258
|
+
```typescript
|
|
259
|
+
import {
|
|
260
|
+
createClaudeAdapter,
|
|
261
|
+
createOpenAIAdapter,
|
|
262
|
+
createGeminiAdapter,
|
|
263
|
+
createOllamaAdapter,
|
|
264
|
+
AdapterFactory,
|
|
265
|
+
} from 'nexus-agents';
|
|
266
|
+
|
|
267
|
+
// Create individual adapters
|
|
268
|
+
const claude = createClaudeAdapter({ model: 'claude-sonnet-4-20250514' });
|
|
269
|
+
const openai = createOpenAIAdapter({ model: 'gpt-4o' });
|
|
270
|
+
const gemini = createGeminiAdapter({ model: 'gemini-1.5-pro' });
|
|
271
|
+
const ollama = createOllamaAdapter({ model: 'llama3:8b' });
|
|
272
|
+
|
|
273
|
+
// Or use the factory
|
|
274
|
+
const factory = new AdapterFactory();
|
|
275
|
+
const adapter = factory.create({ provider: 'anthropic', model: 'claude-sonnet-4-20250514' });
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Agents
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
import { TechLead, ExpertFactory, Expert } from 'nexus-agents';
|
|
282
|
+
|
|
283
|
+
// Create TechLead for orchestration
|
|
284
|
+
const techLead = new TechLead({ adapter });
|
|
285
|
+
|
|
286
|
+
// Create experts
|
|
287
|
+
const factory = new ExpertFactory(adapter);
|
|
288
|
+
const codeExpert = factory.create({ type: 'code' });
|
|
289
|
+
const securityExpert = factory.create({ type: 'security' });
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### MCP Server
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
import { createServer, startStdioServer, registerTools } from 'nexus-agents';
|
|
296
|
+
|
|
297
|
+
// Create and start server
|
|
298
|
+
const result = await startStdioServer({
|
|
299
|
+
name: 'my-server',
|
|
300
|
+
version: '1.0.0',
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
if (result.ok) {
|
|
304
|
+
const { server } = result.value;
|
|
305
|
+
// Server is running with stdio transport
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Development
|
|
312
|
+
|
|
313
|
+
### Prerequisites
|
|
314
|
+
|
|
315
|
+
- Node.js 22.x LTS
|
|
316
|
+
- pnpm 9.x
|
|
317
|
+
- TypeScript 5.8+
|
|
318
|
+
|
|
319
|
+
### Setup
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# Clone the repository
|
|
323
|
+
git clone https://github.com/williamzujkowski/nexus-agents.git
|
|
324
|
+
cd nexus-agents
|
|
325
|
+
|
|
326
|
+
# Install dependencies
|
|
327
|
+
pnpm install
|
|
328
|
+
|
|
329
|
+
# Build the package
|
|
330
|
+
pnpm build
|
|
331
|
+
|
|
332
|
+
# Run tests
|
|
333
|
+
pnpm test
|
|
334
|
+
|
|
335
|
+
# Start development mode
|
|
336
|
+
pnpm dev
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Commands
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# Development
|
|
343
|
+
pnpm dev # Start dev server with watch mode
|
|
344
|
+
pnpm build # Build the package
|
|
345
|
+
pnpm clean # Clean build artifacts
|
|
346
|
+
|
|
347
|
+
# Quality
|
|
348
|
+
pnpm lint # Run ESLint
|
|
349
|
+
pnpm lint:fix # Fix linting issues
|
|
350
|
+
pnpm typecheck # Run TypeScript type checking
|
|
351
|
+
pnpm test # Run all tests
|
|
352
|
+
pnpm test:coverage # Run tests with coverage
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## Contributing
|
|
358
|
+
|
|
359
|
+
We welcome contributions! Please see our guidelines:
|
|
360
|
+
|
|
361
|
+
1. **Fork** the repository
|
|
362
|
+
2. **Create** a feature branch (`git checkout -b feat/amazing-feature`)
|
|
363
|
+
3. **Commit** with conventional commits (`git commit -m 'feat(agents): add amazing feature'`)
|
|
364
|
+
4. **Push** to your branch (`git push origin feat/amazing-feature`)
|
|
365
|
+
5. **Open** a Pull Request
|
|
366
|
+
|
|
367
|
+
### Code Standards
|
|
368
|
+
|
|
369
|
+
- Files must be under 400 lines
|
|
370
|
+
- Functions must be under 50 lines
|
|
371
|
+
- Test coverage must be at least 80%
|
|
372
|
+
- All code must pass linting and type checking
|
|
373
|
+
|
|
374
|
+
See [CODING_STANDARDS.md](./CODING_STANDARDS.md) for detailed guidelines.
|
|
375
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution workflow.
|
|
376
|
+
|
|
377
|
+
### Commit Convention
|
|
378
|
+
|
|
379
|
+
We use [Conventional Commits](https://www.conventionalcommits.org/):
|
|
380
|
+
|
|
381
|
+
```
|
|
382
|
+
feat(scope): add new feature
|
|
383
|
+
fix(scope): fix bug
|
|
384
|
+
refactor(scope): refactor code
|
|
385
|
+
docs(scope): update documentation
|
|
386
|
+
test(scope): add tests
|
|
387
|
+
chore(scope): maintenance tasks
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## License
|
|
393
|
+
|
|
394
|
+
MIT - See [LICENSE](./LICENSE) for details.
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## Acknowledgments
|
|
399
|
+
|
|
400
|
+
This project is a clean-room rewrite inspired by [claude-team-mcp](https://github.com/original/claude-team-mcp), with attribution preserved per MIT license.
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
Built with Claude Code
|