local-bridge

local-bridge

Connects local tools (browser, shell) to a remote MCP server via reverse-MCP, enabling the server agent to control your local browser and execute shell commands.

Category
访问服务器

README

local-bridge

@tianshu-ai/local-bridge — a lightweight local client that connects your machine's tools (browser, and more) into a tianshu server via reverse-MCP.

tianshu runs on a server. This bridge runs on your computer, dials out to the server over a WebSocket, and registers itself as an MCP server. The server-side agent can then drive your local tools — as if they were built in — but scoped to your own sessions only.

your machine                         tianshu server
┌──────────────┐   outbound WSS    ┌──────────────────┐
│ local-bridge │ ────────────────▶ │ /ws (Local Bridge │
│  • browser   │   register tools  │   plugin)         │
│    tools     │ ◀──── tools/call ─│   → agent uses    │
└──────────────┘ ──── result ─────▶ │     your tools    │
                                    └──────────────────┘

Install & run

Install globally, then use the short tsbridge command:

npm i -g @tianshu-ai/local-bridge
tsbridge --server wss://your-tianshu.example.com/ws --token ***

Or run one-off with npx (no install):

npx @tianshu-ai/local-bridge --server wss://your-tianshu.example.com/ws --token ***

The Local Bridge panel in tianshu shows a ready-to-copy command with your server URL + token filled in.

macOS menu-bar app

Prefer a UI? Build a tiny native menu-bar app (no Electron) that wraps the CLI — a menu-bar icon with Start/Stop + Settings (server / token / browser engine / headless):

npm i -g @tianshu-ai/local-bridge
tsbridge install-app --run

That installs Tianshu Bridge.app to ~/Applications (menu-bar only, no Dock icon) and launches it. Click the bolt icon → Settings to configure, then Start. Requires Xcode command line tools (xcode-select --install) for the one-time swiftc build. First launch: right-click → Open (unsigned local build).

(app/install-app.sh is also available for a clone-based build.)

For a local dev server with auth off, the token is optional:

tsbridge --server ws://localhost:3110/ws

The tsbridge and tianshu-local-bridge commands are equivalent.

Keeping it updated

tsbridge update            # update to the latest version if newer (default)
tsbridge update --check    # just check; exit 1 if an update is available
tsbridge update --dry-run  # print the npm command without running it
tsbridge update --tag next # target a non-`latest` dist-tag
tsbridge version           # print the installed version

(Same semantics as tianshu update.)

Flags

flag meaning
--server <url> tianshu chat WS endpoint (required), e.g. wss://host/ws
--token <token> connection token from the Local Bridge panel
--device <id> stable device id (default: hostname)
--label <name> human label shown in the panel
--no-browser don't expose browser tools
--shell expose the shell exec + file sync tools (OFF by default)
--shell-root <dir> fixed root dir that jails exec + sync_up/sync_down (default: ~/.tianshu_shell)
--headless run the browser without a window (default: headful)
--cdp <url> connect to an already-running Chrome's CDP endpoint (default probe http://127.0.0.1:9222; off to skip)
--chrome-channel <ch> which installed browser to launch: chrome (default), msedge, …
--user-data-dir <dir> reuse a Chrome profile dir so logins carry over

No Chromium download. The bridge uses your Chrome:

  1. If a Chrome is already running with --remote-debugging-port=9222, it connects to that (your real browser — real cookies + session).
  2. Otherwise it launches your system-installed Google Chrome via Playwright's channel: "chrome". Pass --user-data-dir to reuse your logged-in profile.

To expose your everyday browser, start Chrome with a debugging port:

# macOS
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --remote-debugging-port=9222

Tools

Both engines expose the full Playwright-MCP toolset (navigate, snapshot, click, type, fill_form, evaluate, tabs, screenshot, …). Only the underlying browser differs:

  • own@playwright/mcp pointed at your Chrome: connects over CDP to a Chrome already running with --remote-debugging-port, else launches your system Chrome (--browser chrome). Real cookies + fingerprint, no Chromium download.
  • stealthcloakbrowser-mcp: the same toolset on CloakBrowser stealth Chromium (source-level anti-bot-detection patches).

Shell + file sync

When --shell is passed, the bridge also exposes three native tools that run directly on your machine. Their names, parameters and result shapes mirror tianshu's server-side openshell plugin, so an agent written against openshell works unchanged against a bridge device.

All three are jailed to a single fixed root directory (~/.tianshu_shell by default, override with --shell-root). exec's cwd + workdir, sync_up's read base, and sync_down's write dest all resolve inside that root; any path that escapes it is rejected.

  • exec — run a shell command via bash -c, cwd inside the root. Params: command, optional workdir (relative to the root, defaults to the root itself), optional timeout_ms (default 300s, cap 1800s). Output is truncated at 200 lines / 8000 bytes per stream. Returns { ok, exit_code, stdout, stderr, truncated, duration_ms, timed_out }.
  • sync_up — read files/dirs under the root and return their bytes (base64) up to the agent. Params: paths[] (relative to the root, directories walked recursively). Per-file cap 8 MiB, ≤500 files/call.
  • sync_down — receive files (base64) from the agent and write them down under the root. Params: files: [{ path, base64 }]. Parent dirs are created; existing files overwritten.

Transport is base64-in-args over the existing reverse-MCP tools/call channel — no protocol changes.

Security: exec runs commands with your user's permissions, but is confined to the --shell-root directory (default ~/.tianshu_shell) — the agent can't cd or read/write outside it via these tools. It is not a kernel sandbox (a determined command could still reach the wider fs), so only connect a bridge to a tianshu server you trust. Because of this, shell is off by default — add --shell only when you want the agent to run commands + move files on your machine.

Protocol

The bridge speaks the reverse-MCP protocol defined authoritatively in the server repo: plugins/reverse-mcp/PROTOCOL.md. It's a thin envelope around standard MCP JSON-RPC over the authenticated chat WebSocket. This client imports no tianshu package.

Develop

npm install
npm run build
node dist/index.js --server ws://localhost:3110/ws --no-browser

Repo: https://github.com/tianshu-ai/local-bridge

Apache-2.0.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选