Local MCP Web Bridge
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.
Local MCP Web Bridge
简体中文 · English
让 Gemini、ChatGPT 网页端也能像 Codex 一样,直接用上你电脑里的工具。
在聊天里查项目目录、读本机资料。只要账号或工作区支持自定义远程 MCP,就可以先用示例跑通,再接入自己的 agent-mcp,按客户端分配只读工具。Gemini 接入条件 · ChatGPT 接入条件
网页 Agent ── HTTPS / OAuth ── 本机网关 ── 回环地址 ── agent-mcp
│
└── 也可直接运行两工具文档示例选择一种运行方式
方式 | 适合什么场景 | 开放范围 |
先体验 MCP 握手和工具调用 | 内置 | |
用支持远程 MCP 的网页 Agent 查询指定目录 | 按 OAuth 客户端分配只读工具,网关核对上游实际生效的共享目录 | |
给本机或可信私网里的客户端使用 | 按工具名选择,或显式使用 |
公网的授权清单同时用于 tools/list 和 tools/call。例如,只分配了 list_dir 的客户端即使知道 read_file 的名字,直接调用也会被拒绝。原始文件保存在你自己的电脑上,工具返回的内容会传给调用方。
Related MCP server: AKIMCP
本机试跑
需要 Git 和 Python 3.11 以上。先克隆仓库,其余命令在仓库根目录执行。
git clone https://github.com/xiehuapeng/local-mcp-web-bridge.git
cd local-mcp-web-bridgeWindows PowerShell
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
$env:MCP_BRIDGE_TOKEN = .\.venv\Scripts\python.exe -c "import secrets; print(secrets.token_urlsafe(32))"
$bridge = Start-Process -FilePath .\.venv\Scripts\python.exe -ArgumentList 'server.py','--documents','examples/documents.json' -WindowStyle Hidden -PassThru等服务启动后,在同一窗口验证和停止。
.\.venv\Scripts\python.exe smoke.py http://127.0.0.1:17800/mcp
Stop-Process -Id $bridge.IdmacOS / Linux
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
export MCP_BRIDGE_TOKEN="$(.venv/bin/python -c 'import secrets; print(secrets.token_urlsafe(32))')"
.venv/bin/python server.py --documents examples/documents.json &
bridge_pid=$!等服务启动后,在同一终端验证和停止。
.venv/bin/python smoke.py http://127.0.0.1:17800/mcp
kill "$bridge_pid"看到 initialize OK、tools/list OK (2 tools) 和 tools/call OK 即可确认握手、工具发现和样本文档读取都已成功。要试用自己的文档,复制 JSON 示例 为被 Git 忽略的 documents.local.json,然后用 --documents documents.local.json 启动。文档在服务启动时载入。
部署公网入口
需要一个本机 agent-mcp、可用的 Tailscale Funnel 和支持远程 MCP 的 OAuth 签发方。按下列顺序部署。
1. 启动本机只读上游
安装 agent-mcp。本项目验证过 3.5.8。给公网网关准备独立实例,并先创建一个专门用于共享的目录。以下是 Windows 示例。将配置保存到仓库外的 %LOCALAPPDATA%/mcp-bridge-upstream/config/mcp_config.json,将 C:/mcp-shared 改成实际存在的绝对路径,并将两处 api_key 替换成同一把随机密钥。上游只监听本机回环地址。
{
"server_name": "Bridge read-only upstream",
"transport": "http",
"host": "127.0.0.1",
"hosts": ["127.0.0.1"],
"port": 18000,
"tool_prefix": "",
"auth_mode": "bearer",
"api_key": "REPLACE_WITH_RANDOM_UPSTREAM_TOKEN",
"profiles": [
{
"id": "default",
"name": "Read-only bridge",
"enabled": true,
"transport": "http",
"tunnel_mode": "none",
"direct_ips": ["127.0.0.1"],
"auth_mode": "bearer",
"api_key": "REPLACE_WITH_RANDOM_UPSTREAM_TOKEN",
"inherit_permissions": false,
"roots": ["C:/mcp-shared"],
"read_only": true,
"allow_all_roots": false,
"allow_secrets": false,
"allow_commands": false,
"allow_processes": false,
"allow_exposures": false,
"allow_clipboard_screen": false
}
]
}$env:AGENT_MCP_HOME = Join-Path $env:LOCALAPPDATA 'mcp-bridge-upstream'
agent-mcp run --config "$env:AGENT_MCP_HOME/config/mcp_config.json"macOS 或 Linux 使用对应的绝对路径,例如 /home/alice/mcp-shared,并用 export AGENT_MCP_HOME=… 指定独立数据目录。在该终端保持上游运行。
2. 配置 OAuth 和工具权限
在 Tailscale 启用 MagicDNS、HTTPS 证书和 Funnel 权限,找到节点 DNS 名。确定完整资源地址
https://<节点名>.ts.net/mcp。这一步先确定地址,网关启动后再开启转发。Tailscale Funnel在签发方配置授权码加 PKCE,以及客户端需要的注册方式。以 WorkOS AuthKit 为例,将完整地址添加为 Resource Indicator。确认 RS256 access token 的
aud包含该地址,并获取允许访问的用户sub和各客户端真实的client_id。AuthKit MCP 配置 · 令牌字段在仓库根目录复制配置。编辑
public_roots,使其与上游roots完全对应。编辑oauth_clients,把示例键换成签发方给出的实际客户端 ID,再选它能使用的工具。macOS/Linux 用cp复制文件。
Copy-Item examples/gateway-oauth.json gateway.local.json可分配的工具包括 stat_file、read_file、read_files、list_dir、glob_files 和 search_text。客户端 ID 来自已验签的 access token,未分配权限的客户端看到空清单。动态注册的客户端可能在首次授权后才有 ID。取得 ID 后,将它写入配置并重启网关,再刷新工具清单。
3. 启动网关并开启 HTTPS
另开终端,在仓库根目录替换下列占位值。MCP_BRIDGE_UPSTREAM_TOKEN 使用上游配置中同一把密钥。issuer 和 JWKS 地址以签发方元数据为准。macOS/Linux 用 export 名称='值' 设置同名变量,Python 使用 .venv/bin/python。
$env:MCP_BRIDGE_UPSTREAM_TOKEN = 'REPLACE_WITH_RANDOM_UPSTREAM_TOKEN'
$env:MCP_BRIDGE_PUBLIC_URL = 'https://node.example.ts.net/mcp'
$env:MCP_BRIDGE_ISSUER = 'https://issuer.example.com'
$env:MCP_BRIDGE_JWKS_URL = 'https://issuer.example.com/oauth2/jwks'
$env:MCP_BRIDGE_SUBJECT = 'replace-with-the-authorized-subject'
.\.venv\Scripts\python.exe server.py --auth oauth --gateway gateway.local.json确认 443 没有其它 Funnel 用途后,在另一终端开启根路径转发。OAuth 发现路径和 /mcp 都需要经过网关。
tailscale funnel --bg --https=443 17800
tailscale funnel status4. 从网页端验证
从另一网络访问
https://<节点名>.ts.net/.well-known/oauth-protected-resource/mcp,应得到资源元数据。匿名POST /mcp应返回401,并给出WWW-Authenticate。在网页连接器填入完整的 HTTPS
/mcp地址并授权。用一个获准的 Agent 列目录、读取一份测试文件,再用只有列表权限的客户端复查。Gemini 自定义应用说明命令行也可查工具清单。在探测进程里把当前客户端的短期 access token 设为
MCP_BRIDGE_TOKEN,运行python smoke.py <你的 HTTPS MCP URL> --expect-tool list_dir --expect-tool read_file。用已安装依赖的 Python 环境,并按实际授权调整工具名。
停止公网入口用 tailscale funnel --https=443 off,再停止网关进程。需要撤销后续访问时,从网页端移除连接器并在签发方撤销授权。已经签发的 JWT 按其到期时间失效。
部署私有入口
私有模式用于本机或你控制的网络。启动独立的本机上游。可沿用上面的只读配置,也可按需配置上游权限。若两种入口同时运行,为网关和上游分别使用独立实例、端口与密钥,Funnel 只指向公网 OAuth 网关。
复制 私有网关示例 后检查
upstream_url,将其改成你的回环地址与端口。macOS/Linux 用cp复制文件。
Copy-Item examples/gateway-private.json gateway.local.json修改
private_tools。保留示例里的三个工具,或显式改为["*"]。上游实际权限仍决定工具可以执行的操作。在仓库根目录启动。两把密钥分别用于上游和网关客户端。macOS/Linux 用同名环境变量,将 Python 路径换成
.venv/bin/python,并用同一个 shell 启动及测试。
$env:MCP_BRIDGE_UPSTREAM_TOKEN = 'REPLACE_WITH_RANDOM_UPSTREAM_TOKEN'
$env:MCP_BRIDGE_TOKEN = .\.venv\Scripts\python.exe -c "import secrets; print(secrets.token_urlsafe(32))"
$bridge = Start-Process -FilePath .\.venv\Scripts\python.exe -ArgumentList 'server.py','--auth','local-token','--gateway','gateway.local.json' -WindowStyle Hidden -PassThru等服务启动后验证示例清单。
.\.venv\Scripts\python.exe smoke.py http://127.0.0.1:17800/mcp --expect-tool list_roots --expect-tool list_dir --expect-tool read_file如果选择 ["*"] 并使用已启用全部工具的 agent-mcp 3.5.8,可将探测参数改为 --expect-count 22。其他版本以运行时列表为准。在 PowerShell 用 Stop-Process -Id $bridge.Id 停止网关。
本机客户端使用 http://127.0.0.1:17800/mcp,并把 MCP_BRIDGE_TOKEN 作为 Bearer 令牌。可信私网内的另一台设备可在已有授权的 SSH 连接上转发端口,用 ssh -N -L 127.0.0.1:17800:127.0.0.1:17800 user@private-host 后访问相同的本地地址。两端端口保持一致,以通过网关的 Host 校验。
常见问题
现象 | 先检查 |
本机可用,公网 | 从另一网络确认,再检查 Funnel 根路径是否指向网关端口 |
OAuth 通过后工具清单为空 |
|
上游只读范围未获准 | 检查上游实际 |
桌面客户端一段时间后收到 401 | 检查固定请求头中的令牌是否过期,以及客户端是否会执行 OAuth 刷新 |
测试记录覆盖 Windows、Linux 和按客户端拒绝直接调用。隔离的 agent-mcp 3.5.8 实测验证了私有入口枚举 22 项工具,以及公网网关使用测试签发方读取样本文档。实际网页产品的登录和回调需用部署者自己的账号验收。
欢迎在 Issues 分享接入的客户端与部署方式,或提供可复现的问题步骤。项目采用 MIT 许可证。上游 agent-mcp 由使用者独立安装,适用其自身许可证。
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
Connect AI assistants to your Mac and Linux computers with scoped access to local files and tools.
OAuth 2.1 short-link tools for AI agents with scoped tokens, approvals, audit logs, and revocation.
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.
Let ChatGPT and Claude read and edit files, search and run commands on your own computer.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to search, update, manage files, and run terminal commands on a computer, with remote access via Streamable HTTP and OAuth 2.0 for integration with ChatGPT and web agents.1MIT
- FlicenseNot gradedqualityAmaintenanceExposes an OAuth-gated suite of 38 tools that let web-based AI chat clients securely operate a local machine, covering files, shell, search, Git, SQLite, browser automation, DevTools, background tasks, localhost services, clipboard, notifications, ports, and Postman. A strict command whitelist and configurable folder allowlist keep that broad local access governed rather than unrestricted.-
- FlicenseNot gradedqualityAmaintenanceExposes 38 OAuth-gated tools over one MCP endpoint so web-based AI clients like Claude, ChatGPT, and Grok can read and edit local files, run whitelisted shell commands, search content, use Git, SQLite, browser automation, DevTools, clipboard, notifications, ports, and background jobs on your own machine. A strict command whitelist and folder restrictions keep the local operating surface governable and safe by default.-
- AlicenseNot gradedqualityAmaintenanceExposes a governed suite of 38 tools over a single OAuth-gated MCP endpoint, letting web-based AI chat clients read and edit local files, run whitelisted shell commands, search, use Git, inspect SQLite databases, and drive browser, DevTools, clipboard, and background-task workflows. It requires no system-wide install or admin rights and restricts access to folders and commands approved from a local control panel.MIT