Skip to content

Support per-server custom CA certificates for HTTP MCP upstreams - #15067

Merged
lpcox merged 3 commits into
mainfrom
copilot/support-per-server-custom-ca-certificates
Oct 16, 2026
Merged

lpcox merged 3 commits into
mainfrom
copilot/support-per-server-custom-ca-certificates

Conversation

Copilot AI commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

HTTP MCP upstreams using private CAs could not be trusted without changing runner-wide trust. Add per-server CA configuration that preserves system trust and standard TLS verification.

  • Configuration: Support caCertFile in JSON stdin and ca_cert_file in TOML for HTTP servers.
  • TLS behavior: Add the configured CA to that server’s outbound connection only; certificate and hostname verification remain enabled. Missing or invalid CA files return clear errors without exposing certificate contents.
  • Example:
    {
      "type": "http",
      "url": "https://mcp.internal.example",
      "caCertFile": "/etc/mcp/internal-ca.pem"
    }
  • Coverage and docs: Document the fields and cover private-CA connections, trust isolation, invalid files, and unchanged default TLS behavior.

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for per-server custom CA certificates for HTTP MCP upstreams Support per-server custom CA certificates for HTTP MCP upstreams Oct 16, 2026
Copilot AI requested a review from lpcox October 16, 2026 19:41
@lpcox
lpcox marked this pull request as ready for review October 16, 2026 19:43
Copilot AI max review requested due to automatic review settings October 16, 2026 19:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

CA loading can silently omit certificates that passed validation when their PEM blocks contain headers.

1 open finding
What changed in this PR

Adds per-server custom CA configuration for HTTP MCP upstreams without changing global trust or disabling TLS verification.

Changes:

  • Add JSON and TOML CA file settings with HTTP-only validation.
  • Load custom certificates into connection-local trust pools.
  • Add configuration and TLS tests plus documentation.
File Description
internal/​mcp/​connection.go Load custom CAs for HTTP connections.
internal/​mcp/​connect_timeout_test.go Test private trust, isolation, and invalid files.
internal/​launcher/​launcher.go Pass CA configuration to HTTP connections.
internal/​config/​validation_server.go Reject CA settings on non-HTTP servers.
internal/​config/​validation_schema_test.go Cover the JSON CA field.
internal/​config/​schema/​mcp-gateway-config.schema.json Define caCertFile.
internal/​config/​config_stdin.go Parse and propagate JSON CA configuration.
internal/​config/​config_stdin_test.go Test CA field conversion.
internal/​config/​config_core.go Add TOML CA configuration and validation.
internal/​config/​config_core_test.go Test TOML CA field loading.
docs/​CONFIGURATION.md Document CA settings and TLS behavior.

🧠 Review effort: Max


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/mcp/connection.go Resolved
@lpcox

lpcox commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Fixed in commit 3eb3bad: each validated certificate is now added directly to the root pool, and the regression test covers a header-bearing CA in a multi-certificate bundle.

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.

Support per-server custom CA certificates for HTTP MCP upstreams

3 participants