feat: give owner runs a headless chrome-devtools MCP

Adds chrome-devtools-mcp 1.11.0 to the Claude runner so the owner (or a
single-mode room) can open pages, click/fill, take screenshots and read
console/network errors. Reviewer, arbiter and read-only runtimes do not
get it. Chrome runs headless with an isolated temp profile under TMPDIR,
Google usage statistics and CrUX lookups are off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-10-21 12:25:04 +09:00
parent 97cc670e34
commit e3308eb119
5 changed files with 154 additions and 6 deletions

View File

@@ -1,7 +1,13 @@
import fs from 'fs';
import { describe, expect, it } from 'vitest';
import { EJCLAW_ENV } from 'ejclaw-runners-shared';
import { buildEjclawMcpServerConfig } from '../src/mcp-config.js';
import {
buildChromeDevtoolsMcpServerConfig,
buildEjclawMcpServerConfig,
resolveChromeDevtoolsMcpEntry,
shouldEnableChromeDevtoolsMcp,
} from '../src/mcp-config.js';
describe('ejclaw MCP config', () => {
it('always loads EJClaw MCP tools on turn one and preserves runtime env', () => {
@@ -29,3 +35,39 @@ describe('ejclaw MCP config', () => {
});
});
});
describe('chrome-devtools MCP config', () => {
it('is enabled only for the owner or a single-mode room', () => {
expect(shouldEnableChromeDevtoolsMcp('owner', false)).toBe(true);
expect(shouldEnableChromeDevtoolsMcp(undefined, false)).toBe(true);
expect(shouldEnableChromeDevtoolsMcp('reviewer', false)).toBe(false);
expect(shouldEnableChromeDevtoolsMcp('arbiter', false)).toBe(false);
expect(shouldEnableChromeDevtoolsMcp('owner', true)).toBe(false);
});
it('resolves the installed server entry', () => {
const entry = resolveChromeDevtoolsMcpEntry();
expect(entry).toMatch(
/chrome-devtools-mcp\/build\/src\/bin\/chrome-devtools-mcp\.js$/,
);
expect(fs.existsSync(entry!)).toBe(true);
});
it('runs headless with an isolated profile and telemetry off', () => {
const config = buildChromeDevtoolsMcpServerConfig('/x/entry.js', [
'/work',
'/home/claude/.tmp',
]);
expect(config.command).toBe('node');
expect(config.args).toEqual([
'/x/entry.js',
'--headless',
'--isolated',
'--no-usage-statistics',
'--no-performance-crux',
'--workspace=/work',
'--workspace=/home/claude/.tmp',
]);
expect(config.env?.CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS).toBe('1');
});
});