fix(mcp,start): JSON-RPC notifications return 202; no tmux attach
- mcp_post: notifications (no `id` field) → HTTP 202 with empty body, per streamable-HTTP MCP transport spec. Fixes rmcp 'transport channel closed' on codex's notifications/initialized. - start.sh: don't attach to tmux; print URL only. Backend + tmux session run in background. UI is the only viewing surface. - scripts/stop.sh: convenience teardown.
This commit is contained in:
@@ -73,3 +73,28 @@ def test_mcp_wrong_side_blocked(client):
|
||||
})
|
||||
text = r.json()["result"]["content"][0]["text"]
|
||||
assert "not_your_turn" in text
|
||||
|
||||
|
||||
def test_mcp_notification_returns_202_no_body(client):
|
||||
# JSON-RPC notification (no "id" key) MUST return 202 with empty body —
|
||||
# otherwise rmcp (codex's MCP client) treats 200+body as an unexpected
|
||||
# response and closes the transport.
|
||||
r = client.post("/mcp/white", json={
|
||||
"jsonrpc": "2.0", "method": "notifications/initialized", "params": {},
|
||||
})
|
||||
assert r.status_code == 202
|
||||
assert r.content == b""
|
||||
|
||||
|
||||
def test_mcp_batch_with_notification(client):
|
||||
# Batch with one request + one notification — response should contain
|
||||
# only the request's reply.
|
||||
r = client.post("/mcp/white", json=[
|
||||
{"jsonrpc": "2.0", "id": 5, "method": "tools/list", "params": {}},
|
||||
{"jsonrpc": "2.0", "method": "notifications/initialized", "params": {}},
|
||||
])
|
||||
assert r.status_code == 200
|
||||
body = r.json()
|
||||
assert isinstance(body, list)
|
||||
assert len(body) == 1
|
||||
assert body[0]["id"] == 5
|
||||
|
||||
Reference in New Issue
Block a user