Skip to content

Instantly share code, notes, and snippets.

@cdeil
Created January 23, 2026 08:17
Show Gist options
  • Select an option

  • Save cdeil/b491544b0743fc35431071f70e0e7e76 to your computer and use it in GitHub Desktop.

Select an option

Save cdeil/b491544b0743fc35431071f70e0e7e76 to your computer and use it in GitHub Desktop.

Prompt

I'm running into this issue again:

Dart-Code/Dart-Code#5847 microsoft/vscode#284024

Can you please check any relevant logs or state concerning VS Code and try to figure out what happened?

Write a Markdown report with your findings.

MCP Tools Duplication Investigation Report

Date: January 23, 2026
Issue: Tools from contributed MCP server appear many times in the tools list
Related Issues:

Summary

Your screenshot shows 1704 tools enabled with a warning that "You may experience degraded tool calling above 128 tools." This is the known issue where the Dart SDK MCP Server tools are being registered multiple times (82× based on the numbered tools like mcp_dart_sdk_mcp_81_*).

Investigation Findings

Current State

Metric Value
VS Code Version 1.108.1
Dart Extension dart-code.dart-code-3.126.0
Flutter Extension dart-code.flutter-3.126.0
Running MCP Servers 0 (currently no mcp-server processes)
Workspace Storage Directories 109

MCP Tool Cache Analysis

Global Cache (~/Library/Application Support/Code/User/globalStorage/state.vscdb):

  • mcpToolCache: 3,686 bytes - looks normal
  • Contains only 1 server entry (Context7 with 2 tools)
  • No Dart MCP entries in global cache (expected - they're per-workspace)

Workspace Caches examined:

  • ~50 workspace storage directories have Dart MCP entries
  • Sample workspace cache: 27,356 bytes with 17 Dart tools + 12 Pylance tools = 29 total tools (normal)

No Evidence of Corruption Found

At the time of investigation, all MCP caches appear normal:

  • Each workspace has 1 Dart MCP Server entry with 17 tools
  • Each workspace has 1 Pylance MCP Server entry with 12 tools
  • No duplicated entries found in any cache

MCP Log Files

The Pylance MCP server logs show repeated connection errors:

Error reading from async stream, we will reconnect: TypeError: terminated

These errors occur every ~5 minutes during idle periods but appear to reconnect successfully.

The Dart MCP Server log files are empty (0 bytes) in recent sessions.

Root Cause Analysis

Based on the GitHub issue discussion:

  1. This is a VS Code bug, not a Dart extension bug
  2. The issue occurs when MCP server tools are cached multiple times despite the server only being registered once
  3. The Dart extension uses McpServerDefinitionProvider which is properly disposed
  4. The bug is intermittent and difficult to reproduce
  5. VS Code team has assigned this to the January 2026 milestone for fixing

Likely Triggers

Based on the discussion and your setup:

  • Multi-window VS Code sessions - you have frontend_flutter nested inside backend_fastapi
  • Extension restarts or crashes - historical analysis server issues
  • Long-running VS Code sessions without restarts
  • Sleep/wake cycles on macOS

Workarounds

Immediate Fix (When Issue Occurs)

  1. Run VS Code command: "MCP: Clear Tool Cache"
  2. Restart VS Code completely
  3. If needed, disable and re-enable the Dart MCP Server in settings

Preventive Measures

  1. Periodically restart VS Code (especially after sleep/wake cycles)
  2. Keep VS Code and extensions updated - a fix is in progress
  3. Monitor the tool count in the Configure Tools dialog

Settings to Consider

Add to your VS Code settings.json to limit tools:

{
  "chat.mcp.discovery.enabled": false  // Disable auto-discovery if you don't need it
}

Or selectively disable MCP servers you don't actively use in the Configure Tools UI.

Technical Details

MCP Storage Locations

Type Path
Global Config ~/Library/Application Support/Code/User/mcp.json
Global State ~/Library/Application Support/Code/User/globalStorage/state.vscdb
Workspace State ~/Library/Application Support/Code/User/workspaceStorage/*/state.vscdb
MCP Logs ~/Library/Application Support/Code/logs/*/window*/mcpServer.*.log

Key Database Tables

-- List MCP-related keys
SELECT key FROM ItemTable WHERE key LIKE '%mcp%';
-- Results: mcpInputs, mcpToolCache, mcp.extCachedServers

Recommendations

  1. Report back to the GitHub issue with updated findings if the problem recurs
  2. Capture the code --status | grep mcp output when the issue is active
  3. Run "MCP: List servers" command when seeing duplicates to capture the server state
  4. Consider using separate VS Code windows for backend_fastapi and frontend_flutter instead of nesting

Status

  • Issue is acknowledged by VS Code team
  • Milestone: January 2026 (current month)
  • Assignee: @connor4312 at Microsoft
  • No action required from you until fix is released

The issue is intermittent and self-resolves after VS Code restart. Continue monitoring and report any additional patterns you observe to the GitHub issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment