claude-code - 💡(How to fix) Fix [BUG] MCP servers intermittently fail to connect when invoking skills via claude -p (headless mode)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Root Cause

When invoking a skill via claude -p "/skill-name args" --dangerously-skip-permissions, MCP servers (specifically Atlassian HTTP OAuth) stay in "still connecting" state and their tools never become available. The skill then fails because it can't access any MCP tools. The issue is intermittent, sometimes it works, sometimes it doesn't, with no changes in between.

Code Example

Claude output:

The Atlassian MCP server is listed as "still connecting" but its tools never materialized during my searches. I was unable to call mcp__atlassian__getAccessibleAtlassianResources because the tool is not available — the Atlassian MCP server connection appears to have failed or is still pending.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When invoking a skill via claude -p "/skill-name args" --dangerously-skip-permissions, MCP servers (specifically Atlassian HTTP OAuth) stay in "still connecting" state and their tools never become available. The skill then fails because it can't access any MCP tools. The issue is intermittent, sometimes it works, sometimes it doesn't, with no changes in between.

What Should Happen?

MCP servers should fully connect and their tools should be available before skill execution begins, just as they are in interactive sessions.

Error Messages/Logs

Claude output:

The Atlassian MCP server is listed as "still connecting" but its tools never materialized during my searches. I was unable to call mcp__atlassian__getAccessibleAtlassianResources because the tool is not available — the Atlassian MCP server connection appears to have failed or is still pending.

Steps to Reproduce

  1. Configure an HTTP OAuth MCP server (Atlassian: https://mcp.atlassian.com/v1/mcp) in ~/.claude.json
  2. Authenticate via /mcp in an interactive session (confirm it works)
  3. Create a skill with context: fork, agent: general-purpose, and mcp__atlassian__* tools in allowed-tools
  4. Run: claude -p "/skill-name" --dangerously-skip-permissions
  5. MCP tools are unavailable — server shows "still connecting"
  6. Running claude -p "call mcp__atlassian__getAccessibleAtlassianResources" (no skill, just a raw prompt) works reliably
  7. Running the same skill interactively always works

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.154

Platform

AWS Bedrock

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

  • OS: Windows 11 Pro 10.0.26200
  • Using AWS Bedrock: CLAUDE_CODE_USE_BEDROCK=1, AWS_REGION=us-west-2
  • MCP server config in ~/.claude.json with type http and OAuth auth
  • Three MCP servers configured: atlassian, github, idea (IntelliJ)
  • setting MCP_TIMEOUT=60000 (60s) had no effect
  • The issue is intermittent — the same command can fail 5 times in a row, then work once, then fail again
  • Smaller skills (5KB body) seem to succeed more often than larger ones (10KB), but both can fail

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING