Add Cloudflare Tunnel option for public HTTPS (claude.ai connectors)#3
Merged
Conversation
The claude.ai / Claude Desktop "custom connector" flow needs a publicly reachable HTTPS endpoint on port 443 — localhost and :3000-behind-Cloudflare don't work. Add an opt-in `cloudflared` service (compose `--profile tunnel`) that exposes the server over HTTPS with no open ports, plus README steps and a configurable MCP_CORS_ORIGIN. Ignore .env so tunnel tokens aren't committed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The claude.ai / Claude Desktop custom connector flow requires a publicly reachable HTTPS endpoint on a standard port (443). A
http://localhost:3000URL — or any:3000URL behind Cloudflare — fails with "Couldn't reach the MCP server" because localhost isn't public, Cloudflare's proxy doesn't forward port 3000, and the endpoint needs valid TLS.This adds an opt-in Cloudflare Tunnel so the Dockerized server can be exposed over HTTPS with no open ports and automatic DNS + TLS.
Changes
docker-compose.yml: optionalcloudflaredservice behind thetunnelprofile (docker compose --profile tunnel up -d), driven byTUNNEL_TOKEN. Defaultupis unchanged. Adds a configurableMCP_CORS_ORIGIN.README.md: "Expose publicly" section explaining the requirement (public HTTPS/443) and the Cloudflare Tunnel steps; connector URL ishttps://<host>/mcp(no port)..gitignore: ignore.env/.env.*so tunnel tokens aren't committed.Notes
.mcp.json/claude mcp add), none of this is needed — the public route is only for the connector UI / sharing.🤖 Generated with Claude Code