Skip to content

feat: run HTTP tools/call handlers on a dedicated worker task - #7

Merged
abcsnowwolf merged 1 commit into
mainfrom
feat/http-tool-worker
Jul 27, 2026
Merged

feat: run HTTP tools/call handlers on a dedicated worker task#7
abcsnowwolf merged 1 commit into
mainfrom
feat/http-tool-worker

Conversation

@abcsnowwolf

Copy link
Copy Markdown
Contributor
  • execute tools/call on a queue-fed worker task instead of the async_tcp task, so slow or blocking handlers no longer starve the TCP stack or trip the task watchdog
  • deliver results via a deferred chunked response (RESPONSE_TRY_AGAIN); protocol methods, notifications, and transport errors stay inline
  • bound pending calls with MCP_HTTP_JOB_QUEUE_DEPTH (default 4) and answer JSON-RPC -32000 "server busy" when the queue is full
  • manage jobs with an intrusive refcount allocated via new (std::nothrow): allocation failure answers JSON-RPC -32603 / HTTP 500 echoing the request id, in both exception modes, instead of aborting under -fno-exceptions; degrade to inline execution if the worker task cannot be created
  • reject HTTP/1.0 tools/call with 505 instead of trusting the fork-dependent close-delimited fallback behind __has_include
  • extend the ESPAsyncWebServer mock with chunked-response support and add tests: slow handlers, queue overflow, client abort, teardown with in-flight jobs, OOM injection, HTTP/1.0 rejection
  • document the HTTP execution model in the README
  • bump version to 0.3.0 and point examples at ESP-MCP ^0.3.0

* execute tools/call on a queue-fed worker task instead of the async_tcp
  task, so slow or blocking handlers no longer starve the TCP stack or
  trip the task watchdog
* deliver results via a deferred chunked response (RESPONSE_TRY_AGAIN);
  protocol methods, notifications, and transport errors stay inline
* bound pending calls with MCP_HTTP_JOB_QUEUE_DEPTH (default 4) and
  answer JSON-RPC -32000 "server busy" when the queue is full
* manage jobs with an intrusive refcount allocated via new (std::nothrow):
  allocation failure answers JSON-RPC -32603 / HTTP 500 echoing the
  request id, in both exception modes, instead of aborting under
  -fno-exceptions; degrade to inline execution if the worker task cannot
  be created
* reject HTTP/1.0 tools/call with 505 instead of trusting the
  fork-dependent close-delimited fallback behind __has_include
* extend the ESPAsyncWebServer mock with chunked-response support and add
  tests: slow handlers, queue overflow, client abort, teardown with
  in-flight jobs, OOM injection, HTTP/1.0 rejection
* document the HTTP execution model in the README
* bump version to 0.3.0 and point examples at ESP-MCP ^0.3.0
@abcsnowwolf
abcsnowwolf merged commit 9a92c58 into main Jul 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant