Skip to content

fix(mcp-worker): set explicit fetch cache mode for axios 1.20 - #596

Merged
jonathannorris merged 2 commits into
mainfrom
fix/mcp-worker-fetch-cache
Oct 8, 2026
Merged

jonathannorris merged 2 commits into
mainfrom
fix/mcp-worker-fetch-cache

Conversation

@jonathannorris

Copy link
Copy Markdown
Member

Summary

  • axios 1.20 (bumped in chore: resolve open dependabot security alerts #592) now defaults fetch adapter requests to cache: 'default', which the Workers runtime rejects with Unsupported cache mode: default. This broke every tool on the remote MCP server.
  • Set fetchOptions: { cache: 'no-store' } on both the global axios.defaults and the shared axiosClient from the worker entry, so direct axios calls (e.g. src/mcp/utils/github.ts) are covered too. The CLI is unchanged.

Related Issues

Relates to #592

@jonathannorris
jonathannorris marked this pull request as ready for review October 8, 2026 20:20
@jonathannorris
jonathannorris requested a review from a team as a code owner October 8, 2026 20:20
@jonathannorris
jonathannorris requested review from jsalaber and suthar26 and a balanced review from Copilot October 8, 2026 20:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The critical compatibility fix lacks regression coverage for both Axios request paths.

1 open finding
What changed in this PR

Configures Axios for Cloudflare Workers compatibility after the Axios 1.20 upgrade.

Changes:

  • Sets cache: 'no-store' for global and shared Axios clients.
  • Loads these defaults from the worker entry point.
File Description
mcp-worker/​src/​index.ts Initializes Worker-specific Axios defaults.
mcp-worker/​src/​axiosFetchDefaults.ts Applies the supported fetch cache mode.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +12 to +13
axios.defaults.fetchOptions = fetchOptions
axiosClient.defaults.fetchOptions = fetchOptions
@jonathannorris
jonathannorris enabled auto-merge (squash) October 8, 2026 20:25
@jonathannorris
jonathannorris merged commit b8a3e3c into main Oct 8, 2026
6 of 7 checks passed
@jonathannorris
jonathannorris deleted the fix/mcp-worker-fetch-cache branch October 8, 2026 20:26
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.

3 participants