Uninstall duplicate GK MCP servers
Description
In cases where GitLens is unable to bundle the GitKraken MCP (GK MCP) (usually when an IDE does not support VS Code's bundled MCP API) a more manual setup process is required for the GK MCP to function. Since the bundled and manually setup GK MCP servers are different to an IDE, this can result in duplicate GK MCP servers being setup at once if an IDE starts supporting VS Code's bundled MCP API.
This issue is to explore cleaning up the manually setup versions of the GK MCP server when the bundled version also exists.
GK CLI version
UPD. 2025-11-21: CLI is fixed on [email protected], [email protected].
Steps to reproduce
-
Run VSCode
-
Go to the folder where GK installer is installed
-
Run
./gk mcp install vscode-insidersor./gk mcp install vscode- If you launch VSCode from a custom profile folder then run
./gk mcp install vscode-insiders --source=gitlens. Then click "install" button on the "MCP Server: GitKraken" tab in VS Code. - If you launch in standard folder in debug sub-profile, make sure you use main
mcp.jsonto list MCP servers:
- If you launch VSCode from a custom profile folder then run
-
Install GitLens pre-release.
-
Using VSCode palette run the command "MCP: List Servers"
Expected result
- previously installed (independent) GitKraken MCP is not in the list
- you see "GitKraken (bundled with GitLens)" MCP server only.
Actual result
you see both MCP servers:
- "GitKraken (bundled with GitLens)"
- "GitKraken" - global in VSCode
I've suggested few improvements to CLI team. Here is the ticket to track and discuss:
- https://github.com/gitkraken/gkcli/issues/546
- https://github.com/gitkraken/gkcli/issues/547
Also I've added steps to reproduce.
cc @justinrobots @eamodio
Additional reproduction case: Duplicates after reinstalling GitLens
I encountered this same issue with a slightly different trigger - duplicates appeared after reinstalling GitLens (not just from manual vs bundled MCP conflict).
Environment
- VS Code version: 1.105.1
- GitLens version: 17.6.2
- OS: Windows 11
- GitLens install method: Standard installation from VS Code marketplace
What I observed
After reinstalling GitLens, the MCP Server features list in Copilot Chat showed 4-5 duplicate entries for each GitKraken MCP command:
MCP Server: GitKraken
├─ Add file contents to the index (git add <pathspec>) OR record changes
├─ Add file contents to the index (git add <pathspec>) OR record changes
├─ Add file contents to the index (git add OR record changes
├─ Add file contents to the index (git add OR record changes
├─ Add file contents to the index (git add OR record changes
├─ git_blame Show what revision and author last modified each line of a file (git blame)
├─ git_blame Show what revision and author last modified each line of a file (git blame)
├─ git_blame Show what revision and author last modified each line of a file (git blame)
└─ [... similar duplicates for other git commands]
Steps to reproduce
- Have GitLens 17.6.2 installed
- Uninstall GitLens via Extensions view
- Reinstall GitLens from marketplace
- Open Copilot Chat → Browse MCP Server features
- Observe duplicate GitKraken MCP command entries
Fix that worked
Clearing the MCP logs during reinstall resolved the issue:
# Uninstall GitLens
code --uninstall-extension eamodio.gitlens
# Clear MCP logs (important!)
rm -rf ~/AppData/Roaming/Code/logs/*/window*/mcpServer.eamodio.gitlens
# Reinstall GitLens
code --install-extension eamodio.gitlens
# Reload VS Code (manually via Command Palette)
# Run: "Developer: Reload Window" or restart VS Code
After this, all duplicates were cleared and each MCP command appeared only once.
Root cause hypothesis
The MCP server logs in ~/AppData/Roaming/Code/logs/*/window*/mcpServer.eamodio.gitlens appear to persist across uninstall/reinstall, causing stale registrations to accumulate. The standard extension uninstall process doesn't clean up these MCP-specific log directories.
Suggestion
Consider adding cleanup logic to GitLens's deactivation/uninstall hooks to remove MCP server logs from the VS Code logs directory, or have VS Code's MCP framework auto-clean stale server registrations on extension reload.
Hope this additional context helps! 👍
@justinrobots @eamodio
Status update:
GK CLI have fixed uninstalling in main but it hasn't been published yet.
I've pushed my changes that will be useful when they ship the fix.
Also I've created few more issues for GK CLI that do not relate the uninstalling directly, but it's probably worth to have them done for better consistency:
- https://github.com/gitkraken/gkcli/issues/546
- https://github.com/gitkraken/gkcli/issues/547