使用说明
Berth — The Safe Runtime & Package Manager for MCP Servers
为您的AI工具提供一个安全的泊位。
Berth是一个开源的CLI工具,用于管理 MCP(模型上下文协议) 服务器。它允许您从单个界面发现、安装、配置、运行和保护MCP服务器——用干净的开发人员体验取代手动JSON配置编辑,并在其上添加安全/权限层。
想想:Homebrew+Docker+npm——但适用于MCP服务器。
为什么是Berth?
MCP生态系统正在快速发展——Anthropic创建了该协议,OpenAI采用了它,现在有数百台MCP服务器用于GitHub、Slack、PostgreSQL、文件系统、搜索引擎等。但开发人员的体验被打破了:
- 查找MCP服务器 在GitHub仓库、博客文章和推特上分散
- 安装MCP服务器 意味着手动编辑JSON配置文件——一个拼写错误就会破坏一切
- 正在运行MCP服务器 没有健康检查,没有自动重启,没有统一的日志记录
- 保护MCP服务器 不存在——没有沙盒、没有权限模型、没有审计跟踪
Berth用一个二进制文件修复了所有这些问题。
安装
# Cargo (recommended)
cargo install berth
# npm
npm install -g @berth/cli
# Shell script (latest GitHub release)
curl -fsSL https://raw.githubusercontent.com/berth-mcp/berth/main/install.sh | sh
# Homebrew (source build)
brew install --HEAD ./Formula/berth.rb
注: 如果您是通过安装的
cargo install,确保~/.cargo/bin在你的PATH. 您可以通过添加export PATH="$HOME/.cargo/bin:$PATH"到您的shell配置文件 (~/.bashrc,~/.zshrc等),然后重新启动终端。
快速开始
# Search the MCP server registry
berth search github
# Get detailed info about an MCP server
berth info github
# List installed MCP servers
berth list
特性
| 功能 | 状态 | 描述 |
|---|---|---|
| MCP服务器搜索 | 正在工作 | 按名称、标签或类别搜索注册表 |
| MCP服务器信息 | 工作 | 查看元数据、权限、配置、兼容性 |
| 列出已安装的MCP服务器 | 正常工作 | 查看已安装的内容及其状态 |
| 安装/卸载/更新MCP服务器 | 正常工作 | 从注册表中安装、删除和更新(支持 npx, uvx,以及二进制伪影) |
| 配置MCP服务器 | 工作 | 设置和查看服务器配置 |
| 启动/停止/重启MCP服务器 | 正常工作 | 具有PID/状态跟踪、优雅的首次关闭和可选的有界自动重启策略的子进程生命周期控制 |
| MCP服务器运行状况和状态 | 工作 | 运行时状态,包括运行/停止/错误以及PID、内存和可选的MCP协议运行状况探测器 |
| MCP服务器日志流 | 工作 | 从持久服务器日志中跟踪生命周期事件 |
| MCP代理模式 | 工作 | 透明的stdio代理执行,可选的exec权限过滤 |
| MCP权限管理 | 工作 | 检查已声明/有效的权限,在启动/链接时强制执行环境覆盖,并在网络完全撤销时阻止启动 |
| MCP审计跟踪 | 工作 | 使用服务器/时间过滤器对生命周期操作进行JSONL审计事件 |
| AI客户端集成 | 工作 | 自动配置Claude Desktop、Cursor、Windsurf、Continue和VS代码 |
| 注册表API(本地) | 工作 | 从当前注册表数据集中为健康、搜索、服务器详细信息和下载计数提供REST端点 |
| 注册表网站(本地) | 正在运行 | 浏览器UI位于 /site 使用目录筛选器、服务器详细信息页面和复制就绪安装命令 |
| 注册表发布工作流 | 正在工作 | 验证 berth.toml,运行本地质量检查,并将提交工件排队进行人工审查 |
| 社区信号 | 工作 | 通过API和网站详情界面提交星级/报告;使用持久的本地计数器管理经过验证的发布者徽章 |
命令
berth search <query> Search the MCP server registry
berth info <server> Show detailed MCP server info
berth list List installed MCP servers
berth install <server[@version]> Install an MCP server
berth import-github <owner/repo> Auto-import server from GitHub `berth.toml` (`--ref`, `--manifest-path`, `--dry-run`)
berth uninstall <server> Remove an MCP server
berth update <server|--all> Update MCP servers
berth config <server> Configure an MCP server (`--set`, `--secure`, `--env`, or `--interactive`)
berth config export [file] Export installed server config values as TOML bundle
berth config import <file> Import server config values from TOML bundle
berth start [server] Start MCP server(s)
berth stop [server] Stop MCP server(s)
berth restart <server> Restart an MCP server
berth status [--health-check] Show MCP server status (state, PID, memory, optional MCP health probe)
berth logs <server> Show recent MCP server logs
berth permissions <server> Show/manage/export MCP server permissions (--grant/--revoke/--reset/--export)
berth policy [server] Show/manage/validate org policy (--init/--set/--json)
berth audit [server] View/export runtime audit log (supports --since, --action, --json, and --export)
berth analytics [server] Summarize audit usage and estimated runtime cost (--since, --top, --json)
berth link <client> [--watch] Link Berth-managed servers to claude-desktop, cursor, windsurf, continue, or vscode
berth unlink <client> Unlink Berth-managed servers from claude-desktop, cursor, windsurf, continue, or vscode
berth proxy <server> Run as transparent MCP proxy
berth registry-api Serve local registry REST API (supports --bind and --max-requests)
berth publish [manifest] Validate + submit `berth.toml` to local review queue (`--dry-run` available)
注册表API终结点:
GET /healthGET /servers?q=<query>&category=<category>&platform=<platform>&trustLevel=<level>&offset=<n>&limit=<n>&sortBy=<field>&order=<asc|desc>GET /servers/suggest?q=<query>&limit=<n>&category=<category>GET /servers/facets?q=<query>&category=<category>&platform=<platform>&trustLevel=<level>GET /servers/filtersGET /servers/trending?limit=<n>&category=<category>&platform=<platform>&trustLevel=<level>GET /stats?top=<n>GET /servers/<name>GET /servers/<name>/related?limit=<n>GET /servers/<name>/downloadsGET /servers/<name>/communityGET /servers/<name>/reports?limit=<n>&offset=<n>GET /reports/filtersGET /reports?server=<name>&reason=<reason>&offset=<n>&limit=<n>GET /analytics?server=<name>&since=<duration>&top=<n>GET /publish/submissions?status=<status>&server=<name>&offset=<n>&limit=<n>GET /publish/submissions/filtersGET /publish/submissions/<id>POST /publish/submissions/<id>/status(JSON正文:status,可选note)GET /publish/review-events?status=<status>&server=<name>&submission=<id>&offset=<n>&limit=<n>GET /publish/review-events/filtersGET /publishers?maintainer=<name>&verified=<verified|unverified|true|false>&offset=<n>&limit=<n>GET /publishers/filtersGET /publishers/<maintainer>POST /servers/<name>/starPOST /servers/<name>/reportGET /publishers/verifiedPOST /publishers/verifyPOST /publishers/unverifyGET /site(HTML目录页面,带有q,category,platform,trustLevel,sortBy,order,limit,offset)GET /site/reports(HTML审核提要server,reason,limit,offset)GET /site/submissions(HTML发布审阅队列status,server,limit,offset)GET /site/review-events(HTML发布评论事件提要status,server,submission,limit,offset)GET /site/publishers(HTML发布者验证仪表板,带maintainer,verified,limit,offset)GET /site/publishers/<maintainer>(带有维护者信号和服务器列表的HTML发布者详细信息页面)GET /site/analytics(HTML使用分析仪表板server,since,以及top)GET /site/submissions/<id>(HTML提交详细信息,包括完整清单和质量检查)GET /site/servers/<name>(HTML服务器详细信息页面)OPTIONS <any-endpoint>(浏览器飞行前;CORS已启用)
GET /servers 和 GET /servers/<name> 包括:
maintainerVerified+badgesqualityScore(确定性排名信号)readmeUrl(详细页面请点击尽力存储库README链接)permissionsSummary(网站友好权限计数/标记)installCommandCopy(复制就绪安装命令文本)
权限覆盖格式:
env:<VAR>(例如:env:GITHUB_TOKEN)env:*network:<host>:<port>(示例:network:api.github.com:443,network:*:443)network:*filesystem:<read|write>:<path>(示例:filesystem:read:/workspace,filesystem:write:/tmp)filesystem:*exec:<command>(例如:exec:git)exec:*
运行时和沙盒配置键:
berth.auto-restart(true或false)berth.max-restarts(正整数,默认值3)berth.sandbox(basic或off)berth.sandbox-network(inherit或deny-all)berth.max-memory(内存限制,例如。512M,1G)berth.max-file-descriptors(文件描述符限制,例如。1024)
沙盒运行时注意事项:
- 在Linux上,
berth.sandbox=basic通过以下方式应用Landlock文件系统限制landlock-restrict如果可用,也适用setpriv --no-new-privs可用时硬化。 - 在macOS上,
berth.sandbox=basic用途sandbox-exec使用生成的配置文件(默认拒绝基线、声明的写入路径允许)。 - 在Windows上,
berth.sandbox=basic使用作业对象进行进程隔离。
全局配置(~/.berth/berth.toml):
- 为运行时设置提供工作区范围的默认值(自动重启、最大重启次数、沙盒)
- 每服务器配置覆盖全局默认值
- 丢失的文件或丢失的密钥会自动恢复为内置默认值
组织策略文件(可选):
- 路径:
~/.berth/policy.toml - 拒绝特定服务器:
[servers]deny = ["github"]
- 启动时拒绝有风险的通配符/写入权限:
[permissions]deny_network_wildcard = truedeny_env_wildcard = truedeny_filesystem_write = truedeny_exec_wildcard = true
注册表源覆盖(可选):
BERTH_REGISTRY_INDEX_URL通过HTTP获取注册表JSON并将其用于查找。BERTH_REGISTRY_INDEX_FILE从本地文件路径加载注册表JSON。BERTH_REGISTRY_CACHE下载/覆盖注册表JSON的缓存路径。
安全行为示例:
- 发布时的Env秘密过滤:
berth permissions github --revoke env:GITHUB_TOKENberth start github(服务器启动时没有GITHUB_TOKEN暴露)
- 网络硬块:
berth config github --set berth.sandbox=basicberth config github --set berth.sandbox-network=deny-allberth start github(用退出代码阻止1)
- 审计导出以供审查:
berth audit github --since 24h --json --export audit.json
- 未声明的网络覆盖警告(仅日志):
berth permissions github --grant network:example.com:443berth start github(打印警告和记录permission-network-warning)
- 组织策略拒绝:
- 配置
~/.berth/policy.toml随着[servers] deny = ["github"] berth start github(封锁和记录policy-denied)- 碰撞恢复路径(
status/监控器自动重启)也保持被阻止状态
- 配置
- 组织策略感知客户端链接:
- 配置
~/.berth/policy.toml随着[servers] deny = ["github"] berth link claude-desktop(跳过被阻止的服务器并发出警告)
- 配置
支持的MCP服务器(种子注册表)
泊位船舶内置了流行的MCP服务器注册表:
| 服务器 | 描述 | 类别 |
|---|---|---|
github |
访问GitHub仓库、问题、PR和操作 | 开发人员工具 |
filesystem |
使用可配置的权限保护本地文件系统访问 | 文件系统 |
brave-search |
通过Brave search API进行Web和本地搜索 | 搜索 |
postgres |
带模式检查的只读PostgreSQL数据库访问 | 数据库 |
slack |
访问Slack工作区、频道、消息和用户 | 沟通 |
notion |
读取和更新Notion页面和数据库 | 生产力 |
google-drive |
从Google云端硬盘访问文件和文件夹 | 生产力 |
sqlite |
查询本地SQLite数据库 | 数据库 |
fetch |
获取工具工作流的HTTP资源 | 搜索 |
memory |
为助手存储和检索结构化内存 | 开发人员工具 |
puppeteer |
自动化浏览器任务并捕获屏幕截图 | 开发人员工具 |
sequential-thinking |
结构化推理和规划实用程序 | 开发人员工具 |
google-maps |
通过谷歌地图API进行地点、地理编码和路线选择 | 搜索 |
docker |
检查和管理本地Docker容器和映像 | 开发人员工具 |
kubernetes |
查询和操作Kubernetes集群资源 | 开发者工具 |
aws |
跨公共服务访问AWS资源 | 开发人员工具 |
linear |
阅读并更新线性问题、项目和团队 | 生产力 |
gitlab |
访问GitLab项目、问题、合并请求和管道 | 开发人员工具 |
sentry |
检查Sentry问题、警报和项目错误趋势 | 开发人员工具 |
datadog |
查询Datadog指标、跟踪、仪表板和监视器 | 开发人员工具 |
redis |
检查密钥并运行安全的Redis操作 | 数据库 |
mongodb |
查询MongoDB集合和文档 | 数据库 |
stripe |
访问Stripe客户、付款和发票 | 开发人员工具 |
shopify |
在Shopify中管理产品、订单和客户 | 生产力 |
twilio |
使用Twilio消息和语音资源 | 通信 |
sendgrid |
管理电子邮件模板、发送和交付统计信息 | 通信 |
figma |
访问Figma文件、组件和注释 | 生产力 |
vercel |
检查Vercel上的项目、部署和日志 | 开发人员工具 |
supabase |
访问Supabase数据库、身份验证和存储资源 | 数据库 |
prisma |
检查Prisma架构并查询连接的数据库 | 开发人员工具 |
git |
读取、搜索和操作本地Git存储库 | 开发人员工具 |
time |
获取当前时间并在时区之间转换 | 开发人员工具 |
playwright |
通过结构化可访问性快照实现浏览器自动化 | 开发人员工具 |
context7 |
AI代码编辑器的最新库文档 | 开发人员工具 |
exa |
通过Exa进行人工智能原生网络搜索和内容检索 | 搜索 |
cloudflare |
管理Cloudflare Workers、KV、R2、D1和DNS资源 | 开发人员工具 |
atlassian |
与Jira问题和Confluence页面交互 | 生产力 |
azure |
通过Azure SDK访问Azure资源和开发人员工具 | 开发人员工具 |
firecrawl |
网络抓取、爬行和结构化数据提取 | 搜索 |
e2b |
在安全云沙盒中执行代码 | 开发人员工具 |
随着注册表的增长,将添加更多的MCP服务器。
发展
# Prerequisites: Rust 1.75+ and a C linker (gcc/clang)
# Build
cargo build
# Run all tests (unit + integration)
cargo test --workspace
# Run with arguments
cargo run -- search github
cargo run -- info github
# Lint (zero warnings policy)
cargo clippy --workspace --all-targets -- -D warnings
# License/compliance checks
cargo deny check
# Format
cargo fmt --all
# Build documentation site
make docs
# Benchmark regression smoke check (startup median guard)
make bench-smoke
# Run CI quality smoke checks locally
bash scripts/quality-checks.sh
项目结构
berth/
Cargo.toml # Workspace root
docs/ # mdBook documentation source
crates/
berth-cli/ # Binary crate (the `berth` command)
berth-registry/ # MCP server registry client, types, search engine
berth-runtime/ # MCP server runtime state management with tokio-backed supervision
文档
完整文档: berth-mcp.github.io/berth
相关
- 模型上下文协议(MCP) --Berth管理的协议
- MCP服务器 --官方MCP服务器实施
- 克劳德桌面版 --支持MCP的AI客户端
- 光标 --支持MCP的AI代码编辑器
- 继续 --开源AI编码助手
许可证
Apache 2.0