anthropics / anthropics/claude-code-action
Connection to MCPs fails without any logs
- Lenguaje dominante
- TypeScript
- Estrellas
- 8.9k
- Forks
- 2.1k
- Merge medio
- 3 d 9 h
- PR fusionados (30 d)
- 10
Descripción
**Describe the bug**
I am trying to connect Claude Code in GitHub Actions to two MCP servers:
1. An internal MCP server running locally via SSE on `http://localhost:7929/mcp`
2. The external Context7 MCP server via SSE on `https://mcp.context7.com/mcp`
Both MCP servers show `"status": "failed"` in Claude's startup logs without any error messages or reasons, even with debug mode enabled.
The MCP servers themselves start successfully and are confirmed to be working.
**To Reproduce**
Steps to reproduce the behavior:
1. Set up a GitHub Actions workflow with Claude Code action
2. Start an MCP server locally
3. Configure Claude Code with `--mcp-config` pointing to both local and remote SSE servers
4. Run the workflow
5. Observe Claude startup logs showing:
```json
"mcp_servers": [
{
"name": "dotnet-knowledge-base",
"status": "failed"
},
{
"name": "context7",
"status": "failed"
}
]
```
7. No additional error messages or failure reasons are provided, even in debug mode
**Expected behavior**
- Claude Code should successfully connect to both MCP servers
- If connection fails, detailed error messages should be provided explaining:
- Why the connection failed
- Network connectivity issues (if any)
- Authentication problems (if any)
- SSE endpoint validation failures (if any)
- Debug mode should provide verbose logging about MCP connection attempts
**Screenshots**
Example log output showing silent failure:
```json
"mcp_servers": [
{
"name": "dotnet-knowledge-base",
"status": "failed"
},
{
"name": "context7",
"status": "failed"
}
]
```
**Workflow yml file**
Main workflow (`.github/workflows/claude-on-mention.yml`):
```yaml
name: Claude on Mention
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened]
pull_request:
types: [opened]
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
jobs:
claude:
if: |
github.event.sender.type != 'Bot' && (
contains(github.event.comment.body, '@claude') ||
contains(github.event.issue.body, '@claude') ||
contains(github.event.issue.title, '@claude') ||
contains(github.event.pull_request.body, '@claude') ||
contains(github.event.pull_request.title, '@claude')
)
uses: ./.github/workflows/reusable-claude-dotnet-setup.yml
with:
max_turns: '100'
secrets: inherit
```
Reusable workflow with MCP configuration (`.github/workflows/reusable-claude-dotnet-setup.yml` - simplified):
```yaml
name: Reusable Claude .NET Setup
on:
workflow_call:
inputs:
max_turns:
required: false
type: string
default: '100'
model:
required: false
type: string
default: 'claude-opus-4-5-20251101'
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.1
# ... setup steps (dotnet, node, dependencies, infrastructure, set up MCP server) ...
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
You are running as Cloud AI inside a GitHub Actions workflow.
${{ inputs.prompt }}
claude_args: |
--max-turns ${{ inputs.max_turns }}
--model ${{ inputs.model }}
--mcp-config '{"mcpServers":{"dotnet-knowledge-base":{"type":"sse","url":"http://localhost:7929/mcp"},"context7":{"type":"sse","url":"https://mcp.context7.com/mcp","headers":{}}}}'
--allowedTools "Edit,Write,Read,Glob,Grep,WebSearch,Bash(dotnet:*),mcp__dotnet-knowledge-base__*,mcp__context7__*"
--strict-mcp-config
show_full_output: true
```
**API Provider**
[x] Anthropic First-Party API (default)
[ ] AWS Bedrock
[ ] GCP Vertex
**Additional context**
I have tried configuring MCP in multiple ways, including:
- Using inline `--mcp-config` with JSON (as shown in the workflow above)
- Using `--mcp-file` pointing to `.github/mcp-config.json`
- Using `.mcp.json` file in the repository root
- Different combinations of flags with `--strict-mcp-config` and without it
All approaches result in the same silent failure with no diagnostic information.
Is there a way to enable more verbose MCP connection logging?
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.