Skip to content

fix: forward MCP_TIMEOUT, MCP_TOOL_TIMEOUT, MAX_MCP_OUTPUT_TOKENS to action step#1162

Merged
ashwin-ant merged 1 commit intoanthropics:mainfrom
qozle:fix/mcp-timeout-env-passthrough
Apr 5, 2026
Merged

fix: forward MCP_TIMEOUT, MCP_TOOL_TIMEOUT, MAX_MCP_OUTPUT_TOKENS to action step#1162
ashwin-ant merged 1 commit intoanthropics:mainfrom
qozle:fix/mcp-timeout-env-passthrough

Conversation

@qozle
Copy link
Copy Markdown
Contributor

@qozle qozle commented Apr 4, 2026

Problem

MCP_TIMEOUT (and related vars) set in a calling workflow never reach the Claude CLI subprocess, causing npx-based MCP servers to always hit the default 30-second timeout.

Every approach users try silently fails:

Method Why it fails
Step-level env: MCP_TIMEOUT: 120000 on calling workflow step Composite action steps do not inherit the caller's step-level env
echo "MCP_TIMEOUT=120000" >> "$GITHUB_ENV" in a prior step Sets job-level env, but the step's explicit env: block shadows it — missing a ${{ env.MCP_TIMEOUT }} line
settings input {"env": {"MCP_TIMEOUT": ...}} Writes to ~/.claude/settings.json, not to process.env — wrong path entirely

Root cause

The "Run Claude Code Action" step in action.yml uses an explicit env: block (~50 vars). In GitHub Actions composite actions, a step with its own env: block does not automatically inherit the calling workflow's job-level environment — it only gets what's explicitly listed. MCP_TIMEOUT, MCP_TOOL_TIMEOUT, and MAX_MCP_OUTPUT_TOKENS were not in the list.

Once any of these vars IS in the step's process environment, the existing forwarding chain is already correct: parse-sdk-options.ts:211 spreads { ...process.env } into sdkOptions.env, the SDK passes that env to the CLI subprocess, and the CLI reads the values directly.

Fix

Add explicit ${{ env.VAR }} passthrough lines for all three MCP config vars — the same pattern already used for OTEL_*, AWS_*, and GCP configuration in lines 271–317.

MCP_TIMEOUT: ${{ env.MCP_TIMEOUT }}
MCP_TOOL_TIMEOUT: ${{ env.MCP_TOOL_TIMEOUT }}
MAX_MCP_OUTPUT_TOKENS: ${{ env.MAX_MCP_OUTPUT_TOKENS }}

No TypeScript changes needed. Single file, 9 lines added (3 vars + 6 lines of comment).

After this fix

# job-level env (recommended)
env:
  MCP_TIMEOUT: "120000"

# or GITHUB_ENV in a prior step
- run: echo "MCP_TIMEOUT=120000" >> "$GITHUB_ENV"

Both approaches now work correctly.

All three vars fixed together — fixing only MCP_TIMEOUT while leaving MCP_TOOL_TIMEOUT and MAX_MCP_OUTPUT_TOKENS broken would generate follow-up issues.

Fixes #1152

…action step

These three env vars are read directly from process.env by the Claude CLI
subprocess to configure MCP server behavior. Users setting them in their
workflow had no reliable way to make them reach the CLI:

- Job-level env: shadowed by the step's explicit env: block
- Step-level env: on the calling workflow step is not inherited by
  composite action steps
- GITHUB_ENV from a prior step: same shadowing problem
- settings input: writes to ~/.claude/settings.json, not process.env

The fix is to add explicit ${{ env.VAR }} passthrough lines for all three
vars, matching the existing pattern already used for OTEL_*, AWS_*, and
Vertex configuration (lines 271-317). No TypeScript changes are needed;
the forwarding chain in parse-sdk-options.ts is already correct.

Fixes anthropics#1152

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@ashwin-ant ashwin-ant merged commit 0f1fe5e into anthropics:main Apr 5, 2026
7 of 37 checks passed
mergify Bot added a commit to ArcadeData/arcadedb that referenced this pull request Apr 13, 2026
Bumps the github-actions group with 2 updates: [anthropics/claude-code-action](https://github.com/anthropics/claude-code-action) and [actions/upload-artifact](https://github.com/actions/upload-artifact).
Updates `anthropics/claude-code-action` from 1.0.88 to 1.0.93
Release notes

*Sourced from [anthropics/claude-code-action's releases](https://github.com/anthropics/claude-code-action/releases).*

> v1.0.93
> -------
>
> **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.93>
>
> v1.0.92
> -------
>
> **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.92>
>
> v1.0.91
> -------
>
> What's Changed
> --------------
>
> * Use pinned bun binary for post-steps when allowed\_non\_write\_users is set by [`@​OctavianGuzu`](https://github.com/OctavianGuzu) in [anthropics/claude-code-action#1190](https://redirect.github.com/anthropics/claude-code-action/pull/1190)
>
> **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.91>
>
> v1.0.90
> -------
>
> What's Changed
> --------------
>
> * fix: forward MCP\_TIMEOUT, MCP\_TOOL\_TIMEOUT, MAX\_MCP\_OUTPUT\_TOKENS to action step by [`@​qozle`](https://github.com/qozle) in [anthropics/claude-code-action#1162](https://redirect.github.com/anthropics/claude-code-action/pull/1162)
> * security: reject PATH\_TO\_CLAUDE\_CODE\_EXECUTABLE with control characters by [`@​qozle`](https://github.com/qozle) in [anthropics/claude-code-action#1185](https://redirect.github.com/anthropics/claude-code-action/pull/1185)
>
> **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.90>
>
> v1.0.89
> -------
>
> What's Changed
> --------------
>
> * fix: skip token revocation when no token was acquired by [`@​Dave-London`](https://github.com/Dave-London) in [anthropics/claude-code-action#918](https://redirect.github.com/anthropics/claude-code-action/pull/918)
> * Use env vars for workflow\_run context values in example workflows by [`@​ddworken`](https://github.com/ddworken) in [anthropics/claude-code-action#1125](https://redirect.github.com/anthropics/claude-code-action/pull/1125)
> * docs: document include/exclude\_comments\_by\_actor inputs by [`@​yuribodo`](https://github.com/yuribodo) in [anthropics/claude-code-action#1130](https://redirect.github.com/anthropics/claude-code-action/pull/1130)
> * fix: use correct fallback type for reviewData in fetcher by [`@​MaxwellCalkin`](https://github.com/MaxwellCalkin) in [anthropics/claude-code-action#1034](https://redirect.github.com/anthropics/claude-code-action/pull/1034)
> * Strip OIDC token request env vars from Claude session by [`@​chyipin`](https://github.com/chyipin) in [anthropics/claude-code-action#1011](https://redirect.github.com/anthropics/claude-code-action/pull/1011)
> * fix: skip retries for non-retryable errors in retryWithBackoff by [`@​ei-grad`](https://github.com/ei-grad) in [anthropics/claude-code-action#1082](https://redirect.github.com/anthropics/claude-code-action/pull/1082)
> * fix: restore ripgrep execute bits after bun install --production by [`@​qozle`](https://github.com/qozle) in [anthropics/claude-code-action#1163](https://redirect.github.com/anthropics/claude-code-action/pull/1163)
> * fix: allow # in branch names for PR checkout and base restore by [`@​qozle`](https://github.com/qozle) in [anthropics/claude-code-action#1167](https://redirect.github.com/anthropics/claude-code-action/pull/1167)
> * fix: prevent hang in restoreConfigFromBase on repos with .gitmodules by [`@​qozle`](https://github.com/qozle) in [anthropics/claude-code-action#1166](https://redirect.github.com/anthropics/claude-code-action/pull/1166)
> * fix: strip shell comment lines before parsing claude\_args by [`@​VoidChecksum`](https://github.com/VoidChecksum) in [anthropics/claude-code-action#1055](https://redirect.github.com/anthropics/claude-code-action/pull/1055)
> * fix: snapshot PR's .claude/ to .claude-pr/ before security restore by [`@​qozle`](https://github.com/qozle) in [anthropics/claude-code-action#1172](https://redirect.github.com/anthropics/claude-code-action/pull/1172)
> * chore: fix prettier formatting by [`@​ashwin-ant`](https://github.com/ashwin-ant) in [anthropics/claude-code-action#1171](https://redirect.github.com/anthropics/claude-code-action/pull/1171)
> * chore: fix prettier formatting in parse-sdk-options.test.ts by [`@​ashwin-ant`](https://github.com/ashwin-ant) in [anthropics/claude-code-action#1176](https://redirect.github.com/anthropics/claude-code-action/pull/1176)
> * fix: pin bun runtime config and improve log hygiene by [`@​ashwin-ant`](https://github.com/ashwin-ant) in [anthropics/claude-code-action#1174](https://redirect.github.com/anthropics/claude-code-action/pull/1174)
>
> New Contributors
> ----------------
>
> * [`@​yuribodo`](https://github.com/yuribodo) made their first contribution in [anthropics/claude-code-action#1130](https://redirect.github.com/anthropics/claude-code-action/pull/1130)
> * [`@​MaxwellCalkin`](https://github.com/MaxwellCalkin) made their first contribution in [anthropics/claude-code-action#1034](https://redirect.github.com/anthropics/claude-code-action/pull/1034)
> * [`@​chyipin`](https://github.com/chyipin) made their first contribution in [anthropics/claude-code-action#1011](https://redirect.github.com/anthropics/claude-code-action/pull/1011)
> * [`@​ei-grad`](https://github.com/ei-grad) made their first contribution in [anthropics/claude-code-action#1082](https://redirect.github.com/anthropics/claude-code-action/pull/1082)
> * [`@​qozle`](https://github.com/qozle) made their first contribution in [anthropics/claude-code-action#1163](https://redirect.github.com/anthropics/claude-code-action/pull/1163)
> * [`@​VoidChecksum`](https://github.com/VoidChecksum) made their first contribution in [anthropics/claude-code-action#1055](https://redirect.github.com/anthropics/claude-code-action/pull/1055)
>
> **Full Changelog**: <anthropics/claude-code-action@v1...v1.0.89>


Commits

* [`b47fd72`](anthropics/claude-code-action@b47fd72) chore: bump Claude Code to 2.1.101 and Agent SDK to 0.2.101
* [`c26cb64`](anthropics/claude-code-action@c26cb64) chore: bump Claude Code to 2.1.100 and Agent SDK to 0.2.98
* [`657fb7c`](anthropics/claude-code-action@657fb7c) chore: bump Claude Code to 2.1.98 and Agent SDK to 0.2.98
* [`2ff1acb`](anthropics/claude-code-action@2ff1acb) chore: bump Claude Code to 2.1.97 and Agent SDK to 0.2.97
* [`b2fdd80`](anthropics/claude-code-action@b2fdd80) Use pinned bun binary for post-steps when allowed\_non\_write\_users is set ([#1190](https://redirect.github.com/anthropics/claude-code-action/issues/1190))
* [`26ddc35`](anthropics/claude-code-action@26ddc35) chore: bump Claude Code to 2.1.96 and Agent SDK to 0.2.96
* [`3983706`](anthropics/claude-code-action@3983706) chore: bump Claude Code to 2.1.94 and Agent SDK to 0.2.94
* [`6cad158`](anthropics/claude-code-action@6cad158) security: reject PATH\_TO\_CLAUDE\_CODE\_EXECUTABLE with control characters ([#1185](https://redirect.github.com/anthropics/claude-code-action/issues/1185))
* [`0f1fe5e`](anthropics/claude-code-action@0f1fe5e) fix: forward MCP\_TIMEOUT, MCP\_TOOL\_TIMEOUT, MAX\_MCP\_OUTPUT\_TOKENS to action s...
* [`6e2bd52`](anthropics/claude-code-action@6e2bd52) fix: pin bun runtime config and improve log hygiene ([#1174](https://redirect.github.com/anthropics/claude-code-action/issues/1174))
* Additional commits viewable in [compare view](anthropics/claude-code-action@1eddb33...b47fd72)
  
Updates `actions/upload-artifact` from 7.0.0 to 7.0.1
Release notes

*Sourced from [actions/upload-artifact's releases](https://github.com/actions/upload-artifact/releases).*

> v7.0.1
> ------
>
> What's Changed
> --------------
>
> * Update the readme with direct upload details by [`@​danwkennedy`](https://github.com/danwkennedy) in [actions/upload-artifact#795](https://redirect.github.com/actions/upload-artifact/pull/795)
> * Readme: bump all the example versions to v7 by [`@​danwkennedy`](https://github.com/danwkennedy) in [actions/upload-artifact#796](https://redirect.github.com/actions/upload-artifact/pull/796)
> * Include changes in typespec/ts-http-runtime 0.3.5 by [`@​yacaovsnc`](https://github.com/yacaovsnc) in [actions/upload-artifact#797](https://redirect.github.com/actions/upload-artifact/pull/797)
>
> **Full Changelog**: <actions/upload-artifact@v7...v7.0.1>


Commits

* [`043fb46`](actions/upload-artifact@043fb46) Merge pull request [#797](https://redirect.github.com/actions/upload-artifact/issues/797) from actions/yacaovsnc/update-dependency
* [`634250c`](actions/upload-artifact@634250c) Include changes in typespec/ts-http-runtime 0.3.5
* [`e454baa`](actions/upload-artifact@e454baa) Readme: bump all the example versions to v7 ([#796](https://redirect.github.com/actions/upload-artifact/issues/796))
* [`74fad66`](actions/upload-artifact@74fad66) Update the readme with direct upload details ([#795](https://redirect.github.com/actions/upload-artifact/issues/795))
* See full diff in [compare view](actions/upload-artifact@bbbca2d...043fb46)
  
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore  major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore  minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore  ` will remove the ignore condition of the specified dependency and ignore conditions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP_TIMEOUT not passed to Claude CLI subprocess — npx-based MCP servers always fail

2 participants