HTML DOM Path Generator

HTML DOM Path Generator MCP Connector for Claude

A+

Generate robust, deterministic CSS selectors from HTML snippets to prevent brittle web scraping.

3 tools Official Updated Oct 1, 2026 Official Vinkius Partner

The HTML DOM Path Generator is a specialized MCP server designed to solve the problem of fragile web scrapers. By providing an HTML snippet and a target element ID, it uses deterministic tree traversal to calculate exact CSS paths using nth-of-type indices. The engine prioritizes IDs, then unique classes, and finally structural paths. You can use generate_css_selector to find precise paths, validate_selector_integrity to ensure selector accuracy, and get_selector_complexity to assess how stable your selectors are against UI changes.

csshtmldomselectorsscrapingautomation

3 tools expose this connector's capabilities to your AI agent.

get_selector_complexity

Calculates a complexity score for a CSS selector

validate_selector_integrity

Validates if a CSS selector correctly resolves to an element in the provided HTML

generate_css_selector

Generates a CSS selector for an element with a specific ID within an HTML snippet

See how to talk to your AI agent using HTML DOM Path Generator.

Generate a CSS selector for the element with ID 'submit-btn' in this HTML: '<div class="container"><button id="submit-btn" class="primary">Click Me</button></div>'

#submit-btn

How complex is the selector 'div:nth-of-type(2) > p:nth-of-type(1)'?

The complexity score is 7. Factors include deep nesting and reliance on structural nth-of-type positioning.

Validate if the selector 'ul > li:nth-child(2)' is valid for this HTML: '<ul><li>Item 1</li><li>Item 2</li></ul>'

The selector is valid and matches 1 element in the provided snippet.

The engine uses a strict hierarchy: it first looks for an ID, then checks for unique classes within the sibling context, and only falls back to structural nth-of-type selectors when necessary. This minimizes reliance on deep nesting.

Related Connectors