Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cursor/mcp.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"mcpServers": {
"browser-use-mcp=server": {
"browser-use-mcp-server": {
"url": "http://localhost:8000/sse"
}
}
Expand Down
7 changes: 5 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
OPENAI_API_KEY=sk
CHROME_PATH=/usr/bin/chromium
# Path to Chrome/Chromium executable leave blank to use default playwright chromium
CHROME_PATH=

# OpenAI API key for OpenAI model access
OPENAI_API_KEY=your-api-key-here
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
group: ${{ github.workflow }}-${{ github.ref_name }}-${{
github.event.pull_request.number || github.sha }}
cancel-in-progress: true

env:
Expand Down Expand Up @@ -70,7 +71,8 @@ jobs:
run: uvx ruff check .

- name: "Validate project metadata"
run: uvx --from 'validate-pyproject[all,store]' validate-pyproject pyproject.toml
run: uvx --from 'validate-pyproject[all,store]' validate-pyproject
pyproject.toml

build-and-publish:
runs-on: ubuntu-latest
Expand Down
14 changes: 9 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM ghcr.io/astral-sh/uv:bookworm-slim AS builder

ARG VNC_PASSWORD=browser-use

ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_PYTHON_INSTALL_DIR=/python \
Expand All @@ -26,6 +24,8 @@

FROM debian:bookworm-slim AS runtime

ARG VNC_PASSWORD="browser-use"

Check warning on line 27 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-publish

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "VNC_PASSWORD") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

# Install required packages including Chromium and clean up in the same layer
RUN apt-get update && \
apt-get install --no-install-recommends -y \
Expand Down Expand Up @@ -56,15 +56,19 @@
ENV PATH="/app/.venv/bin:$PATH" \
DISPLAY=:0 \
CHROME_BIN=/usr/bin/chromium \
CHROMIUM_FLAGS="--no-sandbox --headless --disable-gpu --disable-software-rasterizer --disable-dev-shm-usage"
CHROMIUM_FLAGS="--no-sandbox --headless --disable-gpu --disable-software-rasterizer --disable-dev-shm-usage" \
CHROME_PATH="/usr/bin/chromium"

# Combine VNC setup commands to reduce layers
RUN mkdir -p ~/.vnc && \
echo ${VNC_PASSWORD} | vncpasswd -f > /root/.vnc/passwd && \
echo $VNC_PASSWORD | vncpasswd -f > /root/.vnc/passwd && \
chmod 600 /root/.vnc/passwd && \
printf '#!/bin/sh\nunset SESSION_MANAGER\nunset DBUS_SESSION_BUS_ADDRESS\nstartxfce4' > /root/.vnc/xstartup && \
chmod +x /root/.vnc/xstartup && \
printf '#!/bin/bash\nvncserver -depth 24 -geometry 1920x1080 -localhost no -PasswordFile /root/.vnc/passwd :0\nproxy-login-automator\npython /app/server --transport sse --port 8000' > /app/boot.sh && \
printf '#!/bin/bash\nvncserver -depth 24 -geometry 1920x1080 -localhost no -PasswordFile /root/.vnc/passwd :0\nproxy-login-automator\npython /app/server --port 8000' > /app/boot.sh && \
chmod +x /app/boot.sh


EXPOSE 8000

ENTRYPOINT ["/bin/bash", "/app/boot.sh"]
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
uv pip install playwright
uv run playwright install --with-deps --no-shell chromium
uv run server --transport sse --port 8000
uv run server --port 8000
```

- the .env requires the following:
Expand All @@ -36,6 +36,12 @@ when building the dockerfile you can add in your own VNC server password:
docker build --build-arg VNC_PASSWORD=klaatubaradanikto .
```

### tools

- [x] SSE transport
- [x] browser_use - Initiates browser tasks with URL and action
- [x] browser_get_result - Retrieves results of async browser tasks

### supported clients

- cursor.ai
Expand Down Expand Up @@ -79,3 +85,11 @@ then try asking your LLM the following:
### help

for issues or interest reach out @ https://cobrowser.xyz

# stars

<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=co-browser/browser-use-mcp-server&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=co-browser/browser-use-mcp-server&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=co-browser/browser-use-mcp-server&type=Date" />
</picture>
66 changes: 63 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "browser-use-mcp-server"
version = "0.1.2"
description = "MCP browser-use server"
version = "0.1.3"
description = "MCP browser-use server library"
readme = "README.md"
requires-python = ">=3.13"
requires-python = ">=3.11,<4.0"
authors = [
{name = "Cobrowser Team"}
]
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
dependencies = [
"asyncio>=3.4.3",
"browser-use>=0.1.40",
Expand All @@ -12,4 +23,53 @@ dependencies = [
"langchain-openai>=0.3.1",
"mcp>=1.3.0",
"pydantic>=2.10.6",
"anyio",
"python-dotenv",
"starlette",
"uvicorn",
"playwright>=1.50.0",
]

[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"pytest-asyncio>=0.21.0",
"black>=23.0.0",
"isort>=5.12.0",
"mypy>=1.0.0",
]
test = [
"pytest>=7.0.0",
"pytest-asyncio>=0.21.0",
"pytest-cov>=4.1.0",
]

[project.urls]
"Homepage" = "https://github.com/cobrowser/browser-use-mcp-server"
"Bug Tracker" = "https://github.com/cobrowser/browser-use-mcp-server/issues"

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = "test_*.py"
asyncio_mode = "auto"

[tool.black]
line-length = 88
target-version = ["py311"]

[tool.isort]
profile = "black"
line_length = 88

[tool.mypy]
python_version = "3.11"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true

[project.scripts]
browser-use-mcp-server = "browser_use_mcp_server.cli:cli"

[tool.hatch.build]
packages = ["src/browser_use_mcp_server"]
3 changes: 3 additions & 0 deletions server/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .server import main

__all__ = ["main"]
Loading