Closed
Description
What happened?
Cline is overriding all headers defined in the config.
Version: v3.16.2
My MCP Server config for home assistant
{
"mcpServers": {
"hass": {
"url": "http://192.168.5.131:8123/mcp_server/sse",
"headers": {
"Authorization": "Bearer my-token-here",
"Accept": "text/event-stream",
"User-Agent": "Cline"
},
"disabled": false,
"autoApprove": []
}
}
}
How my LLM interpreted the TCPDUMP from my home assistnat container:
Root Cause Analysis
From your tcpdump
outputs, it's clear that Cline is ignoring your configured headers and overriding them with its own defaults. Here's the smoking gun:
- Your Config Specifies:
"headers": { "Authorization": "Bearer ...", "Accept": "text/event-stream", "User-Agent": "Cline" }
- Actual Headers Sent by Cline (from
tcpdump
):MissingGET /mcp_server/sse HTTP/1.1 host: 192.168.5.131:8123 connection: keep-alive Accept: text/event-stream # Matches your config accept-language: * # Added by Cline sec-fetch-mode: cors # Added by Cline user-agent: node # Overrides your "Cline" User-Agent pragma: no-cache # Added by Cline cache-control: no-cache # Added by Cline accept-encoding: gzip, deflate # Added by Cline
Authorization
header entirely! This explains the401 Unauthorized
failure.
======================================================
This is contrary to documentation provided here: https://docs.cline.bot/mcp/configuring-mcp-servers
Example given:
{
"mcpServers": {
"remote-server": {
"url": "https://your-server-url.com/mcp",
"headers": {
"Authorization": "Bearer your-token"
},
"alwaysAllow": ["tool3"],
"disabled": false
}
}
}
I can also confirm that my home assistant mcp server works fine:
$ curl -X GET -H "Authorization: Bearer my-token-here" -H "Content-Type: application/json" "http://192.168.5.131:8123/mcp_server/sse" -v
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 192.168.5.131:8123...
* Connected to 192.168.5.131 (192.168.5.131) port 8123
> GET /mcp_server/sse HTTP/1.1
> Host: 192.168.5.131:8123
> User-Agent: curl/8.5.0
> Accept: */*
> Authorization: Bearer my-token-here
> Content-Type: application/json
>
< HTTP/1.1 200 OK
< Content-Type: text/event-stream
< Cache-Control: no-cache
< Connection: keep-alive
< X-Accel-Buffering: no
< Transfer-Encoding: chunked
< Date: Wed, 21 May 2025 04:28:25 GMT
< Server: Python/3.13 aiohttp/3.11.18
<
event: endpoint
data: /mcp_server/messages/01JVRHK2PWBY9XKB3EE40AJ95Q
================================================================
Steps to reproduce
{
"mcpServers": {
"hass": {
"url": "http://192.168.5.131:8123/mcp_server/sse",
"headers": {
"Authorization": "Bearer my-token-here",
"Accept": "text/event-stream",
"User-Agent": "Cline"
},
"disabled": false,
"autoApprove": []
}
}
}
Relevant API REQUEST output
TCPDUMP output:
$ sudo tcpdump -i any src 192.168.2.110 and port 8123 -A
tcpdump: data link type LINUX_SLL2
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
04:19:17.348733 eth0 In IP 192.168.2.110.41192 > home-assistant-0.home-assistant.home.svc.cluster.local.8123: Flags [S], seq 3612003611, win 64240, options [mss 1460,sackOK,TS val 2576376427 ecr 0,nop,wscale 7], length 0
G..D.>@.>.:....n
E ..............J.....................
..bk........
04:19:17.349418 eth0 In IP 192.168.2.110.41192 > home-assistant-0.home-assistant.home.svc.cluster.local.8123: Flags [.], ack 2261251531, win 502, options [nop,nop,TS val 2576376428 ecr 3610428088], length 0
E..4.?@.>......n
E ......J..........&R.....
..bl.2..
04:19:17.350638 eth0 In IP 192.168.2.110.41192 > home-assistant-0.home-assistant.home.svc.cluster.local.8123: Flags [P.], seq 0:244, ack 1, win 502, options [nop,nop,TS val 2576376429 ecr 3610428088], length 244
E..(.@@.>......n
E ......J.................
..bm.2..GET /mcp_server/sse HTTP/1.1
host: 192.168.5.131:8123
connection: keep-alive
Accept: text/event-stream
accept-language: *
sec-fetch-mode: cors
user-agent: node
pragma: no-cache
cache-control: no-cache
accept-encoding: gzip, deflate
04:19:17.353573 eth0 In IP 192.168.2.110.41192 > home-assistant-0.home-assistant.home.svc.cluster.local.8123: Flags [.], ack 230, win 501, options [nop,nop,TS val 2576376432 ecr 3610428092], length 0
E..4.A@.>......n
E ......J..........$r.....
..bp.2..
04:19:17.353583 eth0 In IP 192.168.2.110.41192 > home-assistant-0.home-assistant.home.svc.cluster.local.8123: Flags [.], ack 247, win 501, options [nop,nop,TS val 2576376432 ecr 3610428092], length 0
E..4.B@.>......n
E ......J..........$a.....
..bp.2..
04:19:21.355322 eth0 In IP 192.168.2.110.41192 > home-assistant-0.home-assistant.home.svc.cluster.local.8123: Flags [F.], seq 244, ack 247, win 501, options [nop,nop,TS val 2576380433 ecr 3610428092], length 0
E..4.C@.>......n
E ......J.................
..r..2..
04:19:21.356656 eth0 In IP 192.168.2.110.41192 > home-assistant-0.home-assistant.home.svc.cluster.local.8123: Flags [.], ack 248, win 501, options [nop,nop,TS val 2576380435 ecr 3610432095], length 0
E..4.D@.>......n
E ......J.................
..r..2._
Provider/Model
deepseek-v3
Operating System
VSCode Windows, Home-assistant containized
System Info
Not relevant
Cline Version
3.16.2
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels