# Berth

> Mac-native deployment control plane for AI-generated code

- **Type:** MCP server
- **Install:** `agentstack add mcp-berth-app-berth`
- **Verified:** Pending review
- **Seller:** [berth-app](https://agentstack.voostack.com/s/berth-app)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [berth-app](https://github.com/berth-app)
- **Source:** https://github.com/berth-app/berth

## Install

```sh
agentstack add mcp-berth-app-berth
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Berth

> Mac-native deployment control plane for AI-generated code.
> "Paste code. Pick a target. It's running."

Berth is a Tauri-based macOS app that lets developers deploy and manage code -- especially AI-generated code from Claude Code, Codex, Cursor -- to local machines, remote Linux servers, and (soon) AWS Lambda and Cloudflare Workers.

## Features

- **Paste & Deploy** -- Paste code, pick a runtime, hit Run. Zero config.
- **Environment Variables** -- Per-project env var storage with .env import, secret masking in logs.
- **Service Mode** -- Keep API servers, bots, and workers running. Auto-restart on crash with exponential backoff.
- **Docker Compose** -- Drop in a docker-compose.yml. Berth detects it, runs all services, streams logs.
- **Public URLs** -- Click "Publish" on any running service → instant public URL. Pluggable providers: Cloudflare Quick Tunnel (free), ngrok, or custom command. Berth orchestrates, you pick the tunnel.
- **Remote Agents** -- Deploy a single Rust binary to any Linux server. Persistent execution history, agent-side scheduling, store-and-forward events. Communicates via NATS — no direct network connection or open ports needed.
- **Agent Self-Upgrade** -- Cloudflared-model upgrade: atomic binary swap, exit(42), systemd restart, 30s probation with automatic rollback.
- **MCP Server** -- 19 tools via JSON-RPC 2.0. Claude Code can deploy, run, stop, publish, and monitor projects programmatically.
- **CLI** -- Full command parity with the GUI and MCP server.
- **Runtime Detection** -- Auto-detects Python, Node, Go, Rust, Shell, Docker Compose. Parses requirements.txt, package.json, go.mod, Cargo.toml, docker-compose.yml.
- **Scheduling** -- Cron-like scheduling (`@every 5m`, `@hourly`, `30 9 * * *`). Agent runs jobs independently even when the app is offline.
- **Log Streaming** -- Real-time stdout/stderr via xterm.js terminal with ANSI color support.

## Architecture

```
mac-berth/
  src-tauri/         Tauri 2.0 app (Rust backend + React frontend)
  crates/
    berth-core/     Shared Rust library (projects, runtime, executor, gRPC client, SQLite, tunnel)
    berth-agent/    Persistent execution agent (16 gRPC RPCs, SQLite, scheduler)
    berth-cli/      CLI interface
    berth-mcp/      MCP server (stdio transport)
  proto/             gRPC protobuf definitions
  src/               React 19 + TypeScript frontend
  docs/              Technical documentation
```

### Communication

- **Local**: Embedded agent via Unix Domain Socket (`~/.berth/agent.sock`)
- **Remote (NATS)**: All remote agent communication routed through NATS (Synadia Cloud). Neither desktop nor agent needs to expose ports. Works behind NAT, firewalls, and across different networks. `AgentTransport` trait abstracts transport selection per target.
- **Remote (gRPC)**: Fallback for targets without NATS — gRPC over HTTP/2 (port 50051)
- **MCP**: stdio transport (Claude Code spawns it)
- **LAN Discovery**: mDNS (`_berth._tcp.local.`)

## Quick Start

### Run the App (Development)

```bash
# Prerequisites: Rust, Node.js, protoc
cargo tauri dev
```

### Deploy a Remote Agent

```bash
# One-line install on any Linux server:
curl -sSL https://agent.getberth.dev/install.sh | sudo bash
```

The installer will ask you to choose a connection mode:
- **Synadia Cloud** (recommended) — zero inbound ports, works behind NAT. Requires a free [Synadia Cloud](https://cloud.synadia.com) account and a `.creds` file (User → Get Connected → Download Credentials).
- **Direct Connection** — mTLS over gRPC. Requires network reachability between desktop and server.

For manual/development setup, see the [berth-agent](https://github.com/berth-app/berth-agent) repo.

### Register Target in App

```bash
# Via CLI
berth targets add my-server --host 192.168.1.100 --port 50051
berth targets ping my-server

# Or use the Targets page in the GUI
```

### Publish a Service to a Public URL

```bash
# Prerequisite: brew install cloudflared

# Via CLI
berth publish my-api --port 8080
# Published: https://random-words.trycloudflare.com

berth unpublish my-api

# Or click "Publish" in the project toolbar in the GUI
```

### MCP Integration (Claude Code)

Add to your `.mcp.json`:
```json
{
  "mcpServers": {
    "berth": {
      "command": "cargo",
      "args": ["run", "-p", "berth-mcp"]
    }
  }
}
```

Then in Claude Code: "Deploy this script to my Linux server using Berth"

## Remote Agent

The remote agent (`berth-agent`) is a persistent Rust binary with:

- **SQLite store** (`~/.berth/agent.db`) -- 5 tables: deployments, executions, execution_logs, events, schedules
- **16 gRPC RPCs** -- Deploy, Execute, Stop, Health, Status, StreamLogs, GetExecutions, GetExecutionLogs, GetEvents, AckEvents, AddSchedule, RemoveSchedule, ListSchedules, Upgrade, Publish, Unpublish
- **NATS command channel** -- All RPCs available over NATS relay. Desktop sends commands to `berth..cmd.`, agent responds via `berth..resp.`. Zero inbound ports required.
- **Agent-side scheduler** -- Runs cron jobs every 30s, even when the app is disconnected. Triggers macOS notifications on the desktop via NATS events.
- **Store-and-forward events** -- Agent queues events, app polls when connected
- **Remote upgrade** -- Upload new binary via gRPC, agent verifies and restarts via systemd
- **Dependency install** -- Deploy RPC auto-runs `pip install`, `npm install`, `go mod download`

See [docs/remote-agent.html](docs/remote-agent.html) for full technical reference.

## Tech Stack

| Layer | Technology |
|-------|-----------|
| Desktop App | Tauri 2.0 + React 19 + TypeScript |
| Styling | Tailwind CSS |
| Terminal | xterm.js |
| Rust Backend | tokio + tonic (gRPC) + axum (HTTP) |
| Database | SQLite via rusqlite (bundled) |
| Agent | Rust single binary, systemd service |
| MCP | JSON-RPC 2.0 stdio transport |

## Documentation

- [Technical Documentation](https://docs.getberth.dev) -- Architecture, database schema, Tauri commands, protobuf, MCP tools
- [Remote Agent Reference](https://docs.getberth.dev/remote-agent.html) -- Agent architecture, gRPC protocol, deployment, security

## License

[Apache License 2.0](LICENSE)

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [berth-app](https://github.com/berth-app)
- **Source:** [berth-app/berth](https://github.com/berth-app/berth)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: flagged — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-berth-app-berth
- Seller: https://agentstack.voostack.com/s/berth-app
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
