feat: Add authless mode for Claude.ai custom connectors Testing - #16
Merged
Conversation
Claude.ai custom connectors only support authless or OAuth 2.1 connections, not Bearer token authentication via headers. This change adds an ALLOW_AUTHLESS environment variable (default: "true") that bypasses authentication for SSE transport endpoints (/sse, /sse/, /message), enabling Claude.ai to connect while keeping Bearer token auth required for the /mcp JSON-RPC endpoint for backward compatibility. Changes: - src/config/env.ts: Add ALLOW_AUTHLESS to environment schema - src/lambda.ts: Add authless mode logic to auth middleware - src/index.ts: Apply same authless mode logic to local dev server - template.yaml: Add AllowAuthless CloudFormation parameter - README.md: Add Claude.ai custom connector setup section - docs/authentication.md: Document authless mode configuration - AGENTS.md: Update authentication flow documentation https://claude.ai/code/session_019Wnbwj3oTzyM3sfGUh8Xr8
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds authless mode for Claude.ai custom connectors, which cannot send custom authentication headers. It introduces an ALLOW_AUTHLESS environment variable that, when set to "true", bypasses Bearer token authentication for SSE transport endpoints (/sse, /sse/, /message) while maintaining authentication requirements for the /mcp JSON-RPC endpoint.
Changes:
- Added
ALLOW_AUTHLESSconfiguration option to enable/disable authless mode for SSE endpoints - Updated authentication middleware in both Lambda and local dev servers to support authless mode
- Added CloudFormation parameter for configuring authless mode in AWS deployments
- Comprehensive documentation updates explaining the security implications and setup process
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/config/env.ts | Added ALLOW_AUTHLESS environment variable with schema validation |
| src/lambda.ts | Modified authentication middleware to bypass auth for SSE endpoints when authless mode is enabled |
| src/index.ts | Applied same authless mode logic to local development server |
| template.yaml | Added AllowAuthless CloudFormation parameter with default value "true" |
| docs/authentication.md | Added comprehensive documentation for authless mode configuration and security implications |
| README.md | Added Claude.ai custom connector setup section with security considerations |
| AGENTS.md | Updated authentication flow documentation to include authless mode |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Update Lambda timeout to 900s (max for Function URLs) for long SSE sessions - Improve CORS config with explicit methods/headers for Claude.ai compatibility - Add /debug endpoint for troubleshooting Claude.ai connection issues - Update /health endpoint with diagnostic info (authless mode, timestamp) - Sync version numbers to 3.0.0 across all files - Document serverless-express streaming limitation (GitHub issue #655) - Add known_limitations to /debug endpoint response Note: serverless-express does not support Lambda response streaming. If SSE fails, consider AWS Lambda Web Adapter as an alternative. https://claude.ai/code/session_019Wnbwj3oTzyM3sfGUh8Xr8
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
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.
Claude.ai custom connectors only support authless or OAuth 2.1 connections, not Bearer token authentication via headers. This change adds an ALLOW_AUTHLESS environment variable (default: "true") that bypasses authentication for SSE transport endpoints (/sse, /sse/, /message), enabling Claude.ai to connect while keeping Bearer token auth required for the /mcp JSON-RPC endpoint for backward compatibility.
Changes:
https://claude.ai/code/session_019Wnbwj3oTzyM3sfGUh8Xr8