fluxy-bot 0.5.27 → 0.5.28
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/package.json
CHANGED
|
@@ -170,19 +170,24 @@ export async function startFluxyAgentQuery(
|
|
|
170
170
|
} catch {}
|
|
171
171
|
|
|
172
172
|
// Load MCP server config from workspace/MCP.json if it exists
|
|
173
|
-
|
|
173
|
+
// Format: { "server-name": { command, args, env }, ... } (object, not array)
|
|
174
|
+
let mcpServers: Record<string, any> | undefined;
|
|
174
175
|
try {
|
|
175
176
|
const mcpConfigPath = path.join(WORKSPACE_DIR, 'MCP.json');
|
|
176
177
|
const mcpConfig = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf-8'));
|
|
177
|
-
if (Array.isArray(mcpConfig) && mcpConfig.length) {
|
|
178
|
+
if (mcpConfig && typeof mcpConfig === 'object' && !Array.isArray(mcpConfig) && Object.keys(mcpConfig).length) {
|
|
179
|
+
// Already in correct format: { "name": { command, args, env } }
|
|
178
180
|
mcpServers = mcpConfig;
|
|
179
|
-
|
|
181
|
+
} else if (Array.isArray(mcpConfig) && mcpConfig.length) {
|
|
182
|
+
// Legacy array format: merge all entries into a single object
|
|
183
|
+
mcpServers = Object.assign({}, ...mcpConfig);
|
|
184
|
+
}
|
|
185
|
+
if (mcpServers) {
|
|
186
|
+
const names = Object.keys(mcpServers).join(', ');
|
|
180
187
|
log.info(`Loaded MCP server(s): [${names}]`);
|
|
181
188
|
}
|
|
182
189
|
} catch {}
|
|
183
190
|
|
|
184
|
-
log.info(`Starting agent query${mcpServers ? ` with ${mcpServers.length} MCP server(s)` : ''}...`);
|
|
185
|
-
|
|
186
191
|
const claudeQuery = query({
|
|
187
192
|
prompt: sdkPrompt,
|
|
188
193
|
options: {
|
|
@@ -203,11 +208,9 @@ export async function startFluxyAgentQuery(
|
|
|
203
208
|
});
|
|
204
209
|
|
|
205
210
|
onMessage('bot:typing', { conversationId });
|
|
206
|
-
log.info('Agent query created, waiting for first message...');
|
|
207
211
|
|
|
208
212
|
for await (const msg of claudeQuery) {
|
|
209
213
|
if (abortController.signal.aborted) break;
|
|
210
|
-
log.info(`Agent msg: type=${msg.type} subtype=${(msg as any).subtype || '-'}`);
|
|
211
214
|
|
|
212
215
|
switch (msg.type) {
|
|
213
216
|
case 'assistant': {
|
|
@@ -245,22 +245,20 @@ You can connect to external tools via MCP servers. These give you capabilities b
|
|
|
245
245
|
**Config file:** `MCP.json` (in your workspace root)
|
|
246
246
|
|
|
247
247
|
```json
|
|
248
|
-
|
|
249
|
-
{
|
|
250
|
-
"
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
"env": {}
|
|
254
|
-
}
|
|
248
|
+
{
|
|
249
|
+
"server-name": {
|
|
250
|
+
"command": "npx",
|
|
251
|
+
"args": ["-y", "@some/mcp-server"],
|
|
252
|
+
"env": {}
|
|
255
253
|
}
|
|
256
|
-
|
|
254
|
+
}
|
|
257
255
|
```
|
|
258
256
|
|
|
259
|
-
|
|
257
|
+
The file is a JSON object where each key is a server name and the value has `command`, optional `args`, and optional `env`. Use `-y` in npx args to skip install prompts. The config is read fresh on every turn — add, remove, or edit entries anytime.
|
|
260
258
|
|
|
261
|
-
**Your human can ask you to add MCP servers.** When they do, read `MCP.json` (create it if missing), add the new server
|
|
262
|
-
- **Playwright** (browser control): `
|
|
263
|
-
- **Fetch** (HTTP requests): `
|
|
259
|
+
**Your human can ask you to add MCP servers.** When they do, read `MCP.json` (create it if missing), add the new server entry, and write it back. Common examples:
|
|
260
|
+
- **Playwright** (browser control): `"playwright": { "command": "npx", "args": ["-y", "@playwright/mcp@latest", "--headless", "--browser", "chromium"] }`
|
|
261
|
+
- **Fetch** (HTTP requests): `"fetch": { "command": "npx", "args": ["-y", "@anthropic-ai/mcp-fetch@latest"] }`
|
|
264
262
|
|
|
265
263
|
When an MCP server is configured, its tools appear alongside your built-in tools. Use them naturally — no special syntax needed.
|
|
266
264
|
|