flipped-aurora/gin-vue-admin · error
未检测到可用的 Go 环境,且本地没有可复用的 MCP 独立二进制
Error message
未检测到可用的 Go 环境,且本地没有可复用的 MCP 独立二进制
What it means
ensureManagedBinary guarantees a runnable MCP standalone binary: it first tries building with the local Go toolchain, and otherwise falls back to an existing prebuilt binary at binaryPath. This error is thrown when BOTH are unavailable — no `go` command on PATH AND no previously built binary exists — so the managed start has no way to produce a runnable MCP process.
Source
Thrown at server/mcp/standalone_manager.go:350
cmd := exec.CommandContext(buildCtx, goBin, "build", "-o", binaryPath, "./cmd/mcp")
cmd.Dir = serverRoot
output, err := cmd.CombinedOutput()
if err != nil {
message := strings.TrimSpace(string(output))
if message != "" {
return "", fmt.Errorf("构建 MCP 独立服务失败: %w, 输出: %s", err, message)
}
return "", fmt.Errorf("构建 MCP 独立服务失败: %w", err)
}
return binaryPath, nil
}
if fileExists(binaryPath) {
return binaryPath, nil
}
return "", errors.New("未检测到可用的 Go 环境,且本地没有可复用的 MCP 独立二进制")
}
func resolveMCPServerRoot() string {
root := strings.TrimSpace(global.GVA_CONFIG.AutoCode.Root)
serverDir := strings.TrimSpace(global.GVA_CONFIG.AutoCode.Server)
if serverDir == "" {
serverDir = "server"
}
candidates := []string{}
if root != "" {
candidates = append(candidates, filepath.Join(root, filepath.FromSlash(serverDir)))
candidates = append(candidates, root)
}
if cwd, err := os.Getwd(); err == nil {
candidates = append(candidates, cwd)
candidates = append(candidates, filepath.Join(cwd, "server"))View on GitHub (pinned to 3136500ef3)
Solutions
- Install Go and ensure `go` is on PATH (go version should succeed for the backend process user)
- Build the MCP standalone binary once on a machine with Go and copy it to the expected runtime binaryPath
- Fix PATH in the backend service environment (systemd Environment= / Dockerfile ENV) so `go` is discoverable
- Re-check after cleaning the runtime dir: without Go the binary will never be rebuilt
Example fix
# before: no go toolchain go version # command not found # after # Debian/Ubuntu apt-get install -y golang-go # or use official tarball wget https://go.dev/dl/go1.22.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.22.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin
Defensive patterns
Strategy: validation
Validate before calling
if _, err := exec.LookPath("go"); err != nil {
return errors.New("go toolchain required to build MCP standalone binary (or prebuild it into the runtime dir)")
} Try / catch
if _, err := ensureManagedBinary(); err != nil {
log.Fatalf("MCP binary unavailable: %v — install Go or ship a prebuilt binary", err)
} Prevention
- Install Go in every environment that starts the managed MCP service
- Fix PATH for the backend service user (systemd/Docker ENV)
- Build the binary once on a Go machine and copy it to the expected runtime binaryPath for toolchain-less hosts
When it happens
Trigger: StartManagedStandalone on a machine where the Go toolchain is not installed or not on PATH, and the mcp runtime directory contains no previously compiled standalone binary.
Common situations: Deploying to a slim production image without Go; running the page in Docker where PATH lacks go; first-time start on a new machine; cleaned runtime directory removing the cached binary.
Related errors
- 未找到 MCP 独立配置文件,请在当前目录、cmd/mcp 目录或通过 -config / GVA_MCP_CONFIG
- 未能自动识别项目根目录,请在 MCP 配置中设置 autocode.root
- go.mod 中未找到 module 定义
- path 参数是必需的
- description 参数是必需的
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/99fe56c5cbd94320.
Report an issue: GitHub.