flipped-aurora/gin-vue-admin · critical

panic(err) — standalone MCP config load failed

Error message

panic(err) — standalone MCP config load failed

What it means

The standalone MCP server binary panics at startup when loadStandaloneConfig cannot load or parse the MCP configuration (missing config file, invalid YAML, or missing required fields). panic(err) is used deliberately so the process aborts loudly instead of running with a bad config.

Source

Thrown at server/cmd/mcp/main.go:15

package main

import (
	"fmt"

	"github.com/flipped-aurora/gin-vue-admin/server/global"
	mcpTool "github.com/flipped-aurora/gin-vue-admin/server/mcp"
	"github.com/flipped-aurora/gin-vue-admin/server/utils/logger"
	_ "go.uber.org/automaxprocs"
)

func main() {
	configPath, err := loadStandaloneConfig()
	if err != nil {
		panic(err)
	}

	if err := initializeStandaloneLogger(); err != nil {
		panic(err)
	}

	addr := fmt.Sprintf(":%d", global.GVA_CONFIG.MCP.Addr)
	server := mcpTool.NewStreamableHTTPServer()

	logger.Bg().Mod("cli").
		Field("config", configPath).
		Field("addr", addr).
		Field("path", global.GVA_CONFIG.MCP.Path).
		Field("upstream", global.GVA_CONFIG.MCP.UpstreamBaseURL).
		Info("mcp独立服务启动")

	if err := server.Start(addr); err != nil {
		logger.Bg().Mod("cli").Err(err).Error("mcp独立服务启动失败")

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Confirm the config file exists at the path loadStandaloneConfig resolves (check working directory and any -c/env path)
  2. Validate the YAML syntax (yamllint) and required MCP fields (addr, path, upstream)
  3. Run the binary from the project root or pass an explicit absolute config path
  4. Compare against the repo's example config for missing keys

Example fix

// before
./mcp-server   # run from / with no config
// after
cd /opt/gva && ./mcp-server --config /opt/gva/config.yaml
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Stat(configPath); err != nil { log.Fatalf("MCP config not found at %s: %v", configPath, err) }

Try / catch

// in a wrapper
func run() (err error) { defer func() { if r := recover(); r != nil { err = fmt.Errorf("mcp startup panic: %v", r) } }(); /* start server */; return nil }

Prevention

When it happens

Trigger: Running `go run ./cmd/mcp` or the built mcp binary with a missing/misplaced config file, wrong config path flag/env, or a config that fails validation inside loadStandaloneConfig.

Common situations: Deploying the mcp binary without copying the config; running from a different working directory than expected; YAML syntax error after hand-editing; renaming config keys after an upgrade.

Related errors


AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31). Data as JSON: /api/errors/470e53ff90c02dd6. Report an issue: GitHub.