Skip to content

Commit 903b6e9

Browse files
committed
Add separate global api token
1 parent 31e820e commit 903b6e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/mcp-common/src/dev-mode.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import type { AuthProps } from './cloudflare-oauth-handler'
66
interface RequiredEnv {
77
DEV_CLOUDFLARE_EMAIL: string
88
DEV_CLOUDFLARE_API_TOKEN: string
9+
DEV_CLOUDFLARE_GLOBAL_API_TOKEN?: string
910
}
1011

1112
export async function handleDevMode<
1213
T extends typeof McpAgent<unknown, unknown, Record<string, unknown>>,
1314
>(agent: T, req: Request, env: RequiredEnv, ctx: ExecutionContext) {
1415
const { user, accounts } = await getUserAndAccounts(env.DEV_CLOUDFLARE_API_TOKEN, {
1516
'X-Auth-Email': env.DEV_CLOUDFLARE_EMAIL,
16-
'X-Auth-Key': env.DEV_CLOUDFLARE_API_TOKEN,
17+
'X-Auth-Key': env.DEV_CLOUDFLARE_GLOBAL_API_TOKEN ?? env.DEV_CLOUDFLARE_API_TOKEN,
1718
})
1819
ctx.props = {
1920
accessToken: env.DEV_CLOUDFLARE_API_TOKEN,

0 commit comments

Comments
 (0)