Skip to main content
Glama
RAJUSHANIGARAPU

self-healing-browser-mcp

self-healing-browser-mcp

CI License: MIT Python MCP

An MCP server that hands an AI agent — Claude Desktop, Claude Code, Cursor, or anything that speaks MCP — a real browser to drive, with self-healing locators.

Why

The moment you let an agent automate a browser, brittle selectors bite: a data-testid gets renamed, the DOM is restructured, a button's markup changes — and the run dies on a locator not found. Agents burn tokens retrying, or just give up.

This server takes a different contract. You describe an element by whatever you know — a test id, a role + accessible name, a label, some text, a CSS selector — and it resolves the element using the most stable strategy that still works. If your preferred locator has drifted, it heals to a fallback and tells you so, instead of failing.

Related MCP server: AgentBrowser

How the self-healing works

Each element tool accepts the same optional strategies. The resolver tries them in priority order and uses the first that matches exactly one visible element:

testid  →  role + name  →  label  →  placeholder  →  text  →  css  →  fuzzy (accessible-name match)
  • If your first-choice strategy resolves the element, great — no heal.

  • If it doesn't (renamed test id, changed structure) but a later strategy does, the result is flagged healed so you know the locator drifted and should be updated.

  • If only a name is known and its casing/wording shifted, a final fuzzy pass matches the accessible name across interactive roles.

The agent "sees" the page semantically via browser_snapshot (roles + accessible names from the accessibility tree), not raw HTML or screenshots.

Demo

See it heal live — the same locator hint keeps working after a refactor deletes the element's data-testid (examples/self_healing_demo.py):

$ python examples/self_healing_demo.py
1) Original app — the preferred data-testid resolves the button:
   -> resolved via 'testid'   healed=False

2) After a refactor removed the data-testid — SAME hint, no code change:
   -> resolved via 'role'       healed=True
   -> clicked the recovered element successfully

The data-testid the agent learned is gone, but because the hint also carried the button's role and accessible name, the engine recovered the element, flagged the heal, and the element stayed clickable — no test edit, no agent retry loop.

Tools

Tool

What it does

browser_navigate(url)

Open a URL in the shared page

browser_snapshot()

List interactive elements as {role, name}

browser_click(...)

Click an element (self-healing)

browser_fill(value, ...)

Type into a field (self-healing)

browser_get_text(...)

Read an element's text

browser_assert_visible(...)

Assert an element is visible — PASS/FAIL

browser_close()

Close the browser

The ... on element tools is the locator strategy set: testid, role, name, label, placeholder, text, css — all optional; pass as many as you know.

Install

# install straight from the repo (PyPI release coming)
pip install "git+https://github.com/RAJUSHANIGARAPU/self-healing-browser-mcp"
python -m playwright install chromium

Use it from an MCP client

Claude Code:

claude mcp add self-healing-browser -- self-healing-browser-mcp

Claude Desktop / Cursor — add to the MCP servers config:

{
  "mcpServers": {
    "self-healing-browser": {
      "command": "self-healing-browser-mcp"
    }
  }
}

Then ask your agent to, e.g., "open example.com, snapshot the page, and click the Sign in button." When a selector has drifted, the tool result will say it healed.

Configuration

Env var

Default

Purpose

SHBM_TESTID_ATTR

data-testid

The attribute testid maps to (e.g. data-test, data-cy)

SHBM_HEADED

(unset)

Set to 1 to watch the browser instead of running headless

Develop

pip install -e ".[dev]"
python -m playwright install chromium
pytest

The self-healing engine (src/self_healing_browser_mcp/engine.py) is decoupled from the MCP layer and tested deterministically against in-memory HTML — no external site, no flakiness.

Releasing

Publishing to PyPI is automated with GitHub Actions via PyPI Trusted Publishing (OIDC) — no API token is stored in the repo. Every push builds and twine checks the distribution in CI, so main is always release-ready.

To cut a release:

  1. One-time: on PyPI, create the self-healing-browser-mcp project's Trusted Publisher pointing at this repo, workflow publish.yml, and environment pypi.

  2. Bump version in pyproject.toml, commit, and tag (git tag v0.1.1 && git push --tags).

  3. Publish a GitHub Release for that tag — the Publish to PyPI workflow builds and uploads automatically. After that, pip install self-healing-browser-mcp works.

License

MIT — see LICENSE.

Available Tools

7 tools
browser_assert_visibleC

Assert the described element is present and visible. Returns PASS or FAIL.

ParametersJSON Schema
NameRequiredDescriptionDefault
cssNo
nameNo
roleNo
textNo
labelNo
testidNo
placeholderNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Only mentions return value 'PASS or FAIL', but fails to disclose waiting behavior, timeouts, or error handling. With no annotations, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence is concise, but it omits critical details. Conciseness is not inherently valuable if it sacrifices necessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 7 parameters and no annotations, the description is severely incomplete. Does not explain parameter roles, return format, or assertion behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

7 parameters with 0% schema coverage and no description explaining how to specify the element. Agent gets no help on parameter usage or selection.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states verb 'assert' and resource 'element is present and visible', and differentiates from sibling tools like browser_click or browser_snapshot.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives. Does not provide context for selection among sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

browser_clickA

Click an element described by any combination of locator strategies.

Provide as many as you know (e.g. role='button' + name='Log in', and a testid if you have one). The most stable available strategy wins; if it healed to a fallback, the result says so.

ParametersJSON Schema
NameRequiredDescriptionDefault
cssNo
nameNo
roleNo
textNo
labelNo
testidNo
placeholderNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden. It discloses that the most stable strategy wins and fallback is reported, which provides insight into internal behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is succinct, with two sentences. The first sentence states the core purpose, and the second provides usage guidance, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Although there is an output schema, the description covers essential behavior for a click tool. It explains fallback behavior, which is valuable for expected output.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description gives examples of locator strategies (role, name, testid) but does not explain all 7 parameters. Schema coverage is 0%, so partial compensation is provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool clicks an element using locator strategies. It distinguishes from siblings like browser_fill (filling) and browser_get_text (getting text) by specifying 'click' action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description advises providing multiple locator strategies and mentions fallback, giving context for effective use. However, it does not explicitly state when not to use or compare to alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

browser_closeA

Close the browser and release its resources.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description mentions that it closes the browser and releases resources, which is the core behavior. However, it does not disclose potential side effects like discarding unsaved state or whether it can be called multiple times. With no annotations, the burden is on the description, and it is adequate but could be more informative.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of six words, front-loaded with the verb 'Close'. Every word is necessary and there is no extraneous content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that an output schema exists and there are no parameters, the description is largely complete. It covers the primary function, though it could mention prerequisites like the browser being open or whether it errors if already closed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are no parameters, so the description does not need to add parameter information. With 0 parameters, the baseline is 4, and the description does not repeat anything from the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Close' and resource 'browser', clearly stating the action. It effectively distinguishes from sibling tools like browser_navigate or browser_click by indicating a teardown operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when the browser session is complete, but it does not explicitly state when to use or when not to use this tool versus alternatives. No exclusions or context are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

browser_fillC

Type value into an input described by the locator strategies.

ParametersJSON Schema
NameRequiredDescriptionDefault
cssNo
nameNo
roleNo
textNo
labelNo
valueYes
testidNo
placeholderNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It does not disclose whether existing input is cleared, whether events are triggered, or how locator strategies interact (e.g., precedence, combination). The behavioral traits beyond 'type' are absent, making the tool's behavior opaque for an AI agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no extraneous words. It directly states the action and hints at the key concept (locator strategies). However, it is so brief that it sacrifices clarity on parameter usage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 8 parameters with 0% schema description coverage and no annotations, the description is far too sparse. It does not explain how to properly use locator strategies, the expected behavior (e.g., clearing, events), or the structure of the output schema. A more complete description would include usage patterns and behavioral details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description adds no meaning to the 8 parameters. It mentions 'locator strategies' but does not explain the role of each parameter (css, name, role, etc.) or that exactly one locator should likely be provided. The required 'value' parameter's purpose is obvious, but the optional locators are left entirely to the schema names.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action 'Type value into an input', using backticks for the value. It mentions 'locator strategies' which hints at the multiple element selection parameters. However, it does not explicitly differentiate from sibling tools like browser_click or browser_get_text, but the action of typing is distinct enough.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for filling form inputs, but provides no explicit guidance on when to use this tool versus alternatives. No exclusions or prerequisites are mentioned, and the sibling tools are not referenced. The verb 'type' strongly suggests text input, but the lack of comparative guidance leaves some ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

browser_get_textC

Return the visible text of the described element.

ParametersJSON Schema
NameRequiredDescriptionDefault
cssNo
nameNo
roleNo
textNo
labelNo
testidNo
placeholderNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and the description only says 'visible text' without explaining behavior for hidden elements, multiple matches, or element not found. Key behavioral traits remain undisclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The one-sentence description is too short for a tool with 7 parameters and no annotations. It sacrifices essential details for brevity, making it under-specified rather than concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite the presence of an output schema (unspecified), the description fails to explain element selection, visibility criteria, return format, or error handling. The tool's complexity is not matched by the description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%. The description does not explain any of the 7 optional parameters (css, name, role, text, label, testid, placeholder), leaving their use and meaning entirely implied by names.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Return') and the resource ('visible text of the described element'). It distinguishes from siblings like browser_click or browser_fill, but could be more specific about what 'described element' entails.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives such as browser_snapshot or browser_assert_visible. No prerequisites or conditions mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

browser_navigateC

Open a URL in the shared browser page and return the final URL.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description carries full burden. It states the tool opens a URL and returns the final URL but omits details about page load behavior, waiting, or error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very short (one sentence) and front-loaded, but lacks sufficient detail. While concise, it does not earn its place fully since it omits key behavioral information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple nature of the tool and output schema existence, the description is partial. It does not explain return behavior beyond the final URL, nor does it address error scenarios or state changes in the browser.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The sole parameter 'url' has no description in the schema (0% coverage) and the description does not add any additional meaning, format, or examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Open' and the resource 'a URL', and it distinguishes from sibling tools like browser_click or browser_fill.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives, such as when to use browser_get_text or browser_snapshot instead. No exclusions or prerequisites mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

browser_snapshotA

Return the page's interactive elements as roles + accessible names.

Use this to 'see' the page semantically before deciding what to click or type.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It implies a read-only operation ('return', 'see'), but does not explicitly state safety, side effects, or performance. Basic transparency is present, but deeper behavioral details are missing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the core action, and a usage hint. No extraneous words; every sentence serves a purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero parameters and an output schema, the description covers the essential aspects: what it returns and why to use it. Minor missing details could include whether it captures the full page or visible viewport.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so schema coverage is 100%. The description adds value by explaining the output nature (roles and accessible names), going beyond the minimal schema. Baseline 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it returns interactive elements as roles and accessible names, with a usage hint. It distinguishes from siblings like browser_click and browser_fill by focusing on semantic introspection, but does not explicitly contrast with browser_get_text.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description includes 'Use this to see the page semantically before deciding what to click or type', providing a clear context. However, it does not specify when not to use it or mention alternatives like browser_get_text for text extraction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 7 tool updatesv0.1.0
    • First observedbrowser_assert_visible
    • First observedbrowser_click
    • First observedbrowser_close
    • First observedbrowser_fill
    • First observedbrowser_get_text
    • First observedbrowser_navigate
    • First observedbrowser_snapshot

TDQS

B3.4/5.0
Disambiguation5/5

Each tool targets a distinct action (navigate, snapshot, click, fill, get text, assert visibility, close) with no overlap. The descriptions clearly differentiate their purposes.

Naming Consistency5/5

All tools follow a consistent 'browser_verb_noun' pattern in snake_case, making the set predictable and easy to understand.

Tool Count5/5

The server has 7 tools, which is well-scoped for a browser automation server. Each tool provides a necessary function without redundancy or bloat.

Completeness4/5

The tool set covers core browser operations (navigation, interaction, state inspection, assertion). Minor gaps like scrolling or waiting exist but do not critically hinder typical agent workflows.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RAJUSHANIGARAPU/self-healing-browser-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server