@patchen0518/agentbrew 1.0.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 +137 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.js +362 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.js +30 -0
- package/dist/config.js.map +1 -0
- package/dist/dispatcher.d.ts +39 -0
- package/dist/dispatcher.js +245 -0
- package/dist/dispatcher.js.map +1 -0
- package/dist/installer.d.ts +8 -0
- package/dist/installer.js +357 -0
- package/dist/installer.js.map +1 -0
- package/dist/logger.d.ts +6 -0
- package/dist/logger.js +22 -0
- package/dist/logger.js.map +1 -0
- package/dist/migration.d.ts +21 -0
- package/dist/migration.js +344 -0
- package/dist/migration.js.map +1 -0
- package/dist/registry.d.ts +51 -0
- package/dist/registry.js +432 -0
- package/dist/registry.js.map +1 -0
- package/dist/router.d.ts +47 -0
- package/dist/router.js +272 -0
- package/dist/router.js.map +1 -0
- package/dist/state.d.ts +8 -0
- package/dist/state.js +63 -0
- package/dist/state.js.map +1 -0
- package/dist/updater.d.ts +2 -0
- package/dist/updater.js +76 -0
- package/dist/updater.js.map +1 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PC
|
|
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,137 @@
|
|
|
1
|
+
# AgentBrew 🍺
|
|
2
|
+
**The Universal Hub for AI Agents.**
|
|
3
|
+
|
|
4
|
+
AgentBrew is a centralized Model Context Protocol (MCP) multiplexer. It allows you to configure your tools once and use them across all your AI agents (Claude Code, Gemini CLI, Cursor, etc.).
|
|
5
|
+
|
|
6
|
+
## 💡 The Core Idea
|
|
7
|
+
AI developers today face a fragmentation problem: every agent (Claude Code, Gemini CLI, Cursor, etc.) has its own way of managing MCP servers, tools, and skills. Setting up your favorite tools in one agent doesn't mean you have them in another.
|
|
8
|
+
|
|
9
|
+
**AgentBrew** solves this by acting as a **Universal "USB Hub"** for MCP. You install your tools once in AgentBrew, and all your agents can instantly access that same consistent set of capabilities. If you switch agents, your entire "brew" of tools and skills comes with you.
|
|
10
|
+
|
|
11
|
+
## 🚀 Key Features
|
|
12
|
+
- **Lazy Loading:** Servers only start when a tool is actually called.
|
|
13
|
+
- **Auto-Discovery:** Automatically detects MCP servers in Node.js, Python, and Markdown projects.
|
|
14
|
+
- **Universal Migration:** Import your existing configurations from Gemini, Claude Code, and Cursor.
|
|
15
|
+
- **Instruction Index:** Automatically exposes `GEMINI.md` and `CLAUDE.md` files as resources for your agents.
|
|
16
|
+
|
|
17
|
+
## 🛠 Installation
|
|
18
|
+
|
|
19
|
+
### 📦 Via npm Registry (Recommended)
|
|
20
|
+
|
|
21
|
+
You can install AgentBrew globally with a single command:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g @patchen0518/agentbrew
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 🔨 Manual Development Setup
|
|
28
|
+
|
|
29
|
+
If you are developing or contributing to AgentBrew, you can clone and build the repository locally:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Clone and enter the repo
|
|
33
|
+
git clone https://github.com/patchen0518/AgentBrew.git
|
|
34
|
+
cd AgentBrew
|
|
35
|
+
|
|
36
|
+
# Install dependencies and build
|
|
37
|
+
npm install
|
|
38
|
+
npm run build
|
|
39
|
+
|
|
40
|
+
# Link the local build globally
|
|
41
|
+
npm link
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## 📖 Usage
|
|
46
|
+
|
|
47
|
+
### Plugging In Tools
|
|
48
|
+
```bash
|
|
49
|
+
# Install a tool from a Git URL
|
|
50
|
+
agentbrew install <github-url>
|
|
51
|
+
|
|
52
|
+
# Migrate from Gemini, Claude, or Cursor
|
|
53
|
+
agentbrew migrate
|
|
54
|
+
|
|
55
|
+
# Manually link a local command
|
|
56
|
+
# (Internal use or custom scripts)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 🔑 Dedicated Credentials
|
|
60
|
+
For servers requiring custom or dedicated credentials, you can configure them directly in the package's `agentbrew.toml` manifest file inside the package folder:
|
|
61
|
+
|
|
62
|
+
```toml
|
|
63
|
+
# ~/.agentbrew/packages/linked-custom-server/agentbrew.toml
|
|
64
|
+
[[servers]]
|
|
65
|
+
name = "custom-server"
|
|
66
|
+
command = "node"
|
|
67
|
+
args = ["index.js"]
|
|
68
|
+
[servers.env]
|
|
69
|
+
API_TOKEN = "your-secret-token-here"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### Managing the Hub
|
|
74
|
+
```bash
|
|
75
|
+
# List all tools, prompts, and resources
|
|
76
|
+
agentbrew list
|
|
77
|
+
|
|
78
|
+
# Enable/Disable a package
|
|
79
|
+
agentbrew enable <package-name>
|
|
80
|
+
agentbrew disable <package-name>
|
|
81
|
+
|
|
82
|
+
# Uninstall a package
|
|
83
|
+
agentbrew uninstall <package-name>
|
|
84
|
+
|
|
85
|
+
# Update a specific package or all packages
|
|
86
|
+
agentbrew update <package-name>
|
|
87
|
+
agentbrew update --all
|
|
88
|
+
|
|
89
|
+
# Refresh capability cache (required after manual file changes)
|
|
90
|
+
agentbrew refresh
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 🤖 Connecting Agents
|
|
94
|
+
Point your AI agent to launch `agentbrew` as its MCP server.
|
|
95
|
+
|
|
96
|
+
- **Gemini CLI:** `gemini mcp add agentbrew agentbrew`
|
|
97
|
+
- **Claude Code:** `/plugin add agentbrew agentbrew`
|
|
98
|
+
- **Cursor:** Add a new "command" type MCP server in settings with command `agentbrew`.
|
|
99
|
+
|
|
100
|
+
### Manual JSON Configuration
|
|
101
|
+
For agents that use a configuration file (like **Claude Desktop** or other MCP clients), add AgentBrew to your config JSON:
|
|
102
|
+
|
|
103
|
+
**File Paths:**
|
|
104
|
+
- **Claude Desktop (macOS):** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
105
|
+
- **Claude Desktop (Windows):** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
106
|
+
|
|
107
|
+
**Configuration:**
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"mcpServers": {
|
|
111
|
+
"agentbrew": {
|
|
112
|
+
"command": "agentbrew"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
> [!TIP]
|
|
119
|
+
> **Path Resolution Fallback:**
|
|
120
|
+
> If your agent cannot resolve the global `agentbrew` command (e.g., throwing a "command not found" or "executable not found" error during startup), you can configure the server to run via `node` directly using the absolute path to your compiled `cli.js` file:
|
|
121
|
+
>
|
|
122
|
+
> ```json
|
|
123
|
+
> {
|
|
124
|
+
> "mcpServers": {
|
|
125
|
+
> "agentbrew": {
|
|
126
|
+
> "command": "node",
|
|
127
|
+
> "args": ["/absolute/path/to/AgentBrew/dist/cli.js"]
|
|
128
|
+
> }
|
|
129
|
+
> }
|
|
130
|
+
> }
|
|
131
|
+
> ```
|
|
132
|
+
|
|
133
|
+
## 🏗 Architecture
|
|
134
|
+
AgentBrew uses an `mcp-manifest.json` cache in each package directory to enable instant startup. The **Router** acts as a dynamic proxy, spawning child MCP processes on-demand and routing requests using a `prefix__name` convention.
|
|
135
|
+
|
|
136
|
+
## 📄 License
|
|
137
|
+
MIT
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.program = void 0;
|
|
41
|
+
exports.runCLI = runCLI;
|
|
42
|
+
// src/cli.ts
|
|
43
|
+
const commander_1 = require("commander");
|
|
44
|
+
const installer_1 = require("./installer");
|
|
45
|
+
const updater_1 = require("./updater");
|
|
46
|
+
const router_1 = require("./router");
|
|
47
|
+
const state_1 = require("./state");
|
|
48
|
+
const registry_1 = require("./registry");
|
|
49
|
+
const migration_1 = require("./migration");
|
|
50
|
+
const fs_1 = __importDefault(require("fs"));
|
|
51
|
+
const path_1 = __importDefault(require("path"));
|
|
52
|
+
const readline_1 = __importDefault(require("readline"));
|
|
53
|
+
const toml = __importStar(require("smol-toml"));
|
|
54
|
+
const logger_1 = require("./logger");
|
|
55
|
+
exports.program = new commander_1.Command();
|
|
56
|
+
exports.program
|
|
57
|
+
.name('agentbrew')
|
|
58
|
+
.description('Universal package manager for AI agents')
|
|
59
|
+
.version('1.0.0');
|
|
60
|
+
// Default action: Start the MCP Router (for AI agents)
|
|
61
|
+
exports.program
|
|
62
|
+
.action(async () => {
|
|
63
|
+
const router = await (0, router_1.startRouter)();
|
|
64
|
+
// Graceful shutdown
|
|
65
|
+
const shutdown = async () => {
|
|
66
|
+
logger_1.Logger.info("Shutting down AgentBrew Router...");
|
|
67
|
+
await router.stop();
|
|
68
|
+
process.exit(0);
|
|
69
|
+
};
|
|
70
|
+
process.on('SIGINT', shutdown);
|
|
71
|
+
process.on('SIGTERM', shutdown);
|
|
72
|
+
});
|
|
73
|
+
exports.program
|
|
74
|
+
.command('refresh')
|
|
75
|
+
.description('Refresh the capability cache for all installed packages')
|
|
76
|
+
.action(async () => {
|
|
77
|
+
const packages = (0, registry_1.discoverPackages)(true);
|
|
78
|
+
if (packages.length === 0) {
|
|
79
|
+
logger_1.Logger.info("No packages to refresh.");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// Use a Set to avoid double-refreshing sub-projects in the same package
|
|
83
|
+
const refreshedPaths = new Set();
|
|
84
|
+
for (const pkg of packages) {
|
|
85
|
+
if (refreshedPaths.has(pkg.path))
|
|
86
|
+
continue;
|
|
87
|
+
logger_1.Logger.info(`Refreshing cache for ${pkg.packageName}...`);
|
|
88
|
+
const manifests = (0, registry_1.findManifests)(pkg.path, 2);
|
|
89
|
+
for (const m of manifests) {
|
|
90
|
+
await (0, registry_1.generateMcpManifest)(m.path, m.manifest);
|
|
91
|
+
}
|
|
92
|
+
refreshedPaths.add(pkg.path);
|
|
93
|
+
}
|
|
94
|
+
logger_1.Logger.info("Refresh complete.");
|
|
95
|
+
});
|
|
96
|
+
exports.program
|
|
97
|
+
.command('install')
|
|
98
|
+
.description('Install a package from a Git URL')
|
|
99
|
+
.argument('<url>', 'Git URL of the package')
|
|
100
|
+
.action(async (url) => {
|
|
101
|
+
try {
|
|
102
|
+
await (0, installer_1.installPackage)(url, async (summary) => {
|
|
103
|
+
if (summary.scripts.length > 0) {
|
|
104
|
+
logger_1.Logger.info("\nPotentially unsafe scripts found in package.json:");
|
|
105
|
+
summary.scripts.forEach(s => logger_1.Logger.info(` - ${s}`));
|
|
106
|
+
logger_1.Logger.info("");
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
logger_1.Logger.info("\nNo installation scripts found.");
|
|
110
|
+
}
|
|
111
|
+
const rl = readline_1.default.createInterface({ input: process.stdin, output: process.stdout });
|
|
112
|
+
const answer = await new Promise(resolve => rl.question('Proceed with installation? [y/N] ', resolve));
|
|
113
|
+
rl.close();
|
|
114
|
+
return answer.toLowerCase() === 'y';
|
|
115
|
+
});
|
|
116
|
+
logger_1.Logger.info(`Successfully installed package from ${url}`);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
logger_1.Logger.error(`Failed to install package: ${error.message}`);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
exports.program
|
|
124
|
+
.command('update')
|
|
125
|
+
.description('Update installed packages from their remote repositories')
|
|
126
|
+
.argument('[packageName]', 'Name of the package to update')
|
|
127
|
+
.option('--all', 'Update all installed packages')
|
|
128
|
+
.action(async (packageName, options) => {
|
|
129
|
+
try {
|
|
130
|
+
if (options.all) {
|
|
131
|
+
await (0, updater_1.updateAllPackages)();
|
|
132
|
+
}
|
|
133
|
+
else if (packageName) {
|
|
134
|
+
await (0, updater_1.updatePackage)(packageName);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
logger_1.Logger.error("Please specify a package name or use --all");
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
logger_1.Logger.error(error.message);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
exports.program
|
|
147
|
+
.command('list')
|
|
148
|
+
.description('List installed packages and their capabilities')
|
|
149
|
+
.argument('[packageName]', 'Optional: filter by package name')
|
|
150
|
+
.action(async (packageName) => {
|
|
151
|
+
let packages = (0, registry_1.discoverPackages)(true); // include disabled
|
|
152
|
+
if (packageName) {
|
|
153
|
+
packages = packages.filter(p => p.packageName === packageName);
|
|
154
|
+
}
|
|
155
|
+
if (packages.length === 0) {
|
|
156
|
+
logger_1.Logger.info(packageName ? `Package '${packageName}' not found.` : "No packages installed.");
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
// Group by packageName
|
|
160
|
+
const grouped = new Map();
|
|
161
|
+
for (const pkg of packages) {
|
|
162
|
+
const list = grouped.get(pkg.packageName) || [];
|
|
163
|
+
list.push(pkg);
|
|
164
|
+
grouped.set(pkg.packageName, list);
|
|
165
|
+
}
|
|
166
|
+
logger_1.Logger.info("Installed Packages:");
|
|
167
|
+
logger_1.Logger.info("====================");
|
|
168
|
+
for (const [pkgName, items] of grouped.entries()) {
|
|
169
|
+
const pkgEnabled = (0, state_1.isPackageEnabled)(pkgName);
|
|
170
|
+
const status = pkgEnabled ? "[ENABLED]" : "[DISABLED]";
|
|
171
|
+
logger_1.Logger.info(`\n${status} ${pkgName}`);
|
|
172
|
+
for (const item of items) {
|
|
173
|
+
// MCP Servers
|
|
174
|
+
if (item.manifest.servers) {
|
|
175
|
+
for (const srv of item.manifest.servers) {
|
|
176
|
+
const capEnabled = (0, state_1.isPackageEnabled)(pkgName, srv.name);
|
|
177
|
+
const capStatus = capEnabled ? "[ENABLED]" : "[DISABLED]";
|
|
178
|
+
logger_1.Logger.info(` ├── [MCP] ${srv.name} ${capStatus} - ${srv.description || ""}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// Skills
|
|
182
|
+
if (item.manifest.prompts) {
|
|
183
|
+
for (const prompt of item.manifest.prompts) {
|
|
184
|
+
const capEnabled = (0, state_1.isPackageEnabled)(pkgName, prompt.name);
|
|
185
|
+
const capStatus = capEnabled ? "[ENABLED]" : "[DISABLED]";
|
|
186
|
+
logger_1.Logger.info(` ├── [SKILL] ${prompt.name} ${capStatus} - ${prompt.description || ""}`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Resources (Instructions)
|
|
190
|
+
if (item.manifest.instructions) {
|
|
191
|
+
for (const instr of item.manifest.instructions) {
|
|
192
|
+
logger_1.Logger.info(` ├── [RESOURCE] ${instr.name} (${instr.file})`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
exports.program
|
|
199
|
+
.command('enable')
|
|
200
|
+
.description('Enable an installed package or a specific capability')
|
|
201
|
+
.argument('<name>', 'Package name')
|
|
202
|
+
.argument('[capability]', 'Optional: specific capability name')
|
|
203
|
+
.action((name, capability) => {
|
|
204
|
+
const id = capability ? `${name}:${capability}` : name;
|
|
205
|
+
if ((0, state_1.enablePackage)(id)) {
|
|
206
|
+
logger_1.Logger.info(`Enabled ${capability ? `capability '${capability}' in ` : ''}package '${name}'`);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
logger_1.Logger.info(`${capability ? `Capability '${capability}' in ` : ''}Package '${name}' is already enabled.`);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
exports.program
|
|
213
|
+
.command('disable')
|
|
214
|
+
.description('Disable an installed package or a specific capability')
|
|
215
|
+
.argument('<name>', 'Package name')
|
|
216
|
+
.argument('[capability]', 'Optional: specific capability name')
|
|
217
|
+
.action((name, capability) => {
|
|
218
|
+
const id = capability ? `${name}:${capability}` : name;
|
|
219
|
+
if ((0, state_1.disablePackage)(id)) {
|
|
220
|
+
logger_1.Logger.info(`Disabled ${capability ? `capability '${capability}' in ` : ''}package '${name}'`);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
logger_1.Logger.info(`${capability ? `Capability '${capability}' in ` : ''}Package '${name}' is already disabled.`);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
exports.program
|
|
227
|
+
.command('uninstall')
|
|
228
|
+
.description('Uninstall a package or a specific capability')
|
|
229
|
+
.argument('<name>', 'Package name')
|
|
230
|
+
.argument('[capability]', 'Optional: specific capability name')
|
|
231
|
+
.action(async (name, capability) => {
|
|
232
|
+
const packages = (0, registry_1.discoverPackages)(true);
|
|
233
|
+
const target = packages.find(p => p.packageName === name);
|
|
234
|
+
if (!target) {
|
|
235
|
+
logger_1.Logger.error(`Package '${name}' not found.`);
|
|
236
|
+
process.exit(1);
|
|
237
|
+
}
|
|
238
|
+
if (!capability) {
|
|
239
|
+
try {
|
|
240
|
+
logger_1.Logger.info(`Uninstalling ${name} from ${target.path}...`);
|
|
241
|
+
fs_1.default.rmSync(target.path, { recursive: true, force: true });
|
|
242
|
+
logger_1.Logger.info(`Successfully uninstalled package '${name}'`);
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
logger_1.Logger.error(`Failed to uninstall: ${error.message}`);
|
|
246
|
+
process.exit(1);
|
|
247
|
+
}
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
// Capability provided
|
|
251
|
+
let found = false;
|
|
252
|
+
if (target.manifest.servers) {
|
|
253
|
+
if (target.manifest.servers.some(s => s.name === capability)) {
|
|
254
|
+
found = true;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (target.manifest.prompts) {
|
|
258
|
+
if (target.manifest.prompts.some(p => p.name === capability)) {
|
|
259
|
+
found = true;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (!found) {
|
|
263
|
+
logger_1.Logger.error(`Capability '${capability}' not found in package '${name}'.`);
|
|
264
|
+
process.exit(1);
|
|
265
|
+
}
|
|
266
|
+
try {
|
|
267
|
+
logger_1.Logger.info(`Uninstalling capability '${capability}' from package '${name}'...`);
|
|
268
|
+
// Read and update agentbrew.toml if it exists
|
|
269
|
+
const manifestPath = path_1.default.join(target.path, 'agentbrew.toml');
|
|
270
|
+
if (fs_1.default.existsSync(manifestPath)) {
|
|
271
|
+
let content = fs_1.default.readFileSync(manifestPath, 'utf-8');
|
|
272
|
+
// Let's parse it as TOML
|
|
273
|
+
let parsed;
|
|
274
|
+
try {
|
|
275
|
+
parsed = toml.parse(content);
|
|
276
|
+
}
|
|
277
|
+
catch (e) {
|
|
278
|
+
parsed = {};
|
|
279
|
+
}
|
|
280
|
+
if (parsed.servers) {
|
|
281
|
+
parsed.servers = parsed.servers.filter((s) => s.name !== capability);
|
|
282
|
+
}
|
|
283
|
+
if (parsed.prompts) {
|
|
284
|
+
parsed.prompts = parsed.prompts.filter((p) => p.name !== capability);
|
|
285
|
+
}
|
|
286
|
+
content = toml.stringify(parsed);
|
|
287
|
+
fs_1.default.writeFileSync(manifestPath, content, 'utf-8');
|
|
288
|
+
}
|
|
289
|
+
// Also check if prompt file exists and delete it
|
|
290
|
+
if (target.manifest.prompts) {
|
|
291
|
+
const targetPrompt = target.manifest.prompts.find(p => p.name === capability);
|
|
292
|
+
if (targetPrompt) {
|
|
293
|
+
const promptFilePath = path_1.default.join(target.path, targetPrompt.file);
|
|
294
|
+
if (fs_1.default.existsSync(promptFilePath)) {
|
|
295
|
+
fs_1.default.rmSync(promptFilePath, { force: true });
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
logger_1.Logger.info(`Successfully uninstalled capability '${capability}' from package '${name}'`);
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
logger_1.Logger.error(`Failed to uninstall capability: ${error.message}`);
|
|
303
|
+
process.exit(1);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
exports.program
|
|
307
|
+
.command('migrate')
|
|
308
|
+
.description('Migrate configurations and skills from other platforms (Gemini, Claude, Cursor)')
|
|
309
|
+
.option('--dry-run', 'List discovered configurations without performing migration')
|
|
310
|
+
.action(async (options) => {
|
|
311
|
+
if (options.dryRun) {
|
|
312
|
+
const result = (0, migration_1.discoverExternalConfigs)();
|
|
313
|
+
logger_1.Logger.info("Discovered External Configurations (Dry Run):");
|
|
314
|
+
if (result.servers.length === 0 && result.skills.length === 0) {
|
|
315
|
+
logger_1.Logger.info("No external configurations found.");
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (result.servers.length > 0) {
|
|
319
|
+
logger_1.Logger.info("\nServers:");
|
|
320
|
+
for (const srv of result.servers) {
|
|
321
|
+
logger_1.Logger.info(`- [${srv.source}] ${srv.name}: ${srv.command} ${srv.args.join(' ')}`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (result.skills.length > 0) {
|
|
325
|
+
logger_1.Logger.info("\nSkills:");
|
|
326
|
+
for (const skill of result.skills) {
|
|
327
|
+
logger_1.Logger.info(`- [${skill.source}] ${skill.name} (${skill.path})`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
const result = await (0, migration_1.runMigration)();
|
|
333
|
+
if (result) {
|
|
334
|
+
logger_1.Logger.info("\nMigration complete!");
|
|
335
|
+
logger_1.Logger.info("To use AgentBrew with your agents, follow these steps:");
|
|
336
|
+
const sources = new Set([...result.servers.map(s => s.source), ...result.skills.map(s => s.source)]);
|
|
337
|
+
if (sources.has('Gemini')) {
|
|
338
|
+
logger_1.Logger.info("\nFor Gemini CLI:");
|
|
339
|
+
logger_1.Logger.info(" gemini mcp add agentbrew agentbrew");
|
|
340
|
+
}
|
|
341
|
+
if (sources.has('Claude')) {
|
|
342
|
+
logger_1.Logger.info("\nFor Claude Code:");
|
|
343
|
+
logger_1.Logger.info(" /plugin add agentbrew agentbrew");
|
|
344
|
+
}
|
|
345
|
+
if (sources.has('Cursor')) {
|
|
346
|
+
logger_1.Logger.info("\nFor Cursor:");
|
|
347
|
+
logger_1.Logger.info(" Add a new MCP server in Cursor settings with:");
|
|
348
|
+
logger_1.Logger.info(" Name: agentbrew");
|
|
349
|
+
logger_1.Logger.info(" Type: command");
|
|
350
|
+
logger_1.Logger.info(" Command: agentbrew");
|
|
351
|
+
}
|
|
352
|
+
logger_1.Logger.info("\nNote: You can always use 'agentbrew list' to see all available tools and skills.");
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
function runCLI() {
|
|
357
|
+
exports.program.parse(process.argv);
|
|
358
|
+
}
|
|
359
|
+
if (require.main === module) {
|
|
360
|
+
runCLI();
|
|
361
|
+
}
|
|
362
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyVA,wBAEC;AA1VD,aAAa;AACb,yCAAoC;AACpC,2CAA6C;AAC7C,uCAA6D;AAC7D,qCAAsD;AACtD,mCAA0E;AAC1E,yCAA+F;AAC/F,2CAAoE;AACpE,4CAAoB;AACpB,gDAAwB;AACxB,wDAAgC;AAEhC,gDAAkC;AAElC,qCAAkC;AAErB,QAAA,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAErC,eAAO;KACJ,IAAI,CAAC,WAAW,CAAC;KACjB,WAAW,CAAC,yCAAyC,CAAC;KACtD,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,uDAAuD;AACvD,eAAO;KACJ,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAW,GAAE,CAAC;IAEnC,oBAAoB;IACpB,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;QAC1B,eAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QACjD,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC;AAEL,eAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,yDAAyD,CAAC;KACtE,MAAM,CAAC,KAAK,IA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CAAC;gBAC1B,eAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;gBACjC,eAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACtD,CAAC;YAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC1B,eAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAClC,eAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;YACnD,CAAC;YAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC1B,eAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;gBAC7B,eAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;gBAC/D,eAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;gBACjC,eAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;gBAC/B,eAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YACtC,CAAC;YAED,eAAM,CAAC,IAAI,CAAC,oFAAoF,CAAC,CAAC;QACpG,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,SAAgB,MAAM;IACpB,eAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,MAAM,EAAE,CAAC;AACX,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the resolved AgentBrew root directory path.
|
|
3
|
+
* Respects AGENTBREW_ROOT environment variable, defaulting to ~/.agentbrew
|
|
4
|
+
*/
|
|
5
|
+
export declare function getBrewRoot(): string;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the path to the packages directory under AgentBrew root.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getPackagesDir(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the path to the state JSON file.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getStateFile(): string;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getBrewRoot = getBrewRoot;
|
|
7
|
+
exports.getPackagesDir = getPackagesDir;
|
|
8
|
+
exports.getStateFile = getStateFile;
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const os_1 = __importDefault(require("os"));
|
|
11
|
+
/**
|
|
12
|
+
* Returns the resolved AgentBrew root directory path.
|
|
13
|
+
* Respects AGENTBREW_ROOT environment variable, defaulting to ~/.agentbrew
|
|
14
|
+
*/
|
|
15
|
+
function getBrewRoot() {
|
|
16
|
+
return process.env.AGENTBREW_ROOT || path_1.default.join(os_1.default.homedir(), '.agentbrew');
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns the path to the packages directory under AgentBrew root.
|
|
20
|
+
*/
|
|
21
|
+
function getPackagesDir() {
|
|
22
|
+
return path_1.default.join(getBrewRoot(), 'packages');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns the path to the state JSON file.
|
|
26
|
+
*/
|
|
27
|
+
function getStateFile() {
|
|
28
|
+
return path_1.default.join(getBrewRoot(), 'state.json');
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;AAOA,kCAEC;AAKD,wCAEC;AAKD,oCAEC;AAvBD,gDAAwB;AACxB,4CAAoB;AAEpB;;;GAGG;AACH,SAAgB,WAAW;IACzB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AAC7E,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc;IAC5B,OAAO,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY;IAC1B,OAAO,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,YAAY,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
+
import { Tool, Prompt, Resource, ResourceTemplate } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { ManagedClient } from "./router";
|
|
4
|
+
export interface LocalPrompt {
|
|
5
|
+
pkgPath: string;
|
|
6
|
+
file: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
}
|
|
10
|
+
export interface LocalResource {
|
|
11
|
+
pkgPath: string;
|
|
12
|
+
file: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class CapabilityDispatch {
|
|
15
|
+
private managedClients;
|
|
16
|
+
private localPrompts;
|
|
17
|
+
private resourceToClient;
|
|
18
|
+
private localResources;
|
|
19
|
+
constructor(managedClients: Map<string, ManagedClient>, localPrompts: Map<string, LocalPrompt>);
|
|
20
|
+
scopeName(prefix: string, name: string): string;
|
|
21
|
+
parseName(fullName: string): {
|
|
22
|
+
prefix: string;
|
|
23
|
+
name: string;
|
|
24
|
+
};
|
|
25
|
+
scopeUri(prefix: string, uri: string): string;
|
|
26
|
+
unscopeUri(uri: string): {
|
|
27
|
+
prefix: string;
|
|
28
|
+
originalUri: string;
|
|
29
|
+
} | null;
|
|
30
|
+
getClient(prefix: string): Promise<Client>;
|
|
31
|
+
listAllTools(cachedTools: Map<string, Tool[]>): Tool[];
|
|
32
|
+
listAllPrompts(cachedPrompts: Map<string, Prompt[]>): Prompt[];
|
|
33
|
+
getPrompt(fullName: string, args?: Record<string, any>): Promise<any>;
|
|
34
|
+
listAllResources(cachedResources: Map<string, Resource[]>): Resource[];
|
|
35
|
+
listAllResourceTemplates(cachedTemplates: Map<string, ResourceTemplate[]>): ResourceTemplate[];
|
|
36
|
+
readResource(uri: string): Promise<any>;
|
|
37
|
+
addResourceMapping(scopedUri: string, prefix: string, originalUri: string): void;
|
|
38
|
+
addLocalResource(uri: string, local: LocalResource): void;
|
|
39
|
+
}
|