AHP-0002: HTTP registration headers across the spec and SDKs
- Status: Draft
- Authors: @danielkov
- Tracking issue: https://github.com/agenthooksprotocol/agent-hooks-protocol/issues/40
- Created: 2026-10-17
- Review period: Not started
- Supersedes: None
- Superseded by: None
Summary
Add transport.headers to HTTP backend registration in the spec and the
TypeScript, Python, Go, and Rust SDKs. Configured headers apply to event requests
and content uploads.
AHP-REG-003 defines the requirements.
Motivation
Backends and gateways need custom metadata and credentials. Configuring these in
hooks.json avoids separate HTTP-client setup in each SDK.
Design
Header values
Each value is a string, { "valueEnv": "NAME" }, or
{ "valueRef": "reference" }. Source objects require exactly one recognized
source; unknown fields are ignored.
Literal credentials are allowed, including API keys, cookies, and
Authorization: Bearer abc123. Strings are not interpolated. References resolve
the complete header value.
Resolution uses existing environment and secret helpers, operation deadlines, cancellation, and error redaction.
HTTP validation
Any valid HTTP field name can be configured. The HTTP library validates values, including rejection of CR, LF, and NUL. Non-ASCII values are allowed where the library supports them. Unsupported names or values cause an error; they are not silently dropped.
Precedence and authentication
Names are case-insensitive. When names repeat with different casing, the last property in configuration order wins. Parsers preserve this order. Deduplication occurs before secret resolution.
Configured headers override transport defaults and authentication headers,
including Authorization and Content-Type.
A configured Authorization header suppresses OAuth discovery, token acquisition,
challenge handling, and OAuth retries. This applies to every casing and value
source, even when authentication is also configured. Resolution failures do not
fall back to OAuth.
Request scope
The same backend headers apply to events and content uploads. Uploads use their
existing operation deadlines and secret helpers. Configured Authorization also
suppresses upload OAuth.
Redirect behavior and the HTTP library’s handling of sensitive headers remain unchanged. Headers are not installed as global client defaults or sent to unrelated backends, discovery endpoints, or token endpoints. All configured values are redacted from diagnostics.
Schema and conformance
The registration schema defines HttpHeaderSource and HttpHeaderValue for the
four SDK generators. Shared fixtures cover literal credentials, non-ASCII values,
duplicate names, secret sources, and invalid configuration shapes.
Runtime tests cover event and upload requests, header precedence, OAuth suppression, redirects, secret resolution, and redaction. Schema validation alone does not establish runtime support.
Compatibility and security
transport.headers is an optional registration field. It does not change event
envelopes or stdio behavior. Older SDKs may ignore it; deployments that require
headers must use a supporting SDK version.
Configuration can contain credentials and must be protected. Servers remain responsible for authenticating and authorizing requests. Existing transport limits and retry behavior remain unchanged.
MCP references
VS Code supports headers in MCP client configuration. The MCP TypeScript and Python SDKs support custom HTTP request headers. These are client configuration features, not a common configuration format defined by the MCP wire protocol.
Rollout
The spec, schema, fixtures, and generated models are updated in protocol PR #41. SDK implementations are in:
Integration tests use pinned SDK commits until the SDK changes land. Then remove the temporary pins and rerun integration against the default branches.
References
MCP reference implementations
- VS Code MCP configuration schema (MIT): string-valued headers and documented cross-origin isolation.
- MCP TypeScript transport options and common-header builder (MIT): request initialization and case-insensitive managed-header precedence.
- MCP Python client options and protocol-header construction (MIT): custom HTTP client and per-request protocol defaults.
- MCP core Streamable HTTP specification, 2025-11-25 (MIT): wire requirements, distinct from client configuration conventions.