Semantic DOM Filter MCP Server
Converts messy HTML into clean semantic markdown with integer IDs, enabling LLMs to navigate and interact with web pages efficiently using intent-guided filtering and diff-based updates.
README
Semantic DOM Filter MCP Server
A high-pass filter that sits between chaotic web pages and clean LLM context windows. Converts ~100KB HTML into ~2KB Semantic Markdown with integer IDs, eliminating selector hallucination and dramatically reducing token usage.
Architecture
User Prompt → LLM Agent → Semantic MCP Server
↓
┌──────────────────────┐
│ Playwright (Chromium)│
│ ↓ │
│ Accessibility Tree │
│ ↓ │
│ Semantic Processor │
│ ├─ Visibility Filter │
│ ├─ Struct. Flatten │
│ └─ Intent Pruning │
│ ↓ │
│ Markdown Synthesizer │
└──────────────────────┘
↓
Clean Semantic Map → LLM Agent
↓
Action (click id=7) → Semantic Diff
Tools
get_semantic_view
Navigate to a URL and get a filtered semantic map.
| Parameter | Type | Description |
|---|---|---|
url |
string | URL to navigate to |
task_intent |
string | What you're trying to do (guides filtering) |
Intent-guided filtering:
"read content"/"find pricing"→ prunes navigation, footers"fill form"/"login"→ focuses on inputs, buttons"find X"/"navigate"→ keeps navigation, prunes long text
perform_action
Execute an action and get back only what changed (semantic diff).
| Parameter | Type | Description |
|---|---|---|
action |
enum | click, type, select, hover, scroll, wait, press_key, go_back, go_forward, navigate |
id |
number? | Semantic ID of the target element |
value |
string? | Text to type, option to select, scroll direction, key to press |
url |
string? | URL for navigate action |
get_current_state
Re-extract the semantic map without navigating. Useful to refresh after multiple actions.
| Parameter | Type | Description |
|---|---|---|
task_intent |
string? | Optionally change the intent filter |
get_screenshot
Capture a PNG screenshot of the current viewport.
| Parameter | Type | Description |
|---|---|---|
full_page |
boolean? | Capture the full scrollable page |
Output Format
# Example Page
**URL:** https://example.com
**Task:** find the pricing table
**Stats:** 23 semantic nodes (filtered from 847 raw nodes)
## Page Structure
- **main**: "Main Content" (312 nodes)
- **navigation**: "Primary Nav" (45 nodes)
## Semantic Map
[Heading(1): "Pricing Plans", id=1]
[Text: "Choose the plan that works for you"]
[Button: "Monthly", id=3, selected]
[Button: "Annual", id=4]
[Heading(2): "Starter", id=5]
[Text: "$9/month"]
[Button: "Get Started", id=7]
[Heading(2): "Pro", id=8]
[Text: "$29/month"]
[Button: "Get Started", id=10]
Semantic Diff (after actions)
Instead of re-sending the whole page:
**Action:** click on id=3
**Result:** Changes detected
## Changes
Modified:
[Button, id=3]: state.pressed: "unset" → "true"
Added: [Text: "Billed monthly"]
Removed: [Text: "Billed annually"]
Setup
npm install
npm run build
Usage with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"semantic-dom": {
"command": "node",
"args": ["path/to/browser_mcp/dist/index.js"]
}
}
}
Usage with VS Code (Copilot)
Add to your .vscode/mcp.json:
{
"servers": {
"semantic-dom": {
"type": "stdio",
"command": "node",
"args": ["${workspaceFolder}/dist/index.js"]
}
}
}
Why This Wins
| Metric | Raw HTML | This MCP |
|---|---|---|
| Payload | ~100KB | ~2KB |
| Token cost | ~25K tokens | ~500 tokens |
| Selector accuracy | Hallucinated CSS | Integer IDs |
| After-action update | Full re-send | Diff only |
| Intent awareness | None | Prunes by task |
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.