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
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
push:
branches: [main]
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- name: gofmt
run: test -z "$(gofmt -l .)" || { gofmt -l .; exit 1; }
- run: go vet ./...
- run: go test -race ./...
- uses: goreleaser/goreleaser-action@v7
with:
version: "~> v2"
args: release --snapshot --clean --skip=publish
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release

on:
push:
tags: ["v*"]

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0 # the changelog compares with the previous tag
- uses: actions/setup-go@v7
with:
go-version-file: go.mod
- run: go vet ./...
- run: go test -race ./...
- uses: goreleaser/goreleaser-action@v7
with:
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ Thumbs.db

# Go
vendor/

# Release builds (goreleaser)
dist/
56 changes: 56 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Builds the release binaries when a v* tag is pushed (.github/workflows/release.yml).
# Try it locally: goreleaser release --snapshot --clean
version: 2

project_name: agent-browser-mcp

before:
hooks:
- go mod tidy -diff

builds:
- binary: agent-browser-mcp
env:
- CGO_ENABLED=0
goos: [darwin, linux, windows]
goarch: [amd64, arm64]
flags:
- -trimpath
ldflags:
- -s -w -X main.version={{ .Version }}
mod_timestamp: "{{ .CommitTimestamp }}"

archives:
- formats: [tar.gz]
format_overrides:
- goos: windows
formats: [zip]
files:
- README.md
- LICENSE

checksum:
name_template: checksums.txt

changelog:
use: github
sort: asc
groups:
- title: Features
regexp: '^.*?feat(\(.+\))??!?:.+$'
order: 0
- title: Fixes
regexp: '^.*?fix(\(.+\))??!?:.+$'
order: 1
- title: Other changes
order: 999
filters:
exclude:
- "^Merge "

release:
prerelease: auto
header: |
Download the archive for your system, unpack it, and add the `agent-browser-mcp` binary to your MCP client (see the [Quick start](https://github.com/xcode-studio/agentbrowser-mcp#-quick-start)). It needs the [agent-browser](https://github.com/vercel-labs/agent-browser) CLI 0.38.0 or newer.

On macOS, a binary downloaded with a browser is quarantined; clear it once with `xattr -d com.apple.quarantine agent-browser-mcp`.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ Use Claude in Chrome for tasks in your own browser and quick checks of a page. U
agent-browser install
```

2. Build the server (Go 1.26+):
2. Download the server for your system from [Releases](https://github.com/xcode-studio/agentbrowser-mcp/releases) and unpack it. On macOS, a binary downloaded with a browser is quarantined; clear it once with `xattr -d com.apple.quarantine agent-browser-mcp`.

Or build it (Go 1.26+):

```bash
git clone https://github.com/xcode-studio/agentbrowser-mcp.git
Expand Down Expand Up @@ -301,6 +303,7 @@ go build -o agent-browser-mcp . && go run docs/demo/main.go # re-record the de
- **Fakes:** unit tests run every tool against a fake agent-browser that records its arguments, and a fake Chrome that records protocol calls.
- **Guards:** coverage tests fail if a tool or enum value has no test case. Budget tests keep `tools/list` under 48 KB and the instructions under Claude Code's 2,048-character limit.
- **Lighthouse:** set `LIGHTHOUSE_PATH=$(which lighthouse)` to include the Lighthouse audit in the integration run.
- **Releases:** push a tag such as `v2.0.1`. GitHub Actions runs the tests, builds macOS, Linux and Windows binaries (amd64 and arm64) with [GoReleaser](https://goreleaser.com), and publishes them with a changelog. `goreleaser release --snapshot --clean` builds the same archives locally into `dist/`.

## 🤝 Contributing

Expand Down
22 changes: 19 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"fmt"
"os"
"os/signal"
"runtime/debug"
"strings"
"sync"
"syscall"

Expand All @@ -18,19 +20,33 @@ import (
mcpsrv "github.com/xcode-studio/agentbrowser-mcp/internal/mcp"
)

const version = "2.0.0"
// version is set by release builds (-X main.version=...). Without it, the
// module version Go stamps into the binary is used: the tag for go install,
// or a pseudo-version for go build in a clone.
var version = ""

func buildVersion() string {
if version != "" {
return version
}
if bi, ok := debug.ReadBuildInfo(); ok && bi.Main.Version != "" && bi.Main.Version != "(devel)" {
return strings.TrimPrefix(bi.Main.Version, "v")
}
return "dev"
}

func main() {
ver := buildVersion()
cfg, err := config.Load(os.Args[1:])
if err != nil {
fmt.Fprintln(os.Stderr, "agent-browser-mcp: configuration error:", err)
os.Exit(1)
}

mgr := browser.NewManager(cfg)
s, shutdown := mcpsrv.NewServer(version, cfg, mgr)
s, shutdown := mcpsrv.NewServer(ver, cfg, mgr)

fmt.Fprintf(os.Stderr, "agent-browser-mcp %s: listening on stdio; %s\n", version, mgr.CheckVersion(context.Background()))
fmt.Fprintf(os.Stderr, "agent-browser-mcp %s: listening on stdio; %s\n", ver, mgr.CheckVersion(context.Background()))
stop := sync.OnceFunc(func() { shutdown(context.Background()) })
// A client stops a stdio server with SIGINT, then SIGTERM and SIGKILL
// within half a second (Claude Code on reconnect). ServeStdio first waits
Expand Down
Loading