Local MCP Server HTTPS Setup with Claude Desktop (macOS)
https://gitlab.com/nicolaw/unifi-protect-mcp/
https://127.0.0.1:8412/mcp
- Used
mkcertto generate locally trusted certificates for loopback addresses.
brew install mkcert
mkcert -install
mkcert 127.0.0.1 localhost ::1
export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"-
MCP Server Config (
foo.yaml):--- listener: bind_address: "127.0.0.1" port: 8412 tls_cert_file: "127.0.0.1+2.pem" tls_key_file: "127.0.0.1+2-key.pem" insecure_http: false -
Add to macOS system trust store.
sudo security add-trusted-cert -d -r trustRoot -k "$(mkcert -CAROOT)/rootCA.pem"
Claude CLI is (kinda) able to see the local development MCP server, but then bombs out when trying to actually talk to it due to a TLS certificate trust failure.
% export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"
% claude mcp add --transport http unifiprotect https://127.0.0.1:8412/mcp
Added HTTP MCP server unifiprotect with URL: https://127.0.0.1:8412/mcp to local config
File modified: /Users/nicolaw/.claude.json [project: /Users/nicolaw/src/unifi-protect-mcp]
% claude mcp list
Checking MCP server health...
unifiprotect: https://127.0.0.1:8412/mcp (HTTP) - ✓ ConnectedAdding to the Claude Desktop application on macOS is impossible as it seems to validate it more than the Claude CLI does during the configuration time process. I can only assume it is failing for the same TLS trust issues.
None of the following work-around seem to work:
-
Injecting into macOS Window Server (Session-wide):
launchctl setenv NODE_EXTRA_CA_CERTS "$(mkcert -CAROOT)/rootCA.pem" -
Passing via macOS open command:
open -a "Claude" --env NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem" -
Executing the underlying binary directly:
NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem" /Applications/Claude.app/Contents/MacOS/Claude -
Chromium Localhost Bypass Flag:
/Applications/Claude.app/Contents/MacOS/Claude --allow-insecure-localhost -
Chromium Global Certificate Bypass Flag:
/Applications/Claude.app/Contents/MacOS/Claude --ignore-certificate-errors -
Node.js Global TLS Bypass:
NODE_TLS_REJECT_UNAUTHORIZED=0 /Applications/Claude.app/Contents/MacOS/Claude