Fix MCP server authentication and logging issues#12
Merged
rafalzawadzki merged 1 commit intomainfrom Feb 23, 2026
Merged
Conversation
- Enable JSON response mode to prevent SSE stream termination by server.close() - Handle GET/DELETE requests before transport creation (return 405 instead of confusing errors) - Remove API key prefix/suffix from error logs (security fix) - Change informational traces from console.error to console.log - Simplify error responses without leaking environment status This fixes Claude Code's "Authenticate" button showing up and "Failed to reconnect" errors. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supadata-mcp | 013cf8b | Feb 23 2026, 11:02 PM |
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
Fixed two critical issues with the Cloudflare Worker MCP server preventing proper authentication and exposing sensitive data in logs.
Issue 1 – Claude Code shows "Authenticate" button: The transport was using SSE streaming responses, but
server.close()in the finally block terminated the stream before data was delivered. Now uses JSON response mode where responses are fully formed before cleanup.Issue 2 – API key leaked in error logs: Debug logging exposed the first/last 4 characters of the API key (
sd_a...f7c5) and was logged at error level in Cloudflare. Now only logs key length at log level, and removed environment status leaks from error responses.Changes
src/worker.ts: EnableenableJsonResponse: true, handle GET/DELETE before transport creation (return 405), remove API key logging, change console.error to console.warn for missing keys, clean up error responsessrc/mcp.ts: Change informational trace from console.error to console.log (line 9)package.json: Bump version to 1.2.2Testing
Verified locally with curl against wrangler dev:
initialize→ proper JSON-RPC response with capabilitiestools/list→ all 9 tools returnedtools/call→ reaches Supadata API successfullyGET /→ health check 200GET /mcp→ 405 (method not allowed, not confusing errors)🤖 Generated with Claude Code