{"record":{"id":"48dcf20db5258fca","repo":"bytedance/deer-flow","slug":"mcp-server-body-server-name-not-found","errorCode":null,"errorMessage":"MCP server '{body.server_name}' not found","messagePattern":"MCP server '(.+?)' not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"backend/app/gateway/routers/mcp.py","lineNumber":838,"sourceCode":"        config_data[\"skills\"] = {name: {\"enabled\": skill.enabled} for name, skill in current_config.skills.items()}\n\n        atomic_write_extensions_config(config_path, config_data)\n\n        logger.info(f\"MCP configuration updated and saved to: {config_path}\")\n\n        # Reload the Gateway configuration and update the global cache. The\n        # agent runtime lives in Gateway, so this keeps API reads and tool\n        # execution aligned after extensions_config.json changes.\n        reloaded_config = reload_extensions_config()\n        return reloaded_config.mcp_servers\n\n\ndef _apply_mcp_server_state_update(body: McpServerStateUpdateRequest) -> dict:\n    \"\"\"Update one server state while preserving the raw extensions config.\"\"\"\n    with extensions_config_write_lock:\n        config_path = ExtensionsConfig.resolve_config_path()\n        if config_path is None or not config_path.exists():\n            raise HTTPException(\n                status_code=status.HTTP_404_NOT_FOUND,\n                detail=f\"MCP server '{body.server_name}' not found\",\n            )\n\n        with open(config_path, encoding=\"utf-8\") as f:\n            raw_data = json.load(f)\n\n        raw_servers = raw_data.get(\"mcpServers\", {})\n        raw_server = raw_servers.get(body.server_name) if isinstance(raw_servers, dict) else None\n        if not isinstance(raw_server, dict):\n            raise HTTPException(\n                status_code=status.HTTP_404_NOT_FOUND,\n                detail=f\"MCP server '{body.server_name}' not found\",\n            )\n\n        if body.enabled:\n            target_server = McpServerConfigResponse(**raw_server)\n            _validate_mcp_update_request(","sourceCodeStart":820,"sourceCodeEnd":856,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/routers/mcp.py#L820-L856","documentation":"404 raised by _apply_mcp_server_state_update (PATCH /mcp/config) when the extensions configuration file cannot be resolved or does not exist on disk. The per-server enable/disable path operates directly on extensions_config.json; with no config file there are no servers to toggle, so even a valid server name is reported as not found.","triggerScenarios":"PATCH /api/mcp/config on a fresh deployment where `make config` was never run (extensions_config.json missing); a container where the config volume is not mounted; the config file path override (env/config) pointing to a nonexistent location.","commonSituations":"Skipping the documented setup step of copying extensions_config.example.json to extensions_config.json; volume mount mistakes in Docker deploys; CI environments testing the API without provisioning config files.","solutions":["Run `make config` (or copy extensions_config.example.json to extensions_config.json at the repo root) and retry","Verify the config path the Gateway resolves (ExtensionsConfig.resolve_config_path) matches where the file lives","In Docker, check the extensions config volume is mounted read-write into the Gateway container"],"exampleFix":"# before: PATCH immediately after clone -> 404\n# after\ncp extensions_config.example.json extensions_config.json\n# then restart Gateway and PATCH /api/mcp/config with {\"server_name\": \"x\", \"enabled\": true}","handlingStrategy":"validation","validationCode":"const health = await fetch('/api/mcp/config').then(r => r.status); if (health === 404 || health === 500) { console.error('extensions_config.json missing/corrupt — run setup (make config) before PATCHing server state'); }","typeGuard":"null","tryCatchPattern":"try { await patchMcpState(name, enabled); } catch (e) { if (e.status === 404) { const list = await getMcpConfig(); if (!Object.keys(list.mcp_servers).length) throw new Error('config file missing — run make config and restart Gateway'); } throw e; }","preventionTips":["Run `make config` (create extensions_config.json) as part of every fresh deployment checklist","Mount the config volume into containers and verify it exists before startup","Health-check GET /api/mcp/config before issuing PATCH calls"],"tags":["mcp","config","setup","http-404"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}