@darkiceinteractive/mcp-conductor 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 +558 -0
- package/dist/bin/cli.d.ts +8 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +940 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/bridge/http-server.d.ts +161 -0
- package/dist/bridge/http-server.d.ts.map +1 -0
- package/dist/bridge/http-server.js +367 -0
- package/dist/bridge/http-server.js.map +1 -0
- package/dist/bridge/index.d.ts +5 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +5 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/config/defaults.d.ts +29 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +60 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +49 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +272 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +93 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +5 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/hub/index.d.ts +5 -0
- package/dist/hub/index.d.ts.map +1 -0
- package/dist/hub/index.js +5 -0
- package/dist/hub/index.js.map +1 -0
- package/dist/hub/mcp-hub.d.ts +176 -0
- package/dist/hub/mcp-hub.d.ts.map +1 -0
- package/dist/hub/mcp-hub.js +550 -0
- package/dist/hub/mcp-hub.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics/index.d.ts +5 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +5 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/metrics-collector.d.ts +211 -0
- package/dist/metrics/metrics-collector.d.ts.map +1 -0
- package/dist/metrics/metrics-collector.js +437 -0
- package/dist/metrics/metrics-collector.js.map +1 -0
- package/dist/modes/index.d.ts +5 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +5 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/mode-handler.d.ts +132 -0
- package/dist/modes/mode-handler.d.ts.map +1 -0
- package/dist/modes/mode-handler.js +252 -0
- package/dist/modes/mode-handler.js.map +1 -0
- package/dist/runtime/executor.d.ts +57 -0
- package/dist/runtime/executor.d.ts.map +1 -0
- package/dist/runtime/executor.js +700 -0
- package/dist/runtime/executor.js.map +1 -0
- package/dist/runtime/index.d.ts +5 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +5 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +5 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/mcp-server.d.ts +62 -0
- package/dist/server/mcp-server.d.ts.map +1 -0
- package/dist/server/mcp-server.js +1272 -0
- package/dist/server/mcp-server.js.map +1 -0
- package/dist/skills/index.d.ts +5 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +5 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/skills-engine.d.ts +157 -0
- package/dist/skills/skills-engine.d.ts.map +1 -0
- package/dist/skills/skills-engine.js +405 -0
- package/dist/skills/skills-engine.js.map +1 -0
- package/dist/streaming/execution-stream.d.ts +158 -0
- package/dist/streaming/execution-stream.d.ts.map +1 -0
- package/dist/streaming/execution-stream.js +320 -0
- package/dist/streaming/execution-stream.js.map +1 -0
- package/dist/streaming/index.d.ts +5 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/index.js +5 -0
- package/dist/streaming/index.js.map +1 -0
- package/dist/utils/errors.d.ts +36 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +68 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/helpers.d.ts +44 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +95 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +13 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +48 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/permissions.d.ts +97 -0
- package/dist/utils/permissions.d.ts.map +1 -0
- package/dist/utils/permissions.js +165 -0
- package/dist/utils/permissions.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +87 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +187 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/dist/watcher/config-watcher.d.ts +67 -0
- package/dist/watcher/config-watcher.d.ts.map +1 -0
- package/dist/watcher/config-watcher.js +150 -0
- package/dist/watcher/config-watcher.js.map +1 -0
- package/dist/watcher/index.d.ts +5 -0
- package/dist/watcher/index.d.ts.map +1 -0
- package/dist/watcher/index.js +5 -0
- package/dist/watcher/index.js.map +1 -0
- package/package.json +86 -0
- package/templates/CLAUDE.md +137 -0
- package/templates/skill-mcp-conductor.md +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 DarkIce Interactive
|
|
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,558 @@
|
|
|
1
|
+
# MCP Conductor
|
|
2
|
+
|
|
3
|
+
An MCP server that orchestrates code execution in a sandboxed Deno environment with access to all your MCP servers as APIs. Instead of Claude making direct tool calls (high token usage), Claude writes code that runs in a sandboxed environment. Intermediate data stays in the sandbox; only compact results return to Claude's context.
|
|
4
|
+
|
|
5
|
+
**Key Benefits:**
|
|
6
|
+
- 90-98% token reduction for complex workflows
|
|
7
|
+
- Sub-second overhead for code execution
|
|
8
|
+
- Works with any MCP server
|
|
9
|
+
- Secure Deno sandbox with minimal permissions
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- **Node.js 18+** - JavaScript runtime
|
|
14
|
+
- **Deno 1.40+** - Secure sandbox runtime (install from https://deno.land)
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### Quick Start (npm - Recommended)
|
|
19
|
+
|
|
20
|
+
Add to your Claude Desktop configuration:
|
|
21
|
+
|
|
22
|
+
**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
23
|
+
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"mcp-conductor": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["-y", "@darkiceinteractive/mcp-conductor"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Restart Claude Desktop - that's it! The package auto-downloads on first use.
|
|
37
|
+
|
|
38
|
+
> **Prerequisite:** [Deno](https://deno.land) must be installed for the sandbox runtime.
|
|
39
|
+
|
|
40
|
+
### Alternative: From Source
|
|
41
|
+
|
|
42
|
+
For development or customisation:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
git clone https://github.com/darkiceinteractive/mcp-conductor.git
|
|
46
|
+
cd mcp-conductor
|
|
47
|
+
npm run setup
|
|
48
|
+
node dist/bin/cli.js enable-exclusive
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The `enable-exclusive` command migrates your existing MCP servers to a conductor-managed config, ensuring Claude **must** use `execute_code` for all MCP operations. This provides maximum token savings (90%+).
|
|
52
|
+
|
|
53
|
+
### Manual Configuration
|
|
54
|
+
|
|
55
|
+
If not using npx, add to Claude Desktop configuration:
|
|
56
|
+
|
|
57
|
+
**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
58
|
+
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"mcpServers": {
|
|
63
|
+
"mcp-conductor": {
|
|
64
|
+
"command": "node",
|
|
65
|
+
"args": ["/absolute/path/to/mcp-conductor/dist/index.js"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
> **Important:** Replace `/absolute/path/to/mcp-conductor` with the actual path where you cloned the repository.
|
|
72
|
+
|
|
73
|
+
Or use the CLI to add it automatically:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
node dist/bin/cli.js init
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Step 3: Restart Claude Desktop
|
|
80
|
+
|
|
81
|
+
Restart Claude Desktop to load the new server. You should see "mcp-conductor" in the MCP servers list.
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
In Claude, you can now use the `execute_code` tool:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// List files and count by type
|
|
89
|
+
const fs = mcp.server('filesystem');
|
|
90
|
+
const files = await fs.call('list_directory', { path: '/project/src' });
|
|
91
|
+
const counts = { ts: 0, js: 0, other: 0 };
|
|
92
|
+
for (const f of files.entries) {
|
|
93
|
+
if (f.name.endsWith('.ts')) counts.ts++;
|
|
94
|
+
else if (f.name.endsWith('.js')) counts.js++;
|
|
95
|
+
else counts.other++;
|
|
96
|
+
}
|
|
97
|
+
return counts;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## CLI Commands
|
|
101
|
+
|
|
102
|
+
Run from the project directory:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Check system requirements
|
|
106
|
+
node dist/bin/cli.js check
|
|
107
|
+
|
|
108
|
+
# Show configuration status
|
|
109
|
+
node dist/bin/cli.js status
|
|
110
|
+
|
|
111
|
+
# Add to Claude Desktop config automatically
|
|
112
|
+
node dist/bin/cli.js init [--dry-run]
|
|
113
|
+
|
|
114
|
+
# Start the server manually (usually not needed - Claude Desktop starts it)
|
|
115
|
+
node dist/bin/cli.js serve [options]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Serve Options
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
node dist/bin/cli.js serve \
|
|
122
|
+
--port 0 \ # Bridge port (0 = dynamic allocation, default)
|
|
123
|
+
--mode execution \ # Mode: execution|passthrough|hybrid
|
|
124
|
+
--timeout 30000 \ # Default timeout in ms
|
|
125
|
+
--verbose # Enable debug logging
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
> **Note**: Port 0 (the default) enables dynamic port allocation, allowing multiple instances of MCP Conductor to run simultaneously without port conflicts.
|
|
129
|
+
|
|
130
|
+
### Exclusive Mode Commands
|
|
131
|
+
|
|
132
|
+
Exclusive mode ensures Claude ONLY sees mcp-conductor, forcing all MCP operations through `execute_code` for maximum token savings.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Enable exclusive mode (recommended)
|
|
136
|
+
# Migrates servers from Claude config to ~/.mcp-conductor.json
|
|
137
|
+
node dist/bin/cli.js enable-exclusive [--dry-run]
|
|
138
|
+
|
|
139
|
+
# Disable exclusive mode
|
|
140
|
+
# Restores servers back to Claude config
|
|
141
|
+
node dist/bin/cli.js disable-exclusive [--dry-run]
|
|
142
|
+
|
|
143
|
+
# View current configuration status
|
|
144
|
+
node dist/bin/cli.js config show
|
|
145
|
+
|
|
146
|
+
# List servers in conductor config
|
|
147
|
+
node dist/bin/cli.js config servers
|
|
148
|
+
|
|
149
|
+
# Add a server to conductor config
|
|
150
|
+
node dist/bin/cli.js config add <name> <command> [args...]
|
|
151
|
+
|
|
152
|
+
# Remove a server from conductor config
|
|
153
|
+
node dist/bin/cli.js config remove <name>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Permissions Commands
|
|
157
|
+
|
|
158
|
+
Manage Claude Code MCP tool permissions to auto-allow all discovered tools:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# List currently configured MCP permissions in your settings
|
|
162
|
+
node dist/bin/cli.js permissions list
|
|
163
|
+
|
|
164
|
+
# Discover all available MCP tools and show new permissions needed
|
|
165
|
+
node dist/bin/cli.js permissions discover --new-only
|
|
166
|
+
|
|
167
|
+
# Show as JSON (for manual copying)
|
|
168
|
+
node dist/bin/cli.js permissions discover --json
|
|
169
|
+
|
|
170
|
+
# Preview what would be added to settings
|
|
171
|
+
node dist/bin/cli.js permissions add --dry-run
|
|
172
|
+
|
|
173
|
+
# Add all new permissions to user settings (~/.claude/settings.json)
|
|
174
|
+
node dist/bin/cli.js permissions add
|
|
175
|
+
|
|
176
|
+
# Add to project settings instead (.claude/settings.json)
|
|
177
|
+
node dist/bin/cli.js permissions add --scope project
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
This solves the common issue of seeing permission prompts for MCP tools. Run `permissions add` once to auto-approve all tools from your configured MCP servers.
|
|
181
|
+
|
|
182
|
+
### Project Instructions
|
|
183
|
+
|
|
184
|
+
Install project-level instructions to teach Claude to use `execute_code` for batch operations:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Install CLAUDE.md to a project directory
|
|
188
|
+
node dist/bin/cli.js install-instructions --dir /path/to/project
|
|
189
|
+
|
|
190
|
+
# Append to existing CLAUDE.md
|
|
191
|
+
node dist/bin/cli.js install-instructions --append
|
|
192
|
+
|
|
193
|
+
# Preview what would be created
|
|
194
|
+
node dist/bin/cli.js install-instructions --dry-run
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
This creates a `CLAUDE.md` file that instructs Claude to prefer `execute_code` for multi-step MCP operations, ensuring token savings across all your projects.
|
|
198
|
+
|
|
199
|
+
## MCP Tools
|
|
200
|
+
|
|
201
|
+
### execute_code
|
|
202
|
+
|
|
203
|
+
Execute TypeScript/JavaScript code in a sandboxed Deno environment.
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
// Access MCP servers
|
|
207
|
+
const github = mcp.server('github');
|
|
208
|
+
const result = await github.call('search_repos', { query: 'ai' });
|
|
209
|
+
|
|
210
|
+
// Or use attribute-style access
|
|
211
|
+
const result = await mcp.github.call('search_repos', { query: 'ai' });
|
|
212
|
+
|
|
213
|
+
// Search for tools
|
|
214
|
+
const tools = await mcp.searchTools('file');
|
|
215
|
+
|
|
216
|
+
// Log (captured in response)
|
|
217
|
+
mcp.log('Processing...');
|
|
218
|
+
|
|
219
|
+
// Report progress (for streaming)
|
|
220
|
+
mcp.progress(50, 'Halfway done');
|
|
221
|
+
|
|
222
|
+
// Smart batching with auto rate limit detection
|
|
223
|
+
const results = await mcp.batch([
|
|
224
|
+
{ server: 'github', tool: 'search_repositories', params: { query: 'ai' } },
|
|
225
|
+
{ server: 'github', tool: 'search_repositories', params: { query: 'ml' } },
|
|
226
|
+
]);
|
|
227
|
+
|
|
228
|
+
// Convenience method for batched web searches (requires brave-search)
|
|
229
|
+
const searchResults = await mcp.batchSearch([
|
|
230
|
+
'query 1',
|
|
231
|
+
'query 2',
|
|
232
|
+
'query 3'
|
|
233
|
+
], { topN: 3 });
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### list_servers
|
|
237
|
+
|
|
238
|
+
List all connected MCP servers and their tools.
|
|
239
|
+
|
|
240
|
+
### discover_tools
|
|
241
|
+
|
|
242
|
+
Search for tools across all servers.
|
|
243
|
+
|
|
244
|
+
### get_metrics
|
|
245
|
+
|
|
246
|
+
Get session metrics including token savings.
|
|
247
|
+
|
|
248
|
+
### set_mode
|
|
249
|
+
|
|
250
|
+
Switch between operation modes:
|
|
251
|
+
- `execution` - All requests go through code executor (default, maximum token savings)
|
|
252
|
+
- `passthrough` - Direct tool calls without code execution (for debugging)
|
|
253
|
+
- `hybrid` - Automatic selection based on task complexity
|
|
254
|
+
|
|
255
|
+
### compare_modes
|
|
256
|
+
|
|
257
|
+
Analyse how a task would be handled in different modes.
|
|
258
|
+
|
|
259
|
+
### reload_servers
|
|
260
|
+
|
|
261
|
+
Reload MCP server configurations (useful after editing claude_desktop_config.json).
|
|
262
|
+
|
|
263
|
+
### passthrough_call
|
|
264
|
+
|
|
265
|
+
Make direct tool calls without code execution. **Note:** This tool has high token cost and should only be used for debugging.
|
|
266
|
+
|
|
267
|
+
### add_server
|
|
268
|
+
|
|
269
|
+
Add an MCP server to conductor config at runtime without restarting Claude.
|
|
270
|
+
|
|
271
|
+
### remove_server
|
|
272
|
+
|
|
273
|
+
Remove an MCP server from conductor config at runtime.
|
|
274
|
+
|
|
275
|
+
### update_server
|
|
276
|
+
|
|
277
|
+
Update an existing server's configuration (command, args, or environment variables) without removing and re-adding it. Useful for updating API keys after upgrading a service plan.
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
// Update API key for brave-search after upgrading plan
|
|
281
|
+
mcp__mcp-conductor__update_server({
|
|
282
|
+
name: 'brave-search',
|
|
283
|
+
env: { BRAVE_API_KEY: 'your-new-api-key' }
|
|
284
|
+
})
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Optional: Web Search Optimisation
|
|
288
|
+
|
|
289
|
+
For projects requiring multiple web searches, you can add [brave-search](https://www.npmjs.com/package/@modelcontextprotocol/server-brave-search) MCP server for batched, parallel searches via `execute_code`.
|
|
290
|
+
|
|
291
|
+
### Setup
|
|
292
|
+
|
|
293
|
+
1. Get a free Brave Search API key (2000 queries/month): https://brave.com/search/api/
|
|
294
|
+
|
|
295
|
+
2. Add to your conductor config:
|
|
296
|
+
```bash
|
|
297
|
+
node dist/bin/cli.js config add brave-search npx -y @modelcontextprotocol/server-brave-search
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
3. Set the API key in `~/.mcp-conductor.json`:
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"servers": {
|
|
304
|
+
"brave-search": {
|
|
305
|
+
"command": "npx",
|
|
306
|
+
"args": ["-y", "@modelcontextprotocol/server-brave-search"],
|
|
307
|
+
"env": {
|
|
308
|
+
"BRAVE_API_KEY": "your-api-key-here"
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
4. Restart Claude to reload servers.
|
|
316
|
+
|
|
317
|
+
### Usage
|
|
318
|
+
|
|
319
|
+
With brave-search configured, use `mcp.batchSearch()` for automatic rate limit handling:
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
// Simple: handles rate limits automatically, parses results
|
|
323
|
+
const results = await mcp.batchSearch([
|
|
324
|
+
'TypeScript best practices',
|
|
325
|
+
'React hooks tutorial',
|
|
326
|
+
'Node.js performance tips'
|
|
327
|
+
], { topN: 3 });
|
|
328
|
+
|
|
329
|
+
return results;
|
|
330
|
+
// Returns: { "TypeScript...": [{title, url, description}, ...], ... }
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**How it works:**
|
|
334
|
+
- Attempts parallel execution first (fastest)
|
|
335
|
+
- Auto-detects rate limits from API errors
|
|
336
|
+
- Falls back to sequential with 1.1s delays if rate limited
|
|
337
|
+
- Logs warnings with upgrade guidance when rate limited
|
|
338
|
+
- Parses text responses into structured data
|
|
339
|
+
|
|
340
|
+
**Rate limit warnings:**
|
|
341
|
+
```
|
|
342
|
+
⚠️ RATE LIMITED: brave-search - Free tier limit hit. Retrying with delays...
|
|
343
|
+
💡 TIP: Upgrade your API plan for parallel execution: https://brave.com/search/api/
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
**Benefits:**
|
|
347
|
+
- No manual rate limit handling needed
|
|
348
|
+
- Parallel when possible, sequential when required
|
|
349
|
+
- 80%+ token savings vs native WebSearch
|
|
350
|
+
|
|
351
|
+
### Upgrading Your Plan
|
|
352
|
+
|
|
353
|
+
After upgrading your Brave Search API plan:
|
|
354
|
+
|
|
355
|
+
1. **Update the API key** (no restart needed):
|
|
356
|
+
```typescript
|
|
357
|
+
mcp__mcp-conductor__update_server({
|
|
358
|
+
name: 'brave-search',
|
|
359
|
+
env: { BRAVE_API_KEY: 'your-new-api-key' }
|
|
360
|
+
})
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
2. **Test parallel mode** with `forceParallel`:
|
|
364
|
+
```typescript
|
|
365
|
+
const results = await mcp.batchSearch([
|
|
366
|
+
'query 1', 'query 2', 'query 3', 'query 4', 'query 5'
|
|
367
|
+
], { topN: 3, forceParallel: true });
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
3. If parallel works, it will be used automatically for all subsequent batches
|
|
371
|
+
|
|
372
|
+
## Configuration
|
|
373
|
+
|
|
374
|
+
### Exclusive Mode (Recommended)
|
|
375
|
+
|
|
376
|
+
In exclusive mode, Claude only sees mcp-conductor and **must** use `execute_code` for all MCP operations. This provides:
|
|
377
|
+
|
|
378
|
+
- **Maximum token savings** (90-98% reduction)
|
|
379
|
+
- **No bypass possible** - Claude cannot make direct MCP calls
|
|
380
|
+
- **No CLAUDE.md required** - Works automatically in any project
|
|
381
|
+
|
|
382
|
+
**How it works:**
|
|
383
|
+
|
|
384
|
+
```
|
|
385
|
+
Before (default): After (exclusive mode):
|
|
386
|
+
┌─────────────────────────────┐ ┌─────────────────────────────┐
|
|
387
|
+
│ Claude's Config │ │ Claude's Config │
|
|
388
|
+
│ ├── mcp-conductor │ │ └── mcp-conductor ← ONLY │
|
|
389
|
+
│ ├── github ← Claude sees │ └─────────────────────────────┘
|
|
390
|
+
│ ├── filesystem ← can bypass │ ┌─────────────────────────────┐
|
|
391
|
+
│ └── other servers... │ │ ~/.mcp-conductor.json │
|
|
392
|
+
└─────────────────────────────┘ │ ├── github ← hidden │
|
|
393
|
+
│ ├── filesystem ← hidden │
|
|
394
|
+
│ └── other servers... │
|
|
395
|
+
└─────────────────────────────┘
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Enable exclusive mode:
|
|
399
|
+
```bash
|
|
400
|
+
node dist/bin/cli.js enable-exclusive
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Environment Variables
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
MCP_CONDUCTOR_PORT=0 # Bridge port (0 = dynamic allocation)
|
|
407
|
+
MCP_CONDUCTOR_MODE=execution # Operation mode
|
|
408
|
+
MCP_CONDUCTOR_TIMEOUT=30000 # Default timeout in ms
|
|
409
|
+
MCP_CONDUCTOR_LOG_LEVEL=info # Log level: debug|info|warn|error
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### Programmatic Configuration
|
|
413
|
+
|
|
414
|
+
```typescript
|
|
415
|
+
import { MCPConductorServer, loadConfig } from '@darkiceinteractive/mcp-conductor';
|
|
416
|
+
|
|
417
|
+
const config = loadConfig();
|
|
418
|
+
const server = new MCPConductorServer(config);
|
|
419
|
+
await server.start();
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## Security
|
|
423
|
+
|
|
424
|
+
The Deno sandbox is configured with minimal permissions:
|
|
425
|
+
- Network access only to localhost bridge
|
|
426
|
+
- No filesystem access (except via MCP)
|
|
427
|
+
- No environment variable access
|
|
428
|
+
- No subprocess spawning
|
|
429
|
+
- Memory limits via V8 flags
|
|
430
|
+
|
|
431
|
+
## Development
|
|
432
|
+
|
|
433
|
+
```bash
|
|
434
|
+
# Install dependencies
|
|
435
|
+
npm install
|
|
436
|
+
|
|
437
|
+
# Build
|
|
438
|
+
npm run build
|
|
439
|
+
|
|
440
|
+
# Run tests
|
|
441
|
+
npm test
|
|
442
|
+
|
|
443
|
+
# Run tests once (no watch)
|
|
444
|
+
npm run test:run
|
|
445
|
+
|
|
446
|
+
# Run with coverage
|
|
447
|
+
npm run test:coverage
|
|
448
|
+
|
|
449
|
+
# Development mode (watch)
|
|
450
|
+
npm run dev
|
|
451
|
+
|
|
452
|
+
# Lint
|
|
453
|
+
npm run lint
|
|
454
|
+
|
|
455
|
+
# Format
|
|
456
|
+
npm run format
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
## Distribution
|
|
460
|
+
|
|
461
|
+
### Publishing to npm
|
|
462
|
+
|
|
463
|
+
1. Update version in `package.json`
|
|
464
|
+
2. Build and test:
|
|
465
|
+
```bash
|
|
466
|
+
npm run build
|
|
467
|
+
npm run test:run
|
|
468
|
+
```
|
|
469
|
+
3. Publish:
|
|
470
|
+
```bash
|
|
471
|
+
npm publish --access public
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Creating a GitHub Release
|
|
475
|
+
|
|
476
|
+
1. Tag the release:
|
|
477
|
+
```bash
|
|
478
|
+
git tag v0.1.0
|
|
479
|
+
git push origin v0.1.0
|
|
480
|
+
```
|
|
481
|
+
2. Create a release on GitHub with the changelog
|
|
482
|
+
|
|
483
|
+
### Local Development with Claude Desktop
|
|
484
|
+
|
|
485
|
+
For local development, point Claude Desktop to your development build:
|
|
486
|
+
|
|
487
|
+
```json
|
|
488
|
+
{
|
|
489
|
+
"mcpServers": {
|
|
490
|
+
"mcp-conductor": {
|
|
491
|
+
"command": "node",
|
|
492
|
+
"args": ["/Users/you/Dev/mcp-conductor/dist/index.js"]
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
## Architecture
|
|
499
|
+
|
|
500
|
+
```
|
|
501
|
+
Claude Code → MCP Conductor → HTTP Bridge → Deno Sandbox
|
|
502
|
+
↓
|
|
503
|
+
Connected MCP Servers
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
1. Claude calls `execute_code` with TypeScript code
|
|
507
|
+
2. Code is wrapped and run in isolated Deno subprocess
|
|
508
|
+
3. Sandbox calls HTTP bridge to invoke MCP tools
|
|
509
|
+
4. Only the final return value goes back to Claude
|
|
510
|
+
|
|
511
|
+
## Documentation
|
|
512
|
+
|
|
513
|
+
Detailed documentation is available in the [docs](./docs/) folder:
|
|
514
|
+
|
|
515
|
+
| Document | Description |
|
|
516
|
+
|----------|-------------|
|
|
517
|
+
| [Architecture](./docs/architecture.md) | Internal design and data flow |
|
|
518
|
+
| [Configuration](./docs/configuration.md) | All configuration options |
|
|
519
|
+
| [CLI Reference](./docs/cli-reference.md) | Command-line interface |
|
|
520
|
+
| [Tools Reference](./docs/tools-reference.md) | MCP tools and the `mcp` API |
|
|
521
|
+
| [Permissions](./docs/permissions.md) | Managing Claude Code permissions |
|
|
522
|
+
| [Troubleshooting](./docs/troubleshooting.md) | Common issues and solutions |
|
|
523
|
+
|
|
524
|
+
## Troubleshooting
|
|
525
|
+
|
|
526
|
+
### "Deno not installed"
|
|
527
|
+
|
|
528
|
+
Install Deno from https://deno.land or use:
|
|
529
|
+
```bash
|
|
530
|
+
brew install deno # macOS
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### "Network access denied"
|
|
534
|
+
|
|
535
|
+
The Deno sandbox only allows access to the localhost bridge. Ensure your MCP servers are accessible through the bridge.
|
|
536
|
+
|
|
537
|
+
### "Timeout exceeded"
|
|
538
|
+
|
|
539
|
+
Increase the timeout for long-running operations:
|
|
540
|
+
```typescript
|
|
541
|
+
// In execute_code call
|
|
542
|
+
{ timeout_ms: 60000 }
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
### "Server not found"
|
|
546
|
+
|
|
547
|
+
Check that your MCP server is:
|
|
548
|
+
1. Listed in claude_desktop_config.json
|
|
549
|
+
2. Properly started and connected
|
|
550
|
+
3. Use `list_servers` to verify
|
|
551
|
+
|
|
552
|
+
## Licence
|
|
553
|
+
|
|
554
|
+
MIT
|
|
555
|
+
|
|
556
|
+
## Contributing
|
|
557
|
+
|
|
558
|
+
Contributions welcome! Please read our contributing guidelines and submit PRs to the GitHub repository.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/bin/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG"}
|