diff --git a/src/doctor.test.ts b/src/doctor.test.ts index de57ba3..3673ff8 100644 --- a/src/doctor.test.ts +++ b/src/doctor.test.ts @@ -81,7 +81,7 @@ describe('json token helpers', () => { }, }), 'abc123'); const parsed = JSON.parse(next); - expect(parsed.mcp.playwright.env.PLAYWRIGHT_MCP_EXTENSION_TOKEN).toBe('abc123'); + expect(parsed.mcp.playwright.environment.PLAYWRIGHT_MCP_EXTENSION_TOKEN).toBe('abc123'); }); }); diff --git a/src/doctor.ts b/src/doctor.ts index 9e3719b..9e7f43a 100644 --- a/src/doctor.ts +++ b/src/doctor.ts @@ -157,7 +157,7 @@ function readJsonConfigToken(content: string): string | null { function readTokenFromJsonObject(parsed: any): string | null { const direct = parsed?.mcpServers?.[PLAYWRIGHT_SERVER_NAME]?.env?.[PLAYWRIGHT_TOKEN_ENV]; if (typeof direct === 'string' && direct) return direct; - const opencode = parsed?.mcp?.[PLAYWRIGHT_SERVER_NAME]?.env?.[PLAYWRIGHT_TOKEN_ENV]; + const opencode = parsed?.mcp?.[PLAYWRIGHT_SERVER_NAME]?.environment?.[PLAYWRIGHT_TOKEN_ENV]; if (typeof opencode === 'string' && opencode) return opencode; return null; } @@ -178,8 +178,8 @@ export function upsertJsonConfigToken(content: string, token: string): string { enabled: true, type: 'local', }; - parsed.mcp[PLAYWRIGHT_SERVER_NAME].env = parsed.mcp[PLAYWRIGHT_SERVER_NAME].env ?? {}; - parsed.mcp[PLAYWRIGHT_SERVER_NAME].env[PLAYWRIGHT_TOKEN_ENV] = token; + parsed.mcp[PLAYWRIGHT_SERVER_NAME].environment = parsed.mcp[PLAYWRIGHT_SERVER_NAME].environment ?? {}; + parsed.mcp[PLAYWRIGHT_SERVER_NAME].environment[PLAYWRIGHT_TOKEN_ENV] = token; } return `${JSON.stringify(parsed, null, 2)}\n`; }