gemini-local-bridge-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
gemini-local-bridge-mcp
中文:零依赖、跨平台(macOS / Windows / Linux)本地文件与搜索 MCP 服务,面向 Gemini App、Claude Desktop 及各类 AI IDE。仅通过
stdio(NDJSON +Content-Length双帧)说标准 MCP(protocolVersion: 2025-06-18),不引入任何 npm 外部依赖,只用 Node.js ≥ 18 内置模块。带 4KB 级响应帧预算 防客户端卡顿、跨平台路径适配(darwin/win32/linux)、--read-only、--root目录隔离与敏感凭据路径拦截。English: Zero-dependency, cross-platform (macOS / Windows / Linux) local file & search MCP server for Gemini App, Claude Desktop, and AI IDEs. Speaks standard MCP (
protocolVersion: 2025-06-18) overstdio(NDJSON +Content-Lengthdual framing), pulls in no external npm packages, and uses only Node.js ≥ 18 built-ins. Features a 4KB-class response-frame budget to prevent client stalls, cross-platform path handling (darwin/win32/linux),--read-only,--rootscoping, and sensitive-credential path guardrails.
License: MIT (see LICENSE). Package: gemini-local-bridge-mcp 0.1.0, ESM ("type": "module"), engines.node >= 18. No postinstall, no native build, no telemetry.
1. 核心特性 / Key features
零外部依赖 / Zero external dependencies
零外部依赖 / Zero external dependencies. Runtime needs only Node.js ≥ 18. No
npm install, nonode_modules, no native addons, no bundledgrep/ripgrep, nofind. Justnode src/server.mjs.零外部依赖:运行只需 Node.js ≥ 18,无需
npm install,无node_modules、无原生模块、不依赖外部grep/ripgrep/find。直接node src/server.mjs。
Everything uses
node:fs,node:os,node:path,node:url,node:assert. The installer (install.mjs) is likewise dependency-free. 全部node:*内置;安装器同样零依赖。The test suite runs with
node tests/test-all.mjs— no dev dependencies either. 测试也无任何开发依赖。
跨平台路径适配 / Cross-platform path handling (darwin / win32 / linux)
OS detection via
process.platform; supporteddarwin,win32,linux(Linux/POSIX fallthrough).process.platform检测;darwin/win32/linux。Correct path semantics per OS:
path.win32on Windows vspath.posixon macOS/Linux (\vs/, drive letters); Windows root-scope matching case-insensitive.path.win32/path.posix;Windows 大小写不敏感。Real home resolution (
detectRealHome): win32%USERPROFILE%→%HOMEDRIVE%+%HOMEPATH%;os.userInfo().homedir; filter/.gemini/;$HOME/os.homedir(). 真实家目录。Path expansion (
expandUserPath):~,~/,~\, Windows%VAR%(%USERPROFILE%→home; unknown left intact),$HOME/${HOME},resolve().~/%VAR%/$HOME。OS-aware registry targets + Node binary resolution: macOS
/opt/homebrew/bin/node→/usr/local/bin/node→process.execPath; WindowsC:\Program Files[ (x86)]\nodejs\node.exe. 平台化注册表与 Node 二进制。No external tools; line-ending/shell agnostic (
\n/\r\n;zsh/bash; Windows PowerShell/cmd/pwsh); UTF-8. 不调用外部命令;换行/终端无关。
4KB 响应帧预算防客户端卡顿 / 4KB-class response-frame budget
Keeps every tool result small so a local client never freezes on a huge frame. 保持每条结果很小,避免本地客户端在超大帧上卡死。
--max-chars <num>: per-call cap on returned content, default4000(≈4KB), min500, max16000. 默认 4000(约 4KB)。fs_readcontentcapped atmaxChars; middle-truncation…[truncated N chars; pass startLine/endLine…]…head+tail; 1-indexedstartLine/endLine;totalChars/totalLines. 头尾保留+中间截断+行切片。Independent hard caps:
fs_listlimit≤200(def)/500;fs_search≤60,≤2000 files,depth≤8,skip>2MB,skip binary,preview≤160;fs_tree≤250,depth≤6,prune heavy/sensitive dirs;SKIP_DIRS. 额外硬上限。Binary protection: NUL probe first 4096 bytes; binary
fs_read→{isBinary:true,…}no raw bytes. 二进制保护。Honest scope note: 4KB default applies to returned text content + per-result caps; this package does not currently re-serialize/truncate the entire JSON-RPC frame to a strict 4096 bytes for
fs_list/fs_search/fs_tree. Pass--max-chars 4000for tightest default. 诚实说明:4KB 针对返回文本 + 条数上限;非整帧 4096 字节总顶。Valid JSON-RPC; oversized fields truncated with explicit markers, never silently.
stdio 模式 vs 本机独立 HTTP MCP 模式的权限差异 / stdio vs standalone local HTTP MCP (desktop clients)
本仓 gemini-local-bridge-mcp 只发 stdio;下面是桌面客户端下两种模式的权限模型(独立 HTTP MCP 由你用外层守护进程包装同一 src/server.mjs,或参考同作者 mcp-4f3a2b / omni-mac --http,见 §6)。This package ships stdio only; comparison is the permission model.
stdio 模式 / stdio | 本机独立 HTTP MCP / standalone local HTTP MCP | |
谁启动 / who spawns | 客户端 spawn ( | 独立进程(macOS user LaunchAgent |
继承沙盒 / inherits sandbox | 继承宿主客户端沙盒. On macOS, Gemini App / Claude built-in | 不继承客户端沙盒. Own process + OS identity; client only HTTP to |
继承环境 / inherits env | Inherits client | 自管环境; absolute |
权限来源 / source | client sandbox + user + app TCC + spawned-env. | daemon user token + own env + app-level |
典型故障 / typical |
| port conflict; needs |
配置 / config |
| register URL |
生命周期 / lifecycle | starts/stops with client. | independent; |
关键结论 / Bottom line. On sandboxed desktop clients (e.g. macOS Gemini App, built-in command under Seatbelt; sandboxed run_command can't read ~/.config/gh, ~/video, ~/Library/... or write ~/Library/Application Support → EPERM), stdio children inherit that sandbox, but a standalone local HTTP MCP started outside the app runs unsandboxed as your user (mcp-4f3a2b 127.0.0.1:3846 PPID 1; omni-mac --http 3847 + ~/Library/LaunchAgents/cc.omni-mac.http.plist RunAtLoad/KeepAlive no Seatbelt → http://127.0.0.1:3847/mcp, no EPERM). 沙盒客户端下 stdio 继承沙盒;独立本机 HTTP MCP 无沙盒。
But
gemini-local-bridge-mcpitself only implementsstdioand already enforces app-level safety regardless of transport:--read-only,--root, sensitive-path blocks,isWithinAllowedRoots. OS-sandbox differences don't remove these checks. 本仓只 stdio;自带安全两种模式都生效。Windows PowerShell: stdio child inherits current PowerShell logon token,
%PATH%,%USERPROFILE%/%APPDATA%, ACLs;command=absoluteC:\Program Files\nodejs\node.exe. Standalone HTTP = own scheduled-task/service identity (orStart-Job),127.0.0.1, own env; PowerShell transient$envdoesn't leak in;resolveNodeBinarychecksC:\Program Files[ (x86)]\nodejs. Windows 子进程继承令牌/环境/ACL;独立 HTTP 自身身份 + 127.0.0.1。Only bind
127.0.0.1+ validateHost(DNS-rebinding); never0.0.0.0. 仅 127.0.0.1 + Host 校验。
Related MCP server: MCP Smart Filesystem Server
2. 快速开始 / Quick start
2.1 macOS
node --version # v18+ (Homebrew: /opt/homebrew/bin/node); no `npm install`
git clone https://github.com/37chengshan/gemini-local-bridge-mcp.git
cd gemini-local-bridge-mcp
node /Users/cc/code/gemini-local-bridge-mcp/src/server.mjs # read/write stdio
node /Users/cc/code/gemini-local-bridge-mcp/src/server.mjs --read-only # read-only
node /Users/cc/code/gemini-local-bridge-mcp/src/server.mjs --read-only --root ~/Projects --max-chars 40002.2 Windows PowerShell
node --version # v18+; no `npm install`
Get-Command node | Select-Object -ExpandProperty Source # e.g. C:\Program Files\nodejs\node.exe
git clone https://github.com/37chengshan/gemini-local-bridge-mcp.git
Set-Location .\gemini-local-bridge-mcp
& "C:\Program Files\nodejs\node.exe" "C:\Users\$env:USERNAME\code\gemini-local-bridge-mcp\src\server.mjs" # read/write
node .\src\server.mjs # if `node` on PATH
node .\src\server.mjs --read-only --root "$env:USERPROFILE\Projects" --max-chars 4000 # read-only + scoped + 4KBmacOS + Windows PowerShell; Linux too. No
.sh. Windows%USERPROFILE%/%APPDATA%,~\,%VAR%; absolutenode.exe; JSON\\.node install.mjs …in PowerShell too. 双平台。
3. CLI
node src/server.mjs [--read-only] [--root <dir>]... [--max-chars <num>]--read-only;--root(repeatable;~/%VAR%/$HOME; outside→isError);--max-chars(default 4000 ~4KB, min500,max16000).stdio dual framing NDJSON +
Content-Lengthauto;initialize→protocolVersion params.protocolVersion || 2025-06-18,capabilities{tools:{}},serverInfo gemini-local-bridge-mcp/0.1.0;ping,tools/list,tools/call,resources/list,prompts/list; notifications no reply; tool errors→isError:true. stdio 双帧;标准 MCP。
4. 工具 / Tools
Read tools readOnlyHint:true,destructiveHint:false,idempotentHint:true,openWorldHint:false; write readOnlyHint:false,destructiveHint:false,idempotentHint:false,openWorldHint:false. --read-only removes write. isError not throw. 只读/写注解。
Tool | 说明 / description | key params |
| UTF-8 read; line slice; |
|
| dir list (name/type/size/mtime; sensitive filtered). |
|
| compact recursive tree; skip heavy/sensitive; caps. |
|
| pure-Node recursive substring/regex; caps. |
|
| exists/type/bytes/lineCount/mtime + host |
|
| create/overwrite UTF-8; |
|
| replace exact substring. |
|
Paths ~/~//~\/%VAR%/$HOME/${HOME} per-platform; darwin/win32/linux.
5. 客户端配置 / Client mcpServers
macOS
{ "mcpServers": { "local-bridge": { "command": "/opt/homebrew/bin/node",
"args": ["/Users/cc/code/gemini-local-bridge-mcp/src/server.mjs","--read-only","--max-chars","4000"] } } }Gemini
~/.gemini/settings.json,~/.gemini/config/mcp_config.json; Claude~/Library/Application Support/Claude/claude_desktop_config.json,~/.claude.json; Cursor~/.cursor/mcp.json; Windsurf~/.codeium/windsurf/mcp_config.json. 绝对 command。
Windows PowerShell
{ "mcpServers": { "local-bridge": { "command": "C:\\Program Files\\nodejs\\node.exe",
"args": ["C:\\Users\\cc\\code\\gemini-local-bridge-mcp\\src\\server.mjs","--read-only","--max-chars","4000"] } } }%USERPROFILE%\.gemini\settings.json,%APPDATA%\Claude\claude_desktop_config.json,%USERPROFILE%\.claude.json,%APPDATA%\Gemini\mcp_config.json. JSON\\. 绝对 node.exe。
stdio vs standalone HTTP
This package registers stdio. Standalone local HTTP would register URL http://127.0.0.1:PORT/mcp + independent daemon — permission differences in §1. gemini-local-bridge-mcp does not open HTTP itself. 本仓 stdio;独立 HTTP 外层守护,权限见 §1。
6. 安装器 / Installer + doctor
node install.mjs --doctor
node install.mjs --dry-run [--read-only] [--root ~/Projects]
node install.mjs --install [--host gemini|claude|cursor|windsurf|all] [--read-only] [--root …]node install.mjs --doctor
node install.mjs --dry-run --read-only --root "$env:USERPROFILE\Projects"
node install.mjs --install --host gemini --read-onlyRegisters mcpServers["local-bridge"]={command:<absolute node>,args:[src/server.mjs,…]}; backup .bak-localbridge-<ts>; --dry-run no-write; npm run doctor/npm run install:dry; npm test. 注册+备份+体检。
对照独立本机 HTTP MCP(权限)/ contrast
mcp-4f3a2b=standalone node server.mjs 127.0.0.1:3846, no sandbox, {url:http://127.0.0.1:3846/mcp}; omni-mac --http 3847 + ~/Library/LaunchAgents/cc.omni-mac.http.plist(RunAtLoad/KeepAlive,no Seatbelt)→http://127.0.0.1:3847/mcp full-host no EPERM. Windows=scheduled task/service 127.0.0.1. 不改 CoreData .store;不动 mcp-4f3a2b。 See §1.
7. 安全 / Security
--read-only; --root (isWithinAllowedRoots,win32 case-insensitive); per-target; applied to read/write/list/tree/search. Sensitive-path guardrails (isSensitivePath,case-insensitive; \→/; children too): .ssh,.aws,.gnupg,.kube/config,.npmrc,.pypirc,.netrc; macOS ~/Library/Keychains,Chrome Default/Cookies; Windows AppData\Roaming\Microsoft\Credentials,AppData\Local\Microsoft\Credentials,…\Chrome\User Data\Default\Network\Cookies,C:\Windows\System32\config\SAM,NTUSER.DAT. Binary protection; no secret output; no network. App-level independent of OS sandbox; HTTP→127.0.0.1 + DNS-rebinding + own auth. 按平台灵敏度拦截;应用层独立安全。
8. 测试 / Tests
/opt/homebrew/bin/node tests/test-all.mjs # user-specified
node tests/test-all.mjs # node>=18 on PATH
npm test # == node ./tests/test-all.mjsnode tests\test-all.mjs
npm testRepo root; zero dev deps. 6 suites→ALL 6 CROSS-PLATFORM TEST SUITES PASSED. 测试全过。 Verified: /opt/homebrew/bin/node tests/test-all.mjs → 6 PASS.
9. 范围 / Scope
Local file+search stdio MCP; app-level safety; ~4KB. No OS sandbox; no HTTP; no network; no npm install; no secrets. OS sandboxing = host concern; standalone HTTP changes spawn/sandbox inheritance (§1) not internal guardrails. 不提供 OS 沙盒/自带 HTTP/联网;不改变内部安全。
MIT License © 2026 Contributors.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Let ChatGPT and Claude read and edit files, search and run commands on your own computer.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
Connect AI assistants to your Mac and Linux computers with scoped access to local files and tools.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Large Language Models to safely browse and interact with local file systems through secure directory listing, file reading, and content search capabilities. Built with comprehensive security controls and high-performance handling of large directories and files.1MIT
- AlicenseAqualityDmaintenanceProvides LLM-optimized filesystem access with intelligent file pagination for large files, lightning-fast ripgrep-powered code search with regex support, and security sandboxing to safely explore and search codebases.71MIT
- AlicenseAqualityDmaintenanceExposes local file I/O, a restricted shell whitelist, and SQLite helpers for safe integration with AI clients like Cursor and Claude Desktop.7MIT
- AlicenseAqualityCmaintenanceEnables AI agents to search local files by name, path, metadata, and literal text over MCP on Windows, Linux, and macOS, while keeping searches within explicitly configured directories and running locally over stdio.71MIT