From 8beb0fc7271aa53ccb9c27532cdf87902d441322 Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 9 Apr 2025 00:30:24 +0200 Subject: [PATCH 1/8] feat: add MegaLinter configuration and GitHub workflows for linting and release management --- .github/workflows/mega-linter.yaml | 58 ++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 30 ++++++++++++++++ .mega-linter.yml | 17 +++++++++ 3 files changed, 105 insertions(+) create mode 100644 .github/workflows/mega-linter.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .mega-linter.yml diff --git a/.github/workflows/mega-linter.yaml b/.github/workflows/mega-linter.yaml new file mode 100644 index 0000000..ed6dd84 --- /dev/null +++ b/.github/workflows/mega-linter.yaml @@ -0,0 +1,58 @@ +--- + # MegaLinter GitHub Action configuration file + # More info at https://megalinter.io + name: MegaLinter + + on: + push: + branches: [main] + pull_request: + branches: [main] + + permissions: read-all + + env: # Comment env block if you don't want to apply fixes + # Apply linter fixes configuration + APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool) + APPLY_FIXES_EVENT: none # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all) + APPLY_FIXES_MODE: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request) + + concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + + jobs: + megalinter: + name: MegaLinter + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + pull-requests: write + steps: + # Git Checkout + - name: Checkout Code + uses: actions/checkout@v4 + with: + token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} + fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances + # MegaLinter + - name: MegaLinter + id: ml + # deployed v8.3.0, https://github.com/oxsecurity/megalinter/releases/tag/v8.3.0 + uses: oxsecurity/megalinter@1fc052d03c7a43c78fe0fee19c9d648b749e0c01 + env: + # All available variables are described in documentation + # https://megalinter.io/configuration/ + VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} # Validates all source when push on main, else just the git diff with main. Override with true if you always want to lint all sources + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Upload MegaLinter artifacts + - name: Archive production artifacts + if: success() || failure() + uses: actions/upload-artifact@v4 + with: + name: MegaLinter reports + path: | + megalinter-reports + mega-linter.log + \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..c107d0a --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,30 @@ +--- +name: Tag and Release + +on: + push: + branches: + - main + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Use Node.js + uses: actions/setup-node@v4 + + - name: Run semantic-release + env: + GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE }} + run: npx semantic-release --branches main --plugins "@semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/github" diff --git a/.mega-linter.yml b/.mega-linter.yml new file mode 100644 index 0000000..416f4c7 --- /dev/null +++ b/.mega-linter.yml @@ -0,0 +1,17 @@ +--- +# Configuration file for MegaLinter +# See all available variables at https://megalinter.io/configuration/ and in linters documentation + +DISABLE_LINTERS: + - SPELL_CSPELL + - SPELL_LYCHEE + +DISABLE_ERRORS_LINTERS: + - COPYPASTE_JSCPD + - REPOSITORY_DEVSKIM + - REPOSITORY_KICS + +EMAIL_REPORTER: false +FILEIO_REPORTER: false +MARKDOWN_SUMMARY_REPORTER: true +SHOW_ELAPSED_TIME: true \ No newline at end of file From 09170e69681c9bb5cf75939f46cd74fd51296127 Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 9 Apr 2025 01:08:59 +0200 Subject: [PATCH 2/8] chore: update GitHub workflows to set fetch-depth for actions/checkout --- .github/workflows/ci.yml | 2 ++ .github/workflows/python-publish.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d01ecd6..ad81c0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - uses: actions/setup-python@v5 with: diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 139ef61..c16e599 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -19,6 +19,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + fetch-depth: 1 - name: Set up uv and Python uses: astral-sh/setup-uv@v5 From f487a14264a87ef8bf44d4c32e430b0ab44ce762 Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 9 Apr 2025 01:24:25 +0200 Subject: [PATCH 3/8] chore: update issue templates for improved clarity and structure --- .github/ISSUE_TEMPLATE/bug_report.md | 23 ++++++++++++++++------- .github/ISSUE_TEMPLATE/feature_request.md | 19 ++++++++++++------- .github/workflows/ci.yml | 5 ----- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 392a205..b67a5eb 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -6,25 +6,34 @@ labels: bug assignees: "" --- -**Describe the bug** A clear and concise description of what the bug is. +## Describe the bug -**To Reproduce** Steps to reproduce the behavior: +A clear and concise description of what the bug is. + +## To Reproduce + +Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error -**Expected behavior** A clear and concise description of what you expected to -happen. +Expected behavior + +A clear and concise description of what you expected to happen. -**Screenshots** If applicable, add screenshots to help explain your problem. +Screenshots -**Environment (please complete the following information):** +If applicable, add screenshots to help explain your problem. + +## Environment (please complete the following information): - OS: [e.g. macOS, Windows, Linux] - Version [e.g. 1.2.3] - Client [if applicable] - Version [e.g. 1.2.3] -**Additional context** Add any other context about the problem here. +## Additional context + +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcc2bb..27442b1 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -6,14 +6,19 @@ labels: enhancement assignees: "" --- -**Is your feature request related to a problem? Please describe.** A clear and -concise description of what the problem is. Ex. I'm always frustrated when [...] +## Is your feature request related to a problem? Please describe. -**Describe the solution you'd like** A clear and concise description of what you -want to happen. +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -**Describe alternatives you've considered** A clear and concise description of +## Describe the solution you'd like + +A clear and concise description of what you want to happen. + +## Describe alternatives you've considered + +A clear and concise description of any alternative solutions or features you've considered. -**Additional context** Add any other context or screenshots about the feature -request here. +## Additional context + +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad81c0c..bd3c7a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,11 +61,6 @@ jobs: - name: "Install uv" uses: astral-sh/setup-uv@v5 - - name: "Prettier" - run: | - npx prettier --check "**/*.{json5,yaml,yml}" - npx prettier --prose-wrap always --check "**/*.md" - - name: "Python format" run: uvx ruff format --diff . From 9b66046085b7889a4aa9c182c055bda40a5a0840 Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 9 Apr 2025 01:49:53 +0200 Subject: [PATCH 4/8] chore: update MegaLinter configuration and Dockerfile for improved user management and file handling --- .mega-linter.yml | 2 ++ Dockerfile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.mega-linter.yml b/.mega-linter.yml index 416f4c7..874623a 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -8,8 +8,10 @@ DISABLE_LINTERS: DISABLE_ERRORS_LINTERS: - COPYPASTE_JSCPD + - REPOSITORY_CHECKOV - REPOSITORY_DEVSKIM - REPOSITORY_KICS + - REPOSITORY_TRIVY EMAIL_REPORTER: false FILEIO_REPORTER: false diff --git a/Dockerfile b/Dockerfile index 5015fa8..1bdcc48 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \ --mount=type=bind,source=uv.lock,target=uv.lock \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ uv sync --frozen --no-install-project --no-dev -ADD . /app +COPY . /app RUN --mount=type=cache,target=/root/.cache/uv \ uv sync --frozen --no-dev From 1ce6c332d372fcb24c34747ed6006f68db829d50 Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 9 Apr 2025 01:54:31 +0200 Subject: [PATCH 5/8] chore: disable Hadolint in MegaLinter configuration --- .mega-linter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.mega-linter.yml b/.mega-linter.yml index 874623a..f229105 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -8,6 +8,7 @@ DISABLE_LINTERS: DISABLE_ERRORS_LINTERS: - COPYPASTE_JSCPD + - DOCKERFILE_HADOLINT - REPOSITORY_CHECKOV - REPOSITORY_DEVSKIM - REPOSITORY_KICS From fd64a8c39bf9365de54b742b32ed3699d6d51b8a Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 9 Apr 2025 19:51:08 +0200 Subject: [PATCH 6/8] chore: update CI workflows to trigger on release events and remove unused job --- .github/workflows/ci.yml | 39 +++++----------------------- .github/workflows/python-publish.yml | 1 + 2 files changed, 7 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd3c7a0..0a08bc0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,12 @@ +--- name: CI on: - push: - branches: [main] pull_request: - workflow_dispatch: + branches: + - main + release: + types: [published] # Trigger when a release is published concurrency: group: ${{ github.workflow }}-${{ github.ref_name }}-${{ @@ -17,34 +19,6 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: - determine_changes: - name: "Determine changes" - runs-on: ubuntu-latest - outputs: - # Flag that is raised when any code is changed - code: ${{ steps.changed.outputs.code_any_changed }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: tj-actions/changed-files@v45 - id: changed - with: - files_yaml: | - code: - - "**/*" - - "!docs/**/*" - - "!mkdocs.*.yml" - - "!**/*.md" - - "!bin/**" - - "!assets/**" - - "!dist/**" - # Generated markdown and JSON files are checked during test runs - - "docs/reference/cli.md" - - "docs/reference/settings.md" - - "docs/configuration/environment.md" - - "uv.schema.json" lint: timeout-minutes: 10 name: "lint" @@ -68,8 +42,7 @@ 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 diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index c16e599..d77bb7b 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,3 +1,4 @@ +--- name: Upload Python Package on: From 8cada4815af41fb8cba04dcaeb5921e9aa916cf3 Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 9 Apr 2025 20:18:11 +0200 Subject: [PATCH 7/8] chore: update Dockerfile permissions and enhance README for Docker usage --- .github/workflows/ci.yml | 1 - Dockerfile | 6 ++++-- README.md | 21 ++++++++++++++++----- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a08bc0..00fc465 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,6 @@ jobs: permissions: contents: read packages: write - # attestations: write id-token: write steps: diff --git a/Dockerfile b/Dockerfile index 1bdcc48..9adab69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,8 +52,10 @@ RUN apt-get update && \ rm -rf /var/cache/apt/* # Copy only necessary files from builder -COPY --from=builder --chown=python:python /python /python -COPY --from=builder --chown=app:app /app /app +COPY --from=builder /python /python +COPY --from=builder /app /app +# Set proper permissions +RUN chmod -R 755 /python /app ENV PATH="/app/.venv/bin:$PATH" \ DISPLAY=:0 \ diff --git a/README.md b/README.md index 02be82b..a8e3412 100644 --- a/README.md +++ b/README.md @@ -154,18 +154,29 @@ To develop and test the package locally: ## Docker +Using Docker provides a consistent and isolated environment for running the server. + ```bash -# Run with default VNC password +# Build the Docker image docker build -t browser-use-mcp-server . + +# Run the container with the default VNC password ("browser-use") +# --rm ensures the container is automatically removed when it stops +# -p 8000:8000 maps the server port +# -p 5900:5900 maps the VNC port docker run --rm -p8000:8000 -p5900:5900 browser-use-mcp-server -# Use custom VNC password -echo "your-password" > vnc_password.txt +# Run with a custom VNC password read from a file +# Create a file (e.g., vnc_password.txt) containing only your desired password +echo "your-secure-password" > vnc_password.txt +# Mount the password file as a secret inside the container docker run --rm -p8000:8000 -p5900:5900 \ - -v $(pwd)/vnc_password.txt:/run/secrets/vnc_password \ + -v $(pwd)/vnc_password.txt:/run/secrets/vnc_password:ro \ browser-use-mcp-server ``` +*Note: The `:ro` flag in the volume mount (`-v`) makes the password file read-only inside the container for added security.* + ### VNC Viewer ```bash @@ -175,7 +186,7 @@ cd noVNC ./utils/novnc_proxy --vnc localhost:5900 ``` -Default password: `browser-use` +Default password: `browser-use` (unless overridden using the custom password method)
VNC Screenshot From a1aa6b467a188efd83c8579f813c154cee27f94e Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 9 Apr 2025 20:23:53 +0200 Subject: [PATCH 8/8] chore: update MegaLinter configuration to disable Markdown link checks and enhance README formatting --- .mega-linter.yml | 1 + README.md | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.mega-linter.yml b/.mega-linter.yml index f229105..166d5bf 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -9,6 +9,7 @@ DISABLE_LINTERS: DISABLE_ERRORS_LINTERS: - COPYPASTE_JSCPD - DOCKERFILE_HADOLINT + - MARKDOWN_MARKDOWN_LINK_CHECK - REPOSITORY_CHECKOV - REPOSITORY_DEVSKIM - REPOSITORY_KICS diff --git a/README.md b/README.md index a8e3412..dc09e6e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ uv tool update-shell Create a `.env` file: -``` +```bash OPENAI_API_KEY=your-api-key CHROME_PATH=optional/path/to/chrome PATIENT=false # Set to true if API calls should wait for task completion @@ -65,7 +65,7 @@ browser-use-mcp-server run server --port 8000 --stdio --proxy-port 9000 ## Client Configuration -### SSE Mode +### SSE Mode Client Configuration ```json { @@ -77,7 +77,7 @@ browser-use-mcp-server run server --port 8000 --stdio --proxy-port 9000 } ``` -### stdio Mode +### stdio Mode Client Configuration ```json { @@ -198,7 +198,7 @@ Default password: `browser-use` (unless overridden using the custom password met Try asking your AI: -``` +```text open https://news.ycombinator.com and return the top ranked article ```