Repository navigation
feat: port the hardened HTTP/MCP server and switch to the ESP32Async … - #11
Merged
Merged
Conversation
…forks BREAKING CHANGE: the constructor no longer starts listening. Register every tool, then call begin() once WiFi is connected. Protocol version 2024-11-05 is no longer supported. * replace the archived me-no-dev ESPAsyncWebServer/AsyncTCP with the maintained ESP32Async forks (^3.6.0 / ^3.3.2) * run tools/call on a dedicated FreeRTOS worker task with a deferred chunked reply and a 20 ms inline fast path, so a blocking handler no longer stalls the async_tcp task that services every connection on the device * harden the request path: cap bodies at MCP_HTTP_MAX_BODY_SIZE (413), answer 411 without Content-Length, 415 for non-JSON, 500 on OOM, and 400 on a short body; write chunks by index and clamp clients that overshoot * fix a _tempObject leak on the empty-body path and drop the Serial dump of every request body * reject browser origins that do not name this device by its current IP or its advertised <server-name>.local hostname (403), on every route; matching Origin against Host alone does not survive a DNS rebind * sanitize the mDNS hostname; a server name with spaces produced an invalid DNS label * drop 2024-11-05, which is the deprecated HTTP+SSE transport this server does not implement; negotiate 2025-11-25/2025-06-18/2025-03-26 and reject an unsupported MCP-Protocol-Version header with 400 as the spec requires * stay stateless: no MCP-Session-Id is issued, which the spec permits * add ping, treat notifications as JSON-RPC requires (202, no body), enforce the envelope, and accept any JSON number as an id * return structuredContent and isError; add MCP_OMIT_TEXT_WHEN_STRUCTURED * cache the serialized tools/list body between registrations * serialize responses without a wrapper document, halving peak JSON residency * answer GET/DELETE with 405 + Allow instead of 200 * drop ASYNCWEBSERVER_REGEX from the example: the library tests it with #ifdef, so -D ASYNCWEBSERVER_REGEX=0 enabled regex routing rather than disabling it, costing 266 KB of flash for a server with one fixed path * add native test envs (unity, ASan/UBSan, coverage) with 112 tests at 92.3% line coverage, including a new suite for the Schema builder * add CI: native tests, coverage floor, cppcheck, and an example build against the working tree * declare -std=gnu++17 in library.json; the sources need C++17 * bump to 0.2.0 and refresh the README
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…forks
BREAKING CHANGE: the constructor no longer starts listening. Register every tool, then call begin() once WiFi is connected. Protocol version 2024-11-05 is no longer supported.