FlowiseAI/Flowise · error · Error

MCP server ${serverId} not found

Error message

MCP server ${serverId} not found

What it means

Thrown by CustomMcpServerTool.getTools when the TypeORM findOneBy({ id: serverId, workspaceId }) returns null. The query is workspace-scoped, so the record appears 'not found' if the serverId doesn't exist, was deleted, OR exists in a different workspace. The serverId is echoed in the message for debugging.

Source

Thrown at packages/components/nodes/tools/MCP/CustomMcpServerTool/CustomMcpServerTool.ts:139

            throw new Error('MCP Server is required')
        }

        const appDataSource = options.appDataSource as DataSource
        const databaseEntities = options.databaseEntities as IDatabaseEntity
        if (!appDataSource || !databaseEntities?.['CustomMcpServer']) {
            throw new Error('Database not available')
        }

        const workspaceId =
            (options.workspaceId as string | undefined) ??
            ((options.searchOptions as ICommonObject | undefined)?.workspaceId as string | undefined)
        if (!workspaceId) {
            throw new Error('Workspace context is required to load MCP server')
        }

        const serverRecord = await appDataSource.getRepository(databaseEntities['CustomMcpServer']).findOneBy({ id: serverId, workspaceId })
        if (!serverRecord) {
            throw new Error(`MCP server ${serverId} not found`)
        }
        if (serverRecord.status !== 'AUTHORIZED') {
            throw new Error(`MCP server "${serverRecord.name}" is not authorized. Please authorize it in the Tools page first.`)
        }

        // Build headers from encrypted authConfig — only when authType explicitly requires them
        let headers: Record<string, string> = {}
        if (serverRecord.authType === 'CUSTOM_HEADERS' && serverRecord.authConfig) {
            try {
                const decrypted = await decryptCredentialData(serverRecord.authConfig)
                if (decrypted?.headers && typeof decrypted.headers === 'object') {
                    headers = decrypted.headers as Record<string, string>
                }
            } catch {
                // authConfig decryption failed — proceed without headers
            }
        }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Open the Tools page in the correct workspace and copy the current serverId, then re-select it on the node.
  2. If the server was deleted, recreate it and update the node reference.
  3. For cross-workspace imports, re-create the server in the target workspace and rebind the node.
  4. Verify the workspaceId in options matches the workspace where the server was created.

Example fix

// before — stale id after deletion
nodeData.inputs = { mcpServerId: 'old-uuid' }
// after — current id from Tools page
nodeData.inputs = { mcpServerId: 'new-uuid' }
Defensive patterns

Strategy: validation

Validate before calling

async function assertServerExists(ds: DataSource, entity: any, serverId: string, workspaceId: string) {
  const rec = await ds.getRepository(entity).findOneBy({ id: serverId, workspaceId })
  if (!rec) throw new Error(`No managed MCP server '${serverId}' in workspace '${workspaceId}' — recreate or rebind`)
  return rec
}

Type guard

async function serverExists(ds: DataSource, entity: any, serverId: string, workspaceId: string): Promise<boolean> {
  const c = await ds.getRepository(entity).countBy({ id: serverId, workspaceId })
  return c > 0
}

Try / catch

try {
  return await tool.getTools(nodeData, options)
} catch (e) {
  if (e instanceof Error && /MCP server .* not found/.test(e.message)) {
    return rebindToCurrentServerId(nodeData)
  }
  throw e
}

Prevention

When it happens

Trigger: A stale node still referencing a serverId that was deleted; a serverId copied from another workspace (tenant isolation hides it); a typo/UUID truncation in the id; the server record exists but with a different casing/format that doesn't match.

Common situations: Deleted a server from the Tools page but the flow still references it; exported a flow from workspace A and imported into workspace B (serverIds don't exist there); copy-paste truncating the UUID.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/ab6b80b918f25fa1. Report an issue: GitHub.