DOM Analyzer MCP Server
A Puppeteer-based server designed for remote debugging, E2E testing, and DOM inspection of frontend applications. It allows users to interact with page elements, capture screenshots, monitor network traffic, and execute JavaScript directly within a browser environment.
README
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 connetteStdioServerTransport.
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:
contentcontexteimage(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+ resetnetworkRequests.
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, defaultlocalStorage)key(opzionale)
13) set_storage
Scrive local/sessionStorage.
Input:
type(localStorage|sessionStorage, defaultlocalStorage)key(string)value(string)
14) get_performance_metrics
Restituisce metriche di performance Puppeteer + window.performance.
Output:
- JSON con
metricseperfTiming.
Comandi consigliati per test e debug
reset_appper stato deterministico.wait_for_selectorprima di click/type su elementi dinamici.get_network_requestsper validare API call.get_console_errorsper errori JS.get_computed_stylesper assertion visuale.
Suggerimenti operativi (migliorie future)
- Aggiungere
assert_*(assertElementVisible, assertText) come tool. - Aggiungere opzione
headless/headfuldinamica. - Implementare
screenshot_diffepage_trace. - Aggiungere supporto per multi-page
targeteframe.
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 >:)
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.