{"record":{"id":"bfce251963e815b2","repo":"FlowiseAI/Flowise","slug":"mcp-server-serverrecord-name-is-not-authorize","errorCode":null,"errorMessage":"MCP server \"${serverRecord.name}\" is not authorized. Please authorize it in the Tools page first.","messagePattern":"MCP server \"(.+?)\" is not authorized\\. Please authorize it in the Tools page first\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/tools/MCP/CustomMcpServerTool/CustomMcpServerTool.ts","lineNumber":142,"sourceCode":"        const appDataSource = options.appDataSource as DataSource\n        const databaseEntities = options.databaseEntities as IDatabaseEntity\n        if (!appDataSource || !databaseEntities?.['CustomMcpServer']) {\n            throw new Error('Database not available')\n        }\n\n        const workspaceId =\n            (options.workspaceId as string | undefined) ??\n            ((options.searchOptions as ICommonObject | undefined)?.workspaceId as string | undefined)\n        if (!workspaceId) {\n            throw new Error('Workspace context is required to load MCP server')\n        }\n\n        const serverRecord = await appDataSource.getRepository(databaseEntities['CustomMcpServer']).findOneBy({ id: serverId, workspaceId })\n        if (!serverRecord) {\n            throw new Error(`MCP server ${serverId} not found`)\n        }\n        if (serverRecord.status !== 'AUTHORIZED') {\n            throw new Error(`MCP server \"${serverRecord.name}\" is not authorized. Please authorize it in the Tools page first.`)\n        }\n\n        // Build headers from encrypted authConfig — only when authType explicitly requires them\n        let headers: Record<string, string> = {}\n        if (serverRecord.authType === 'CUSTOM_HEADERS' && serverRecord.authConfig) {\n            try {\n                const decrypted = await decryptCredentialData(serverRecord.authConfig)\n                if (decrypted?.headers && typeof decrypted.headers === 'object') {\n                    headers = decrypted.headers as Record<string, string>\n                }\n            } catch {\n                // authConfig decryption failed — proceed without headers\n            }\n        }\n\n        const serverParams: any = {\n            url: serverRecord.serverUrl,\n            ...(Object.keys(headers).length > 0 ? { headers } : {})","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/MCP/CustomMcpServerTool/CustomMcpServerTool.ts#L124-L160","documentation":"Thrown by CustomMcpServerTool.getTools when serverRecord.status !== 'AUTHORIZED'. Managed MCP servers go through an explicit authorization step on the Tools page (e.g. completing OAuth, validating headers, confirming the SSE handshake) before they are usable. Until status flips to AUTHORIZED, the tool refuses to load them — this prevents half-configured or revoked servers from breaking the agent's tool set. The server name is included to identify it in the UI.","triggerScenarios":"A newly created server that was never authorized; an authorization that expired or was revoked (token refresh failure, user disconnected OAuth); a server in PENDING/UNAUTHORIZED/DISABLED state selected on a node.","commonSituations":"User creates a server entry but doesn't finish the OAuth flow; the upstream MCP provider revoked the token; an admin disabled the server; the authConfig decryption silently left the server unusable.","solutions":["Go to the Tools page, find the named server, and click Authorize; complete any OAuth/credential prompt.","If authorization repeatedly fails, re-enter the authConfig (headers/client secret) and re-authorize.","Confirm the server's serverUrl is reachable and the MCP endpoint responds.","After a provider-side revocation, re-authorize to mint a fresh token."],"exampleFix":"// before — status 'PENDING'\nserverRecord.status === 'PENDING'  // throws\n// after — authorize on Tools page\nserverRecord.status === 'AUTHORIZED'  // passes","handlingStrategy":"validation","validationCode":"async function assertAuthorized(ds: DataSource, entity: any, serverId: string, workspaceId: string) {\n  const rec = await ds.getRepository(entity).findOneBy({ id: serverId, workspaceId })\n  if (!rec) throw new Error('server not found')\n  if (rec.status !== 'AUTHORIZED') throw new Error(`server '${rec.name}' status is ${rec.status} — authorize on the Tools page`)\n  return rec\n}","typeGuard":"function isAuthorized(rec: { status?: string } | null): rec is { status: 'AUTHORIZED' } {\n  return !!rec && rec.status === 'AUTHORIZED'\n}","tryCatchPattern":"try {\n  return await tool.getTools(nodeData, options)\n} catch (e) {\n  if (e instanceof Error && /not authorized/i.test(e.message)) {\n    return promptUserToAuthorize(e.message) // surface the Tools-page action\n  }\n  throw e\n}","preventionTips":["Complete the Authorize step on the Tools page before binding a server to a node.","Re-authorize after provider-side token revocation.","If authorization fails repeatedly, re-enter the authConfig (headers/secret).","Confirm serverUrl is reachable before authorizing."],"tags":["mcp","authorization","oauth","config","lifecycle"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}