MCP SSE server: tools/call fails with -32602 despite valid connection and correct schemas
Bug Description
MCP tool calls to a Home Assistant SSE server consistently fail with MCP error -32602: Invalid request parameters, even though:
claude mcp listshows the server as Connected- The Bearer token is valid (HA REST API responds correctly)
- All tools are listed correctly via the server's
tools/list - Direct MCP protocol calls work perfectly (tested via Python)
Environment
- Claude Code version: (current)
- OS: Linux 6.17.0-35-generic
- MCP Server: Home Assistant built-in MCP server v1.26.0
- Transport: SSE (
http://<host>:8123/mcp_server/sse) - Protocol version:
2024-11-05
MCP Server Configuration
Type: sse
URL: http://192.168.2.102:8123/mcp_server/sse
Headers: Authorization: Bearer <token>
Steps to Reproduce
- Add a Home Assistant MCP server via SSE transport:
````
claude mcp add --transport sse homeassistant http://<ha-host>:8123/mcp_server/sse \
--header "Authorization: Bearer <token>"
- Confirm
claude mcp listshows✔ Connected - Call any tool, e.g.
GetDateTime(no required parameters) - Observe error:
MCP error -32602: Invalid request parameters
Direct Protocol Test (Works Fine)
The following Python code calls the same tool via the same endpoint successfully:
import requests, threading, json, time
BASE = "http://192.168.2.102:8123"
HEADERS = {"Authorization": "Bearer <token>"}
messages = []
msg_endpoint = None
def listen_sse():
global msg_endpoint
with requests.get(f"{BASE}/mcp_server/sse", headers={**HEADERS, "Accept": "text/event-stream"}, stream=True, timeout=15) as r:
for line in r.iter_lines(decode_unicode=True):
if line.startswith("data:"):
data = line[5:].strip()
if data.startswith("/"): msg_endpoint = data
elif data:
try: messages.append(json.loads(data))
except: pass
t = threading.Thread(target=listen_sse, daemon=True)
t.start()
time.sleep(1)
# Initialize (required before tool calls)
requests.post(f"{BASE}{msg_endpoint}", headers={**HEADERS, "Content-Type": "application/json"},
json={"jsonrpc": "2.0", "id": 1, "method": "initialize",
"params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1"}}})
time.sleep(0.3)
# Call GetDateTime
requests.post(f"{BASE}{msg_endpoint}", headers={**HEADERS, "Content-Type": "application/json"},
json={"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "GetDateTime", "arguments": {}}})
time.sleep(1)
# Returns: {"result": {"content": [{"type": "text", "text": "{\"success\": true, \"result\": {...}}"}]}}
Hypothesis
Claude Code's MCP client may not be sending the initialize request before tools/call, or may be omitting/malforming the arguments field. The HA MCP server requires a proper initialization handshake before accepting tool calls on an SSE session.
Expected Behavior
Tool calls to a Connected SSE MCP server should succeed.
Actual Behavior
All tool calls return MCP error -32602: Invalid request parameters regardless of tool or parameters.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗