When registering a remote MCP server programmatically using the vscode.cursor.mcp.registerServer() API with RemoteServerConfig, the headers field is silently ignored. Headers such as Authorization and custom
headers (e.g. X-API-Key) are never sent to the MCP server.
Root Cause & Upstream Fix:
I believe this issue was caused by an upstream bug in VS Code’s MCP implementation. The identical issue was reported and resolved in VS Code:
Observe that the MCP server receives no Authorization or custom headers in incoming requests.
Expected Behavior
All headers specified in RemoteServerConfig should be included in requests to the remote MCP server, as documented in the MCP Extension API Reference (MCP Extension API Reference | Cursor Docs).
Hey, thanks for the detailed report and for finding the root cause in VS Code.
A couple quick questions to narrow it down:
Do you see the same issue if you set up the remote MCP server via .cursor/mcp.json with headers, instead of using the extension API? This will help us tell if it’s specific to registerServer() or if it affects the MCP client more broadly.
Did you confirm the headers were missing by checking the actual network traffic, like with a proxy or server logs?
Let me know what you find with the config file test. It’ll help clarify how widespread this is.
Yes. I tried the same extension code with VS Code itself. It is able to send the headers:
```
DEBUG [6d75e5e6] → POST /mcp
Request Headers:
{
“host”: “127.0.0.1:62603”,
“connection”: “keep-alive”,
“authorization”: “Bearer ….”,
“content-type”: “application/json”,
“accept”: “text/event-stream, application/json”,
“user-agent”: “Visual Studio Code/1.108.2”,
“accept-language”: “*”,
“sec-fetch-mode”: “cors”,
“accept-encoding”: “gzip, deflate”,
“content-length”: “351”
}
```
Your diagnosis is spot on. This is tied to an upstream VS Code fix that hasn’t been merged into our fork yet. The fact that .cursor/mcp.json works but registerServer() doesn’t confirms the issue is isolated to the extension API path.
The team is aware. There’s no ETA for bringing in the upstream fix, but your report, especially the network log comparison, helps us prioritize it.
For now, the workaround is to use .cursor/mcp.json for remote servers that need headers, as you already confirmed, it works.
Since headers like Authentication change on every extension run and we want to keep them in memory (without writing to a file), I can’t consider using .cursor/mcp.json as a workaround. That said, I understand, and we’ll wait for the upstream fix from your side.
Nothing has changed yet. The bug is logged and the team is aware. The upstream fix in VS Code has been available for a while, but it still hasn’t been merged into our fork. Sadly, I can’t share an ETA.
@alperen, I see your workaround using request params. That works if you control the server. If you don’t, .cursor/mcp.json is still the only option, but it has limits with dynamic tokens.
@realark, for now it’s still the same two options:
.cursor/mcp.json with headers, works but tokens are static
Request params in the URL, if you control the MCP server