From eaf0986c492c4e28de8edf40e44f6d54587f9882 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Thu, 8 Oct 2026 16:20:20 -0400 Subject: [PATCH 1/2] fix(mcp-worker): set explicit fetch cache mode for axios 1.20 --- mcp-worker/src/axiosFetchDefaults.ts | 13 +++++++++++++ mcp-worker/src/index.ts | 1 + 2 files changed, 14 insertions(+) create mode 100644 mcp-worker/src/axiosFetchDefaults.ts diff --git a/mcp-worker/src/axiosFetchDefaults.ts b/mcp-worker/src/axiosFetchDefaults.ts new file mode 100644 index 00000000..5ef9b9c5 --- /dev/null +++ b/mcp-worker/src/axiosFetchDefaults.ts @@ -0,0 +1,13 @@ +import axios from 'axios' +import { axiosClient } from '../../src/api/apiClient' + +/** + * axios >= 1.20 defaults fetch requests to `cache: 'default'`, which the + * Workers runtime rejects ("Unsupported cache mode: default"). Workers only + * accept `no-store` / `no-cache`, so set an explicit value on both the global + * axios defaults and the shared CLI client instance. + */ +const fetchOptions = { cache: 'no-store' as const } + +axios.defaults.fetchOptions = fetchOptions +axiosClient.defaults.fetchOptions = fetchOptions diff --git a/mcp-worker/src/index.ts b/mcp-worker/src/index.ts index 736d5522..e8e12a2a 100644 --- a/mcp-worker/src/index.ts +++ b/mcp-worker/src/index.ts @@ -1,3 +1,4 @@ +import './axiosFetchDefaults' import OAuthProvider from '@cloudflare/workers-oauth-provider' import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' import type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js' From 03942e2c52beda1e3c14be9d1e32d49faeff24c6 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Thu, 8 Oct 2026 16:24:36 -0400 Subject: [PATCH 2/2] test(mcp-worker): cover axios fetch cache defaults --- mcp-worker/src/axiosFetchDefaults.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 mcp-worker/src/axiosFetchDefaults.test.ts diff --git a/mcp-worker/src/axiosFetchDefaults.test.ts b/mcp-worker/src/axiosFetchDefaults.test.ts new file mode 100644 index 00000000..6c2048de --- /dev/null +++ b/mcp-worker/src/axiosFetchDefaults.test.ts @@ -0,0 +1,14 @@ +import { describe, expect, test } from 'vitest' +import axios from 'axios' +import { axiosClient } from '../../src/api/apiClient' +import './axiosFetchDefaults' + +describe('axiosFetchDefaults', () => { + test('sets a Workers-compatible cache mode on global axios defaults', () => { + expect(axios.defaults.fetchOptions?.cache).toBe('no-store') + }) + + test('sets a Workers-compatible cache mode on the shared axiosClient', () => { + expect(axiosClient.defaults.fetchOptions?.cache).toBe('no-store') + }) +})