morpheus-cli 0.5.3 → 0.5.4

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.
@@ -185,21 +185,21 @@ PHASE 2 — Source Discovery
185
185
  - Major authoritative publications
186
186
  4. Reformulate query if necessary.
187
187
 
188
- PHASE 3 — Source Validation (MANDATORY)
189
- 1. Open at least 3 distinct URLs with browser_navigate.
190
- 2. Read actual page content.
191
- 3. NEVER rely only on search snippets.
192
- 4. Ignore inaccessible pages.
188
+ PHASE 3 — Source Validation
189
+ 1. Try to open at least 3 distinct URLs with browser_navigate.
190
+ 2. Read actual page content from accessible pages.
191
+ 3. Ignore inaccessible pages (timeouts, bot blocks, errors).
192
+ 4. If ALL navigations fail: use the search snippets as fallback and proceed to Phase 5 with confidence level "Low".
193
193
 
194
194
  PHASE 4 — Cross-Verification
195
- 1. Extract relevant information from each source.
195
+ 1. Extract relevant information from each accessible source.
196
196
  2. Compare findings:
197
197
  - Agreement → verified
198
198
  - Minor differences → report variation
199
199
  - Conflict → report discrepancy
200
- 3. Require confirmation from at least 2 reliable sources.
201
- 4. If not confirmed, state clearly:
202
- "Information could not be confidently verified."
200
+ 3. Seek confirmation from at least 2 reliable sources when possible.
201
+ 4. If confirmed by snippets only (all navigations failed), state:
202
+ "Based on search result snippets (page content could not be accessed)."
203
203
 
204
204
  PHASE 5 — Structured Report
205
205
  Include:
@@ -210,8 +210,9 @@ Include:
210
210
 
211
211
  ANTI-HALLUCINATION RULES
212
212
  - Never answer from prior knowledge without verification.
213
- - Never stop after reading only one source.
213
+ - Never stop after reading only one source when navigation is successful.
214
214
  - Treat time-sensitive information as volatile.
215
+ - NEVER say "no results found" when browser_search returned results — always report what was found, even if only from snippets.
215
216
 
216
217
 
217
218
 
@@ -40,6 +40,15 @@ function wrapToolWithSanitizedSchema(tool) {
40
40
  }
41
41
  return tool;
42
42
  }
43
+ /** Timeout (ms) for connecting to each MCP server and fetching its tools list. */
44
+ const MCP_CONNECT_TIMEOUT_MS = 15_000;
45
+ /**
46
+ * Returns a promise that rejects after `ms` milliseconds with a timeout error.
47
+ * Used to guard `client.getTools()` against servers that never respond.
48
+ */
49
+ function connectTimeout(serverName, ms) {
50
+ return new Promise((_, reject) => setTimeout(() => reject(new Error(`MCP server '${serverName}' timed out after ${ms}ms`)), ms));
51
+ }
43
52
  export class Construtor {
44
53
  static async probe() {
45
54
  const mcpServers = await loadMCPConfig();
@@ -50,7 +59,10 @@ export class Construtor {
50
59
  mcpServers: { [serverName]: serverConfig },
51
60
  onConnectionError: "ignore",
52
61
  });
53
- const tools = await client.getTools();
62
+ const tools = await Promise.race([
63
+ client.getTools(),
64
+ connectTimeout(serverName, MCP_CONNECT_TIMEOUT_MS),
65
+ ]);
54
66
  results.push({ name: serverName, ok: true, toolCount: tools.length });
55
67
  }
56
68
  catch (error) {
@@ -63,7 +75,6 @@ export class Construtor {
63
75
  const display = DisplayManager.getInstance();
64
76
  const mcpServers = await loadMCPConfig();
65
77
  const serverCount = Object.keys(mcpServers).length;
66
- // console.log(mcpServers);
67
78
  if (serverCount === 0) {
68
79
  display.log('No MCP servers configured in mcps.json', { level: 'info', source: 'Construtor' });
69
80
  return [];
@@ -78,13 +89,14 @@ export class Construtor {
78
89
  onConnectionError: "ignore",
79
90
  });
80
91
  try {
81
- const tools = await client.getTools();
92
+ const tools = await Promise.race([
93
+ client.getTools(),
94
+ connectTimeout(serverName, MCP_CONNECT_TIMEOUT_MS),
95
+ ]);
82
96
  // Rename tools to include server prefix to avoid collisions
83
97
  tools.forEach(tool => {
84
- const originalName = tool.name;
85
- const newName = `${serverName}_${originalName}`;
98
+ const newName = `${serverName}_${tool.name}`;
86
99
  Object.defineProperty(tool, "name", { value: newName });
87
- const shortDesc = tool.description && typeof tool.description === 'string' ? tool.description.slice(0, 100) + '...' : '';
88
100
  display.log(`Loaded MCP tool: ${tool.name} (from ${serverName})`, { level: 'info', source: 'Construtor' });
89
101
  });
90
102
  // Sanitize tool schemas to remove fields not supported by Gemini
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morpheus-cli",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "Morpheus is a local AI agent for developers, running as a CLI daemon that connects to LLMs, local tools, and MCPs, enabling interaction via Terminal, Telegram, and Discord. Inspired by the character Morpheus from *The Matrix*, the project acts as an intelligent orchestrator, bridging the gap between the developer and complex systems.",
5
5
  "bin": {
6
6
  "morpheus": "./bin/morpheus.js"