flipped-aurora/gin-vue-admin · error
未找到 MCP 独立配置文件,请在当前目录、cmd/mcp 目录或通过 -config / GVA_MCP_CONFIG
Error message
未找到 MCP 独立配置文件,请在当前目录、cmd/mcp 目录或通过 -config / GVA_MCP_CONFIG 指定 config.yaml
What it means
The standalone MCP server's config loader resolves the config file from -config flag, GVA_MCP_CONFIG env var, current dir, then cmd/mcp dir. If no readable config.yaml is found in any candidate location, loadStandaloneConfig fails with this error and the process exits.
Source
Thrown at server/cmd/mcp/config.go:82
candidates := []string{
filepath.Join(wd, "config.yaml"),
filepath.Join(wd, "mcp.yaml"),
filepath.Join(wd, "cmd", "mcp", "config.yaml"),
filepath.Join(wd, "server", "cmd", "mcp", "config.yaml"),
filepath.Join(exeDir, "config.yaml"),
filepath.Join(exeDir, "mcp.yaml"),
}
for _, candidate := range candidates {
if candidate == "" {
continue
}
if info, err := os.Stat(candidate); err == nil && !info.IsDir() {
return filepath.Abs(candidate)
}
}
return "", errors.New("未找到 MCP 独立配置文件,请在当前目录、cmd/mcp 目录或通过 -config / GVA_MCP_CONFIG 指定 config.yaml")
}
func parseConfigFlag(args []string) (string, error) {
fs := flag.NewFlagSet("gva-mcp", flag.ContinueOnError)
fs.SetOutput(io.Discard)
var configPath string
fs.StringVar(&configPath, "c", "", "MCP config file path")
fs.StringVar(&configPath, "config", "", "MCP config file path")
if err := fs.Parse(args); err != nil {
return "", err
}
return strings.TrimSpace(configPath), nil
}
func applyStandaloneDefaults(configPath string, cfg *standaloneConfig) {
if cfg.MCP.Name == "" {View on GitHub (pinned to 3136500ef3)
Solutions
- Pass the config explicitly: ./gva-mcp -config /path/to/config.yaml
- Set the GVA_MCP_CONFIG environment variable to the config path
- Run the command from the project root or server/cmd/mcp where config.yaml exists
- Create a config.yaml in one of the searched locations
Example fix
// before ./gva-mcp // after GVA_MCP_CONFIG=./config.yaml ./gva-mcp // or ./gva-mcp -config /etc/gva/mcp/config.yaml
Defensive patterns
Strategy: validation
Validate before calling
// shell pre-flight before launching the mcp server if [ -z "$GVA_MCP_CONFIG" ] && [ ! -f ./config.yaml ] && [ ! -f ./cmd/mcp/config.yaml ]; then echo "gva-mcp: no config.yaml found; set -config or GVA_MCP_CONFIG" >&2 exit 1 fi
Try / catch
cfg, err := loadStandaloneConfig()
if err != nil {
fmt.Fprintf(os.Stderr, "启动失败: %v\n", err)
os.Exit(1)
} Prevention
- Always pass -config explicitly in systemd/containers (set WorkingDirectory too)
- Set GVA_MCP_CONFIG in the deployment environment as the single source of truth
- Document the config search order (flag > env > cwd > cmd/mcp) in the repo README
- Verify config.yaml is shipped in the deploy artifact
When it happens
Trigger: Running the gva-mcp binary from a working directory that lacks config.yaml, without -config and without GVA_MCP_CONFIG set, and no config.yaml next to cmd/mcp.
Common situations: Launching the binary from PATH or a systemd unit whose WorkingDirectory is wrong; running `go run ./cmd/mcp` from a different package dir; renamed/missing config file in deployment.
Related errors
- 未能自动识别项目根目录,请在 MCP 配置中设置 autocode.root
- go.mod 中未找到 module 定义
- panic(err) — standalone MCP config load failed
- 参数错误:executionPlan 必须提供
- packageName 不能为空
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/8a18a76b8c00e731.
Report an issue: GitHub.