Skip to content

MCP: daemon handler crashes on initialize requests (HTTP 500, "Received type number (0)") #1581

Description

@calionauta

Summary

The daemon's MCP handler crashes when handling initialize requests in executor v1.5.40 (linux-arm64), so MCP requests cannot be handled via either documented transport. The internal daemon transport (e.g. POST /executions, GET /tools) works as expected; the issue appears to be isolated to MCP session handling.

Reproduction

# 1) stdio bridge
printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"probe","version":"1.0"}}}' \
  | executor mcp --scope /some/scope --elicitation-mode model
# -> Executor MCP bridge daemon transport error: Streamable HTTP error: Error POSTing to endpoint:

# 2) direct HTTP (with the daemon bearer token)
curl -X POST http://127.0.0.1:4789/mcp \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <daemon token>' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"probe","version":"1.0"}}}'
# -> HTTP 500 {"jsonrpc":"2.0","error":{"code":-32603,"message":"Internal server error"},"id":null}

Daemon error log

[executor] MCP session mode {"clientCapabilities":null,"elicitationSupport":{"form":false,"url":false},"elicitationMode":"model","resumeEnabled":true}
[mcp] handleRequest error: Error: The first argument must be of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type number (0)
    at nNe (/$bunfs/root/main.js:89835:51338)
    at ~effect/Utils/internal (/$bunfs/root/main.js:8:1707)

Observations

  • Crash is independent of payload: reproduced with empty params, with/without capabilities/clientInfo, and with protocolVersion 2024-10-07, 2024-11-05, 2025-06-18.
  • Auth is not the issue: without the bearer token the endpoint returns 401; with it the request reaches the handler and crashes (500).
  • Reproduced on both the default port (4788) and a custom --port; the /mcp route exists in both cases.
  • executor daemon status always reports "Daemon not running at http://localhost:4788" even when a daemon is running on that port (default-port check may be a separate issue).

Environment

  • executor 1.5.40 (linux-arm64), daemon run via executor daemon run --foreground --port 4789

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions