Skip to content

x/tools/gopls: crash on start up when HTTP MCP server configured #75877

@shumayl-asmawi

Description

@shumayl-asmawi

gopls version: v0.20.0/go1.25.1
gopls flags: -mcp.listen=localhost:8092
update flags: proxy
extension version: 0.50.0
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Mon, 13 Oct 2025 01:14:25 GMT
restart history:
Sun, 12 Oct 2025 11:43:40 GMT: config change (enabled: true)
Sun, 12 Oct 2025 11:51:36 GMT: config change (enabled: true)
Sun, 12 Oct 2025 11:55:14 GMT: config change (enabled: true)
Sun, 12 Oct 2025 12:01:30 GMT: config change (enabled: true)
Sun, 12 Oct 2025 12:01:50 GMT: config change (enabled: true)
Mon, 13 Oct 2025 00:22:12 GMT: config change (enabled: true)
Mon, 13 Oct 2025 00:37:26 GMT: config change (enabled: true)
Mon, 13 Oct 2025 01:12:16 GMT: config change (enabled: true)
Mon, 13 Oct 2025 01:12:48 GMT: config change (enabled: true)
Mon, 13 Oct 2025 01:13:49 GMT: config change (enabled: true)
Mon, 13 Oct 2025 01:14:23 GMT: config change (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

When running the gopls with VS Code (extension: VS Code Go extension) with the gopls MCP enabled, it will inevitably crash.

The only way to restart gopls is by removing the gopls-mcp configs in settings.json (i.e. comment out) and restarting gopls with > Go: Restart Language Server, then adding the gopls-mcp configs back in settings.json. This too sometimes fail.

settings.json

...
    // MCP
    "go.languageServerFlags": [
        "-mcp.listen=localhost:8092"
    ],
    "chat.mcp.serverSampling": {
        "Global in Code: gopls-mcp": {
            "allowedModels": [
                "copilot/gpt-5-experiment-b",
                "copilot/claude-3.7-sonnet",
                "copilot/gemini-2.5-pro"
            ]
        }
    }
...

mcp.json

{
	"servers": {
		"gopls-mcp": {
			"url": "http://localhost:8092/",
			"type": "http"
		}
	},
	"inputs": []
}
mcp.go:48: Gopls MCP server: starting up on http
gopls stats -anon { "DirStats": { "Files": 352, "TestdataFiles": 0, "GoFiles": 20, "ModFiles": 1, "Dirs": 204 }, "GOARCH": "arm64", "GOOS": "darwin", "GOPACKAGESDRIVER": "", "GOPLSCACHE": "", "GoVersion": "go1.25.1", "GoplsVersion": "v0.20.0", "InitialWorkspaceLoadDuration": "12.350679541s", "MemStats": { "HeapAlloc": 159192264, "HeapInUse": 177741824, "TotalAlloc": 318371952 }, "WorkspaceStats": { "Files": { "Total": 1440, "Largest": 969864, "Errs": 0 }, "Views": [ { "GoCommandVersion": "go1.25.1", "AllPackages": { "Packages": 268, "LargestPackage": 169, "CompiledGoFiles": 1446, "Modules": 20 }, "WorkspacePackages": { "Packages": 12, "LargestPackage": 5, "CompiledGoFiles": 30, "Modules": 1 }, "Diagnostics": 0 } ] } }

Let me know if there's any further info I can share to help with debugging this.

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions