[BUG] VS Code panel sessions never get mcp__ide__getDiagnostics: the IDE server is only advertised to integrated terminals

Status Open
Reported on v2.1.281
Maintainer reply None cached
Activity 0 comments · opened Sep 24, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Sessions in the VS Code extension panel have no mcp__ide__* tools, so Claude cannot query the Problems panel through mcp__ide__getDiagnostics. The panel does attach <ide_diagnostics> for a file Claude has just edited, but nothing can ask for diagnostics on demand, for other files, or after a build. In the same VS Code window and workspace, the extension's bundled claude binary started in the integrated terminal gets the tools, and they work.

The symptom was reported before in #40766 (closed as not planned by the inactivity bot), #65709 (closed as a duplicate of #40766), and #8635 (closed by the inactivity bot). None of those reports identified the cause. This one does, from the 2.1.281 extension.js and the bundled CLI binary (minified names are from 2.1.281):

  1. The extension's IDE MCP server, the WebSocket server on the lock-file port that serves getDiagnostics, advertises its port only through the extension context's environment variable collection:

``js
async function Vf$($,J,Q){ /* ... */ $.environmentVariableCollection.replace(J,Q); /* ... */ }
// ...
await Vf$(Q,"CLAUDE_CODE_SSE_PORT",String(Y))
``

VS Code applies an environment variable collection to integrated terminals only.

  1. The panel starts the CLI through the SDK with an environment it builds itself (PATH, MCP_CONNECTION_NONBLOCKING, CLAUDE_CODE_ENABLE_TASKS, CLAUDE_CODE_ENTRYPOINT=claude-vscode, and the user's configured variables). CLAUDE_CODE_SSE_PORT is not in it.
  1. The MCP servers the panel passes to the SDK are claude-vscode and whatever getAdditionalMcpServers() returns:

``js
R=this.getAdditionalMcpServers(),x={"claude-vscode":_,...R}
// VS Code build:
getAdditionalMcpServers(){return{}}
``

claude-vscode only handles notifications (experiment gates, file_updated, log_event) and registers no tools. claude-vscode-extension is added only while a debug session or Jupyter is active. The IDE server is never passed.

  1. In the CLI, IDE auto-connect (lock-file discovery, matched against CLAUDE_CODE_SSE_PORT) appears to run only in the interactive UI. A headless run, which is how the panel runs the CLI (--output-format stream-json), does not connect to the IDE server even with CLAUDE_CODE_SSE_PORT set to the live port (test below). Setting the variable through the extension's environment settings is therefore not a workaround, and the port also changes on every window reload.

The wiring is identical in 2.1.280.

What Should Happen?

Panel sessions should get the same IDE MCP tools as a CLI started in the integrated terminal. The extension starts the IDE server and already holds its port and auth token, so it could pass the server to the SDK as an MCP server, or pass CLAUDE_CODE_SSE_PORT and have headless mode connect to it.

Error Messages/Logs

# Panel startup (Output > Claude VSCode), new session. Every configured MCP server starts connecting; no "ide" server appears.
[info] Spawning Claude with SDK query function - cwd: <workspace>, permission mode: auto, version: 2.1.281, <extension dir>/resources/native-binary/claude, resume: undefined
[DEBUG] [MCP] --mcp-config servers running fully async (nonblocking)
[DEBUG] [MCP] claude.ai connectors running fully async (nonblocking)
[DEBUG] MCP server "playwright": Starting connection with timeout of 30000ms
[DEBUG] MCP server "nuget": Starting connection with timeout of 30000ms
[DEBUG] MCP server "microsoft.docs.mcp": Starting connection with timeout of 30000ms
[WARN] claude-vscode notification channel error: Received a response for an unknown message ID: {"jsonrpc":"2.0","result":{},"id":0}; further channel errors are not logged this session

# In the panel session:
[DEBUG] ToolSearchTool: select failed — none found: mcp__ide__getDiagnostics

# Headless run of the bundled binary with the live IDE port set:
CLAUDE_CODE_SSE_PORT=<port from ~/.claude/ide/<port>.lock> CLAUDE_CODE_ENTRYPOINT=claude-vscode \
  <extension dir>/resources/native-binary/claude --print "Reply with the single word ok." \
  --output-format stream-json --verbose --max-turns 1 --debug --debug-to-stderr
# The session succeeds. Its init message lists the configured MCP servers and claude.ai connectors but no "ide" server,
# and no mcp__ide__* tools. The debug output never mentions the IDE, and no connection is made to the port.

The unknown message ID warning is logged on nearly every panel startup (24 of 26 in one day's logs). It comes from the notification-only claude-vscode server, so it is probably not the cause, but it also suppresses any later errors on that channel.

Steps to Reproduce

  1. Open a folder in VS Code with the Claude Code extension 2.1.281 installed.
  2. Open the Claude Code panel and start a new session.
  3. Ask Claude to load mcp__ide__getDiagnostics through tool search. No matching tool exists.
  4. Open VS Code's integrated terminal in the same window and run <extension dir>/resources/native-binary/claude.
  5. Ask for the Problems panel diagnostics there. mcp__ide__getDiagnostics is available and works.
  6. Optional: while the panel session is running, ss --tcp --all --numeric --processes shows only the listening socket on the port from ~/.claude/ide/<port>.lock, with no connection from the panel's claude process.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.281 (VS Code extension anthropic.claude-code 2.1.281 with its bundled CLI, VS Code 1.139.0)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

  • Terminal/Shell is "Other" because the bug is in the extension panel, not a terminal. OS is Ubuntu 26.04.1 LTS.
  • Related, all closed: #40766, #65709, and #8635. #40766 is labeled has repro, and #87647 tracks the auto-closing of such issues.
  • Workaround: run the bundled CLI in VS Code's integrated terminal.

_Drafted by Claude (Anthropic AI assistant)._

View original on GitHub ↗