locator-mcp
MCP server for scanning browser pages and collecting element locators (XPath, testId, CSS).
README
locator-mcp
MCP server for scanning browser pages and collecting element locators (XPath, testId, CSS).
Setup
npm install
Run
# Development (TypeScript directly)
npm run dev
# Production (compile first)
npm run build
npm start
Test
npm test
Project structure
src/
server.ts MCP tool handlers
scanner/ Scan pipeline
shared/ Registry I/O, constants, utils
registry/ Local scan output (gitignored *.json)
tests/ Unit tests
.cursor/rules/ Cursor AI rules for this repo
Registry
Scans write to registry/{scanName}.json. Registry JSON files are not committed — generate them locally with scan_page.
MCP tools
scan_page— scan a browser page and save locatorsget_registry_keys— list keys (token-efficient)get_locator— fetch one entry by keyget_registry— full registry (high token cost)search_registry— filter entrieslist_registries— list available registries
Cursor MCP configuration
Add to ~/.cursor/mcp.json under mcpServers.
Set cwd to your local clone path. From the repo root:
pwd
# e.g. /Users/you/projects/locator-mcp
Use that output for <path-to-repo> in the snippets below.
Recommended (dev — no build step)
{
"mcpServers": {
"locator-mcp": {
"command": "npm",
"args": ["run", "dev"],
"cwd": "<path-to-repo>"
}
}
}
Production (compiled)
Run npm run build in the repo first, then use:
{
"mcpServers": {
"locator-mcp": {
"command": "npm",
"args": ["run", "start"],
"cwd": "<path-to-repo>"
}
}
}
With Playwright MCP (for scan_page)
scan_page connects to an already-open browser. Pair with Playwright MCP on the same Chrome CDP endpoint:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest",
"--cdp-endpoint",
"http://localhost:9222"
]
},
"locator-mcp": {
"command": "npm",
"args": ["run", "dev"],
"cwd": "<path-to-repo>"
}
}
}
Launch Chrome with remote debugging before scanning:
open -a "Google Chrome" --args --remote-debugging-port=9222 --user-data-dir=/tmp/pw-chrome
Then call scan_page with cdpEndpoint: "http://localhost:9222".
Alternative (explicit entry file)
If you prefer not to use npm scripts, set cwd and a relative args path:
{
"mcpServers": {
"locator-mcp": {
"command": "npx",
"args": ["tsx", "src/server.ts"],
"cwd": "<path-to-repo>"
}
}
}
Compiled:
{
"mcpServers": {
"locator-mcp": {
"command": "node",
"args": ["dist/server.js"],
"cwd": "<path-to-repo>"
}
}
}
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.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
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.