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

Resolved 💬 3 comments Opened May 28, 2026 by bancell04 Closed Jun 30, 2026

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?

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

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗