Dev

Merged
H3
2mo ago
+2182-173

Summary by cubic

Turns protocol streaming and discovery paths into reliable, bounded operations instead of leaving unsupported generators, unbounded reconnects, or opaque failures. It also tightens endpoint and MCP authentication checks while preserving local loopback development.

Bug Fixes

  • CLI yields completed command results as one chunk; MCP awaits the result; TCP and UDP return proper async generators.
  • MCP reuses one client per server and auth configuration, tracks ownership per calling client, and closes sessions only when no manual still uses them; connection config is built before the client-creation lock, and concurrent OAuth token fetches and session creations are coalesced and shielded from caller cancellation so one request serves all callers. OAuth token state is keyed by the full credential configuration, so manuals that share a client_id but differ in token URL, secret, or scope cannot receive each other's tokens.
  • MCP close() now clears cached OAuth tokens and cancels in-flight fetches so they cannot repopulate the cache on the shared instance.
  • MCP manual OAuth2 now supplies bearer credentials when needed; token endpoints and HTTP/WS server URLs are validated before use, token requests refuse 3xx redirects, and responses whose access_token is not a non-empty visible-ASCII string fail instead of being cached.
  • SSE resumes dropped streams with Last-Event-ID, retries at most 5 times with 60-second delays, and bounds handshakes to 30 seconds; initial failures still fail fast and POST streams are not replayed.
  • SSE parsing handles CRLF and split UTF-8, validates the exact media type, and rejects oversized or malformed frames without reconnecting.
  • Failed HTTP calls, discovery, and streaming paths include bounded server error/message/detail bodies.
  • Remote manuals cannot point tools at loopback services; the check keys off the final post-redirect discovery URL, and manuals discovered from loopback remain allowed.

Dependencies

  • utcp_mcp pins mcp to <2 because mcp 2 removed APIs the plugin uses.
  • Stdio MCP child stderr is suppressed by default; set UTCP_MCP_CHILD_STDERR=inherit to restore it while debugging.
  • utcp-cli, utcp-http, utcp-mcp, and utcp-socket get patch version bumps.