SelectorsHub logo
SelectorsHub
NEW · MCP SERVER

IntroducingSelectorsHub MCP Server

Give Claude, Cursor, VS Code Copilot or any AI agent the SelectorsHub engine. Ask in plain English and get Playwright locators, XPath and CSS selectors that are verified against the real page before they reach your test.

claude mcp add selectorshub -- npx -y selectorshub-mcp
100% free · all features No sign-up · no key Shadow DOM · iFrame · SVG
Open the login page and give me Playwright locators for the form
selectorshub · generate_locators
page.getByLabel('Email')
page.getByLabel('Password')
page.getByRole('button', { name: 'Sign in' })
3 of 3 verified · each matches exactly 1 element
Why SelectorsHub MCP

AI agents guess locators. SelectorsHub verifies them.

Most agents read the page and invent a selector that looks right. SelectorsHub MCP runs the same engine trusted by millions of testers, then checks every locator against the live page.

Verified, not guessed

Every locator is checked to resolve to the exact element you asked for. Playwright locators are verified with real Playwright.

Stable by default

Skips generated ids and hashed classes like :r3: or css-19bb58m that break on the next build.

Smart in lists & tables

For repeated cards and rows, locators are anchored to nearby unique text instead of fragile positions like [3].

Shadow DOM & iFrames

Handles the hard cases the SelectorsHub extension is known for: shadow roots, nested iframes and SVG elements.

Typical AI-generated locator
page.locator('#mui-4821 > div:nth-child(3) button')

Depends on a generated id and position. Breaks on the next deploy.

With SelectorsHub MCP
page.locator('div.card').filter({ hasText: 'Backpack' })
  .getByRole('button', { name: 'Add to cart' })

Anchored to visible text and role. Verified: matches exactly 1 element.

Get started

Up and running in 3 steps

No account, no license key, no global install. If you have Node.js, you're ready.

1

Check Node.js

Node.js 18 or newer. Run node -v to check.

2

Add it to your AI client

Copy the command or config for your tool below, then restart it.

3

Ask for locators

Describe what you need in plain English. The agent does the rest.

Run this in your terminal:

claude mcp add selectorshub -- npx -y selectorshub-mcp

Settings → Developer → Edit Config, add this to claude_desktop_config.json, then restart Claude Desktop:

{
  "mcpServers": {
    "selectorshub": {
      "command": "npx",
      "args": ["-y", "selectorshub-mcp"]
    }
  }
}

Add to ~/.cursor/mcp.json (or Settings → MCP → Add new server):

{
  "mcpServers": {
    "selectorshub": {
      "command": "npx",
      "args": ["-y", "selectorshub-mcp"]
    }
  }
}

Add to .vscode/mcp.json in your project, then use it from Copilot Chat in Agent mode:

{
  "servers": {
    "selectorshub": {
      "command": "npx",
      "args": ["-y", "selectorshub-mcp"]
    }
  }
}

Any MCP client that supports local (stdio) servers works. Use this command:

npx -y selectorshub-mcp

Works on Windows, macOS and Linux.

What you can ask

Just talk to your agent

No new syntax to learn. Here are a few things testers ask every day.

Open https://selectorshub.com and give me Playwright locators for the main navigation links. generate_locators
This locator broke after the last release. Find me a stable one for the same button. fix_locator
Does //button[text()='Save'] match only one element on this page? validate_locator
Create a Playwright page object for the checkout page with locators for every field. generate_page_object
List all the inputs and buttons on the signup form. list_elements
Give me XPath and CSS selectors for the "Edit" button in Ravi's row of the users table. generate_locators
Free. Every feature.

SelectorsHub MCP is free for everyone at launch: every feature, no usage limits, no license key. Individual testers will always be free.

  • All tools, no daily limits
  • Use it at work and in CI
  • No sign-up, no account

Your pages stay on your machine

SelectorsHub MCP runs locally next to your AI client. The pages it opens, the elements it inspects and the locators it generates are never sent to SelectorsHub.

The only thing we count is installs: one anonymous request when the package is installed, so we know how many people use it. Install with --ignore-scripts to skip it.

FAQ

Questions testers ask

What is an MCP server?
MCP (Model Context Protocol) is the open standard AI assistants use to call external tools. Adding SelectorsHub MCP to Claude, Cursor or VS Code lets the AI open pages and use the SelectorsHub engine to generate and verify locators for you.
Do I need the SelectorsHub browser extension?
No. The MCP server includes the SelectorsHub engine and opens pages in its own browser. The extension is still the best way to inspect elements by hand, and the two work great together.
Which AI tools does it work with?
Claude Code, Claude Desktop, Cursor, VS Code (GitHub Copilot in Agent mode), Windsurf, and any other client that supports local MCP servers.
Which locator types does it generate?
Playwright locators (getByRole, getByLabel, getByText, locator and filter chains), XPath and CSS selectors, so it fits Playwright, Selenium, Cypress and WebdriverIO projects.
How is this different from asking the AI directly?
Without SelectorsHub, the AI reads the HTML and guesses a selector. It often picks generated ids or positions, or a locator that matches several elements. SelectorsHub MCP generates locators with a proven engine and checks each one against the live page, so you only get locators that match the exact element.
Is it really free? Can I use it at work?
Yes. At launch every feature is free for everyone, including companies and CI pipelines. Individual testers will stay free forever. If business licensing is ever introduced, it will be announced at least 60 days in advance.
Does it work with Shadow DOM and iFrames?
Yes. Shadow DOM, nested iframes and SVG elements are supported, just like in the SelectorsHub extension.
Where do I report a bug or request a feature?
Open an issue on GitHub. We read every one.

Stop fixing flaky locators.
Let your agent get them right.

Add SelectorsHub MCP to your AI client in under a minute.