Repository navigation
feat(mcp): add HTTP transport to the MCP server - #378
Conversation
Adds a Streamable HTTP transport alongside stdio, built on the official mcp SDK's StreamableHTTPSessionManager so remote and browser-based MCP clients (including Claude Code's "type": "http" option) can connect without spawning a local subprocess. - Hoist shared tool-dispatch logic from stdio.py into MCPServerBase so both transports stay in sync. - New HttpMCPServer (chunkhound/mcp_server/http_server.py): /health (unauthenticated) + /mcp endpoints, bearer-token auth via raw ASGI middleware (SSE-safe), optional CORS, uvicorn run loop. - CLI: --transport/--host/--port/--auth-token/--cors flags; HTTP mode bypasses the daemon/ClientProxy since it already multiplexes clients. - Refuse to start with a non-loopback --host and no --auth-token. - Bump mcp>=1.16.0; add starlette/uvicorn as direct deps. Co-Authored-By: Claude Sonnet 5 <[email protected]>
AGENTS.md's mcp_http command referenced a nonexistent `mcp http` subcommand; the real invocation uses --transport http. Also add the missing --transport/--host/--port/--auth-token/--cors/--read-only flags to the cli-reference mcp section. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…test cleanup - Skip printing irrelevant stdio launch configs when running in HTTP transport mode, and copy the actually-relevant client config to clipboard - Register CORSMiddleware outermost so it can answer preflight OPTIONS requests before the bearer-auth middleware would otherwise 401 them - Terminate the full descendant process tree in test_smoke's MCP HTTP tests so `uv run`'s child process doesn't leak a locked DB/port on Windows
Enabling --cors without --auth-token let any website open in the same browser read from the MCP HTTP transport via CORS, even on the default loopback host — this is now a validation error at startup, mirroring the existing non-loopback-host check. Adds fast in-process validator tests plus end-to-end smoke coverage for the rejection and the allowed (cors + token) path, and documents the requirement in cli-reference.md.
- Recognize any loopback IP literal (not just exact string match) when validating --host for the HTTP transport, via a new _is_loopback_host helper built on ipaddress.ip_address(...).is_loopback. - Fix the printed client config URL for bind-all hosts (0.0.0.0/::) and bracket IPv6 literals so the copy-pasted config is actually reachable; note when the displayed host was substituted. - Warn instead of silently ignoring --stdio when combined with --transport http. - Avoid re-validating config a second time when the HTTP transport is launched from mcp_command, which already validated it once. - Construct the shared MCP SDK Server object lazily in _register_common_tool_handlers instead of unconditionally in MCPServerBase.__init__, so subclasses whose _register_tools() is a no-op (the daemon) never allocate one. - Harden HTTP smoke tests: fail fast in _wait_for_http_ready if the spawned server process exits early instead of spinning for the full timeout; use the full process-tree terminate (not a bare kill) on the negative-path startup-rejection tests so a regressed validation gate can't leak an orphaned server process; add coverage for CORS preflight and an authenticated CORS request against /mcp itself, not just the auth-exempt /health endpoint. - Extract shared JSON-RPC envelope building/unwrapping and exception types into tests/utils/jsonrpc_envelope.py, reused by both SubprocessJsonRpcClient and HttpMcpClient instead of being duplicated. Co-Authored-By: Claude Sonnet 5 <[email protected]>
VakninAriel
left a comment
There was a problem hiding this comment.
Summary: Well-executed HTTP transport addition with good security defaults and thorough tests; one architectural concern about stateless=False session management, and starlette/uvicorn as hard runtime dependencies deserve consideration.
Strengths
- Security by default: Non-loopback host without
--auth-tokenis refused at startup; CORS requires--auth-tokentoo. The raw-ASGI_BearerAuthMiddleware(SSE-safe, doesn't buffer) is the right approach overBaseHTTPMiddleware. Middleware ordering (CORS outermost) is correct and well-documented. - Solid refactor: Tool-dispatch and list_tools logic hoisted into
MCPServerBase._register_common_tool_handlers()— stdio and HTTP share the same handler code, eliminating drift. Deletion of ~80 lines of duplication fromstdio.py. - Test coverage: 6 new smoke tests cover handshake, health endpoint, bearer auth, startup rejection (non-loopback, CORS-without-token), CORS preflight, and an authenticated CORS request.
HttpMcpClientmirrorsSubprocessJsonRpcClient's API. JSON-RPC envelope helpers factored intojsonrpc_envelope.pyto prevent divergence.
Issues
Major
stateless=False with no session cleanup path (http_server.py:124):
StreamableHTTPSessionManager(stateless=False) maintains per-session state. There's no client disconnect detection, session TTL, or DELETE /mcp handler for session teardown. In a long-running server, every client that abandons without a clean disconnect leaks a session entry. The MCP spec defines DELETE /mcp with Mcp-Session-Id for explicit teardown — worth wiring up or at minimum documenting the leak risk.
Simpler alternative for the initial cut: stateless=True avoids this entirely (reconstruct context on each request); the tradeoff is slightly higher per-request overhead but no leak surface.
starlette and uvicorn as hard runtime deps (pyproject.toml:56-57):
These are now required for all installs, including users who only use stdio transport. Combined with the mcp>=1.16.0 bump, this is a meaningful install-weight increase. Consider making them optional extras (chunkhound[http]) with an import guard for the HTTP path, similar to how the MCP SDK itself is already guarded. (Not strictly blocking, but meaningful for the install story.)
Minor
allow_origins=["*"] with allow_headers=["*"] (http_server.py:161-163):
Combining wildcard origin + wildcard headers works, but note: browsers won't send Authorization in cross-origin requests unless allow_credentials=True is set — and wildcard origin with allow_credentials=True is mutually exclusive per the CORS spec. The current behavior is correct for programmatic clients. Add a comment clarifying that allow_credentials is intentionally omitted (wildcard origin incompatible, and cookie-based auth isn't used here) so a future reader doesn't "helpfully" add it.
_is_loopback_host placement (config.py:370):
This helper is only used in Config.validate_for_command for the MCP case. It fits equally well as a module-level fn in mcp_config.py next to the config it validates — minor placement nit, no functional impact.
Decision: REQUEST CHANGES
Blocking: the stateless=False session-leak concern needs resolution (use stateless=True for initial cut, or add session cleanup + document the behavior). Hard deps on starlette/uvicorn are a strong recommendation to make optional.
…khound#378 review nits Keeps StreamableHTTPSessionManager stateful as requested. DELETE /mcp teardown already worked (the raw-ASGI Route has no method restriction and the MCP SDK handles DELETE itself); documented that behavior instead of adding redundant routing, and added a smoke test proving a terminated session is actually rejected afterward. Also: verified mcp>=1.16.0 already hard-requires starlette/uvicorn unconditionally, so making them optional extras would save no install weight — left them as direct deps with a comment explaining why. Plus smaller review nits: moved _is_loopback_host to mcp_config.py, added port bounds, fixed a stale docstring and a test-utils import path, and documented the /health and CORS allow_credentials tradeoffs. Co-Authored-By: Claude Sonnet 5 <[email protected]>
VakninAriel
left a comment
There was a problem hiding this comment.
All items from the previous review are addressed:
- Session teardown — behavior documented clearly in 's docstring; new smoke test proves a terminated session is rejected (not silently resumed). The upstream SDK characteristic (terminated entries stay in-dict for process lifetime) is noted.
- starlette/uvicorn deps — the
pyproject.tomlcomment makes the reasoning clear:mcp>=1.16.0already unconditionally pulls both in, so an optional extra would save no one an install. - CORS
allow_credentials— explicit comment added explaining why it's intentionally omitted and warning against adding it. is_loopback_hostplacement — moved tomcp_config.pywhere it belongs.- Port bounds —
ge=1, le=65535added.
Code is clean, security defaults are solid, test coverage is thorough. ✅
VakninAriel
left a comment
There was a problem hiding this comment.
All items from the previous review are addressed.
Session teardown: DELETE /mcp behavior documented in _StreamableHttpEndpoint's docstring; new test_mcp_http_session_teardown smoke test proves a terminated session is rejected. The upstream SDK characteristic (terminated entries stay in-dict for process lifetime) is noted.
starlette/uvicorn deps: pyproject.toml comment explains that mcp>=1.16.0 already unconditionally pulls both in, so an optional extra would save no one an install.
CORS allow_credentials: explicit comment added explaining why it is intentionally omitted and warning against adding it.
is_loopback_host placement: moved to mcp_config.py where it belongs.
Port bounds: ge=1, le=65535 added.
Code is clean, security defaults are solid, test coverage is thorough. Approved.
Code Review — PR #378Verdict:
Findings🟠 Previously-flagged concern — Initialization order of
|
RFC 7235 requires it; without it some compliant clients won't automatically retry with credentials. Flagged in PR chunkhound#378 review. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Follow-up Review — All findings addressed ✅Checked the 5 fix commits since the initial review:
Additional improvements spotted in the fix commits (beyond what was flagged):
Reviewed by Ariel Vaknin via Claude Code |
VakninAriel
left a comment
There was a problem hiding this comment.
All findings from the initial review have been addressed across 5 fix commits. The HTTP transport implementation is solid — correct ASGI middleware ordering, SSE-safe auth, proper CORS preflight handling, comprehensive test coverage, and good security defaults. ✅
VakninAriel
left a comment
There was a problem hiding this comment.
Code Review — PR #378
Verdict:
| Severity | Count |
|---|---|
| 🔴 Critical | 0 |
| 🟠 High | 0 |
| 🟡 Medium | 2 |
| 🟢 Minor | 4 |
The overall implementation is solid — the raw ASGI auth middleware, CORS/auth ordering, security guards at startup, psutil process-tree teardown, and the logging note in the module docstring are all done well. The findings below are mostly about test resilience.
Findings
🟡 HttpMcpClient always parses SSE — will break if server returns plain JSON
Location: tests/utils/http_mcp_client.py · _parse_sse_data / send_request
send_request unconditionally calls _parse_sse_data(response.text), which scans for a data: line and raises SubprocessJsonRpcError if not found. The MCP Streamable HTTP spec allows servers to respond with either application/json or text/event-stream. If the SDK ever returns plain JSON (e.g. on a future SDK upgrade or in stateless mode), all tests using HttpMcpClient will fail with a confusing "No SSE data line found" error rather than a meaningful protocol assertion.
Suggested fix:
content_type = response.headers.get("content-type", "")
if "text/event-stream" in content_type:
body = _parse_sse_data(response.text)
else:
body = response.json()
return unwrap_result(body, method)🟡 TOCTOU port race in _get_free_port() can cause flaky tests
Location: tests/test_smoke.py · _get_free_port
_get_free_port() binds an ephemeral port, records it, then releases the socket — all before the spawned server binds it. Under pytest -n auto (parallel workers), a sibling worker or background OS process can grab that port in the window, causing random test timeouts with no clear error message.
Suggested fix:
def _get_free_port() -> int:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(("127.0.0.1", 0))
return sock.getsockname()[1]SO_REUSEADDR substantially narrows the race window so the server can re-bind immediately after the helper socket closes.
🟢 Default port 5173 collides with Vite's dev server
Location: chunkhound/core/config/mcp_config.py · MCPConfig.port
Port 5173 is Vite's well-known default. Developers running ChunkHound alongside a Vite frontend will get a confusing "Address already in use" error with no pointer to the conflict. Consider a less collision-prone default (e.g. 3333 or 8765), or note the known conflict in the CLI help text.
🟢 MCPConfig.__repr__ not updated for new HTTP fields
Location: chunkhound/core/config/mcp_config.py · __repr__
The __repr__ method was not updated to include host, port, auth_token, and cors. Debug logs and config validation error messages won't show the new HTTP settings even when they're the root cause.
Suggested fix:
def __repr__(self) -> str:
parts = [f"transport={self.transport!r}"]
if self.transport == "http":
parts += [
f"host={self.host!r}", f"port={self.port}",
f"auth_token={'<set>' if self.auth_token else None}",
f"cors={self.cors}",
]
return f"MCPConfig({', '.join(parts)})"Note: mask the token value to avoid leaking it into logs.
🟢 SubprocessJsonRpcError name is misleading in HTTP context
Location: tests/utils/jsonrpc_envelope.py
SubprocessJsonRpcError is now the base exception for both subprocess and HTTP clients, but the name implies subprocess-only origin. When HttpMcpClient raises it for a 401 or a missing SSE frame, callers reading the traceback have to look past the misleading class name.
Consider renaming to McpClientError in jsonrpc_envelope.py, keeping the old name as an alias in subprocess_jsonrpc.py's __all__ for backwards compatibility.
🟢 test_mcp_http_session_teardown: assertion doesn't verify 404 on terminated session
Location: tests/test_smoke.py · test_mcp_http_session_teardown
After terminate_session(), the test asserts pytest.raises(SubprocessJsonRpcError) on the follow-up request. That's satisfied by any non-200 response (401, 500, network error), not specifically a 404 from a truly-terminated session. A 500 regression would silently pass.
Suggested fix:
with pytest.raises(SubprocessJsonRpcError) as exc_info:
await client.send_request("tools/list", timeout=5.0)
assert "404" in str(exc_info.value), (
f"Expected 404 for terminated session, got: {exc_info.value}"
)Reviewed by Ariel Vaknin via Claude Code
…port tests Fixes the test-resilience findings from Ariel Vaknin's follow-up review: HttpMcpClient now honors the Content-Type instead of assuming SSE, _get_free_port() sets SO_REUSEADDR to narrow its TOCTOU window, the session-teardown test asserts a 404 specifically, MCPConfig.__repr__ surfaces HTTP fields, and the misleadingly-named SubprocessJsonRpcError is renamed to McpClientError (old name kept as an alias). Co-Authored-By: Claude Sonnet 5 <[email protected]>
VakninAriel
left a comment
There was a problem hiding this comment.
Three small nits — no blockers.
| # already-registered call_tool handler observe the patched behavior — the | ||
| # handler closure below resolves this name from these module globals on | ||
| # every call, not from a value captured once at registration time. | ||
| from .common import first_error_tool_content, handle_tool_call # noqa: E402 |
There was a problem hiding this comment.
🔵 nit: noqa: E402 on from .common import ... is unnecessary — there is no sys.path manipulation above it in this module. The annotation was copied from stdio.py where the imports follow sys.path.insert and E402 genuinely fires. Drop the comment so it doesn't mislead future readers into searching for the (nonexistent) sys.path edit.
| stripped = line.strip() | ||
| if stripped.startswith("data:"): | ||
| return json.loads(stripped[len("data:") :].strip()) | ||
| raise SubprocessJsonRpcError(f"No SSE data line found in response body: {text!r}") |
There was a problem hiding this comment.
🔵 nit: _parse_sse_data raises SubprocessJsonRpcError. This is a pure-HTTP client — no subprocess involved. Technically it's an alias for McpClientError, but using the old name in new HTTP code is semantically misleading. Use McpClientError directly so readers don't wonder what subprocess they're missing.
|
|
||
|
|
||
| def is_loopback_host(host: str) -> bool: | ||
| """True if ``host`` is a loopback address/hostname. |
There was a problem hiding this comment.
🔵 nit: is_loopback_host returns False for any non-IP hostname (e.g. my-internal-server.local), which is correct and conservative but worth calling out in the docstring. A reader might expect hostnames to be resolved and checked against 127.0.0.0/8, not treated as externally-reachable. A brief note — "non-IP hostnames always require auth" — would clarify the boundary.
Rename the misleading SubprocessJsonRpcError alias to McpClientError in the HTTP test client, and clarify is_loopback_host's docstring on non-IP hostnames always requiring auth. Co-Authored-By: Claude Sonnet 5 <[email protected]>
* feat(mcp): add HTTP transport to the MCP server Adds a Streamable HTTP transport alongside stdio, built on the official mcp SDK's StreamableHTTPSessionManager so remote and browser-based MCP clients (including Claude Code's "type": "http" option) can connect without spawning a local subprocess. - Hoist shared tool-dispatch logic from stdio.py into MCPServerBase so both transports stay in sync. - New HttpMCPServer (chunkhound/mcp_server/http_server.py): /health (unauthenticated) + /mcp endpoints, bearer-token auth via raw ASGI middleware (SSE-safe), optional CORS, uvicorn run loop. - CLI: --transport/--host/--port/--auth-token/--cors flags; HTTP mode bypasses the daemon/ClientProxy since it already multiplexes clients. - Refuse to start with a non-loopback --host and no --auth-token. - Bump mcp>=1.16.0; add starlette/uvicorn as direct deps. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs: document MCP HTTP transport flags AGENTS.md's mcp_http command referenced a nonexistent `mcp http` subcommand; the real invocation uses --transport http. Also add the missing --transport/--host/--port/--auth-token/--cors/--read-only flags to the cli-reference mcp section. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(mcp): correct HTTP transport setup output, middleware order, and test cleanup - Skip printing irrelevant stdio launch configs when running in HTTP transport mode, and copy the actually-relevant client config to clipboard - Register CORSMiddleware outermost so it can answer preflight OPTIONS requests before the bearer-auth middleware would otherwise 401 them - Terminate the full descendant process tree in test_smoke's MCP HTTP tests so `uv run`'s child process doesn't leak a locked DB/port on Windows * fix(mcp): require --auth-token when --cors is enabled on HTTP transport Enabling --cors without --auth-token let any website open in the same browser read from the MCP HTTP transport via CORS, even on the default loopback host — this is now a validation error at startup, mirroring the existing non-loopback-host check. Adds fast in-process validator tests plus end-to-end smoke coverage for the rejection and the allowed (cors + token) path, and documents the requirement in cli-reference.md. * fix(mcp): address PR #378 review findings on HTTP transport - Recognize any loopback IP literal (not just exact string match) when validating --host for the HTTP transport, via a new _is_loopback_host helper built on ipaddress.ip_address(...).is_loopback. - Fix the printed client config URL for bind-all hosts (0.0.0.0/::) and bracket IPv6 literals so the copy-pasted config is actually reachable; note when the displayed host was substituted. - Warn instead of silently ignoring --stdio when combined with --transport http. - Avoid re-validating config a second time when the HTTP transport is launched from mcp_command, which already validated it once. - Construct the shared MCP SDK Server object lazily in _register_common_tool_handlers instead of unconditionally in MCPServerBase.__init__, so subclasses whose _register_tools() is a no-op (the daemon) never allocate one. - Harden HTTP smoke tests: fail fast in _wait_for_http_ready if the spawned server process exits early instead of spinning for the full timeout; use the full process-tree terminate (not a bare kill) on the negative-path startup-rejection tests so a regressed validation gate can't leak an orphaned server process; add coverage for CORS preflight and an authenticated CORS request against /mcp itself, not just the auth-exempt /health endpoint. - Extract shared JSON-RPC envelope building/unwrapping and exception types into tests/utils/jsonrpc_envelope.py, reused by both SubprocessJsonRpcClient and HttpMcpClient instead of being duplicated. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(mcp): document DELETE session teardown, address remaining PR #378 review nits Keeps StreamableHTTPSessionManager stateful as requested. DELETE /mcp teardown already worked (the raw-ASGI Route has no method restriction and the MCP SDK handles DELETE itself); documented that behavior instead of adding redundant routing, and added a smoke test proving a terminated session is actually rejected afterward. Also: verified mcp>=1.16.0 already hard-requires starlette/uvicorn unconditionally, so making them optional extras would save no install weight — left them as direct deps with a comment explaining why. Plus smaller review nits: moved _is_loopback_host to mcp_config.py, added port bounds, fixed a stale docstring and a test-utils import path, and documented the /health and CORS allow_credentials tradeoffs. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(mcp): add WWW-Authenticate header on HTTP transport 401 responses RFC 7235 requires it; without it some compliant clients won't automatically retry with credentials. Flagged in PR #378 review. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(mcp): address latest PR #378 review round on HTTP transport tests Fixes the test-resilience findings from Ariel Vaknin's follow-up review: HttpMcpClient now honors the Content-Type instead of assuming SSE, _get_free_port() sets SO_REUSEADDR to narrow its TOCTOU window, the session-teardown test asserts a 404 specifically, MCPConfig.__repr__ surfaces HTTP fields, and the misleadingly-named SubprocessJsonRpcError is renamed to McpClientError (old name kept as an alias). Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(mcp): address final PR #378 review nits on HTTP transport Rename the misleading SubprocessJsonRpcError alias to McpClientError in the HTTP test client, and clarify is_loopback_host's docstring on non-IP hostnames always requiring auth. Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
… meta, and canonical URL support (chunkhound#379) * fix(dot): correct social preview accent dot position cx:597→595 * feat(site): add enterprise architecture proposal page with local-first vs server comparison * feat(site): make social meta tags configurable and add canonical url support * Add green palette CSS variables for shipped/success badge states * Replace manifesto-style path comparison with engineering roadmap on architecture page * Update stale test assertions to match rewritten enterprise roadmap content * Remove dead CSS selectors from enterprise architecture page * Consolidate duplicate HTML test helpers into shared html_helpers.py * ci: split test suite into 2 parallel groups per OS via pytest-split The tests job runs the full 4392-test suite as one serial pytest invocation per OS, with Windows alone budgeting 60 minutes. The suite intentionally avoids -n auto for the full run since daemon/MCP/realtime tests aren't safe to parallelize within one process. Splitting into two independent CI job shards per OS sidesteps that constraint entirely, cutting wall-clock time without touching in-process parallelism. pytest-split balances shards by recorded test duration once a .test_durations baseline exists; until then it falls back to an even per-test-count split (verified 2196/2196 via --collect-only). Co-Authored-By: Claude Sonnet 5 <[email protected]> * ci: keep tests job green when only flaky-annotated tests fail continue-on-error on the pytest step stops a persistent flaky failure from hard-failing the job; the flaky-annotation check remains the real gate and still fails the job on any unannotated failure. * fix(project-detection): make Windows discovery survive CWD==home and locked-down parents (chunkhound#362) * fix(project-detection): make Windows discovery survive CWD==home and locked-down parents Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * test(project-detection): cover walk continuing past ACL-denied ancestor Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> * feat(native): Phase 0 Rust DB writer (chunkhound#375) * feat(native): Phase 0 Rust DB writer with Python benchmark Adds RustDbWriter PyO3 class to chunkhound_native, exposing a batch-oriented DuckDB write path from Rust. Python stays as orchestrator; Rust handles all DB writes via the native extension. Key design points: - Full HNSW invariant compliance: DROP before BEGIN, RECREATE after COMMIT - DDL (ensure_embedding_table) runs outside transactions (Invariant 13) - GIL released via py.allow_threads() for the entire DB operation - Feature flag CHUNKHOUND_USE_RUST=0 disables the Rust path - Crash recovery for .swap_intent files on open() New files: - src/error.rs, src/types.rs — shared error/batch types - src/db/mod.rs — DbBackend trait + DbConfig - src/db/duckdb_backend.rs — DuckDB HNSW-correct implementation - src/db_writer.rs — PyO3 RustDbWriter class - chunkhound/services/pipeline_bridge.py — feature-flag shim - scripts/bench_db_writer.py — Python vs Rust benchmark Benchmark (200 files × 50 chunks × 1536 dims, release build): Python: 102s, 98 chunks/s Rust: 75s, 133 chunks/s → 1.4× faster, 40% less memory Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(bench): bulk-load real DB data and sample files with chunks load_from_db was doing per-file queries and sampling LIMIT 200 from the files table directly, which returned mostly files with 0 chunks (gradle/build files). Fixed to: - One bulk query for files that have at least one chunk - One bulk query for all chunks of sampled files - One bulk query per embedding table for all chunk embeddings - Also fixed CURRENT_TIMESTAMP → now() in ON CONFLICT SET clause Real-data benchmark (quest/mono, 256-dim, 200 files × 14 chunks): Python: 21.7s, 130 chunks/s Rust: 10.7s, 264 chunks/s → 2.0× faster, stable across 3 runs Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(bench): use production batch size heuristic for both Python and Rust paths Mirrors indexing_coordinator._determine_db_batch_size: budgets 10% of available RAM against estimated bytes/file (code + embedding float32 + 512B overhead), clamped to [100, 5000] files/batch. Both run_python_path and run_rust_path now iterate in these batches, preventing the +1.7 GB Rust RSS spike observed when all 10k files were serialized as a single JSON payload. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * feat(bench): add per-batch progress printouts with wall time, CPU%, and RSS Prints a line after each batch for both Python and Rust paths showing files, chunks, embeddings written, elapsed seconds, CPU utilization (computed from getrusage utime+stime delta), and current RSS. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * test(native): add Rust DB writer integration tests; fix 3 DuckDB FK bugs Adds tests/test_rust_db_writer.py with 21 Python tests covering lifecycle, write round-trip, BatchResult schema, upsert idempotency, deletion, compaction counter, all three crash-recovery intent states, HNSW 49-vs-50 boundary, and the CHUNKHOUND_USE_RUST feature flag. Tests exposed three real bugs in duckdb_backend.rs, all matching known DuckDB FK constraint limitations documented in the Python provider: 1. delete_paths ran inside BEGIN/COMMIT — DuckDB rejects parent-row deletes in an explicit transaction after child-row deletes on FK-linked tables. Fixed: delete_paths() extracted and called before BEGIN. 2. upsert_file used ON CONFLICT DO UPDATE — DuckDB internally deletes the conflicting row before reinserting, firing the FK check against chunks that still reference that file_id. Fixed: replaced with SELECT + UPDATE-or-INSERT. 3. Re-indexing a file without existing_file_id left old chunks in place, causing chunk duplication on every write. Fixed: always delete old chunks by path lookup when existing_file_id is not provided. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * feat(bench): add DB row count correctness check after each run Queries the actual DB after Python and Rust writes complete and compares files/chunks/embeddings counts, printing PASS/FAIL per row. Catches reporter bugs (e.g. Python rowcount=-1 on ON CONFLICT DO UPDATE) that the returned write counts miss. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * perf(native): batch embedding inserts 100-rows-per-statement for 3× speedup Replaces per-row stmt.execute() loop (one SQL call per embedding) with multi-row VALUE batching (100 rows per INSERT), cutting round-trips ~100×. Benchmarked at 3.0× speedup on 10k real files vs Python direct path. Also fixes bench rowcount guard (n >= 0) to handle drivers returning -1. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * perf(native): batch path deletes and remove per-batch CHECKPOINT E: Replace per-path DELETE loop (2N SQL calls) with IN-list batching (500 paths/batch), cutting delete round-trips ~500× on re-index runs. F: Remove CHECKPOINT from recreate_hnsw_indexes — it was flushing the WAL after every batch write. CHECKPOINT now only runs in run_compaction and close, yielding a measured 9% throughput improvement. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * perf(native): cache HNSW index DDL to skip per-batch catalog query After the first successful discovery, store the index info on the struct and reuse it for all subsequent batches, avoiding a duckdb_indexes() catalog query on every write_batch call. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * feat(db-writer): implement HNSW bookend protocol (drop once / rebuild once) Replace N×(DROP+CREATE) per-batch HNSW lifecycle with a single drop before the batch loop and a single rebuild after — eliminating per-batch HNSW overhead entirely when bulk-loading. - Add `hnsw_bulk_mode` flag to `DuckDbHnswBackend`; when true, `write_batch` skips the HNSW lifecycle step entirely - Add `drop_all_hnsw_indexes` / `ensure_all_hnsw_indexes` trait methods with default no-ops so existing callers compile unchanged - Expose both as PyO3 `#[pymethods]`; `ensure` releases the GIL via `py.allow_threads()` since HNSW build can take 10–80s - `close()` auto-calls `ensure` as a safety net if bulk mode was never explicitly closed - Wire forwarding methods through `RustWriterBridge` in `pipeline_bridge.py` - Add `_python_ensure_hnsw_indexes` to benchmark for a fair comparison where both paths produce HNSW-equipped databases - Add per-step timing (drop / rebuild / batch writes) to benchmark output Benchmark (4000 files, batch=20, best of 3, real DB): Python: 454.9s (440.4s writes + 14.5s HNSW rebuild) Rust: 215.3s (200.7s writes + 14.6s HNSW rebuild) Speedup: 2.1× overall; HNSW rebuild cost identical between paths Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(db-writer): delete orphaned embeddings before chunk/file deletes embeddings_N tables have no FK cascade from chunks, so deleting chunks without first deleting their embeddings caused ghost embedding rows to accumulate on every re-index. Ghost rows participate in HNSW searches and silently corrupt recall quality. Two call sites fixed: - delete_paths(): deletes embeddings via subquery before chunk delete, batched in the same 500-path chunks as the existing path delete - write_batch_txn(): per-file pre-delete loop now clears embeddings before chunks for both the existing_file_id and path-lookup branches discover_embedding_tables() is called once per function call (not per file/batch) to avoid repeated catalog queries. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * perf(native): batch chunk staging inserts 100-rows-per-statement The per-file chunk insert loop in insert_chunks_for_file was issuing one SQL round-trip per chunk (K+3 round-trips per file), violating Invariant 5 and regressing against the Python path which uses executemany. Replace the single-row stmt.execute() loop with the same multi-row VALUES batching already used by insert_embeddings_txn: build a (?,?,?,?,?,?,?,?,?,?) placeholder string for up to 100 rows at a time and bind all params via params_from_iter. For a typical file with 17 chunks this cuts the temp-table staging from 17 round-trips to 1. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * perf(native): extract batch via PyO3 directly — eliminate json.dumps round-trip Replace json.dumps(batch) → String → serde_json::from_str with direct PyO3 extraction of the Python dict. At 20 files × 17 chunks × 1536-dim embeddings per batch, this eliminates ~4MB of JSON generation+parsing per call, or ~800MB across a 4000-file session (200 batches). The embedding Vec<f32> is now extracted natively from Python list[float] via PyO3 — no intermediate string representation. The GIL is still released before the DuckDB writes via allow_threads; extract_batch() runs inside the GIL where the Python objects are still valid. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * perf(native): batch pre-delete IN-list per group — eliminate N statements per batch (PF-3) Replace per-file DELETE loop in write_batch_txn with two grouped IN-list statements: files with existing_file_id use BigInt IN-list; path-only files use Text IN-list with subquery. Reduces 2×N statements per batch to 4 statements total (2 groups × 2 tables). Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * perf(native): skip SELECT in upsert_file when existing_file_id is known (PF-4) When the caller already has a valid file_id (incremental re-indexing), jump straight to UPDATE and return the id — saves one SELECT round-trip per file. Falls through to SELECT → INSERT/UPDATE if the id is stale (e.g., benchmark replay into a fresh DB). Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Revert "perf(native): skip SELECT in upsert_file when existing_file_id is known (PF-4)" This reverts commit 9bacbaa. * fix(native): resolve 7 critical blockers from PR review - Remove `unsafe impl Send for WriterInner` — violates #![forbid(unsafe_code)] and is unnecessary since DbBackend: Send makes Box<dyn DbBackend> Send - Propagate HNSW recreate errors after COMMIT (was silently `let _ =`) - Replace assert guards with RuntimeError in pipeline_bridge.py — asserts are stripped by python -O - Wrap open/close/drop_all_hnsw_indexes in py.allow_threads() — DDL can block 100ms+ and must not hold the GIL - Guard RustDbWriter re-export in chunkhound_native/__init__.py with try/except ImportError so scan_files still works on older wheels - Add __del__ to RustWriterBridge to close the Rust DuckDB connection on GC — prevents single-writer lock leak when caller raises before finalize() - Reset hnsw_bulk_mode=false at entry of ensure_all_hnsw_indexes so any error path leaves bulk mode off (previously only reset on success path) Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(native): resolve 13 PR review findings in RustDbWriter - Replace all .unwrap() on Mutex at PyO3 boundary with .unwrap_or_else(|e| e.into_inner()) to avoid interpreter crash on mutex poison (C1) - Use .expect("reason") for logically-unreachable conn/embedding unwraps (C2, C3) - Add schema_version table to setup_schema for Python compaction round-trip compatibility (M1) - Rename HNSW indexes to idx_hnsw_{dims} matching Python canonical convention (M2) - Fix swap_intent/old path construction for chunks.db extension — replace set_extension() with format!() (M3) - Add table_schema = 'main' filter in discover_embedding_tables (M5) - Wrap needs_compaction in py.allow_threads (m1) - Restore deleted gitignore normalization comment in scan_files (m2) - Clarify FK delete-outside-transaction comment (m3) - Remove unsafe __del__; add __enter__/__exit__ context manager (m4) - Convert _USE_RUST module constant to _get_use_rust() function (m5) - Export RustDbWriter cleanly (no None sentinel) in chunkhound_native - Add .db-extension swap_intent regression test; rewrite feature flag tests to use monkeypatch.setenv without importlib.reload Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(native): fix HNSW cache staleness + drop bundled DuckDB compile Two correctness/CI fixes identified in PR review: 1. HNSW cache staleness: when a new embedding dimension was introduced mid-session the per-batch bookend only managed pre-existing indexes, leaving the new embeddings_N table without an HNSW index permanently. Fix tracks known_dims per session (primed on open()), invalidates hnsw_cache on new dims, and creates idx_hnsw_{dims} post-commit for each genuinely new table (Step 5+). Regression test added. 2. Bundled DuckDB compile: features = ["bundled"] compiled DuckDB C++ from source on every clean build (~15-30 min in CI). Dropped in favour of DUCKDB_DOWNLOAD_LIB=1, which pulls a precompiled libduckdb .so from the official GitHub release for the exact crate-matched DuckDB version (v1.5.4). URLs verified live (HTTP 200 + ZIP magic bytes confirmed). CI gains a separate target/duckdb-download/ cache keyed on Cargo.lock so zip survives unrelated dep bumps. Also fixes 7 pre-existing clippy warnings (repeat_n, type_complexity, redundant_closure) and applies rustfmt to the whole file. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(native): address remaining PR review minor issues - Remove hasattr guards in RustWriterBridge (RustDbWriter always has drop_all_hnsw_indexes and ensure_all_hnsw_indexes) - Add Phase 0/TODO(Phase 1) comment to run_compaction - Quote table names consistently in ensure_embedding_table_dims and insert_embeddings_txn (matching the quoting style in delete/HNSW paths) - Add TODO(Phase 1) comment on discover_embedding_tables inside write_batch_txn - Document RustWriterBridge as Phase 0 with wiring into IndexingCoordinator as explicit Phase 1 work Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(native): address PR review findings — schema parity + clippy + minor fixes - setup_schema: add idx_files_language, idx_chunks_type, idx_chunks_symbol to match Python canonical schema (schema_constants.py) - ensure_embedding_table_dims: add idx_{dims}_chunk_id (with 1536 legacy compat) and idx_{dims}_provider_model so Rust-created DBs match Python-created ones; chunk_id index is required for performant delete subqueries - write_batch_txn: add inline comment to #[allow(clippy::type_complexity)] per AGENTS.md rule - close(): surface ensure_all_hnsw_indexes and CHECKPOINT errors via eprintln! instead of silently dropping them - hnsw_cache: cache empty discovery result (Some(vec![])) to avoid re-querying the catalog every batch when no HNSW indexes exist yet - pipeline_bridge: document intentional no-op semantics of HNSW bookend methods - chunkhound_native/__init__.py: replace bare pass with RustDbWriter = None stub Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(native): fix schema DDL triplication + pipeline_bridge dead-code note - Add TestSchemaParity test that cross-checks Rust-created column names against schema_constants.py at CI time — catches drift between duckdb_backend.rs::setup_schema and the Python canonical source - Derive bench_db_writer.py _CREATE_SCHEMA from schema_constants.py (_FILES_TABLE_COLUMNS / _CHUNKS_TABLE_COLUMNS) instead of a third hardcoded DDL copy - Fix schema_version description from 'initial schema (rust writer)' to 'Initial schema' to match Python's insert - Add SCHEMA PARITY comment block above setup_schema directing maintainers to schema_constants.py as canonical source - Clarify RustWriterBridge docstring: intentionally unwired in Phase 0, Phase 1 targets SerialDatabaseExecutor Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(native): address PR review findings — MSRV, extension NULL, schema type parity, bench portability - Cargo.toml: add rust-version = "1.82" (repeat_n MSRV) so older toolchains get a clear error - duckdb_backend.rs: store NULL (not "") for extension on extensionless files, matching the nullable column - test_rust_db_writer.py: add TestSchemaParity::test_column_types_match_python_schema — creates a reference DB from Python canonical DDL and compares data_type via information_schema, catching type/constraint drift that the column-names-only test cannot detect - bench_db_writer.py: guard `import resource` with try/except for Windows portability; replace all resource.getrusage() call sites with a _getrusage() helper that returns zero values on Windows Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(native): address PR review findings — close() propagation, ergonomics, co-location - close() now propagates ensure_all_hnsw_indexes / CHECKPOINT errors instead of swallowing them with eprintln; connection is always dropped regardless - Document delete_paths atomicity gap and self-healing recovery in write_batch - needs_compaction: &mut self → &self in trait and impl - write_batch_txn renamed to write_batch_inner with clarifying comment - BatchInner named struct replaces #[allow(clippy::type_complexity)] tuple return - conn_or_err() helper eliminates 5 repeated ok_or_else("not open") chains - RustDbWriter::new() uses direct PyO3 extract_req/extract_opt — no json round-trip - bench_db_writer: _create_embedding_table delegates to schema_constants helpers - pipeline_bridge.py moved to chunkhound/providers/database/ next to serial_executor - AGENTS.md: document local (air-gapped) and CI maturin develop build procedures Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * docs(native): fix air-gapped build instructions in AGENTS.md Use $(pwd) in the find command so OUT is always an absolute path — the relative-path form produced a broken symlink target. Also add RUSTFLAGS=-C link-arg=-lstdc++ (required for static DuckDB) and explain why (__gxx_personality_v0 lives in libstdc++.so). Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(native): address remaining PR review issues — atomicity, FK safety, docs - delete_paths: split into two commits (emb+chunks atomic, then files auto-commit) so DuckDB's FK check sees the committed chunk deletes before the parent-row DELETE; wrapping all three in one txn caused a spurious FK constraint error because DuckDB reads committed state, not in-progress transaction state. - pre_delete_for_upsert (new): extract upsert pre-deletes from write_batch_inner and run them before BEGIN for the same reason — UPDATE on files inside a txn where child chunks were deleted earlier in that same txn was rejected by DuckDB's FK engine. Fixes test_upsert_idempotent_no_duplication and test_upsert_replaces_chunks. - tests: quote table name in _count() helper to prevent SQL injection. - pipeline_bridge.py: document the intentional error-behaviour asymmetry between write_batch/needs_compaction/run_compaction (raise RuntimeError when unavailable) and drop/ensure_all_hnsw_indexes (silent no-op). - duckdb_backend.rs: expand TODO(Phase 1) comment to explain why caching emb_tables is non-trivial (new dims can appear mid-session). - Cargo.toml: add comment explaining that build mode is env-var-driven, not feature-flag-driven (duckdb default-features = []). Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * style(native): apply cargo fmt to fix CI formatting check Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * ci: move Rust checks into a parallel job to unblock Python test budget cargo fmt, clippy, and cargo test were bundled in the `tests` job, consuming up to 15 min of its 30-min budget before pytest even started. The new `rust-checks` job runs these in parallel on ubuntu+macos, with no `needs` dependency, so it starts immediately and doesn't gate pytest. `maturin develop` stays in `tests` since Python tests need the native .so. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * ci: remove invalid job-level hashFiles guard from rust-checks hashFiles() is only available in step-level if expressions, not job-level. Cargo.toml is permanent in this repo so the guard is unnecessary anyway. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * test: update pages-artifact needs contract to include rust-checks Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(rust-db-writer): address PR chunkhound#375 review findings - Crash recovery: call ensure_all_hnsw_indexes() in open() so HNSW indexes lost between Step 2 (DROP) and Step 5 (RECREATE) are rebuilt on the next session instead of silently falling back to brute-force scan - Log VSS load failures at debug level instead of swallowing them silently - Extract compaction_batch_threshold directly as u32, removing the u64→u32 silent truncation cast - Add Phase 1 caching TODO to delete_paths to match pre_delete_for_upsert - Fix typo: db_writter → db_writer in pipeline_bridge.py docstring Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(rust-db-writer): address PR chunkhound#375 review — atomicity gap doc, finalize error level, const hoist, __enter__ guard * fix(native): address PR chunkhound#375 review — try_load_vss warn level + HNSW crash-recovery test - Upgrade try_load_vss failure log from debug! to warn! so VSS degradation is visible at default RUST_LOG levels. - Add test_hnsw_crash_recovery_restores_missing_indexes: simulates crash between write_batch Step 2 (DROP HNSW) and Step 5 (RECREATE) then verifies open() restores missing HNSW indexes. * feat(native): 3-phase EXPORT/IMPORT atomic compaction with two-signal fragmentation detection Replace CHECKPOINT-only compaction with a full EXPORT/IMPORT atomic swap: - Phase 1: EXPORT DB to Parquet, CHECKPOINT, close connection - Phase 2: fsynced intent markers, rename old DB, IMPORT into fresh DB, rebuild HNSW indexes - Phase 3: atomic rename of compacted DB to active path, cleanup Add two-signal fragmentation detection (compaction_stats): - free_ratio from pragma_database_size - row_waste_ratio from pragma_storage_info vs live COUNT(*) - Falls back to write-count threshold when stats unavailable Crash recovery via intent markers (pre-swap/phase1/phase2) that restore the original DB if compaction is interrupted. New DbConfig fields: compaction_threshold (default 0.30), compaction_min_size_bytes (default 50MB), wired from Python via compaction_min_size_mb. * fix(native): remove trailing blank line (cargo fmt) --------- Co-authored-by: Hanan Kavitz <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]> * feat(config): make DB execute timeout configurable via JSON/env/CLI (chunkhound#377) Lift serial executor timeout into DatabaseConfig so it can be set from .chunkhound.json, CHUNKHOUND_DATABASE__EXECUTE_TIMEOUT_SECONDS, CLI --db-execute-timeout, or the legacy CHUNKHOUND_DB_EXECUTE_TIMEOUT env var, instead of only a runtime os.getenv in the executor. * feat(mcp): add HTTP transport to the MCP server (chunkhound#378) * feat(mcp): add HTTP transport to the MCP server Adds a Streamable HTTP transport alongside stdio, built on the official mcp SDK's StreamableHTTPSessionManager so remote and browser-based MCP clients (including Claude Code's "type": "http" option) can connect without spawning a local subprocess. - Hoist shared tool-dispatch logic from stdio.py into MCPServerBase so both transports stay in sync. - New HttpMCPServer (chunkhound/mcp_server/http_server.py): /health (unauthenticated) + /mcp endpoints, bearer-token auth via raw ASGI middleware (SSE-safe), optional CORS, uvicorn run loop. - CLI: --transport/--host/--port/--auth-token/--cors flags; HTTP mode bypasses the daemon/ClientProxy since it already multiplexes clients. - Refuse to start with a non-loopback --host and no --auth-token. - Bump mcp>=1.16.0; add starlette/uvicorn as direct deps. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs: document MCP HTTP transport flags AGENTS.md's mcp_http command referenced a nonexistent `mcp http` subcommand; the real invocation uses --transport http. Also add the missing --transport/--host/--port/--auth-token/--cors/--read-only flags to the cli-reference mcp section. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(mcp): correct HTTP transport setup output, middleware order, and test cleanup - Skip printing irrelevant stdio launch configs when running in HTTP transport mode, and copy the actually-relevant client config to clipboard - Register CORSMiddleware outermost so it can answer preflight OPTIONS requests before the bearer-auth middleware would otherwise 401 them - Terminate the full descendant process tree in test_smoke's MCP HTTP tests so `uv run`'s child process doesn't leak a locked DB/port on Windows * fix(mcp): require --auth-token when --cors is enabled on HTTP transport Enabling --cors without --auth-token let any website open in the same browser read from the MCP HTTP transport via CORS, even on the default loopback host — this is now a validation error at startup, mirroring the existing non-loopback-host check. Adds fast in-process validator tests plus end-to-end smoke coverage for the rejection and the allowed (cors + token) path, and documents the requirement in cli-reference.md. * fix(mcp): address PR chunkhound#378 review findings on HTTP transport - Recognize any loopback IP literal (not just exact string match) when validating --host for the HTTP transport, via a new _is_loopback_host helper built on ipaddress.ip_address(...).is_loopback. - Fix the printed client config URL for bind-all hosts (0.0.0.0/::) and bracket IPv6 literals so the copy-pasted config is actually reachable; note when the displayed host was substituted. - Warn instead of silently ignoring --stdio when combined with --transport http. - Avoid re-validating config a second time when the HTTP transport is launched from mcp_command, which already validated it once. - Construct the shared MCP SDK Server object lazily in _register_common_tool_handlers instead of unconditionally in MCPServerBase.__init__, so subclasses whose _register_tools() is a no-op (the daemon) never allocate one. - Harden HTTP smoke tests: fail fast in _wait_for_http_ready if the spawned server process exits early instead of spinning for the full timeout; use the full process-tree terminate (not a bare kill) on the negative-path startup-rejection tests so a regressed validation gate can't leak an orphaned server process; add coverage for CORS preflight and an authenticated CORS request against /mcp itself, not just the auth-exempt /health endpoint. - Extract shared JSON-RPC envelope building/unwrapping and exception types into tests/utils/jsonrpc_envelope.py, reused by both SubprocessJsonRpcClient and HttpMcpClient instead of being duplicated. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(mcp): document DELETE session teardown, address remaining PR chunkhound#378 review nits Keeps StreamableHTTPSessionManager stateful as requested. DELETE /mcp teardown already worked (the raw-ASGI Route has no method restriction and the MCP SDK handles DELETE itself); documented that behavior instead of adding redundant routing, and added a smoke test proving a terminated session is actually rejected afterward. Also: verified mcp>=1.16.0 already hard-requires starlette/uvicorn unconditionally, so making them optional extras would save no install weight — left them as direct deps with a comment explaining why. Plus smaller review nits: moved _is_loopback_host to mcp_config.py, added port bounds, fixed a stale docstring and a test-utils import path, and documented the /health and CORS allow_credentials tradeoffs. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(mcp): add WWW-Authenticate header on HTTP transport 401 responses RFC 7235 requires it; without it some compliant clients won't automatically retry with credentials. Flagged in PR chunkhound#378 review. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(mcp): address latest PR chunkhound#378 review round on HTTP transport tests Fixes the test-resilience findings from Ariel Vaknin's follow-up review: HttpMcpClient now honors the Content-Type instead of assuming SSE, _get_free_port() sets SO_REUSEADDR to narrow its TOCTOU window, the session-teardown test asserts a 404 specifically, MCPConfig.__repr__ surfaces HTTP fields, and the misleadingly-named SubprocessJsonRpcError is renamed to McpClientError (old name kept as an alias). Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(mcp): address final PR chunkhound#378 review nits on HTTP transport Rename the misleading SubprocessJsonRpcError alias to McpClientError in the HTTP test client, and clarify is_loopback_host's docstring on non-IP hostnames always requiring auth. Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]> * fix: update MCP transport label to show stdio and HTTP * fix: update HTTP MCP notes to reflect native transport * fix: add phase numbering to roadmap cards (LSM-Vec) * fix: improve contrast of loser cells in comparison table * refactor: extract shared meta_tag_content helper to html_helpers * fix: correct false 4.4x speedup and 256-dim claims * fix: add phase numbering to roadmap cards * fix: clarify overstated gap claims (DB deps, gap 5) * fix: prevent mobile overflow on gap grid below 480px * chore: add site/test-results to gitignore * chore: prettier reformat enterprise architecture page * docs: decompose Phase 2 into index/executor cards, sharpen post-Phase-2 server vision * Replace vague thesis with concrete mechanism * Clarify stateless HTTP MCP deployment requires session work * Add concrete distribution mechanism with generic HTTP endpoints * Fix stale aria-labelledby reference * Correct stale scale note numbers --------- Co-authored-by: Hanan Kavitz <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: e91d82c73 <[email protected]> Co-authored-by: HananKavitzAmat <[email protected]> Co-authored-by: Hanan Kavitz <[email protected]> Co-authored-by: Robert Gero <[email protected]>
Adds a Streamable HTTP transport alongside stdio, built on the official mcp SDK's StreamableHTTPSessionManager so remote and browser-based MCP clients (including Claude Code's "type": "http" option) can connect without spawning a local subprocess.