{"record":{"id":"4dfc8fb5e6dcf991","repo":"alibaba/nacos","slug":"api-function-disabled-4dfc8f","errorCode":"API_FUNCTION_DISABLED","errorMessage":"Nacos AI MCP module and API required both `naming` and `config` module.","messagePattern":"Nacos AI MCP module and API required both `naming` and `config` module\\.","errorType":"exception","errorClass":"NacosApiException","httpStatus":501,"severity":"error","filePath":"console/src/main/java/com/alibaba/nacos/console/handler/impl/noop/ai/McpNoopHandler.java","lineNumber":51,"sourceCode":"\n/**\n * Noop implementation of Mcp handler.\n * Used when `naming` or `config` module are not enabled.\n *\n * @author xiweng.yy\n */\n@Service\n@ConditionalOnMissingBean(value = McpHandler.class, ignored = McpNoopHandler.class)\npublic class McpNoopHandler implements McpHandler {\n    \n    private static final String MCP_NOT_ENABLED_MESSAGE =\n        \"Nacos AI MCP module and API required both `naming` and `config` module.\";\n    \n    @Override\n    public Page<McpServerBasicInfo> listMcpServers(String namespaceId, String mcpName,\n        String search, int pageNo,\n        int pageSize) throws NacosException {\n        throw new NacosApiException(NacosException.SERVER_NOT_IMPLEMENTED,\n            ErrorCode.API_FUNCTION_DISABLED,\n            MCP_NOT_ENABLED_MESSAGE);\n    }\n    \n    @Override\n    public McpServerDetailInfo getMcpServer(String namespaceId, String mcpName, String mcpId,\n        String version)\n        throws NacosException {\n        throw new NacosApiException(NacosException.SERVER_NOT_IMPLEMENTED,\n            ErrorCode.API_FUNCTION_DISABLED,\n            MCP_NOT_ENABLED_MESSAGE);\n    }\n    \n    @Override\n    public String createMcpServer(String namespaceId, McpServerBasicInfo serverSpecification,\n        McpToolSpecification toolSpecification, McpEndpointSpec endpointSpecification)\n        throws NacosException {\n        throw new NacosApiException(NacosException.SERVER_NOT_IMPLEMENTED,","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console/src/main/java/com/alibaba/nacos/console/handler/impl/noop/ai/McpNoopHandler.java#L33-L69","documentation":"This error is thrown by McpNoopHandler.listMcpServers when listing MCP (Model Context Protocol) servers. The noop handler is a @ConditionalOnMissingBean fallback that activates when the real McpHandler (McpInnerHandler or McpRemoteHandler) was not loaded. The real handlers require @EnabledAiHandler, which needs both naming and config modules to be active. HTTP status is 501 (SERVER_NOT_IMPLEMENTED) with ErrorCode.API_FUNCTION_DISABLED (40001).","triggerScenarios":"A client calls GET /v3/console/ai/mcp/list or GET /v3/admin/ai/mcp/server/list on a Nacos server whose functionMode is 'config' or 'naming' (single-module), or where nacos.extension.ai.enabled=false. ConditionAiEnabled.matches() returns false.","commonSituations":"Developers integrating MCP tool servers into their LLM workflows who point their MCP registry client at a Nacos node deployed for traditional config/service-discovery. Also occurs after upgrading Nacos to a version with MCP support without updating the functionMode that was set on the old version.","solutions":["Unset functionMode (enable all modules) or set it to 'ai' / 'microservice'.","Verify nacos.extension.ai.enabled is not explicitly false in application.properties or JVM args.","Restart the Nacos server so Spring re-evaluates @ConditionalOnMissingBean and loads the real McpHandler."],"exampleFix":"# before (config-only deployment)\njava -Dnacos.functionMode=config -jar nacos-server.jar\n\n# after (enable AI/MCP support)\njava -Dnacos.functionMode=ai -jar nacos-server.jar","handlingStrategy":"try-catch","validationCode":"// Probe MCP availability before calling listMcpServers\npublic boolean isMcpAvailable(NacosRestTemplate restTemplate, String baseUrl) {\n    try {\n        restTemplate.get(\n            baseUrl + \"/v3/console/ai/mcp/list?pageNo=1&pageSize=1\",\n            String.class);\n        return true;\n    } catch (NacosApiException e) {\n        return e.getErrCode() != NacosException.SERVER_NOT_IMPLEMENTED;\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    Page<McpServerBasicInfo> servers = mcpHandler.listMcpServers(\n        namespaceId, mcpName, search, pageNo, pageSize);\n} catch (NacosApiException e) {\n    if (e.getErrCode() == NacosException.SERVER_NOT_IMPLEMENTED\n        && ErrorCode.API_FUNCTION_DISABLED.getCode() == e.getDetailErrCode()) {\n        // MCP module not enabled — return empty result or notify user\n        log.warn(\"MCP list failed: AI module not enabled on server.\");\n        return new Page<>();\n    }\n    throw e;\n}","preventionTips":["MCP client integrations (Claude Desktop, Cursor, etc.) should probe the Nacos MCP endpoint at startup and warn the user if the module is disabled.","In multi-cluster setups, route MCP discovery calls only to clusters with functionMode=ai or no functionMode restriction."],"tags":["ai","mcp","noop-handler","module-disabled","function-mode","list"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}