Skip to content

mcp: add HTTP authorization and header environment variables (SERVERS-17) - #2011

Merged
bbondy merged 4 commits into
brave:mainfrom
winshaurya:parity-mcp-http-auth-header
Oct 13, 2026
Merged

bbondy merged 4 commits into
brave:mainfrom
winshaurya:parity-mcp-http-auth-header

Conversation

@winshaurya

@winshaurya winshaurya commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

User impact: Users can now connect to hosted HTTP MCP servers requiring authentication by declaring --bearer-env <NAME> or --header-env <HEADER>=<NAME>, keeping secrets in environment variables without writing them to disk.

Hi @bbondy and reviewers,

I have implemented support for HTTP MCP server authorization and custom header environment variables, resolves #1397.

The problem

An HTTP MCP server declared with bravebot mcp add <alias> --http <url> had no mechanism to send authentication headers or API keys. Remote hosted MCP servers (such as GitHub's Copilot MCP endpoint) require bearer tokens or custom headers, which previously could not be sent over HTTP. This forced users to build and run local binaries instead of using hosted endpoints directly.

Reproduce

  1. Attempt to add a hosted HTTP MCP server requiring authorization:
    bravebot mcp add github --http https://api.githubcopilot.com/mcp
  2. Observe that there were no CLI flags or configuration fields to supply an authorization token or headers.
  3. The server rejects unauthenticated requests during handshake initialization with HTTP 401 Unauthorized.

The fix

I implemented environment-variable-backed headers across four modular commits:

  1. Configuration and Schema (crates/config/src/mcp.rs):

    • Added env_http_headers: BTreeMap<String, String> and bearer_env: Option<String> to Declaration::Http.
    • Validated header names per RFC token syntax and variable names per is_variable_name().
    • Included header and variable names in declaration digests while preserving backward compatibility for declarations without headers.
    • Refused static secrets and invalid flag combinations.
  2. Network Egress and Socket Scoping (crates/net, crates/mcp):

    • Added socket-scoped headers to bravebot-net::Request.
    • Attached secret headers only when the target URL matches the declared socket (scheme, host, and port).
    • Stripped socket headers and Authorization on redirect hops that cross sockets.
  3. CLI and Agent Integration (crates/agent, crates/cli, crates/i18n):

    • Added --bearer-env <name> and --header-env <header>=<name> CLI flags to bravebot mcp add --http.
    • Read header tokens from the runtime environment at launch without persisting secrets to ~/.bravebot/mcp.json.
    • Refused non-UTF-8 environment values with Problem::Value per PATH-002.
    • Formatted header names and variable names (Authorization: Bearer $VAR and Header: $VAR) in approval prompts and get/list outputs without exposing secrets.
    • Added localized strings in en-US.ftl and fr.ftl.
  4. Specification and Documentation (docs/specs):

    • Added normative clause SERVERS-17 to docs/specs/mcp-servers.md.
    • Updated the Claude Code parity table row for GitHub.
    • Documented in-flight credential protection in docs/specs/credential-protection.md.
    • Incremented the SERVERS clause count in docs/specs/README.md.

Affected callers of changed shared behaviour (TS-004)

Stripping Authorization across socket hops changes behaviour for callers setting it via Request::header:

  • crates/aichat/src/lib.rs:528 (aichat model client)
  • crates/bedrock/src/lib.rs:1084 (bedrock model client)

The integration test plain_authorization_header_is_stripped_on_cross_socket_redirect in crates/net/tests/egress.rs covers and verifies that cross-socket redirects safely strip Authorization for these callers.

Governing specifications (SP-004)

Checked against and conforms to:

  • docs/specs/mcp-servers.md (SERVERS-17, SERVERS-10, SERVERS-11)
  • docs/specs/credential-protection.md
  • docs/specs/network-egress.md

Test plan

  1. Run mechanical spec check: python3 agents/skills/check-spec/check-spec.py --mechanical-only (passes with 0 errors).
  2. Run locale check: python3 contrib/check-locales.py (passes with clean sync).
  3. Run formatting check: cargo fmt --all -- --check (passes).
  4. Run clippy: cargo clippy --all-targets --all-features -- -D warnings (passes).
  5. Run configuration tests: cargo test -p bravebot-config --lib mcp::tests::http_headers (passes).
  6. Run egress tests: cargo test -p bravebot-net --test egress socket_scoped_headers and cargo test -p bravebot-net --test egress plain_authorization_header_is_stripped_on_cross_socket_redirect (passes).
  7. Run MCP tests: cargo test -p bravebot-mcp --test http configured_headers (passes).
  8. Run CLI tests: cargo test -p bravebot-cli --bin bravebot mcp::tests::http_bearer (passes).
  9. Run agent server tests: cargo test -p bravebot-agent --lib servers::tests::a_declarations_headers_are_drawn_with_variable_names_and_without_secrets (passes, covering happy paths, unset variables, and non-UTF-8 refusals).
  10. Manual verification:
  • Run MYTOKEN=s3cret bravebot mcp add demo --http http://127.0.0.1:8080/mcp --bearer-env MYTOKEN --header-env X-Api-Key=MYKEY.
  • Verify bravebot mcp get demo displays headers: Authorization: Bearer $MYTOKEN, X-Api-Key: $MYKEY and no secret.
  • Inspect ~/.bravebot/mcp.json and verify s3cret is not stored.
  • Start a session and verify headers are received on the target listener.

Thank you very much!

@netzenbot-reviewer netzenbot-reviewer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation: request changes

What this pull request does

This adds two flags to bravebot mcp add --http <url>: --bearer-env <VAR> and --header-env <Header>=<VAR>. The declaration stores only header and variable names (new env_http_headers and bearer_env fields in mcp.json), and the values are read from the process environment when the server starts. bravebot-net::Request gains socket-scoped headers, which are sent only when the hop's scheme, host and port match the declared URL. On a redirect to another socket the code drops those headers and any Authorization header. The approval prompt and get/list output show a headers: line such as Authorization: Bearer $TOKEN, the header and variable names feed the digest (declarations without headers keep their old digest), and stdio declarations that use the flags are refused. Two points differ from the description or spec. The spec says a cross-socket hop is refused at the egress gate and put to the person as a server move, but the diff only strips the headers. A variable that is unset or not valid UTF-8 is silently skipped, so the server is contacted without the header.

Trying it by hand

The description does not say how to try this change. These steps would:

  1. Build bravebot and use a scratch HOME so your real ~/.bravebot is untouched. Start a local HTTP MCP server, or a tiny listener that logs request headers, on http://127.0.0.1:PORT/mcp.
  2. Run MYTOKEN=s3cret bravebot mcp add demo --http http://127.0.0.1:PORT/mcp --bearer-env MYTOKEN --header-env X-Api-Key=MYKEY. Expect it to be declared. Then run bravebot mcp get demo and bravebot mcp list. Expect a line like headers: Authorization: Bearer $MYTOKEN, X-Api-Key: $MYKEY and no secret value.
  3. Open the scratch ~/.bravebot/mcp.json. Expect env_http_headers and bearer_env to hold only variable names, with no s3cret anywhere.
  4. Start a session with MYTOKEN=s3cret MYKEY=k1 set and approve the server at the prompt. Expect the prompt to list the header and variable names only. Check that the listener received Authorization: Bearer s3cret and X-Api-Key: k1.
  5. Point the declaration at a URL that redirects to a different port or host, with a second listener on the target. Expect the target to receive no Authorization or X-Api-Key. Check what the session shows at this point, because the spec promises a server-move prompt and the diff does not add one.
  6. Run the same add with --bearer-env and a stdio form (-- /opt/srv). Expect a refusal naming env_http_headers. Also try --header-env bad, --header-env X=, --bearer-env A --bearer-env B, and --header-env Bad:Name=VAR. Expect each to be refused.
  7. Re-add demo with a different --header-env variable. Expect the approval to be asked again, because the digest changed. Then start a session with MYTOKEN unset and check what happens, since the header is skipped silently.

Missing from the description

  • A User impact: line above the first heading: what a person using the product can now see, or none and why not.
  • A ## The problem section.
  • A ## Reproduce section.
  • A ## The fix section.
  • A ## Test plan section.
How this review reached its recommendation

The review read 12 changed files.

What it checked:

  • Written best practices. The changes were compared with 16 rules from this project's best-practice documents (compatibility, dependencies, paths, portability, shared-implementation, specs, tests, writing).
  • Bugs. The changes were read for mistakes that would make the code misbehave or stop it building.
  • This project's own criteria. The changes were checked against these questions:
    • Whether the change agrees with the project's specs, and whether a change to behaviour a spec describes also updates that spec and its tests.
    • Whether untrusted content (text from the web, files or tools) can influence a decision, or be given a better trust label than it came with, anywhere other than the places built for that.
    • Whether the tests would fail if the behaviour broke, rather than covering only the allowed case or passing with the bug put back.
    • Whether the change does what its title says and nothing more, with no unrelated refactor and no new dependency, permission or network destination the title does not explain.

The checks flagged 12 possible problems. 5 of them went to a second reader, who checked each against the full source code rather than only the diff, and kept 3.

Comment thread crates/agent/src/servers.rs Resolved
Comment thread crates/net/src/lib.rs Resolved
Comment thread crates/agent/src/servers.rs Resolved
@winshaurya
winshaurya force-pushed the parity-mcp-http-auth-header branch from 8164390 to 2ca9586 Compare October 11, 2026 16:52

@netzenbot-reviewer netzenbot-reviewer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation: request changes

Not approved: 1 earlier comment is still open.

  • crates/net/src/lib.rs:852: crates/net/tests/egress.rs now has plain_authorization_header_is_stripped_on_cross_socket_redirect, but the PR description still does not list the callers that change behaviour (the aichat and bedrock model clients).

2 earlier comments were addressed and resolved.

What this pull request does

This adds --bearer-env <name> and --header-env <header>=<name> to bravebot mcp add --http, so a hosted MCP server that needs an Authorization or API-key header can be declared. The declaration stores only header names and environment variable names in ~/.bravebot/mcp.json; the values are read from the person's environment when the server starts and are never stored. Header and variable names are validated, included in the declaration digest (unchanged for declarations without headers), refused on stdio declarations, and shown as headers: Authorization: Bearer $TOKEN in approval prompts and get/list. In bravebot-net, a new socket_header on Request attaches these headers only when the hop's scheme, host and port match the request URL. Any Authorization header, plain or socket-scoped, is also dropped on a hop to a different socket. One behaviour to check: an unset variable silently omits its header rather than failing the launch, so a missing token shows up as an unauthenticated request. The spec text says a cross-socket hop is put to the person as a server move, which is existing behaviour that this diff does not change.

Trying it by hand

The description does not say how to try this change. These steps would:

  1. Build the CLI (cargo build) and run bravebot mcp add demo --http http://127.0.0.1:8080/mcp --bearer-env DEMO_TOKEN --header-env X-Api-Key=DEMO_KEY. Expect the declaration to be accepted, and ~/.bravebot/mcp.json to contain bearer_env and env_http_headers with the variable names only.
  2. Run bravebot mcp get demo. Expect a headers: line showing Authorization: Bearer $DEMO_TOKEN, X-Api-Key: $DEMO_KEY and no token values.
  3. Try the refusals: bravebot mcp add bad --bearer-env T -- /bin/true (stdio with a header flag), --header-env novalue, --header-env 'Bad:Name=VAR', and --bearer-env A --bearer-env B. Expect each to be refused with a message and nothing written.
  4. Start a small local HTTP server that logs request headers and answers MCP initialize, for example a Python http.server subclass on port 8080. Export DEMO_TOKEN=abc and DEMO_KEY=xyz, then start a session that uses demo and approve the server when asked. Expect the server log to show Authorization: Bearer abc and X-Api-Key: xyz.
  5. Unset DEMO_TOKEN and start again. Expect no Authorization header at the server and no error from bravebot (check whether that silent omission is what you want).
  6. Make the local server answer with a 302 to a different port. Expect the redirect target to receive neither Authorization nor X-Api-Key, and the cross-socket hop to be handled as a server move per the existing flow (confirm the prompt text).
  7. Edit a header variable name with mcp add again and start a session. Expect the declaration's digest to change and the approval to be asked again.

Missing from the description

  • A User impact: line above the first heading: what a person using the product can now see, or none and why not.
  • A ## The problem section.
  • A ## Reproduce section.
  • A ## The fix section.
  • A ## Test plan section.
How this review reached its recommendation

The review read 2 of the 12 changed files: only those that changed since the bot last reviewed this pull request.

What it checked:

  • Written best practices. The changes were compared with 16 rules from this project's best-practice documents (compatibility, dependencies, paths, portability, shared-implementation, specs, tests, writing).
  • Bugs. The changes were read for mistakes that would make the code misbehave or stop it building.
  • This project's own criteria. The changes were checked against these questions:
    • Whether the change agrees with the project's specs, and whether a change to behaviour a spec describes also updates that spec and its tests.
    • Whether untrusted content (text from the web, files or tools) can influence a decision, or be given a better trust label than it came with, anywhere other than the places built for that.
    • Whether the tests would fail if the behaviour broke, rather than covering only the allowed case or passing with the bug put back.
    • Whether the change does what its title says and nothing more, with no unrelated refactor and no new dependency, permission or network destination the title does not explain.

None of these checks flagged anything, so there was nothing to double-check.

@winshaurya
winshaurya force-pushed the parity-mcp-http-auth-header branch from 2ca9586 to 9482086 Compare October 11, 2026 18:20
@winshaurya

winshaurya commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor Author

@bbondy

I have updated the pull request with the following fixes:

  1. Affected Callers and Shared Behaviour (TS-004):

    • Added a dedicated subsection in the PR description explicitly identifying the affected callers that set Authorization via Request::header:
      • crates/aichat/src/lib.rs:528 (aichat model client)
      • crates/bedrock/src/lib.rs:1084 (bedrock model client)
    • Verified that the integration test plain_authorization_header_is_stripped_on_cross_socket_redirect in crates/net/tests/egress.rs covers cross-socket stripping for these callers.
  2. Governing Specifications (SP-004):

    • Documented explicit compliance with docs/specs/mcp-servers.md (SERVERS-17, SERVERS-10, SERVERS-11), docs/specs/credential-protection.md, and docs/specs/network-egress.md.
  3. Code Quality and Lints:

    • Resolved clippy::type_complexity in crates/mcp/tests/http.rs by introducing the RecordedRequest type alias.
    • Resolved clippy::collapsible_if in crates/agent/src/servers.rs by flattening the environment variable lookup.
    • Formatted all code cleanly with cargo fmt --all.
    • Verified that all workspace tests, mechanical spec checks (check-spec.py --mechanical-only), locale checks (check-locales.py), and narration checks (check-narration.py) pass with zero errors.

Thank you very much!

@netzenbot-reviewer netzenbot-reviewer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation: approve

What this pull request does

This adds --bearer-env <NAME> and --header-env <HEADER>=<NAME> to bravebot mcp add --http, so a hosted MCP server can be sent an Authorization: Bearer token or custom headers. Only the header names and variable names are stored in mcp.json, and they are part of the declaration digest, so changing them needs re-approval. The values are read from the environment when the server starts, and a non-UTF-8 value is refused. They are attached through a new Request::socket_header in bravebot-net, and only to requests whose scheme, host and port match the declared URL. As a side effect, the egress send now strips any plain Authorization header from a redirect hop that leaves the original socket, which also changes behaviour for the existing aichat and bedrock callers. Approval prompts and get/list show Authorization: Bearer $VAR and Header: $VAR and never a value. Header flags on a stdio declaration are refused, and the PR adds SERVERS-17, en-US and fr strings, and updates the GitHub parity row. One difference from the author's wording: a variable that is unset at launch is silently skipped and the server starts with no such header, rather than failing.

How this review reached its recommendation

The review read 6 of the 12 changed files: only those that changed since the bot last reviewed this pull request.

What it checked:

  • Written best practices. The changes were compared with 16 rules from this project's best-practice documents (compatibility, dependencies, paths, portability, shared-implementation, specs, tests, writing).
  • Bugs. The changes were read for mistakes that would make the code misbehave or stop it building.
  • This project's own criteria. The changes were checked against these questions:
    • Whether the change agrees with the project's specs, and whether a change to behaviour a spec describes also updates that spec and its tests.
    • Whether untrusted content (text from the web, files or tools) can influence a decision, or be given a better trust label than it came with, anywhere other than the places built for that.
    • Whether the tests would fail if the behaviour broke, rather than covering only the allowed case or passing with the bug put back.
    • Whether the change does what its title says and nothing more, with no unrelated refactor and no new dependency, permission or network destination the title does not explain.

The checks flagged 2 possible problems. 2 of them went to a second reader, who checked each against the full source code rather than only the diff, and found none of them to be a real problem introduced by this change.

@winshaurya
winshaurya force-pushed the parity-mcp-http-auth-header branch from 9482086 to ba3bf31 Compare October 11, 2026 18:26

@netzenbot-reviewer netzenbot-reviewer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation: approve

What this pull request does

This adds environment-variable-backed headers to HTTP MCP server declarations. bravebot mcp add <alias> --http <url> now accepts --bearer-env <NAME> (sent as Authorization: Bearer <value>) and --header-env <HEADER>=<NAME>, and both are refused on stdio declarations. Only the header and variable names are stored in ~/.bravebot/mcp.json, they are included in the declaration digest (unchanged for declarations with no headers, so existing approvals keep working), and get/list/approval prompts show them as Header: $VAR. At server start the agent reads the variables from the process environment, silently omits any that are unset, and refuses a non-UTF-8 value. In bravebot-net, a new Request::socket_header attaches headers only when the hop's scheme, host and port match the request URL, and the send path now also drops any plain Authorization header on a cross-socket hop, which changes behaviour for every existing caller of Request::header (aichat, bedrock), not only MCP. The diff also adds spec clause SERVERS-17, updates the GitHub parity row and credential-protection notes, and adds English and French strings.

How this review reached its recommendation

The review read 0 of the 12 changed files: only those that changed since the bot last reviewed this pull request.

None of these checks flagged anything, so there was nothing to double-check.

@winshaurya
winshaurya force-pushed the parity-mcp-http-auth-header branch from ba3bf31 to 0ce6ef1 Compare October 11, 2026 20:46

@netzenbot-reviewer netzenbot-reviewer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation: approve

What this pull request does

This adds --bearer-env <NAME> and --header-env <HEADER>=<NAME> to bravebot mcp add --http, so a hosted HTTP MCP server can be sent an Authorization bearer token or custom headers taken from environment variables. The declaration (Declaration::Http) now stores only the header names and variable names, validates them, includes them in the digest (unchanged for declarations without headers), and draws them in prompts, get and list as headers: Authorization: Bearer $VAR, X-Key: $VAR. Values are read from the environment when the server starts, and a non-UTF-8 value is refused. A variable that is unset is silently skipped, so the request goes out without that header. In bravebot-net, a new Request::socket_header attaches headers only when the hop's scheme, host and port match the request URL. As a side effect for every caller, a plain Authorization header set through Request::header is now also dropped on a hop to a different socket, which affects the aichat and bedrock clients. The same flags on a stdio declaration are refused. The patch adds SERVERS-17 to the MCP servers spec, rewrites the GitHub parity row to use the hosted endpoint, and adds both English and French strings.

How this review reached its recommendation

The review read 1 of the 12 changed files: only those that changed since the bot last reviewed this pull request.

What it checked:

  • Written best practices. The changes were compared with 16 rules from this project's best-practice documents (compatibility, dependencies, paths, portability, shared-implementation, specs, tests, writing).
  • Bugs. The changes were read for mistakes that would make the code misbehave or stop it building.
  • This project's own criteria. The changes were checked against these questions:
    • Whether the change agrees with the project's specs, and whether a change to behaviour a spec describes also updates that spec and its tests.
    • Whether untrusted content (text from the web, files or tools) can influence a decision, or be given a better trust label than it came with, anywhere other than the places built for that.
    • Whether the tests would fail if the behaviour broke, rather than covering only the allowed case or passing with the bug put back.
    • Whether the change does what its title says and nothing more, with no unrelated refactor and no new dependency, permission or network destination the title does not explain.

None of these checks flagged anything, so there was nothing to double-check.

@winshaurya

Copy link
Copy Markdown
Contributor Author

@chrislacy

@netzenbot-reviewer netzenbot-reviewer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation: approve

What this pull request does

This adds two flags to bravebot mcp add --http, --bearer-env <NAME> and --header-env <HEADER>=<NAME>, so a hosted MCP server that needs a token or API key can be declared. Only the header and variable names are stored in ~/.bravebot/mcp.json and in the declaration digest. The values are read from the environment when the server starts, and a non-UTF-8 value is refused. The names, never the values, are shown in get, list and approval prompts as Authorization: Bearer $VAR and Header: $VAR. In bravebot-net, a request now carries socket-scoped headers that are sent only while the target scheme, host and port match the declared URL. Any cross-socket redirect hop drops those headers and also drops any plain Authorization header, so the aichat and bedrock clients get this stripping too. The header flags are refused on stdio declarations, header names are checked as RFC tokens, and a bearer flag combined with an Authorization header entry is rejected. Two behaviours are not called out in the description. A variable that is unset is silently omitted, so the server is contacted without that header. In the agent's launch path, a declaration whose variable is non-UTF-8 is dropped from the plan with a note. The PR also adds spec clause SERVERS-17, updates the GitHub row of the parity table, and adds the French and English strings.

How this review reached its recommendation

The review read 0 of the 12 changed files: only those that changed since the bot last reviewed this pull request.

None of these checks flagged anything, so there was nothing to double-check.

Support env_http_headers and bearer_env in HTTP MCP server declarations.
Validate header names per RFC token rules and environment variable names,
refusing static values and invalid syntax. Include header names and
variable names in declaration digest with backward compatibility.
Add socket-scoped headers to Request, sending them only when the
target socket matches the declared destination. Strip Authorization
and socket headers on redirect hops that cross sockets. Send declared
headers in HttpServer requests.
…iables

Parse --bearer-env and --header-env in mcp add, resolving them from
the environment at launch and passing them to the HTTP transport.
Display header names and variable names in approval prompts and
declaration listings without exposing secrets. Refuse non-UTF-8 values
with Problem::Value.
Add SERVERS-18 covering HTTP MCP server authorization and custom headers
read from named environment variables, socket isolation, redirect stripping,
and secret protection. Update the Claude Code parity comparison and
increment the clause count.
@bbondy
bbondy force-pushed the parity-mcp-http-auth-header branch from 2533976 to 44c146a Compare October 13, 2026 15:26

@netzenbot-reviewer netzenbot-reviewer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation: approve

What this pull request does

This adds --bearer-env <NAME> and --header-env <HEADER>=<NAME> to bravebot mcp add --http, so a hosted MCP server can be sent an Authorization: Bearer token or custom headers taken from environment variables. Declaration::Http now stores only the header and variable names, and these are validated, included in the digest (the digest is unchanged for declarations without headers), written to mcp.json, and shown as headers: Authorization: Bearer $VAR, X-Key: $VAR in get, list and the approval question. At launch the agent reads the variables, refuses non-UTF-8 values, and silently omits headers whose variable is unset. bravebot-net::Request gains socket-scoped headers that are sent only when the hop's scheme, host and port match the request URL. Authorization set through plain Request::header is now also dropped on a cross-socket redirect, which changes behaviour for the aichat and bedrock clients. Stdio declarations given these flags are refused. The title and PR text say SERVERS-17, but the diff adds the clause, tests and docs as SERVERS-18. The new spec text says a cross-socket hop is refused and put to the person as a server move, whereas the code only strips the headers and continues.

How this review reached its recommendation

The review read 8 of the 12 changed files: only those that changed since the bot last reviewed this pull request.

What it checked:

  • Written best practices. The changes were compared with 16 rules from this project's best-practice documents (compatibility, dependencies, paths, portability, shared-implementation, specs, tests, writing).
  • Bugs. The changes were read for mistakes that would make the code misbehave or stop it building.
  • This project's own criteria. The changes were checked against these questions:
    • Whether the change agrees with the project's specs, and whether a change to behaviour a spec describes also updates that spec and its tests.
    • Whether untrusted content (text from the web, files or tools) can influence a decision, or be given a better trust label than it came with, anywhere other than the places built for that.
    • Whether the tests would fail if the behaviour broke, rather than covering only the allowed case or passing with the bug put back.
    • Whether the change does what its title says and nothing more, with no unrelated refactor and no new dependency, permission or network destination the title does not explain.

The checks flagged 1 possible problem. 1 of them went to a second reader, who checked each against the full source code rather than only the diff, and found none of them to be a real problem introduced by this change.

@bbondy
bbondy merged commit d1ae362 into brave:main Oct 13, 2026
25 checks passed
@winshaurya
winshaurya deleted the parity-mcp-http-auth-header branch November 21, 2026 15:24
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.

Add an authorization header to an HTTP MCP server, with its value read from a named environment variable

3 participants