browser
AGENTS.md2 starsChanged 7 months agoApache-2.0View on GitHub
This file is the source of truth for AI coding agents working in this repo. Keep it concise, update it when project commands or safety rules change, and prefer linking to .agents/ for details. browser-mcp is an MCP server that exposes browser automation over HTTP/SSE. It combines direct Playwright tools with a browser-use agent flow for complex multi-step browser tasks. Read .agents/ARCHITECTURE.md before changing runtime lifecycle, tool registration, or artifact handling. Main runtime pieces: 1. For any code writing, review,…
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository8 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/00-project.mdcCursor rule
- .cursor/rules/10-python.mdcCursor rule
- .cursor/rules/20-mcp-tools.mdcCursor rule
- capture-evidence-bundleSkill
- guidelinesSkill
- safe-loginSkill
- scrape-with-paginationSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
18 rules. About 1 is common, 3 are distinctive, and 14 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 4
Keep it concise, update it when project commands or safety rules change, and prefer linking to .agents/ for details.
- Very specific: line 15
Read .agents/ARCHITECTURE.md before changing runtime lifecycle, tool registration, or artifact handling.
- Very specific: line 30
Read .agents/RULES.md for safety and MCP boundary rules.
- Very specific: line 31
Read .agents/REPO_RULES.md for project-specific gotchas.
- Very specific: line 33
If adding or changing a skill, update .agents/SKILLS.md and keep tests passing.
- Very specific: line 47
Do not introduce pyproject.toml, uv, ruff, mypy, or OpenTelemetry in this foundation pass unless a later task explicitly asks for it.
- Very specific: line 53
Keep direct Playwright access behind BrowserRuntime.
- Very specific: line 58
Keep browse_and_act string-compatible for existing clients.
- Distinctive: line 60
Use clear tool descriptions/docstrings so MCP clients can choose tools well.
- Very specific: line 61
Avoid cross-imports between src/tools/* modules except shared lightweight helpers.
- Very specific: line 66
All artifact/download file reads must go through BrowserRuntime.resolve_file_path().
- Very specific: line 68
All artifact writes must use BrowserRuntime.build_artifact_path().
- Very specific: line 69
Never commit headless=False in runtime code.
- Common: line 70
Never log or return raw cookies, auth headers, API keys, passwords, or TOTP secrets.
- Very specific: line 72
Do not write runtime artifacts to paths outside /data in the container or ./data on the host.
- Very specific: line 74
Do not add outbound HTTP from tool code outside Playwright/browser-use flows.
- Distinctive: line 87
Keep AI-first docs and runtime contract changes scoped.
- Distinctive: line 88
Update tests with behavior changes, especially MCP output shape or path safety.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md - browser-mcp
This file is the source of truth for AI coding agents working in this repo.
Keep it concise, update it when project commands or safety rules change, and
prefer linking to .agents/ for details.
Project
browser-mcp is an MCP server that exposes browser automation over HTTP/SSE.
It combines direct Playwright tools with a browser-use agent flow for complex
multi-step browser tasks.
Architecture
Read .agents/ARCHITECTURE.md before changing runtime lifecycle, tool
registration, or artifact handling.
Main runtime pieces:
main.py: thin local/container entrypoint that addssrctosys.path.src/server.py: createsFastMCP, loads settings, wires runtime, LLM, tools.src/browser.py: owns Playwright/browser-use lifecycle and data path helpers.src/tools/: MCP tools split by domain.tests/: lightweight unit and validation tests.
Before Work
- For any code writing, review, or refactor, read and apply
.agents/skills/guidelines/SKILL.md. - Read
.agents/RULES.mdfor safety and MCP boundary rules. - Read
.agents/REPO_RULES.mdfor project-specific gotchas. - For multi-step browser workflows, check
.agents/SKILLS.mdfirst. - If adding or changing a skill, update
.agents/SKILLS.mdand keep tests passing.
Commands
| Action | Command |
| Install deps | python3 -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt |
| Run server | python3 main.py |
| Docker run | docker compose up --build |
| Unit tests | python3 -m unittest discover -s tests -p "test_*.py" |
| Runtime tests only | python3 -m unittest tests/test_browser_runtime.py |
| Syntax check | python3 -m compileall -q src tests main.py |
Do not introduce pyproject.toml, uv, ruff, mypy, or OpenTelemetry in this
foundation pass unless a later task explicitly asks for it.
Code Rules
- Python 3.11+ style, async-first for browser and MCP tool I/O.
- Keep direct Playwright access behind
BrowserRuntime. - MCP tools should return
dictpayloads withok: boolunless preserving an existing legacy contract. - Errors should be converted at the MCP tool boundary to
{ok: false, error, error_type}. Helper/internal functions may raise normally. - Keep
browse_and_actstring-compatible for existing clients. Add structured sibling tools rather than breaking that return type. - Use clear tool descriptions/docstrings so MCP clients can choose tools well.
- Avoid cross-imports between
src/tools/*modules except shared lightweight helpers.
Safety Boundaries
- All artifact/download file reads must go through
BrowserRuntime.resolve_file_path(). - All artifact writes must use
BrowserRuntime.build_artifact_path(). - Never commit
headless=Falsein runtime code. - Never log or return raw cookies, auth headers, API keys, passwords, or TOTP secrets.
- Do not write runtime artifacts to paths outside
/datain the container or./dataon the host. - Do not add outbound HTTP from tool code outside Playwright/browser-use flows.
AI-First Assets
.agents/: repo-local AI-first architecture, rules, skills, and commands..cursor/rules/: Cursor project rules derived from this file..github/copilot-instructions.md: Copilot mirror of the core instructions.skills/: deprecated compatibility placeholder; canonical skills live in.agents/skills/.
Change Discipline
- The worktree may contain user changes. Do not revert unrelated edits.
- Keep AI-first docs and runtime contract changes scoped.
- Update tests with behavior changes, especially MCP output shape or path safety.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

