
brokre
io.github.Furowu由 GitHub 账号 Furowu 发布v0.2.36更新于 Oct 24, 2026
AI-safe credential broker for MCP — run saved SSH/MySQL/psql aliases; passwords never reach AI.
概览
本地凭据代理,让 AI 助手运行已保存的 SSH、MySQL、psql 等 CLI 别名,而密码不会进入 AI 上下文。
- 可以做什么
- 列出已保存的本地别名,可选发现经堡垒机路由的别名(如 b150::db),返回访问方式与可用性元数据,不返回密钥。通过代理运行任意已保存的 CLI 别名,包括 SSH 远程命令、shell 脚本和数据库客户端,密码在提示符处注入。以 sudo、sudo -i 或 su 执行远程特权命令,并复用提权会话。打开本地管理界面,供人工添加或编辑凭据。查询并校验防篡改审计日志,读取或设置堡垒机门禁策略。
- 适用场景
- 当助手需要操作会提示输入密码的 SSH 主机、数据库或内部 CLI,且希望密码不进入模型上下文、环境变量和进程列表时适用。也适合通过跳板机以路由别名管理集群。
- 运行要求
- 以本地 stdio 进程运行。npm 方式需要 Node.js 18+,也提供原生二进制安装。凭据必须由人工通过本地管理界面或首次交互连接添加,因为 MCP 不提供保存凭据功能。堡垒机路由需要在跳板机上安装 brokre 并执行解锁步骤。
安装
在 SourceWeft 中
- 打开 控制台中的 brokre,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
brokre — AI-safe Credential Broker
English | 简体中文
brokre is a local credential broker for AI agents and humans. Use it with Cursor, Claude Code, Kimi Code, Trae, OpenClaw, Hermes Agent, ChatClaw, and other MCP-capable clients to run ssh, mysql, psql, and more — passwords never enter AI context, environment variables, or ps output. It wraps any CLI on your PATH — not only SSH or MySQL — and injects saved passwords at the prompt without exposing plaintext to the AI process, shell history, or process environment.
Developed by Techinone (成都同创合一科技有限公司).
What's New in 0.2.17
0.2.17 is the current release: SessionRelay routed SSH by default, multi-hop bastion routes, local-only list by default, and the existing one-command npm install / auto MCP registration / auto binary upgrade flow.
npm — install, auto-update, auto MCP setup
Recommended MCP config (also applied by auto-setup):
Bastion broker — cluster management
The bastion layer lets AI agents operate many hosts behind one jump box without copying vault passwords into context or scattering secrets on the laptop.
Typical flow for a K8s / DB / batch cluster behind one entry host:
MCP equivalent:
Gate policy (default vs strict) — see Bastion gate policy below. Gate is inactive until brokre bastion set-key; then default unlocks only bastion outbound paths; strict requires unlock for every exec while list remains local-only unless bastion discovery is requested.
See Cross-network list inheritance and Bastion proxy below for setup details.
CLI security (core)
brokre is built around one rule: secrets stay out of the AI's reach and out of observable process state.
Full threat model: SECURITY.md, THREAT_MODEL.md.
Any CLI on PATH (generic by design)
brokre is not a fixed list of database/SSH wrappers. The core model is:
First connection: run verbatim, capture the password you type at the prompt, offer to save as an alias.
Next time: brokre <cli> <alias> … auto-injects — AI and scripts only see the alias name.
Preset prompt patterns ship for common tools (ssh, mysql, psql, redis-cli, ftp, clickhouse, git, docker, kubectl, sudo, …). Everything else uses a generic password: / passphrase: matcher — no code changes required.
Customize when needed:
~/.brokre/prompts.toml— per-binary prompt regex overrides~/.brokre/manage.toml— custom sections in the manage UI (e.g. GaussDB, internal tools)
Built-in manage UI tabs (when the binary is installed) include SSH, FTP, MySQL, PostgreSQL, Redis, ClickHouse, MinIO — convenience only; the PTY wrapper works for any CLI.
Install (MCP first — recommended for AI)
The npm package brokre launches the local brokre mcp server over stdio for Cursor, Claude Code, Kimi Code, Trae, OpenClaw, Windsurf, VS Code, and other MCP clients.
Choose your install path
Recommended MCP entry (also what auto-setup writes):
No Node — point MCP at the native binary: { "command": "brokre", "args": ["mcp"] }.
Path A — npm one-liner (0.2.8+)
Windows: npm install -g brokre, open a new terminal, run brokre --version (first run downloads the native CLI if needed). Local npm i brokre (no -g) is not on PATH.
On npm install, three things happen automatically:
- MCP launcher —
brokre-mcp/npx -y brokre@latestspawnsbrokre mcp. - IDE auto-registration —
postinstallrunsbrokre-setup-mcp: detects installed IDEs only (app, CLI, or real usage artifacts — not empty folders) and merges the MCP entry above into each global config. Idempotent; preserves your other MCP servers. - Binary auto-upgrade — on each MCP start, if
PATHor~/.brokre/bin/brokreis older than the npm package, the matching GitHub Release is downloaded.
IDEs covered by auto-setup
Re-run registration (e.g. you installed brokre before Cursor, then installed Cursor later):
Skip auto-registration on npm install: BROKRE_MCP_SKIP_SETUP=1. Disable binary auto-download: BROKRE_SKIP_AUTO_INSTALL=1. Pin a binary: BROKRE_BIN=/path/to/brokre.
Requires Node.js 18+ for the npm path.
Path B — Native CLI (install.sh / Homebrew, no npm)
Version and upgrade (built into the CLI — no npm required):
Re-run install.sh also upgrades when a newer release exists.
Register MCP after CLI install (needs Node for the setup script, or npx fallback):
Manual per-IDE setup (optional)
Use this only if you skip auto-setup or need project-scoped config.
Cursor — one-click install, or ~/.cursor/mcp.json:
Claude Code — user scope in ~/.claude.json or claude mcp add --scope user brokre -- npx -y brokre@latest. Project scope: .mcp.json with "type": "stdio".
More clients and env vars: packages/brokre-mcp/README.md. MCP Registry ID: io.github.Furowu/brokre.
MCP tools and usage
MCP vs CLI (essential for AI agents)
brokre is not a drop-in for ssh / mysql — you must prefix with brokre for vault injection.
Common mistakes (AI agents)
For remote SSH: tokens after the alias are argv slices, not one shell command. Use split tokens for simple commands; use shell_command for complex scripts.
OpenSSH remote quoting: When there are two or more argv tokens after the connection target, brokre adds shell quotes before invoking ssh so OpenSSH’s space-joined remote command does not split scripts (spaces, tabs, quotes). With one remote token, brokre leaves it unchanged — e.g. brokre ssh host 'cd /tmp && ls' is still parsed by the remote login shell. Split argv tokens such as *.log or $VAR are not expanded remotely; put globs/variables in shell_command or a single shell string. Multi-hop bastion routes need an inner brokre with this fix; single-hop direct-inner is covered by local double escaping.
stdin / stdout (automation scripts)
- Intent-aware routing: non-consumer remote commands (
test,uname,mkdir,bash -c '…', etc.) auto-disconnect stdin (no-nin heredocs); consumer commands (cat,tee,tar,dd,mysql,psql, barebash/sh) forward stdin —cat file | brokre ssh … 'cat > path'works with zero extra flags. - Non-upload remote commands use pipe mode by default (stable stdout); MCP
brokre_execalways disconnects stdin. - Custom tool reading stdin:
brokre ssh --with-stdin alias /path/to/tool. - Explicit disconnect:
brokre ssh -n alias cmd,brokre ssh --no-stdin alias cmd. - Revert to legacy behavior:
BROKRE_SSH_LEGACY_STDIN=1(optionally withBROKRE_SSH_AUTO_NULL_STDIN=1). - sudo: use
brokre ssh alias sudo cmdor MCPbrokre_exec_elevated;sudo -non sudo-rs is non-interactive and brokre cannot inject a password.
MCP elevated sessions (sudo / su, Unix)
By default, brokre mcp reuses a background elevated shell per (alias, mode, user) so sudo passwords are not re-prompted on every call.
brokre_exec_elevated (preferred for privilege escalation):
When the session pool is enabled, responses include session_reused and session_idle_expires_at in addition to exit_code / stdout / stderr. session_idle_expires_at is a rolling idle-window hint refreshed on each call, not a fixed expiry timestamp. stderr is usually empty on the pool path. stdout is the remote command output only — TTY echo, __BROKRE_* framing, and shell prompts are stripped.
brokre_exec: binary=ssh with sudo/su in args auto-uses the same pool (always reuse; no session=new|close). Example: args=["prod","sudo","whoami"].
Writing remote scripts/files (shell_command, binary=ssh only): pass only the alias in args; put the full shell script in shell_command (brokre normalizes to sh -c). Brokre quotes multi-token remote argv before OpenSSH so -c scripts with spaces/tabs survive transport; a single remote token is unchanged. Do not embed sh -c '...' in args or split printf/redirects across argv tokens. For privileged system paths use brokre_exec_elevated.command.
Bastion routes work the same: args=["b150::db"] with shell_command as the remote script.
SessionRelay tunnel (default)
brokre ssh b150::db uses the SessionRelay path by default: the laptop starts brokre tunnel agent --stdio on b150 over SSH, and the agent runs brokre ssh db on the bastion. Multi-hop routes peel one hop per agent (b1::b2::db starts on b1, then b1 continues with b2::db). Inner credentials stay in the bastion vault; the laptop only relays terminal bytes. BROKRE_TUNNEL=0 is a temporary legacy escape hatch for emergency rollback.
MCP brokre_exec responses for routed SSH include tunnel: { mode, active }. TcpForward, endpoint sync, Manage UI tunnel controls, and persistent tunneld are later phases.
Not supported: interactive sudo -i without a command, vim/top, or sudo passwords different from the vault password field. See THREAT_MODEL.md T12.
On first connect with an empty vault, brokre opens manage in your browser (http://127.0.0.1:56777/?t=…). Session tokens stay on localhost — never returned to the AI. Set BROKRE_MCP_NO_AUTO_OPEN=1 to disable auto-open.
| MCP tool | Purpose |
Add credentials
After CLI install, the manager opens on first run (brokre manage --onboard --open). Or anytime:
Or save on first interactive connection (any CLI):
Use (AI-safe)
List metadata (safe for AI / scripts)
When bastions are registered, brokre list stays local-only by default and does not SSH to bastions or trigger bastion unlock. Use brokre list --include-bastions (MCP: include_bastions=true) when you actually need routed aliases such as b150::db; that remote discovery may require unlock.
OpenSSH sessions inject ConnectTimeout=5 by default (BROKRE_SSH_CONNECT_TIMEOUT). Override with -o ConnectTimeout=N or the env var. Bastion RPC (brokre list --include-bastions / remote list) times out after 60s (BROKRE_BASTION_RPC_TIMEOUT). Remote commands use ControlPath=none so they do not attach to a ControlPersist mux master.
Cross-network list inheritance (bastion broker)
For cross-network access — travel, VPN, public entry points — when direct LAN aliases are unreachable locally but reachable via a bastion running brokre.
Prerequisites
- Laptop:
brokre bastion enable b150(b150is a saved SSH alias) - Bastion host runs brokre at
~/.brokre/bin/brokre(standard install /npxpath) with inner aliases saved (e.g.db)
Routed list
When cross-network, use --include-bastions when you need routed aliases. Plain brokre list stays local-only and does not unlock or SSH to bastions.
Execute
When both paths work, the list shows both db (direct) and b150::db (via_b150) — distinguish by access.
Bastion proxy (cross-network / intranet entry)
Promote any saved SSH alias whose remote host runs brokre into a bastion broker. Secrets stay on the bastion; the laptop caches metadata and executes via SSH passthrough.
- Route separator
::(:is illegal in alias names):db(local),b150::db(via bastion),b1::b2::inner(multi-hop, default depth ≤2). - Remote brokre: routed exec invokes
~/.brokre/bin/brokreon the bastion (withBROKRE_SOFT_MEMLOCK=1,BROKRE_ALLOW_FILE_KEYCHAIN=1,BROKRE_ROUTED_INNER=1for headless Linux). Interactive commands (e.g.sudo -i) automatically get-tt. - Guardrails: probe concurrency cap, ms timeouts, short cache, loop detection, audit
route/bastion(HMAC v4). - Manage UI:
brokre manageBastion tab — register/disable bastions, Web set-key and unlock/lock, strict-mode toggle, sync remote aliases; non-TTY still auto-opens/bastion-auth. Audit tab filters bybastion/sourceand shows route fields.
Bastion gate policy (default vs strict)
The bastion gate is a human unlock step before sensitive operations. It is off until you set a bastion key (brokre bastion set-key). After a key exists, unlock establishes a local TTL session (brokre bastion unlock, TTY passphrase, manage UI /bastion-auth, or MCP browser elicitation).
Policy is stored at ~/.brokre/bastion/policy.json (strict_mode, default false).
Examples (default mode, key set, session locked)
In strict mode, exec rows require unlock; metadata-only brokre list remains local-only and does not unlock unless --include-bastions is used.
Set gate mode
MCP read response includes strict_mode, gate_mode, key_set, unlocked. List/exec responses include bastion_gate (required, unlocked_during_call, idle_expires_at).
Unlock session TTL (defaults): 30 min idle (BROKRE_BASTION_IDLE_SECS), 8 h max lifetime (BROKRE_BASTION_MAX_SECS). Idle window renews on each gated call while unlocked (shared across CLI, MCP, and manage UI via ~/.brokre/run/bastion_session.json). Bastion gate auth is independent of manage UI session idle expiry. Disable auto-open browser on MCP unlock: BROKRE_BASTION_NO_AUTO_OPEN=1.
Reveal / delete (human-only, real TTY)
Audit log (metadata only)
Events are stored at ~/.brokre/audit/audit.log (HMAC-chained). Command arguments are uniformly redacted as <REDACTED>. New events include a source field (cli, mcp, or manage). The manage UI Audit log tab and MCP brokre_audit_list expose the same metadata.
Manage UI security
- 127.0.0.1 only; session token in terminal
- Passwords: create / rotate only — no read API
- Delete / rotate require reveal passphrase (or
YESfor auto-saved records) - 15-minute idle timeout
Architecture
- Double encryption: unique DEK per field; wrapped for
execandrevealseparately. - Vault metadata:
profile,name,host_alias,saved_argsin cleartext beside ciphertext (THREAT_MODEL.md T3). - SSH private keys:
0600temp file +-ifor the session (docs/HARDENING.md).
Preset manage UI groups
Convenience tabs when the binary is on PATH:
Roadmap
Today: generic PTY wrapper + manage.toml groups + prompts.toml overrides.
Planned: full TOML connector profiles under ~/.brokre/profiles/ with per-tool injection strategies.
Piped stdin and OpenSSH sharing
- Piped stdin (
tar | brokre ssh host 'tar xf -'): pipe data forwards only after injection completes. - OpenSSH family (
ssh,scp,sftp): shared saved credentials when the host matches. Interactive save required first (TTY).
Development
Release version is declared in VERSION (also reflected in Cargo.toml and packages/brokre-mcp/package.json). Official binaries and npm packages are published by TechinOne via GitHub Releases and CI — not part of this open-source tree.
License
MIT — see LICENSE.
Techinone · 成都同创合一科技有限公司
来源:README.md,提交 96aa085
工具
0版本历史
4- v0.2.36最新Sep 24, 2026
- v0.2.32Sep 19, 2026
- v0.2.26Sep 18, 2026
- v0.2.25Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分