DOM Analyzer MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
cd dom-analyzer-mcp
PUPPETEER_SKIP_DOWNLOAD=true npm i
npm run build
npm start
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add dom-analyzer -- node "<FULL_PATH_TO_DOM_ANALYZER_MCP>/dist/index.js"

Replace <FULL_PATH_TO_DOM_ANALYZER_MCP>/dist/index.js with the actual folder you prepared in step 1.

README.md

A Puppeteer-based server for remote debugging, E2E testing, and DOM inspection.

DOM Analyzer MCP Server

Introduzione

Il progetto dom-analyzer-mcp è un DOM Analyzer/E2E server MCP basato su Puppeteer per controllare un'app frontend in un URL configurabile.

  • Percorso: server.ts
  • Stack: Model Context Protocol (MCP) + Puppeteer
  • Obiettivo: fornire comandi remoti di debug, test e ispezione DOM/CSS rete.

Configurazione esterna

File: config.json

Esempio:

{
  "targetUrl": "http://localhost:4200",
  "headless": true
}
  • targetUrl: URL dell'app da esplorare (es. server dev locale)
  • headless: booleano per avvio Puppeteer headless

Struttura generale

Variabili di stato globali:

  • browser: Browser (Puppeteer)
  • page: Page (Puppeteer)
  • networkRequests: {url, method, status?, response?}[]
  • consoleErrors: string[]

Core:

  • initBrowser(url = 'http://localhost:4200'): inizializza Puppeteer con retry, intercetta request/response.
  • main(): avvia il server MCP, registra console errors e connette StdioServerTransport.

Tool MCP disponibili

1) `take_screenshot`

Scatta uno screenshot della pagina o elemento selezionato.

Input:

  • selector (opzionale): CSS selector dell'elemento.
  • navigateTo (opzionale): URL da visitare prima di catturare.

Output:

  • content con text e image (base64 PNG).

2) `read_dom`

Restituisce l'HTML (outerHTML) del body o elemento specificato.

Input:

  • selector (opzionale): CSS selector.

Output:

  • content[0].text = HTML.

3) `get_computed_styles`

Recupera gli stili computati di un elemento.

Input:

  • selector (required)
  • properties (array di string, opzionale)

Output:

  • JSON con proprietà CSS richieste o tutte.

4) `get_network_requests`

Lista chiamate HTTP intercettate.

Input:

  • filterUrl (opzionale)
  • filterMethod (opzionale, GET/POST/PUT/DELETE/PATCH)
  • limit (opzionale, default 50)

Output:

  • JSON array richieste.

5) `execute_js`

Esegue JS nella pagina e ritorna il risultato.

Input:

  • script (string)

Output:

  • JSON value o errore.

6) `navigate_to`

Naviga a URL o route dell'app.

Input:

  • url (obbligatorio)

Behaviour:

  • page.goto + reset networkRequests.

7) `get_console_errors`

Recupera console error/warn catturati.

Output:

  • lista errori (stringhe) o Nessun errore in console.

8) `click`

Simula click su elemento.

Input:

  • selector (obbligatorio)

Behaviour:

  • page.waitForSelector(selector) + page.click(selector).

9) `type`

Inserisce testo in input.

Input:

  • selector (obbligatorio)
  • text (obbligatorio)

Behaviour:

  • page.waitForSelector(selector) + page.type(selector, text).

10) `wait_for_selector`

Attende elemento nel DOM.

Input:

  • selector (obbligatorio)
  • timeout (opzionale, default 10000ms)

11) `reset_app`

Resetta stato app e ricarica.

Behaviour:

  • pulisce localStorage/sessionStorage/cookie
  • page.goto('http://localhost:4200')
  • reset networkRequests

12) `get_storage`

Legge local/sessionStorage.

Input:

  • type (localStorage|sessionStorage, default localStorage)
  • key (opzionale)

13) `set_storage`

Scrive local/sessionStorage.

Input:

  • type (localStorage|sessionStorage, default localStorage)
  • key (string)
  • value (string)

14) `get_performance_metrics`

Restituisce metriche di performance Puppeteer + window.performance.

Output:

  • JSON con metrics e perfTiming.

Comandi consigliati per test e debug

  • reset_app per stato deterministico.
  • wait_for_selector prima di click/type su elementi dinamici.
  • get_network_requests per validare API call.
  • get_console_errors per errori JS.
  • get_computed_styles per assertion visuale.

Suggerimenti operativi (migliorie future)

  • Aggiungere assert_* (assertElementVisible, assertText) come tool.
  • Aggiungere opzione headless/headful dinamica.
  • Implementare screenshot_diff e page_trace.
  • Aggiungere supporto per multi-page target e frame.

Esempio d'uso rapido (MCP request)

{
  "name": "take_screenshot",
  "input": {"navigateTo": "http://localhost:4200"}
}
{
  "name": "click",
  "input": {"selector": "button#submit"}
}
{
  "name": "get_network_requests",
  "input": {"filterMethod": "GET", "limit": 20}
}

Avvio server

Eseguire da terminale:

cd dom-analyzer-mcp
PUPPETEER_SKIP_DOWNLOAD=true npm i
npm run build
npm start

Il server continua a leggere da stdin/stdout e risponde alle chiamate MCP.


Made by Elia at 01:15am >:)

Tools (14)

take_screenshotCaptures a screenshot of the page or a specific element.
read_domReturns the outerHTML of the body or a specified element.
get_computed_stylesRetrieves computed CSS styles for an element.
get_network_requestsLists intercepted HTTP network calls.
execute_jsExecutes JavaScript directly within the browser page.
navigate_toNavigates the browser to a specific URL or route.
get_console_errorsRetrieves captured console errors and warnings.
clickSimulates a mouse click on a specified element.
typeTypes text into a specified input element.
wait_for_selectorWaits for a specific element to appear in the DOM.
reset_appResets the application state, clears storage, and reloads.
get_storageReads data from localStorage or sessionStorage.
set_storageWrites data to localStorage or sessionStorage.
get_performance_metricsReturns Puppeteer and window.performance metrics.

Configuration

claude_desktop_config.json
{"targetUrl": "http://localhost:4200", "headless": true}

Try it

Take a screenshot of the login button on the current page.
Get all network requests made to the API endpoint and filter for POST methods.
Check the console for any JavaScript errors on the page.
Click the submit button and wait for the success message element to appear.
Get the computed background color of the main header element.

Frequently Asked Questions

What are the key features of DOM Analyzer?

Remote DOM and CSS inspection using Puppeteer. Network traffic monitoring and filtering. Automated E2E testing capabilities like clicking and typing. Performance metrics collection. State management via storage access and app resets.

What can I use DOM Analyzer for?

Debugging frontend UI issues by inspecting computed styles. Validating API integration by monitoring network requests. Automating repetitive E2E test scenarios in a local development environment. Capturing visual evidence of UI states for bug reports. Monitoring console logs for runtime JavaScript errors.

How do I install DOM Analyzer?

Install DOM Analyzer by running: cd dom-analyzer-mcp && PUPPETEER_SKIP_DOWNLOAD=true npm i && npm run build && npm start

What MCP clients work with DOM Analyzer?

DOM Analyzer works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep DOM Analyzer docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare