Mintplex-Labs/anything-llm · error
MCP server is not currently running
Error message
MCP server ${name} is not currently running What it means
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.
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
Defensive patterns
Strategy: validation
Validate before calling
const mcpLayer = new MCPCompatibilityLayer();
await mcpLayer.bootMCPServers(); // ensure connections exist
const server = mcpLayer.mcps[name];
if (!server) {
return `${name} is offline — restart it in MCP settings before retrying.`;
}
const result = await server.callTool({ name: toolName, arguments: args }); Type guard
function isMcpServerRunning(mcpLayer, name) {
return !!mcpLayer.mcps[name] && typeof mcpLayer.mcps[name].callTool === 'function';
} Try / catch
try {
return await currentMcp.callTool({ name: tool.name, arguments: args });
} catch (error) {
if (/not currently running/.test(error.message)) {
// re-boot the hypervisor once, then retry the call before giving up
}
throw error;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Access denied - path outside allowed directories.
- Could not find exact match for edit:\n
- ${error.message}
- Invalid period: " ". Use "today", "tomorrow", "week", "this…
- MCP server args must be an array
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/4a01648d7ec3baaf.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/MCP/index.js:83
name: `${name}-${tool.name}`,
setup: (aibitat) => {
aibitat.function({
super: aibitat,
name: `${name}-${tool.name}`,
controller: new AbortController(),
description: tool.description,
isMCPTool: true,
examples: [],
parameters: {
$schema: "http://json-schema.org/draft-07/schema#",
...tool.inputSchema,
},
handler: async function (args = {}) {
try {
const mcpLayer = new MCPCompatibilityLayer();
const currentMcp = mcpLayer.mcps[name];
if (!currentMcp)
throw new Error(
`MCP server ${name} is not currently running`
);
aibitat.handlerProps.log(
`Executing MCP server: ${name}:${tool.name} with args:`,
args
);
aibitat.introspect(
`Executing MCP server: ${name} with ${JSON.stringify(args, null, 2)}`
);
const result = await currentMcp.callTool({
name: tool.name,
arguments: args,
});
aibitat.handlerProps.log(
`MCP server: ${name}:${tool.name} completed successfully`,
result
);View on GitHub (pinned to 3aec848f28)