UI Annotator MCP is an MCP (Model Context Protocol) server whose goal is to establish a shared language for web UI elements between humans and AI programming assistants. It works through a reverse proxy, requires no browser extension installation, and does not modify project code, supporting any browser such as Chrome, Firefox, Safari, Edge, etc.
Purpose When using an AI programming assistant to review or modify a web UI, the hardest part is often not the code change itself, but clearly describing which element to change. Users may not know the element's name, and the AI cannot see the location the user is pointing to, leading to repeated back-and-forth communication. UI Annotator solves this problem by adding a visible label to every web page element: hover over any element to see its name, and then you can describe the modification to the AI using the real component name, for example "move SearchButton below NavBar", and the AI can locate the correct component.
Main capabilities
- Hover annotation: when hovering over any element, display the element name (pink), CSS selector (monospace font), content preview, and width×height dimensions.
- Inspect mode: click the Inspect button in the toolbar (or have the AI toggle it) to enter inspect mode; clicking any element copies its name to the clipboard and pauses page interaction to avoid accidentally triggering buttons or links; click Inspect again to return to normal mode.
- Collapsible toolbar: a toolbar is displayed at the top center of the page, containing the Inspect toggle button, an operation instructions subtitle, and a collapse button (▲).
- MCP tools: provide an interface for the AI assistant to query page element information.
- Automatic rescanning: automatically rescan elements when the DOM changes via MutationObserver.
How to use
- Open the page through the annotation proxy.
- Hover over any element to view its name, CSS selector, and dimensions.
- Describe the desired modification to the AI assistant using the real component name.
- The AI assistant edits the corresponding component; after refreshing the page, repeat the above process.
Proxy workflow: the user requests localhost:7077/localhost:3847, the proxy fetches http://localhost:3847。对于 the HTML response, the proxy injects a fetch()/XMLHttpRequest interceptor (rewriting API paths to go through the proxy), rewrites href="/..." and src="/..." attributes so they go through the proxy, and injects the annotation script before </body>; for non-HTML resources (CSS, JS, images), it passes them through directly. The proxy also removes the Content-Security-Policy header to allow the injected script to run.
Annotation workflow: the script scans the DOM for elements with id, class, semantic role, or interactive role; on hover, it positions the overlay border (following border-radius) and the tooltip (always kept within the viewport); it reports all detected elements to the server via POST /__annotator/elements; it polls GET /__annotator/commands every second to obtain server instructions (highlight, rescan, inspect mode toggle).
Technical dependencies
- Reverse proxy: Node.js built-in http module.
- MCP server: @modelcontextprotocol/sdk (stdio transport).
- Communication: HTTP POST (browser→server) + GET polling (server→browser).
- No WebSocket, no Express, no browser extension.
Applicable scenarios Suitable for scenarios involving web UI design, review, and iteration using an AI programming assistant, especially when precise reference to page elements is needed and communication ambiguity must be reduced. Can be used with Claude Code.
Limitations The materials do not provide specific installation commands, environment variable details, pricing information, platform support scope, or effect guarantees; this content is not yet provided.