DevTools Lens MCP
Enables AI agents to inspect and control a live Chromium browser for frontend debugging, providing console logs, network requests, DOM snapshots, and accessibility analysis.
README
DevTools Lens MCP
Give your AI agent Chrome DevTools.
DevTools Lens MCP is a production-oriented Model Context Protocol server that lets Claude, Codex, and other MCP clients inspect and control a live Chromium browser. It is built for frontend debugging—not just browser automation.
Ask an agent why a login request failed, which exception broke a click handler, what changed in the DOM after submit, or whether the current page has accessibility problems. The server combines Playwright's reliable lifecycle and interaction layer with direct Chrome DevTools Protocol diagnostics.
<!-- Demo GIF placeholder: console + failed network root-cause workflow -->
Why this exists
Browser automation tools can click and type, but debugging needs evidence: buffered console history, request/response details, stack traces, DOM state, computed styles, accessibility metadata, and before/after changes. DevTools Lens MCP exposes that evidence as focused, schema-validated tools that an AI agent can reason over.
Highlights
- 19 purpose-built debugging tools over MCP stdio
- Multiple isolated browser sessions with optional single-session shorthand
- CDP-native console, exception, and network event collection
- Grouped console errors with likely categories
- Failed-request detection for HTTP, DNS, timeout, refused, CORS, and aborted requests
- Bounded textual response-body inspection and default credential redaction
- Compact DOM snapshots, element styles/layout, and structural DOM diffing
- Click impact capture: DOM, console, network, and URL before/after evidence
- Page and element screenshots written to a controlled output directory
- axe-core accessibility analysis
- Strict TypeScript, Zod inputs, Vitest coverage, Docker, and CI
Architecture
flowchart LR
Client[Claude / Codex / MCP client] -->|MCP stdio| Server[MCP tool registry]
Server --> Schemas[Zod validation + structured errors]
Server --> Manager[BrowserManager]
Manager --> S1[BrowserSession A]
Manager --> S2[BrowserSession B]
S1 --> PW[Playwright lifecycle + interactions]
S1 --> CDP[Chrome DevTools Protocol]
CDP --> Console[Console ring buffer]
CDP --> Network[Network ring buffer]
Server --> Services[DOM / console / network / a11y / screenshot services]
Services --> S1
Each session owns one Chromium page, one CDP session, independent console/network buffers, active requests, and lifecycle timestamps. The transport is isolated in the server entry point so HTTP transports can be added later without rewriting browser services.
Five-minute setup
Requirements: Node.js 20.19+ and npm.
npm install -g devtools-lens-mcp
npx playwright install chromium
devtools-lens-mcp
For one-command client usage, configure the client to run:
npx -y devtools-lens-mcp
When developing from source:
git clone https://github.com/aakcay5656/devtools-lens-mcp.git
cd devtools-lens-mcp
npm install
npx playwright install chromium
npm run build
npm start
MCP client configuration
Claude Desktop
Add this server to the mcpServers object in Claude Desktop's configuration:
{
"mcpServers": {
"devtools-lens": {
"command": "npx",
"args": ["-y", "devtools-lens-mcp"]
}
}
}
Restart Claude Desktop after saving the file.
Codex CLI or IDE extension
The CLI and IDE extension share MCP configuration. Add the server with:
codex mcp add devtools-lens -- npx -y devtools-lens-mcp
Or add it manually to ~/.codex/config.toml:
[mcp_servers.devtools-lens]
command = "npx"
args = ["-y", "devtools-lens-mcp"]
startup_timeout_sec = 30
tool_timeout_sec = 120
Tools
| Tool | Purpose |
|---|---|
browser_launch |
Launch Chromium with URL, viewport, and headless options |
browser_connect |
Connect to an existing CDP remote-debugging endpoint |
browser_navigate |
Navigate and wait for a lifecycle state |
browser_get_page_info |
Get URL, title, viewport, UA, loading state, and DOM/resource counts |
browser_get_console_logs |
Filter buffered console history |
browser_get_console_errors |
Group errors/exceptions and classify likely causes |
browser_get_network_requests |
Filter complete session request history |
browser_get_failed_requests |
Explain HTTP and transport failures |
browser_get_request_details |
Get headers, payload, initiator, timing, and bounded text body |
browser_inspect_element |
Get layout, visibility, styles, accessible identity, and selector |
browser_get_dom_snapshot |
Capture a compact, depth-limited DOM model |
browser_click |
Click and optionally capture diagnostic changes |
browser_fill |
Fill editable elements with password-safe results |
browser_select |
Select an option by value, label, or index |
browser_press_key |
Press keys or chords on a target or page |
browser_screenshot |
Save page or element screenshots |
browser_get_accessibility_issues |
Run axe-core and return actionable findings |
browser_compare_dom |
Compare snapshots by additions/removals/text/attributes/visibility |
browser_close |
Safely close a session |
All browser-facing tools accept sessionId. It may be omitted when exactly one session exists. Ambiguous and invalid sessions return structured errors with available session IDs.
Example workflow
- Ask the client to call
browser_launchwith{ "headless": true, "url": "https://example.com" }. - Call
browser_get_console_errorsandbrowser_get_failed_requeststo establish a baseline. - Call
browser_clickwith{ "selector": "button[type=submit]", "captureChanges": true }. - Inspect new requests with
browser_get_request_detailsand the DOM diff from the click result. - Call
browser_closewhen finished.
Prompts to try
- “Find all console errors on this page and explain their likely causes.”
- “Click the login button and analyze what fails.”
- “Inspect failed API requests and suggest a fix.”
- “Compare the page before and after submitting this form.”
- “Find accessibility issues in the current page.”
- “Inspect the styling and accessibility properties of the submit button.”
<!-- Demo GIF placeholder: captureChanges DOM/network/console comparison -->
Configuration
| Environment variable | Default | Meaning |
|---|---|---|
DEVTOOLS_LENS_OUTPUT_DIR |
./output |
Only directory used for screenshots |
DEVTOOLS_LENS_MAX_CONSOLE |
2000 |
Console buffer capacity per session |
DEVTOOLS_LENS_MAX_NETWORK |
2000 |
Network buffer capacity per session |
DEVTOOLS_LENS_MAX_BODY_BYTES |
1000000 |
Maximum returned response-body bytes |
Security
Treat the browser and every page it opens as untrusted.
authorization,cookie,set-cookie,x-api-key, andproxy-authorizationheaders are masked by default.- Password inputs are never returned by fill results or DOM snapshot value attributes.
- Binary response bodies are not returned; textual bodies are byte-limited.
- Screenshots can only be written under the configured output directory.
- The server exposes no arbitrary shell command or general-purpose JavaScript evaluation tool.
- Localhost and private-network navigation are not blocked. This is intentional for local frontend debugging, but it makes SSRF-style access possible when an agent follows untrusted instructions. Run the server with only the network access it needs.
- Never attach this server to a trusted personal browser profile. Use a fresh, disposable debugging profile with no saved credentials, cookies, extensions, or open authenticated tabs.
- Response bodies and page text may themselves contain secrets. Review outputs before sharing them.
- Connecting by remote debugging endpoint grants powerful control over that browser. Bind debugging ports to loopback and do not expose them publicly.
For untrusted targets, prefer the Docker image with a restricted network policy and disposable filesystem. Report vulnerabilities privately according to SECURITY.md.
Development
npm run dev
npm run typecheck
npm run lint
npm run test:unit
npm run test:integration
npm run test
npm run build
npm run format
Integration tests start a local fixture and a real headless Chromium instance. Install the browser once with npx playwright install chromium.
Docker
docker build -t devtools-lens-mcp .
docker run --rm -i -v "$PWD/output:/app/output" devtools-lens-mcp
The image is designed for MCP stdio (-i is required). See docker-compose.yml for a minimal example.
Roadmap
- React component tree, props, and state inspection
- Redux and Zustand state inspection
- Vue component inspection
- Performance trace analysis and Lighthouse integration
- CSS and JavaScript coverage
- Source-map-aware source navigation
- Breakpoints, step debugging, and WebSocket inspection
- IndexedDB, localStorage, sessionStorage, and cookie editing
- Mobile device emulation and multi-tab support
- Browser recording and replay
- AI-driven automatic root-cause analysis
Contributing
Issues and pull requests are welcome. Read CONTRIBUTING.md, keep tools narrowly focused on frontend diagnosis, add Zod validation for inputs, and include unit or Chromium integration coverage for behavior changes.
License
MIT © DevTools Lens MCP contributors.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。