{"record":{"id":"4a01648d7ec3baaf","repo":"Mintplex-Labs/anything-llm","slug":"mcp-server-name-is-not-currently-running","errorCode":null,"errorMessage":"MCP server ${name} is not currently running","messagePattern":"MCP server (.+?) is not currently running","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/utils/MCP/index.js","lineNumber":83,"sourceCode":"            name: `${name}-${tool.name}`,\n            setup: (aibitat) => {\n              aibitat.function({\n                super: aibitat,\n                name: `${name}-${tool.name}`,\n                controller: new AbortController(),\n                description: tool.description,\n                isMCPTool: true,\n                examples: [],\n                parameters: {\n                  $schema: \"http://json-schema.org/draft-07/schema#\",\n                  ...tool.inputSchema,\n                },\n                handler: async function (args = {}) {\n                  try {\n                    const mcpLayer = new MCPCompatibilityLayer();\n                    const currentMcp = mcpLayer.mcps[name];\n                    if (!currentMcp)\n                      throw new Error(\n                        `MCP server ${name} is not currently running`\n                      );\n\n                    aibitat.handlerProps.log(\n                      `Executing MCP server: ${name}:${tool.name} with args:`,\n                      args\n                    );\n                    aibitat.introspect(\n                      `Executing MCP server: ${name} with ${JSON.stringify(args, null, 2)}`\n                    );\n                    const result = await currentMcp.callTool({\n                      name: tool.name,\n                      arguments: args,\n                    });\n                    aibitat.handlerProps.log(\n                      `MCP server: ${name}:${tool.name} completed successfully`,\n                      result\n                    );","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/MCP/index.js#L65-L101","documentation":"Agent tool plugins are built once at boot from each MCP server's listTools() output, but the handler re-resolves the server at call time via a fresh MCPCompatibilityLayer and this.mcps[name]. If the server has since disconnected, crashed, or been removed from the connection map, that lookup fails and this error is thrown inside the tool handler; the surrounding catch converts it to a failure string the agent sees.","triggerScenarios":"The agent invokes an MCP tool (name-toolname) after the backing server disconnected post-boot — remote endpoint went down, stdio process exited, hypervisor restarted and failed to reconnect, or the server was removed from the JSON while tools were still registered.","commonSituations":"Long-running chats where a remote MCP server dropped (auth expiry, network change, laptop sleep); local stdio server crashing on bad args; editing mcp_servers.json without re-registering tools; container restarts severing outbound connections.","solutions":["Restart the MCP server / re-boot the hypervisor (toggle it in the agent MCP settings) so tools re-register against a live connection","Check the MCP server itself is reachable (curl the url, or run the stdio command manually)","Check server logs for the transport close/error events that preceded the tool call","Retry the agent turn after the server is back — stale tool registrations are refreshed on re-boot"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const mcpLayer = new MCPCompatibilityLayer();\nawait mcpLayer.bootMCPServers(); // ensure connections exist\nconst server = mcpLayer.mcps[name];\nif (!server) {\n  return `${name} is offline — restart it in MCP settings before retrying.`;\n}\nconst result = await server.callTool({ name: toolName, arguments: args });","typeGuard":"function isMcpServerRunning(mcpLayer, name) {\n  return !!mcpLayer.mcps[name] && typeof mcpLayer.mcps[name].callTool === 'function';\n}","tryCatchPattern":"try {\n  return await currentMcp.callTool({ name: tool.name, arguments: args });\n} catch (error) {\n  if (/not currently running/.test(error.message)) {\n    // re-boot the hypervisor once, then retry the call before giving up\n  }\n  throw error;\n}","preventionTips":["Re-boot MCP servers (activeMCPServers/bootMCPServers) before long agent sessions so tools map to live connections","Monitor transport close/error events and remove or re-register tools when a server drops","Health-check remote MCP endpoints on a schedule and alert before users hit stale tool registrations"],"tags":["mcp","agent-tools","disconnected-server","runtime-state"],"backgroundTag":"mcp-server-disconnected","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}