CherryHQ/cherry-studio · warning · Error

MCP server ${server.name} is disabled

Error message

MCP server ${server.name} is disabled

What it means

Thrown by `getOrCreateClient` when `server.isActive` is false. The runtime not only throws but also calls `setServerStatus(server.id, 'disabled')` as a side effect, marking the server's status in the cache for UI visibility. This means a disabled server cannot be used for any client operation.

Source

Thrown at src/main/ai/mcp/McpRuntimeService.ts:401

  }

  public async withClient<T>(
    serverId: string,
    operation: (client: Client, server: McpServer) => Promise<T>
  ): Promise<T> {
    const server = this.getServerById(serverId)
    const client = await this.getOrCreateClient(server)
    return operation(client, server)
  }

  private async getOrCreateClient(server: McpServer): Promise<Client> {
    if (this.stopping || this.isStopped || this.isDestroyed) {
      throw new Error('MCP runtime is stopping')
    }

    if (!server.isActive) {
      this.setServerStatus(server.id, 'disabled')
      throw new Error(`MCP server ${server.name} is disabled`)
    }

    const serverKey = this.getServerKey(server)

    // If there's a pending initialization, wait for it
    const pendingClient = this.pendingClients.get(serverKey)
    if (pendingClient) {
      this.setServerStatus(server.id, 'connecting')
      getServerLogger(server).silly(`Waiting for pending client initialization`)
      return pendingClient
    }

    // Check if we already have a client for this server configuration
    const existingClient = this.clients.get(serverKey)
    if (existingClient) {
      try {
        // Check if the existing client is still connected
        const pingResult = await existingClient.ping({

View on GitHub (pinned to 726446b54c)

Solutions

  1. Check `server.isActive` before attempting tool calls or client operations
  2. Re-enable the server in the MCP settings UI (set isActive to true)
  3. In the calling code, handle this error gracefully by skipping the server or prompting the user to enable it
  4. Investigate why the server was deactivated — check server logs for prior connection failures

Example fix

// before
const result = await runtime.callToolByServer({ server, name, args })

// after
if (!server.isActive) {
  throw new Error(`Server ${server.name} is not active. Enable it in MCP settings.`)
}
const result = await runtime.callToolByServer({ server, name, args })
Defensive patterns

Strategy: validation

Validate before calling

if (!server.isActive) {
  throw new Error(`Server '${server.name}' is disabled. Enable it in MCP settings.`)
}
// Only proceed with client operations if active
const client = await runtime.getOrCreateClient(server)

Type guard

function isActiveServer(server: McpServer): boolean {
  return server.isActive === true
}

Try / catch

try {
  await runtime.callToolByServer({ server, name, args })
} catch (e) {
  if (e instanceof Error && e.message.includes('is disabled')) {
    // Prompt user to enable the server, or skip it
    return { error: 'server-disabled', serverName: server.name }
  }
  throw e
}

Prevention

When it happens

Trigger: Calling any method that needs a client connection (callTool, listTools, listResources, etc.) on a server whose `isActive` field is false in the database. This can happen if the user toggled the server off, or a previous failure cascade deactivated it.

Common situations: User disabled the server in MCP settings UI but a background AI task still references it; server was auto-deactivated after repeated connection failures; the server entity was loaded from DB with isActive=false but caller didn't check.

Related errors


AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12). Data as JSON: /api/errors/f9877ce905eb341c. Report an issue: GitHub.