import json

from mcp_server import server


def test_mcp_write_returns_queued_receipt_without_requiring_rest_shape(monkeypatch):
    monkeypatch.setattr(
        server,
        "_post",
        lambda path, body: {
            "queued": True,
            "outbox_id": "env-1",
            "idempotency_key": "statehub-edge:env-1",
            "upstream": "unreachable",
        },
    )

    result = json.loads(server.add_progress_event("queued progress"))

    assert result["queued"] is True
    assert result["tool"] == "add_progress_event"
    assert result["receipt"]["outbox_id"] == "env-1"
