MCP Server

Let AI agents deploy and manage code through Berth programmatically.

What is MCP

The Model Context Protocol (MCP) is a standard that lets AI coding agents interact with external tools. Berth exposes an MCP server with 26 tools, enabling AI agents like Claude Code to deploy, run, stop, and monitor projects programmatically.

The MCP server uses stdio transport — Claude Code spawns it as a subprocess and communicates over stdin/stdout.

Setup with Claude Code

Add Berth to your project's .mcp.json file:

{
  "mcpServers": {
    "berth": {
      "command": "cargo",
      "args": ["run", "-p", "berth-mcp", "--quiet"],
      "cwd": "/path/to/berth"
    }
  }
}

Replace /path/to/berth with the path to your Berth source directory.

Tip: After adding the config, restart Claude Code. You can verify the MCP server is connected by asking Claude to run berth_health.

Project Tools

ToolDescriptionParameters
berth_list_projects List all projects with status, runtime, and metadata None
berth_project_status Get detailed status of a project including run history project_id required
berth_deploy Deploy code to a target from a path or inline code name required
path optional — code directory or file
code optional — inline code
target optional — default: local
berth_run Run a project and return output project_id required
timeout_secs optional — default: 30
berth_stop Stop a running project project_id required
berth_logs Fetch recent logs from a project project_id required
tail optional — lines to return, default: 50
berth_import_code Import code from a path or inline string, creating a new project name required
path optional — path to code
code optional — inline code
filename optional — filename for inline code
berth_detect_runtime Auto-detect runtime, entrypoint, and dependencies for a path path required
berth_delete Delete a project project_id required
berth_health Check system health and version None

Scheduling Tools

ToolDescriptionParameters
berth_schedule_add Add a cron-like schedule to a project project_id required
cron required — e.g. @hourly, 30 9 * * *
berth_schedule_list List all schedules None
berth_schedule_remove Remove a schedule by UUID schedule_id required

Target Tools

ToolDescriptionParameters
berth_list_targets List configured deploy targets (local + remote) None
berth_add_target Add a new remote deploy target name required
host required
port optional — default: 50051
berth_remove_target Remove a deploy target by name name required
berth_list_agents List connected agents and their health status (pings each target) None

Publishing Tools

ToolDescriptionParameters
berth_publish Publish a running project to a public URL via tunnel project_id required
port required — port the service listens on
provider optional — default: cloudflared
berth_unpublish Stop the public URL tunnel for a project project_id required

Environment Variable Tools

ToolDescriptionParameters
berth_env_set Set an environment variable for a project project_id required
key required
value required
berth_env_get Get all environment variables for a project project_id required
berth_env_delete Delete an environment variable project_id required
key required
berth_env_import Import variables from .env format (merges with existing) project_id required
content required — KEY=VALUE lines

Template Store Tools

ToolDescriptionParameters
berth_store_list List available templates, optionally filtered by category category optional — scrapers, api-servers, bots, ai-ml
berth_store_search Search templates by keyword query required
berth_store_install Install a template, creating a new project template_id required

Usage Examples

Deploy and run inline code

Ask Claude Code:

"Deploy this Python script to Berth and run it:
import requests
r = requests.get('https://news.ycombinator.com')
print(f'HN status: {r.status_code}')"

Claude Code will call berth_deploy with the inline code, then berth_run to execute it.

Set up environment variables and run

"Set the API_KEY environment variable on my-bot to sk-abc123, then run it"

Claude Code calls berth_env_set followed by berth_run.

Check project status

"What's the status of all my Berth projects?"

Claude Code calls berth_list_projects and summarizes the results.

Publish a service

"Publish my-api on port 8080 to a public URL"

Claude Code calls berth_publish and returns the public URL.