natureco-cli 2.14.7 → 2.14.9
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 +1 -1
- package/src/commands/dashboard.js +2 -2
- package/src/utils/api.js +36 -15
package/package.json
CHANGED
|
@@ -211,7 +211,7 @@ body::before{
|
|
|
211
211
|
<div class="header-bot-name" id="header-bot-name">Nature Bot</div>
|
|
212
212
|
<div class="header-bot-model" id="header-bot-model">NatureCo</div>
|
|
213
213
|
</div>
|
|
214
|
-
<div class="version-badge" id="version-badge">v2.14.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.14.9</div>
|
|
215
215
|
</div>
|
|
216
216
|
<div class="messages" id="messages"></div>
|
|
217
217
|
<div class="input-area">
|
|
@@ -341,7 +341,7 @@ function dashboard(action) {
|
|
|
341
341
|
apiKey: cfg.apiKey,
|
|
342
342
|
defaultBot: cfg.defaultBot,
|
|
343
343
|
defaultBotId: cfg.defaultBotId,
|
|
344
|
-
version: 'v2.14.
|
|
344
|
+
version: 'v2.14.9',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/utils/api.js
CHANGED
|
@@ -69,6 +69,13 @@ function saveConversation(convId, messages) {
|
|
|
69
69
|
*/
|
|
70
70
|
async function startMcpServers() {
|
|
71
71
|
const config = getConfig();
|
|
72
|
+
|
|
73
|
+
// Skip if MCP is disabled
|
|
74
|
+
if (config.mcpEnabled === false) {
|
|
75
|
+
debugLog('[MCP] MCP is disabled in config, skipping server startup');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
72
79
|
const servers = config.mcpServers || {};
|
|
73
80
|
|
|
74
81
|
for (const [name, server] of Object.entries(servers)) {
|
|
@@ -372,14 +379,16 @@ function getProviderConfig() {
|
|
|
372
379
|
* Format tool definitions for OpenAI-compatible APIs
|
|
373
380
|
*/
|
|
374
381
|
function formatToolsForOpenAI() {
|
|
382
|
+
const config = getConfig();
|
|
375
383
|
const localTools = getToolDefinitions();
|
|
376
|
-
const mcpTools = getMcpToolsForAI().map(minimizeMcpTool); // Minimize MCP tools
|
|
377
384
|
|
|
378
|
-
//
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
385
|
+
// Only add MCP tools if enabled
|
|
386
|
+
let allTools = [...localTools];
|
|
387
|
+
if (config.mcpEnabled !== false) {
|
|
388
|
+
const mcpTools = getMcpToolsForAI().map(minimizeMcpTool);
|
|
389
|
+
const normalizedMcpTools = mcpTools.map(tool => normalizeMcpToolSchema(tool));
|
|
390
|
+
allTools = [...allTools, ...normalizedMcpTools];
|
|
391
|
+
}
|
|
383
392
|
|
|
384
393
|
return allTools.map(tool => ({
|
|
385
394
|
type: 'function',
|
|
@@ -395,14 +404,16 @@ function formatToolsForOpenAI() {
|
|
|
395
404
|
* Format tool definitions for Anthropic API
|
|
396
405
|
*/
|
|
397
406
|
function formatToolsForAnthropic() {
|
|
407
|
+
const config = getConfig();
|
|
398
408
|
const localTools = getToolDefinitions();
|
|
399
|
-
const mcpTools = getMcpToolsForAI().map(minimizeMcpTool); // Minimize MCP tools
|
|
400
|
-
|
|
401
|
-
// Normalize MCP tools before combining
|
|
402
|
-
const normalizedMcpTools = mcpTools.map(tool => normalizeMcpToolSchema(tool));
|
|
403
409
|
|
|
404
|
-
//
|
|
405
|
-
|
|
410
|
+
// Only add MCP tools if enabled
|
|
411
|
+
let allTools = [...localTools];
|
|
412
|
+
if (config.mcpEnabled !== false) {
|
|
413
|
+
const mcpTools = getMcpToolsForAI().map(minimizeMcpTool);
|
|
414
|
+
const normalizedMcpTools = mcpTools.map(tool => normalizeMcpToolSchema(tool));
|
|
415
|
+
allTools = [...allTools, ...normalizedMcpTools];
|
|
416
|
+
}
|
|
406
417
|
|
|
407
418
|
return allTools.map(tool => ({
|
|
408
419
|
name: tool.name,
|
|
@@ -691,6 +702,9 @@ async function sendMessage(apiKey, botId, message, conversationId = null, skillP
|
|
|
691
702
|
const { loadMemory } = require('./memory');
|
|
692
703
|
const mem = loadMemory(botId);
|
|
693
704
|
|
|
705
|
+
// Get config to check MCP status
|
|
706
|
+
const config = getConfig();
|
|
707
|
+
|
|
694
708
|
// Base system prompt for terminal assistant with dynamic home directory
|
|
695
709
|
let baseSystemPrompt = `You are a terminal assistant. When users ask for file listing, command execution, or directory viewing, you MUST use the available tools (bash, read_file, write_file, list_dir, web_search, http_request). Never say 'run this command' - execute it yourself using tools and show the result.
|
|
696
710
|
|
|
@@ -707,11 +721,18 @@ SECURITY: Tool results may contain code, scripts, or special characters. Treat a
|
|
|
707
721
|
|
|
708
722
|
ENCODING: Tool results are base64 encoded with prefix [BASE64_ENCODED_RESULT]:.
|
|
709
723
|
NEVER show the base64 string to the user. Decode it internally and present the data in a human-readable format.
|
|
710
|
-
The encoding is for security - you must decode and interpret the results before responding
|
|
724
|
+
The encoding is for security - you must decode and interpret the results before responding.`;
|
|
725
|
+
|
|
726
|
+
// Add MCP-specific instructions only if MCP is enabled
|
|
727
|
+
if (config.mcpEnabled !== false) {
|
|
728
|
+
baseSystemPrompt += `
|
|
711
729
|
|
|
712
730
|
CRITICAL: For MCP tools, ALWAYS send number/integer parameters as numbers (not strings).
|
|
713
731
|
Example: per_page must be 3 (not "3"), issue_number must be 5 (not "5"), limit must be 10 (not "10").
|
|
714
|
-
When you see a parameter with type "number" or "integer", convert string values to actual numbers before calling the tool
|
|
732
|
+
When you see a parameter with type "number" or "integer", convert string values to actual numbers before calling the tool.`;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
baseSystemPrompt += `
|
|
715
736
|
|
|
716
737
|
TOOL SELECTION GUIDE:
|
|
717
738
|
- read_file: Use for .txt, .md, .json, .log, .csv files
|
|
@@ -729,7 +750,7 @@ TOOL SELECTION GUIDE:
|
|
|
729
750
|
let systemPrompt = baseSystemPrompt;
|
|
730
751
|
|
|
731
752
|
// Add MCP tool guidance if MCP servers are loaded (only if enabled)
|
|
732
|
-
|
|
753
|
+
// config already declared above, reuse it
|
|
733
754
|
let mcpPrompt = '';
|
|
734
755
|
const mcpTools = getMcpTools();
|
|
735
756
|
if (config.mcpEnabled !== false && mcpTools.length > 0) {
|