-
Notifications
You must be signed in to change notification settings - Fork 1
[EVAL] feat: add certificate trust configuration for MCP servers #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
daniel-lxs
wants to merge
19
commits into
main
from
eval-pr-review-feat-mcp-certificate-trust-1760026781184
Closed
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a158c21
feat: add certificate trust configuration for MCP servers
roomote b73bd7c
fix: resolve TypeScript type error for agent property in fetch
roomote e2b5556
test: webhook throttle test commit 1
daniel-lxs 2ad3209
test: webhook throttle test commit 2
daniel-lxs c533ebb
test: webhook throttle test commit 3
daniel-lxs ff458a5
test: webhook throttle test commit 4
daniel-lxs d04abc0
test: webhook commit 5 - testing 5min timeout with running task
daniel-lxs a11aad8
test: webhook commit 6
daniel-lxs a57d035
test: webhook commit 7
daniel-lxs 6fa6924
test: webhook commit 8
daniel-lxs 5922c94
test: webhook commit 9
daniel-lxs cf6abc7
test: webhook commit 10
daniel-lxs 6f1b0c5
test: webhook commit 11
daniel-lxs 4a963a1
test: webhook commit 12
daniel-lxs 6a0fbdc
test: webhook commit 13
daniel-lxs 91530f9
test: webhook commit 14
daniel-lxs 39dbeee
test: webhook commit 15
daniel-lxs afa5eb9
test: webhook commit 16
daniel-lxs 1cfb8da
test: webhook commit 17
daniel-lxs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule pr-8274
added at
e46929
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,168 @@ | ||
| # MCP Server Certificate Trust Configuration | ||
|
|
||
| This document describes how to configure certificate trust settings for MCP servers that use HTTPS connections (SSE and StreamableHTTP transports). | ||
|
|
||
| ## Overview | ||
|
|
||
| When connecting to MCP servers over HTTPS, you may encounter servers that use: | ||
|
|
||
| - Self-signed certificates | ||
| - Certificates signed by internal/corporate Certificate Authorities (CAs) | ||
| - Certificates that would otherwise be rejected by default Node.js certificate validation | ||
|
|
||
| The certificate trust configuration allows you to specify how these certificates should be handled. | ||
|
|
||
| ## Configuration Options | ||
|
|
||
| Certificate trust settings can be added to any SSE or StreamableHTTP server configuration in your MCP settings file. | ||
|
|
||
| ### Available Options | ||
|
|
||
| | Option | Type | Default | Description | | ||
| | -------------------- | ------- | --------- | ----------------------------------------------------------- | | ||
| | `allowSelfSigned` | boolean | false | Allow connections to servers using self-signed certificates | | ||
| | `caCertPath` | string | undefined | Path to a CA certificate file (PEM format) to trust | | ||
| | `rejectUnauthorized` | boolean | true | Whether to reject unauthorized certificates | | ||
|
|
||
| ## Configuration Examples | ||
|
|
||
| ### 1. Allow Self-Signed Certificates | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "my-internal-server": { | ||
| "type": "sse", | ||
| "url": "https://internal.company.com/mcp", | ||
| "certificateTrust": { | ||
| "allowSelfSigned": true | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### 2. Trust a Custom CA Certificate | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "corporate-server": { | ||
| "type": "streamable-http", | ||
| "url": "https://api.internal.corp/mcp", | ||
| "certificateTrust": { | ||
| "caCertPath": "/path/to/company-ca.pem" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### 3. Disable Certificate Validation (Development Only) | ||
|
|
||
| ⚠️ **Warning**: This configuration disables certificate validation entirely and should only be used in development environments. | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "dev-server": { | ||
| "type": "sse", | ||
| "url": "https://dev.local:8443/mcp", | ||
| "certificateTrust": { | ||
| "rejectUnauthorized": false | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### 4. Combined Configuration | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "complex-server": { | ||
| "type": "sse", | ||
| "url": "https://secure.internal.com/mcp", | ||
| "headers": { | ||
| "Authorization": "Bearer token" | ||
| }, | ||
| "certificateTrust": { | ||
| "allowSelfSigned": true, | ||
| "caCertPath": "/etc/ssl/certs/internal-ca.pem", | ||
| "rejectUnauthorized": false | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Obtaining CA Certificates | ||
|
|
||
| ### From System Certificate Store | ||
|
|
||
| On many systems, CA certificates are stored in standard locations: | ||
|
|
||
| - **Linux**: `/etc/ssl/certs/` or `/usr/share/ca-certificates/` | ||
| - **macOS**: Can be exported from Keychain Access | ||
| - **Windows**: Can be exported from Certificate Manager (certmgr.msc) | ||
|
|
||
| ### From Your IT Department | ||
|
|
||
| For corporate environments, contact your IT department to obtain: | ||
|
|
||
| 1. The internal CA certificate (usually in PEM or CRT format) | ||
| 2. Instructions on where to save it securely | ||
| 3. Any specific certificate validation requirements | ||
|
|
||
| ### Converting Certificate Formats | ||
|
|
||
| If you have a certificate in DER/CER format, convert it to PEM: | ||
|
|
||
| ```bash | ||
| openssl x509 -inform der -in certificate.cer -out certificate.pem | ||
| ``` | ||
|
|
||
| ## Security Considerations | ||
|
|
||
| 1. **Production Environments**: Always use proper certificates signed by trusted CAs in production. | ||
|
|
||
| 2. **Certificate Validation**: Only disable `rejectUnauthorized` in development environments where security is not a concern. | ||
|
|
||
| 3. **CA Certificate Storage**: Store CA certificate files in a secure location with appropriate file permissions. | ||
|
|
||
| 4. **Regular Updates**: Keep CA certificates up to date, especially for internal CAs that may rotate periodically. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Common Error Messages | ||
|
|
||
| 1. **"UNABLE_TO_VERIFY_LEAF_SIGNATURE"**: The server's certificate cannot be verified. Consider adding the CA certificate using `caCertPath`. | ||
|
|
||
| 2. **"SELF_SIGNED_CERT_IN_CHAIN"**: The certificate chain contains a self-signed certificate. Set `allowSelfSigned: true` if this is expected. | ||
|
|
||
| 3. **"CERT_HAS_EXPIRED"**: The certificate has expired. Contact the server administrator to renew it. | ||
|
|
||
| ### Debugging Certificate Issues | ||
|
|
||
| To debug certificate issues, you can test the connection using OpenSSL: | ||
|
|
||
| ```bash | ||
| # View server certificate | ||
| openssl s_client -connect hostname:port -showcerts | ||
|
|
||
| # Test with a specific CA certificate | ||
| openssl s_client -connect hostname:port -CAfile /path/to/ca.pem | ||
| ``` | ||
|
|
||
| ## Limitations | ||
|
|
||
| - Certificate trust settings only apply to SSE and StreamableHTTP transports | ||
| - STDIO transport servers do not use HTTPS and therefore don't need certificate configuration | ||
| - The configuration requires Node.js environment; browser-based implementations may have different requirements | ||
| - Test webhook commit 17 | ||
|
|
||
| ## Related Documentation | ||
|
|
||
| - [MCP Server Configuration](./mcp-servers.md) | ||
| - [Model Context Protocol Specification](https://modelcontextprotocol.io) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation contains a test commit message
- Test webhook commit 17that should be removed before merging to production.