[BUG] Reference the connection state management bug after SSE reconnection
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Atlassian MCP Connection Diagnostic Report
Date: 2025-10-28
Claude Code Version: 2.0.28
Issue: Atlassian MCP tools consistently fail with "Not connected" error
Summary
The Atlassian MCP server has a critical connection state management issue:
- Authentication: ✅ Working (OAuth tokens valid for ~55 minutes)
- Initial SSE Connection: ✅ Establishes successfully
- SSE Stability: ❌ Connection repeatedly drops and reconnects
- Tool Execution: ❌ All tool calls fail instantly (0s) with "Not connected"
- Success Rate: 0/7 tool calls succeeded
Key Findings
1. Connection Pattern
[DEBUG] SSE transport closed/disconnected, attempting automatic reconnection
[DEBUG] SSE reconnection successful after 961ms
[DEBUG] Calling MCP tool: search
[DEBUG] Tool 'search' failed after 0s: Not connected
2. Statistics from Session
- Failed tool calls: 7
- Successful tool calls: 0
- SSE disconnections: 2+ (within minutes of connection)
- Reconnection time: ~1 second (fast reconnection)
3. Network Environment
- VPN/Tunnel interfaces active: utun0, utun1, utun2, utun3
- Multiple default routes present (potential routing conflicts)
- DNS: Using local gateway (192.168.1.254)
- No HTTP proxy configured
- Connection to mcp.atlassian.com (185.166.141.16-18) via HTTPS works
4. Root Cause Analysis
The error occurs in the connection state check within the MCP client. When tools attempt to execute:
- SSE connection successfully reconnects
- Tool invocation begins
- Connection state check fails immediately (0s timing indicates no network call)
- Returns "Not connected" error
This suggests an internal state management bug where the connection status flag is not properly updated after SSE reconnection, or there's a race condition between reconnection completion and tool execution.
Reproduction Steps
- Start Claude Code session with Atlassian MCP configured
- Run
/mcpto connect - Wait for "Authentication successful. Reconnected to atlassian."
- Immediately try any Atlassian tool (e.g., search, getJiraIssue)
- Tool fails with "Not connected" despite successful authentication
Potential Contributing Factors
- VPN/Network Tunneling: Multiple utun interfaces may cause routing instability
- SSE Keep-Alive Issues: Long-lived SSE connections may be timing out
- State Management Bug: Connection flag not updated after reconnection
- Server-Side Issues: Atlassian MCP SSE server stability
Recommended Actions
Immediate Workarounds
- Use Jira/Confluence web interface directly
- Use Atlassian REST APIs via curl/http clients
- Try disabling VPN if not required
For Anthropic/Atlassian
- Add more detailed SSE disconnect logging (reason codes)
- Fix connection state management after SSE reconnection
- Add connection health checks with retry logic
- Implement exponential backoff for reconnections
- Add debug mode flag to log connection state transitions
Files Referenced
- Debug log:
~/.claude/debug/d21fff70-d5ae-47e1-82e1-a92e8a0ae3a6.txt - Error location:
/Users/OgmaJ/.nvm/versions/node/v20.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1303:15666
What Should Happen?
Expected Behavior
After successful OAuth authentication and SSE connection establishment:
- Tool calls should execute successfully
- Or, if connection is genuinely lost, automatic reconnection should restore functionality
Error Messages/Logs
Steps to Reproduce
Bug Report: Atlassian MCP "Not connected" Error Despite Successful Authentication
Summary
Atlassian MCP tools consistently fail with "Not connected" error even after successful OAuth authentication and SSE connection establishment. The connection state flag is not properly synchronized after SSE reconnection events.
Environment
- Claude Code Version: 2.0.28
- Platform: macOS (Darwin 25.0.0)
- Node Version: v20.19.0
- Installation Method: npm-global
- MCP Server: atlassian-mcp-server v1.0.0
Steps to Reproduce
- Install and Configure Atlassian MCP
- Ensure Atlassian MCP server is configured in Claude Code
- No special configuration required - use default settings
- Start Claude Code Session
``bash``
cd /path/to/any/project
claude
- Connect to Atlassian MCP
- Run the
/mcpcommand - Complete OAuth authorization flow in browser
- Wait for confirmation message: "Authentication successful. Reconnected to atlassian."
- Attempt to Use Any Atlassian Tool
- Try any Atlassian MCP tool, for example:
mcp__atlassian__searchwith query parametermcp__atlassian__getJiraIssuewith issue keymcp__atlassian__getAccessibleAtlassianResources
- Observe the Error
- All tool calls fail instantly (0s execution time)
- Error returned: "Not connected"
- This occurs despite successful authentication and connection
Expected Behavior
After successful OAuth authentication and SSE connection establishment:
- Tool calls should execute successfully
- Or, if connection is genuinely lost, automatic reconnection should restore functionality
Actual Behavior
- OAuth authentication completes successfully ✅
- SSE connection establishes successfully ✅
- Connection status shows as "reconnected" ✅
- All tool invocations fail immediately with "Not connected" ❌
- Success rate: 0% (0 out of 7+ attempts in test session)
Debug Log Evidence
From ~/.claude/debug/latest:
[DEBUG] MCP server "atlassian": Successfully connected to sse server in 653ms
[DEBUG] MCP server "atlassian": Connection established with capabilities: {"hasTools":true,"hasPrompts":false,"hasResources":false,"serverVersion":{"name":"atlassian-mcp-server","version":"1.0.0"}}
[DEBUG] MCP server "atlassian": SSE reconnection successful after 1267ms
[DEBUG] MCP server "atlassian": Returning tokens
[DEBUG] MCP server "atlassian": Token length: 74
[DEBUG] MCP server "atlassian": Has refresh token: true
[DEBUG] MCP server "atlassian": Expires in: 3257s
[DEBUG] MCP server "atlassian": Calling MCP tool: search
[DEBUG] MCP server "atlassian": Tool 'search' failed after 0s: Not connected
Key Observations
- SSE Connection Instability
- SSE transport repeatedly closes/disconnects
- Automatic reconnection succeeds within ~1 second
- Pattern:
SSE transport closed/disconnected, attempting automatic reconnection→SSE reconnection successful
- Instant Failure
- Tool calls fail in 0 seconds (no network request attempted)
- Suggests connection state check failing before tool execution
- State Synchronization Issue
- Logs show: "Connection established", "SSE reconnection successful", valid tokens present
- Yet connection state check returns false immediately
Root Cause Hypothesis
There appears to be a race condition or state management bug where:
- SSE reconnection completes successfully
- Connection capabilities are received from server
- Internal connection state flag is not updated atomically
- Tool invocations check the stale connection state and fail immediately
The 0-second failure time indicates no network call is attempted, pointing to an internal state check failing before the actual tool execution.
Reproducibility
- Frequency: 100% (every tool call attempt fails)
- Timing: Occurs immediately after authentication
- Persistence: Issue persists throughout the session
Potential Contributing Factors
- Multiple VPN/tunnel interfaces (utun0-3) active on system
- May contribute to SSE connection instability
- However, the state management bug is the primary issue
Error Stack Trace
Error: Not connected
at file:///Users/ogmaj/.nvm/versions/node/v20.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1303:15666
at new Promise (<anonymous>)
at KuA.request (file:///Users/ogmaj/.nvm/versions/node/v20.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1303:15607)
at KuA.callTool (file:///Users/ogmaj/.nvm/versions/node/v20.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1303:149084)
Suggested Fix
- Ensure atomic state updates after SSE reconnection
- Add connection state validation logging before failing tool calls
- Implement retry logic for tool calls if connection was recently re-established
- Add connection health check before tool execution with auto-reconnect
- Log detailed SSE disconnect reasons to help diagnose underlying instability
Workaround
Currently, no workaround exists within Claude Code. Users must:
- Use Atlassian web interfaces directly
- Use Atlassian REST APIs with personal API tokens
- Wait for fix
Impact
High - Atlassian MCP integration is completely non-functional. Users cannot:
- Search Jira/Confluence
- Read or update issues
- Access any Atlassian resources through Claude Code
Additional Context
This issue blocks all Atlassian MCP functionality and affects the user experience significantly, as the authentication flow completes successfully but the integration remains unusable.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.28 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗