{"record":{"id":"fa575eeef028144e","repo":"flipped-aurora/gin-vue-admin","slug":"mcp-cmd-mcp-config-yaml-server-conf","errorCode":null,"errorMessage":"未找到 MCP 配置文件，请确认 cmd/mcp/config.yaml 或 server/config.yaml 存在","messagePattern":"未找到 MCP 配置文件，请确认 cmd/mcp/config\\.yaml 或 server/config\\.yaml 存在","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/standalone_manager.go","lineNumber":396,"sourceCode":"\t\treturn candidates[0]\n\t}\n\n\treturn \"\"\n}\n\nfunc resolveMCPConfigPath(serverRoot string) (string, error) {\n\tcandidates := []string{\n\t\tfilepath.Join(serverRoot, \"cmd\", \"mcp\", \"config.yaml\"),\n\t\tfilepath.Join(serverRoot, \"config.yaml\"),\n\t}\n\n\tfor _, candidate := range candidates {\n\t\tif fileExists(candidate) {\n\t\t\treturn candidate, nil\n\t\t}\n\t}\n\n\treturn \"\", errors.New(\"未找到 MCP 配置文件，请确认 cmd/mcp/config.yaml 或 server/config.yaml 存在\")\n}\n\nfunc ensureMCPRuntimeDir() (string, error) {\n\truntimeDir := filepath.Join(resolveMCPProjectRoot(), mcpRuntimeDirName, mcpRuntimeSubDir)\n\tif err := os.MkdirAll(runtimeDir, 0o755); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn runtimeDir, nil\n}\n\nfunc resolveMCPProjectRoot() string {\n\troot := strings.TrimSpace(global.GVA_CONFIG.AutoCode.Root)\n\tif root != \"\" {\n\t\treturn root\n\t}\n\n\tserverRoot := resolveMCPServerRoot()\n\tif serverRoot == \"\" {","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/standalone_manager.go#L378-L414","documentation":"resolveMCPConfigPath checks a list of candidate config file locations (cmd/mcp/config.yaml and server/config.yaml among them) and returns the first that exists. It throws this error when none of the candidates can be found, because the standalone MCP service cannot start without its YAML configuration.","triggerScenarios":"StartManagedStandalone on a deployment where the server root exists but neither cmd/mcp/config.yaml nor server/config.yaml (nor other candidates) are present — e.g. config renamed, moved, or excluded from the build/deploy artifact.","commonSituations":"Docker images or CI artifacts that strip yaml files; config renamed to config.yml or config.example.yaml never copied to config.yaml; deploying only the compiled binary without the source tree; wrong server root resolution pointing to a directory without config.","solutions":["Create/copy cmd/mcp/config.yaml (or server/config.yaml) under the resolved server root","If you renamed the config (e.g. config.yml), rename it back to config.yaml or place it at a candidate path","Ensure deployment packages include yaml config files alongside binaries","Verify the server root that was resolved (fix autocode.root/server if it points at the wrong directory)"],"exampleFix":"# before: config missing\ncp cmd/mcp/config.example.yaml cmd/mcp/config.yaml   # restore expected candidate\n# verify\nls cmd/mcp/config.yaml server/config.yaml","handlingStrategy":"validation","validationCode":"for _, p := range []string{\"cmd/mcp/config.yaml\", \"config.yaml\"} {\n    if _, err := os.Stat(filepath.Join(serverRoot, p)); err == nil {\n        return nil // config present\n    }\n}\nreturn errors.New(\"place cmd/mcp/config.yaml (or server/config.yaml) under the server root first\")","typeGuard":null,"tryCatchPattern":"if _, err := resolveMCPConfigPath(serverRoot); err != nil {\n    log.Fatalf(\"MCP config missing: %v — copy config.example.yaml to config.yaml\", err)\n}","preventionTips":["Always ship yaml config files in deploy artifacts (don't exclude *.yaml)","Create cmd/mcp/config.yaml from the example template during provisioning","Don't rename config.yaml to config.yml; the resolver looks for exact candidate names"],"tags":["mcp","configuration","yaml"],"backgroundTag":"missing-config-file","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}