Skip to main content
Glama
s3hq4y
by s3hq4y

Portal

Portal

English · 简体中文

Portal 是一个 VS Code 扩展,将当前工作区暴露为 公共 MCP 端点。其设计刻意精简:仅支持命令和文件传输。

通过隧道将任意 MCP 客户端(Claude、ChatGPT、Cursor、自定义代理、curl)连接到您的机器。代理可以运行 shell 命令并移动文件,但不能通过 MCP 工具编辑文本——因为没有此类工具。

您将获得

表面

作用

MCP Streamable HTTP

https://<tunnel>/mcp/<token>

文件 HTTP API

https://<tunnel>/files/<token>/…(同一 token)

侧边栏与设置

扁平 Win10 风格面板:启动/停止、复制 URL、隧道健康状态

Portal Agent 终端

run_command 输入/输出的可选实时镜像

Related MCP server: FreeRDC Community Edition

MCP 工具(恰好五个)

工具

用途

run_command

前台执行命令。默认超时 120s(最大 600s)。使用 command + shell,或 executable + args(不需要 shell 语法时推荐使用后者)。

start_command

启动长时间运行的进程。返回 command_id 和 PID。最多同时运行四个任务。

read_command

按偏移量增量读取 stdout/stdout,省略 command_id 可列出已保留的任务。完成的记录在 10 分钟后过期。

stop_command

停止后台任务及其进程树(force 跳过 2 秒的宽限期)。

file_transfer_info

公共文件 API 的基础 URL、大小限制和 curl 示例。

Shell 环境: powershell(Windows 默认)、pwsh、cmd)()、bash / sh(存在 Git Bash 时)。自动设置 UTF-8。

会话: 复用来自 initialize 的 Mcp-Session-Id。若该 ID 丢失或未通过验证,请重新执行 SessionInitialized——不要自行编造 ID。

不存在 read_file / write_file / edit_file / list_* / search_files 等工具。请通过 shell 或 HTTP 文件 API 来读写。

文件传输(双向 HTTP)

与 MCP 使用相同的隧道和 token。默认最大大小:64 MiB(portal.maxTransferBytes)。上传操作将原子替换文件。下载支持 Range 并返回 SHA-256。

GET    {base}?op=info              capability + workspace
GET    {base}?glob=**/*            list files
GET    {base}/<relpath>            download
HEAD   {base}/<relpath>            metadata
PUT    {base}/<relpath>            upload
DELETE {base}/<relpath>            delete
POST   {base}?op=pack              zip  JSON { "paths": ["src"] }
POST   {base}?op=unpack&dest=.     unzip (raw zip body)

免费 ngrok 域名需要以下请求头:ngrok-skip-browser-warning: 1。

# download
curl -fsSL -H "ngrok-skip-browser-warning: 1" \
  "$BASE/README.md" -o README.md

# upload
curl -fsSL -H "ngrok-skip-browser-warning: 1" \
  -T ./photo.png "$BASE/incoming/photo.png"

# pack a folder
curl -fsSL -H "ngrok-skip-browser-warning: 1" \
  -H "Content-Type: application/json" \
  -d '{"paths":["src"]}' "$BASE?op=pack" -o src.zip

隧道提供商

提供商

URL

说明

cloudflare-quick(默认)

每次启动生成新的随机 trycloudflare.com

快速试用;不稳定

cloudflare-named

固定主机名

需要存储的隧道 token、公共主机名、固定在本机端口

ngrok-reserved

保留域名(例如 *.ngrok-free.dev)

永久性 URL

custom

自有命令或已有 URL

占位符:{{port}} {{token}} {{workspace}}。空命令 + customTunnelUrl = 接入模式

路由 token 是秘密路径段。MCP 位于 /mcp/<token>。将 portal.routeToken 留空,则启动时自动生成一个。

命令(命令面板)

  • Portal: 启动 / 停止

  • Portal: 复制 URL

  • Portal: 检查隧道

  • Portal: 设置

  • Portal: 安装 cloudflared / 安装/升级 ngrox

  • Portal: 显示日志 / 显示 Agent 终端

有用的设置:portal.startOnActivation(默认开启)、portal.showCommandsInTerminal、portal.localPort(0 = 自动,cloudflare-named 除外)。

构建

需要 Node 18+ 和 VS Code ^1.95.0。

npm install
npm run build      # esbuild → dist/extension.js
npm run typecheck
npm run package    # .vsix (no bundled node_modules)

加载打包后的 VSIX,或在桌面版 VS Code 主机中运行该扩展(extensionKind:ui + workspace)。

许可证

MIT 协议。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    Expose your VS Code workspace's tools — files, terminal, LSP, diagnostics, and images — to remote MCP clients over a public HTTPS tunnel.
    5
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables a remote MCP client to access narrowly scoped local filesystem resources and process capabilities through a loopback-only bridge. Supports guarded file reads, searches, and mutations, authenticated transport, and private reachability via OpenAI Secure MCP Tunnel.
    1
    AGPL 3.0
  • A
    license
    A
    quality
    A
    maintenance
    Enables MCP clients to securely work with local files, directories, searches, terminal sessions, and processes on paired computers via outbound connections, without exposing inbound ports.
    2
    7
    1
    MIT