Skip to content

docs(proposals): VEP-0004 — HTTP transport for vouch serve (draft) - #104

Merged
plind-junior merged 4 commits into
vouchdev:testfrom
dripsmvcp:fix/94-http-transport-vep
Jun 4, 2026
Merged

docs(proposals): VEP-0004 — HTTP transport for vouch serve (draft)#104
plind-junior merged 4 commits into
vouchdev:testfrom
dripsmvcp:fix/94-http-transport-vep

Conversation

@dripsmvcp

@dripsmvcp dripsmvcp commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds VEP-0004 (draft) proposing an HTTP transport for vouch serve (--transport http), per the project process that requires a written, maintainer-accepted proposal before any code for a new transport (feat: HTTP transport for vouch serve (--transport http) [VEP] #94 is tagged [VEP]).
  • No implementation — this PR is the design record only. Indexed in proposals/README.md as draft.

Why a VEP and not a code PR

proposals/README.md requires a VEP for "any new transport," reviewed and marked accepted before implementation. HTTP transport qualifies, so this opens the design for discussion rather than shipping a server.

What the VEP proposes

  • vouch serve --transport http [--host 127.0.0.1] [--port …] [--token …] [--allow-public], reusing the existing shared _handle_request dispatch table (same kb.* surface as MCP/JSONL — no new methods).
  • POST /rpc carrying the same JSONL envelope as VEP-0002; plus unauthenticated GET /capabilities and GET /healthz.
  • Safe by default: binds 127.0.0.1; refuses any non-loopback bind unless --allow-public and a bearer token are set. Constant-time token compare, no TLS in-process (reverse-proxy terminates), CORS denied. The review gate is unchanged.
  • Zero new runtime dependencies (stdlib http.server).

Open questions for reviewers (in the VEP)

  • Bespoke JSONL-over-HTTP vs MCP streamable-HTTP (the issue mentions a future Claude plugin) — leaning JSONL-first.
  • Default port; per-method (read vs write) authz; whether host/port/token belong in config.yaml.

Test Plan

  • N/A — documentation only (no code paths changed)
  • Adds proposals/VEP-0004-http-transport.md (status draft) and the index row in proposals/README.md

Refs #94 (implementation lands in separate PRs once/if the VEP is accepted)

Summary by CodeRabbit

Release Notes

  • New Features

    • Added HTTP transport (vouch serve --transport http) exposing RPC, capabilities, and health check endpoints
    • Configurable host, port, bearer token authentication, and optional public binding
    • Default localhost-only binding with secure opt-in for remote access
  • Documentation

    • HTTP transport specification added to official documentation
    • HTTP transport proposal (VEP-0004) documented

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 566ff2af-262b-40ae-9bc1-ff1821c03d7b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR introduces an HTTP transport for the Vouch knowledge base via vouch serve --transport http. The implementation adds a threaded HTTP server exposing the existing kb.* dispatch surface over three endpoints: POST /rpc (with bearer-token auth), GET /healthz, and GET /capabilities. The server binds to localhost by default and refuses public binds without both --allow-public and a configured token. Request-scoped actor attribution via the X-Vouch-Agent header flows through context variables into audit logs.

Changes

HTTP Transport Feature

Layer / File(s) Summary
Request-scoped actor attribution infrastructure
src/vouch/jsonl_server.py
ContextVar _actor and updated _agent() function enable per-request actor tracking without process-wide state mutation, allowing HTTP and other transports to set audit actor per request.
HTTP transport server implementation
src/vouch/http_server.py
Threaded HTTP server implements /rpc (JSONL envelope dispatch, optional bearer-token auth), /healthz (unauthenticated), and /capabilities (unauthenticated). Enforces loopback-by-default bind policy and strict Content-Length validation. Sets request actor via context for audit trail.
CLI integration for HTTP transport
src/vouch/cli.py
The serve command adds HTTP transport option with --host, --port, --token, and --allow-public flags, dispatching to the new run_http function and converting runtime errors to user-friendly messages.
Capability advertisement for HTTP transport
src/vouch/capabilities.py
The capabilities() return value adds "http" to the advertised transports list.
Comprehensive HTTP server test suite
tests/test_http_server.py
226 lines of test coverage validating RPC dispatch, error handling, token authentication, unauthenticated GET access, bind-policy guardrails, X-Vouch-Agent actor attribution, and edge cases including negative Content-Length rejection.
VEP-0004 HTTP transport proposal
proposals/VEP-0004-http-transport.md
Formal proposal documenting scope, motivation, design choices, endpoint specifications, auth model, bind policy, security implications, and open questions for HTTP transport feature.
Normative specification updates
spec/transports.md
Adds HTTP transport section defining endpoints, JSONL envelope framing, bearer-token authorization, bind policy, and actor attribution. Updates transport comparison table and future transports discussion.
Documentation index and changelog
CHANGELOG.md, proposals/README.md
Changelog documents HTTP transport v0.1.0 feature; VEP index adds VEP-0004 with draft status.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Poem

🐇 A server bound to localhost, secure and snug,
With /rpc envelopes in JSON, no need for a hug—
Bearer tokens at the gate, actors in the light,
The HTTP transport dances, loopback-safe and bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding VEP-0004 documentation for an HTTP transport proposal. It is specific, concise, and directly describes the primary content—a design proposal that is being added and indexed as draft.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dripsmvcp
dripsmvcp marked this pull request as ready for review June 4, 2026 01:31
@dripsmvcp

Copy link
Copy Markdown
Contributor Author

@plind-junior This PR is ready for review. I've added the HTTP transport feature to be used for claude code and codex integration

@dripsmvcp
dripsmvcp changed the base branch from main to test June 4, 2026 01:32
@plind-junior

Copy link
Copy Markdown
Member

LGTM!

@plind-junior
plind-junior merged commit 7a1f81c into vouchdev:test Jun 4, 2026
3 of 4 checks passed
plind-junior pushed a commit that referenced this pull request Jun 9, 2026
…nnel

Closes #176. Promotes VEP-0004 from draft to accepted by delivering the
spec-compliant HTTP transport the five Claude surfaces require (Claude.ai
Custom Connectors, Claude mobile write, Anthropic Managed Agents,
Messages-API mcp_servers, Computer Use). The vouch-native /rpc envelope
from PR #104 keeps working byte-for-byte; the new /mcp endpoint is what
unblocks the Claude surfaces.

What changes:

* src/vouch/http_server.py rewritten on Starlette + uvicorn. One ASGI app
  mounts FastMCP's StreamableHTTPASGIApp at /mcp (and /messages alias),
  plus the existing /rpc, /healthz, /capabilities routes. /health is a
  new alias for /healthz so Claude.ai's connector validator can probe it.
* Bearer auth becomes multi-token. The legacy --token still works; the
  new accept-list is read from config.yaml under a serve: section that
  supports bearer_tokens: [list] and bearer_token: env:VAR for
  env-var-referenced secrets.
* FastMCP runs stateless + json_response mode so curl-shaped clients
  don't need to track Mcp-Session-Id between calls.
* adapters/http-tunnel/ ships three reference deployments: a base
  Dockerfile, a fly.toml for managed-TLS, and a cloudflare-tunnel
  compose.yml for no-open-port self-hosting. Each treats the bearer
  token as the trust boundary -- vouch refuses to bind a non-loopback
  host without at least one token.
* tests/test_http_server_mcp.py adds 14 tests covering MCP initialize,
  tools/list, tools/call kb_status round-trip, /messages alias,
  bearer-required-when-set, multi-token accept-list, /health alias,
  config.yaml YAML parsing (list + env-ref + missing-env-ref + empty
  section), and three regression tests that prove the legacy /rpc,
  /healthz, and /capabilities surface still behaves exactly as before.
* tests/test_http_server.py: the negative-Content-Length test is updated
  to accept uvicorn's transport-layer 4xx response (which is at least as
  safe as the prior application-layer 400-JSON path).
* proposals/VEP-0004-http-transport.md: status draft -> accepted,
  open-questions block resolved (bespoke REST vs MCP -> both; config
  vs flags -> both; default port stays 8731), endpoint table updated.

Why "max-feature": #176 is a high-leverage unblock for Bittensor/Gittensor
contributors who run multiple AI agents in parallel, so the spec-compliant
path, the multi-token rotation story, and the public-internet reference
deployments all need to ship together -- a partial fix would leave the
trust-boundary story half-documented and force every operator to figure it
out from scratch. The kb.* surface is unchanged: 44 tools, same parameter
and result shapes across stdio, JSONL, /rpc, /mcp.

CI: ruff clean, mypy clean, 330 pytest passed (316 prior + 14 new + 0
regressions).
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.

2 participants