flipped-aurora/gin-vue-admin · warning
当前 MCP 服务不是由页面启动的,无法自动停用
Error message
当前 MCP 服务不是由页面启动的,无法自动停用
What it means
StopManagedStandalone stops the MCP standalone service only if the backend itself started it (verified via the managed-process meta file). When meta cannot be read (service not page-managed) but the endpoint IS reachable, it returns this error to tell the caller the running instance belongs to something else (e.g. manually launched `go run`) and cannot be auto-terminated. If the service is unreachable and unmanaged, it returns the status with no error.
Source
Thrown at server/mcp/standalone_manager.go:205
LogPath: logPath,
ConfigPath: configPath,
WorkDir: workDir,
Command: commandPath,
Args: append([]string{}, commandArgs...),
}
if err := writeManagedProcessMeta(meta); err != nil {
return GetManagedStandaloneStatus(context.Background()), err
}
return waitForManagedProcess(ctx, meta)
}
func StopManagedStandalone(ctx context.Context) (ManagedStandaloneStatus, error) {
meta, err := readManagedProcessMeta()
if err != nil {
status := GetManagedStandaloneStatus(ctx)
if status.Reachable {
return status, errors.New("当前 MCP 服务不是由页面启动的,无法自动停用")
}
return status, nil
}
if meta.PID > 0 && processExists(meta.PID) {
if err := terminateProcess(meta.PID); err != nil {
return GetManagedStandaloneStatus(context.Background()), fmt.Errorf("停用 MCP 独立服务失败: %w", err)
}
}
deadline := time.NewTimer(mcpStopWaitTimeout)
ticker := time.NewTicker(200 * time.Millisecond)
defer deadline.Stop()
defer ticker.Stop()
for {
select {
case <-ctx.Done():View on GitHub (pinned to 3136500ef3)
Solutions
- Stop the process manually: find the PID listening on the MCP port and kill it (e.g. lsof -i :PORT then kill PID)
- Restart the service from the admin page so it becomes page-managed, then stop it from the page
- Check the MCP runtime meta file (mcp runtime dir) is intact; if it was deleted, the running process is orphaned and must be killed manually
- Verify GetManagedStandaloneStatus in the UI to confirm who owns the running process before stopping
Example fix
// manually stop an orphaned MCP process lsof -i :8888 # find PID bound to the MCP port kill <PID> # then manage lifecycle from the page
Defensive patterns
Strategy: fallback
Try / catch
status, err := mcp.StopManagedStandalone(ctx)
if err != nil {
log.Printf("service is externally managed: %v; stop it manually", err)
// fall back: locate PID by port and terminate by hand
} Prevention
- Always start/stop the MCP service from the page so the meta file tracks ownership
- Never delete the mcp runtime directory while the service is running
- After manual `go run` starts, expect page-side stop to fail and kill the process manually
When it happens
Trigger: Clicking stop/deactivate for the MCP standalone service in the page while the service was started manually from a terminal, by another tool, or the managed-process meta file was deleted/corrupted while the process still runs.
Common situations: Developer started the MCP server via `go run ./cmd/mcp` or a compiled binary by hand, then tries to manage it from the admin UI; stale or wiped runtime meta directory after reinstall/clean while an orphan process keeps listening.
Related errors
- 未找到 server 根目录,无法启动 MCP 独立服务
- 未找到 MCP 独立配置文件,请在当前目录、cmd/mcp 目录或通过 -config / GVA_MCP_CONFIG
- 未能自动识别项目根目录,请在 MCP 配置中设置 autocode.root
- go.mod 中未找到 module 定义
- path 参数是必需的
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/536a0db082ae3423.
Report an issue: GitHub.