Local Ops MCP
Local Ops MCP is a local file and Git management server that exposes MCP tools for authorized workspace operations with path-boundary enforcement.
File browsing: list directories and read UTF-8 files with SHA-256 hashes.
File writing: write files, optionally requiring overwrite and expected hash for safe updates.
Directory management: create directories, including recursive parent creation, and delete directories (with recursive option; root cannot be deleted).
File organization: copy, move, and rename files within the workspace.
File deletion: delete individual files.
Git read-only tools: status, unstaged/staged diffs, log, show revisions, and list branches.
Git write tools: stage explicit files, create commits from staged changes, and amend the latest commit message only.
Remote Git operations: fetch, fast-forward-only pull, and current-branch push are available when explicitly enabled.
Provides Git repository management for local repositories within an authorized workspace, including status, diff, log, branch, add, commit, amend message, fetch, pull, and push operations.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Local Ops MCP show me the git status and uncommitted changes in the workspace"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Local Ops MCP
一个轻量、零运行时依赖的本地 MCP 服务。它允许 ChatGPT 或 Codex 在一个明确授权的工作区内管理文件和本地 Git 仓库,同时由服务端阻止路径越界。
本项目是个人参考实现,不是 OpenAI 官方产品,也没有经过独立的专业安全审计。请勿直接用于生产环境或关键数据;使用者负责限制工作区权限、备份数据、保护凭据并审查写入与远程 Git 操作。
ChatGPT / Codex
↓ MCP
Local Ops MCP
↓ 路径边界检查
指定的本地项目目录文档
第一次使用,建议从中文文档导航开始:
零基础完整教程:理解 MCP、Tunnel、安全边界和完整搭建流程;
Tunnel 综合配置速查:查询配置来源、日常启动、重新初始化和故障定位;
换电脑只看这一页:在新电脑上恢复配置;
全部文档目录:查看公开文档。
文档维护地图:了解每类信息的唯一维护位置。
公开文档只使用占位路径和示例编号。发布截图或日志前,仍需检查 Runtime API Key、真实 Tunnel ID、本机用户名和私人项目路径。
Related MCP server: Softority MCP Server
环境要求
Node.js 20 或更高版本
使用 ChatGPT 或 Codex;其他客户端尚未在本项目中验证
使用 Hosted Chat 时需要 OpenAI Secure MCP Tunnel 与官方
tunnel-client
使用 ChatGPT Hosted Chat 接入时还需要 ChatGPT 开发者模式。根据 OpenAI 官方开发者模式文档,该功能目前在网页版向 Pro、Plus、Business、Enterprise 和 Education 账户开放;免费账户不在官方列出的适用范围内。开始配置前,请先确认自己的账户能够在“设置 → 安全与登录”中启用开发者模式。ChatGPT 套餐权限与 OpenAI Platform 的 API/Tunnel 权限是两套独立条件,具备其中一项不代表自动具备另一项。
可用工具
浏览:
list_directory、read_file写入:
write_file、create_directory整理:
copy_file、move_file、move_directory、rename_file删除:
delete_file、delete_directoryGit 只读:
git_status、git_diff_unstaged、git_diff_staged、git_log、git_show、git_branchGit 写入:
git_add、git_commit、git_amend_messageGit 远程:
git_fetch、git_pull、git_push(默认关闭,需显式启用)
测试
npm testGit 支持
Git 必须已经安装并位于 PATH。仓库路径使用工作区相对路径,解析后的仓库必须位于 LOCAL_OPS_ROOT 下。
git_add 必须传入明确的仓库相对路径列表,git_commit 只提交已经暂存的修改。git_amend_message 只修改最近一次本地提交的信息,不会把暂存区或工作区修改并入该提交;它会改写最近一次提交,应仅在确认尚未推送或明确需要改写历史时使用。不开放 checkout、reset、删除分支、强制推送、删除远程分支、任意 Git 参数或通用 Shell。
远程工具使用仓库中已有的 remote,以及电脑现有的 Git Credential Manager 或 SSH 凭据,不接受凭据作为工具输入。git_pull 始终使用 --ff-only;git_push 只把 HEAD 通过非强制 refspec 推送到当前分支的 upstream。允许网络 URL 和 LOCAL_OPS_ROOT 内的本地 remote,拒绝根目录之外的本地 remote。
本地 Git 命令默认超时 30 秒,远程命令默认超时 60 秒。可通过 LOCAL_OPS_GIT_TIMEOUT_MS 和 LOCAL_OPS_GIT_REMOTE_TIMEOUT_MS 调整;命令输出与文件读取共同遵守 LOCAL_OPS_MAX_BYTES 上限。
Git 开关
环境变量 | 默认值 | 控制范围 |
|
| status、diff、log、show、branch |
|
| add、commit、amend message |
|
| 所有远程工具的总开关 |
|
| 总开关启用后的 fetch |
|
| 总开关启用后的仅快进 pull |
|
| 总开关启用后的当前分支 push |
关闭的工具不会出现在 MCP tools/list 中,直接调用也会被拒绝。布尔值支持 true/false、1/0、yes/no 或 on/off。
修改开关后,先重启 Local Ops Tunnel;服务端安全策略会立即生效。若工具增减后 ChatGPT 仍显示旧清单,先在连接器详情页刷新应用以重新拉取工具描述和清单;若当前界面没有刷新入口或刷新后实测仍未更新,再删除旧的 Local Ops 自定义连接器,并保持原 Tunnel 运行、使用原 Tunnel ID 重新创建。后者是本项目的故障兜底经验,不是平台保证。这里不需要删除 OpenAI Platform 中的 Tunnel,也不需要重新初始化本机 tunnel-client Profile。
安全边界
所有路径都必须位于
LOCAL_OPS_ROOT下;拒绝..越界和符号链接越界;除非明确设置
overwrite=true,否则不会覆盖已有文件;expected_sha256可以防止覆盖读取后又被其他程序修改的文件;删除非空目录必须明确设置
recursive=true,且工作区根目录永远不能被删除;移动和重命名不会替换已存在的目标;
文件默认限制为 2 MiB,可通过
LOCAL_OPS_MAX_BYTES调整;不暴露通用 Shell 或管理员工具;Git 使用固定参数数组启动,不经过 Shell,远程工具默认关闭;
协议日志写入 stderr,stdout 只用于 MCP JSON-RPC 消息。
通过 Secure MCP Tunnel 连接 Hosted Chat
Hosted Chat 无法直接启动本机 STDIO 进程。OpenAI Secure MCP Tunnel 可以把 ChatGPT 的工具调用转发到本机,同时不需要开放入站防火墙端口。
Windows 快速开始
准备 Node.js 20、一个明确授权的本地项目目录,以及官方
tunnel-client。在 OpenAI Platform 创建 Tunnel,为它选择目标
ChatGPT workspace,并创建具备 Tunnels Read + Use 权限的 Runtime API Key。双击仓库根目录的
Local-Ops.bat,选择1. Create or edit configuration保存配置;再次打开菜单选择3. Initialize Tunnel,成功后选择2. Start Tunnel。编辑和初始化是独立操作,初始化不会改写配置。再选择
2. Start Tunnel并保持窗口开启。在 ChatGPT 开发者模式中创建 Tunnel 连接的应用,从“可用隧道”列表选择对应 Tunnel,然后先执行一次只读目录测试。
tunnel-client 是 OpenAI Secure MCP Tunnel 的官方传输客户端;本仓库的 server.mjs 才是提供受限文件工具的 MCP 服务端。二者配套使用,不能互相替代。仓库不再分发或跟踪官方客户端二进制文件。
后续细节按场景查阅,避免在多份文档中维护同一套操作规则:
第一次搭建:零基础完整教程
配置字段、日常启动、重新初始化和排错:Tunnel 综合配置速查
迁移到新电脑:换电脑只看这一页
配置与密钥
config/local-ops.example.psd1:可提交的脱敏模板;config/*.psd1(模板除外):每台电脑单独生成的真实配置,已被 Git 忽略;Runtime API Key:不保存在仓库中,脚本需要时临时询问;
.mcp.json:本地插件入口,安装前应确认LOCAL_OPS_ROOT指向预期工作区。
不要为了方便把工作区设为整个磁盘、用户主目录或系统目录。推荐一个 Local Ops 实例只授权一个明确项目。
开源与安全
许可证:MIT License
安全问题:SECURITY.md
参与贡献:CONTRIBUTING.md
本项目在设计、编码和文档编写过程中使用了 AI 编程工具辅助。维护者会检查改动并运行自动测试,但自动测试不等于安全审计。
Available Tools
18 toolscopy_fileADestructive
Copy a regular file within the configured workspace root. Existing destinations require overwrite=true.
Inputs: source (required), destination (required), overwrite.
create_directoryA
Create a directory below the configured workspace root. Set recursive=true to also create missing parent directories.
Inputs: path (required), recursive.
delete_directoryADestructive
Delete a directory below the configured workspace root. Non-empty directories require recursive=true. The workspace root itself can never be deleted.
Inputs: path (required), recursive.
delete_fileADestructive
Delete a regular file below the configured workspace root.
Inputs: path (required).
git_addA
Stage an explicit list of repository-relative files. Arbitrary Git options are not accepted.
Inputs: files (required), repo_path.
git_amend_messageADestructive
Rewrite only the most recent local commit message without including staged or working-tree changes. This rewrites local history and does not contact a remote.
Inputs: message (required), repo_path.
git_branchARead-only
List local, remote, or all Git branches.
Inputs: repo_path, branch_type.
git_commitA
Create a local Git commit from already staged changes. This does not stage files or contact a remote.
Inputs: message (required), repo_path.
git_diff_stagedARead-only
Show staged Git changes for a repository below the configured workspace root.
Inputs: repo_path.
git_diff_unstagedARead-only
Show unstaged Git changes for a repository below the configured workspace root.
Inputs: repo_path.
git_logARead-only
Show recent Git commits for a repository below the configured workspace root.
Inputs: max_count, repo_path.
git_showARead-only
Show one Git revision without invoking external diff helpers.
Inputs: revision (required), repo_path.
git_statusBRead-only
Show the concise Git working-tree status for a repository below the configured workspace root.
Inputs: repo_path.
list_directoryARead-only
List files and directories below the configured local workspace root.
Inputs: path.
move_fileADestructive
Move a regular file to a new workspace-relative path. The destination must not already exist.
Inputs: source (required), destination (required).
read_fileARead-only
Read a UTF-8 text file below the configured workspace root and return its SHA-256 hash.
Inputs: path (required).
rename_fileADestructive
Rename a regular file without moving it to another directory. The new name must not already exist.
Inputs: path (required), new_name (required).
write_fileADestructive
Write a UTF-8 text file below the configured workspace root. Existing files require overwrite=true; expected_sha256 can prevent lost updates.
Inputs: path (required), content (required), overwrite, expected_sha256.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Each tool maps to a distinct filesystem or Git operation, and most names are self-explanatory. The only mild ambiguity is between move_file and rename_file, though the descriptions clearly separate moving to a new path from renaming within the same directory.
All tools follow a consistent verb_noun snake_case pattern, such as list_directory, copy_file, git_diff_staged, and git_amend_message. No mixed conventions or vague verbs appear.
Eighteen tools is on the higher end, but the server covers two coherent domains: workspace file operations and local Git workflow. Each tool has a clear purpose, so the count feels slightly large rather than bloated.
The file operations cover common file and directory workflows but lack directory copy/move and file metadata/search. The Git side covers status/diff/log/add/commit but omits branch creation/checkout/deletion and unstage, leaving notable gaps in common local Git workflows.
Maintenance
Related MCP Connectors
Securely search and manage workspace context files for AI agents and teams.
Persistent cloud workspaces for AI agents: run commands, edit files, use git and a browser.
Read and write KukGit repositories, files, issues and pull requests from an AI assistant.
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.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides secure, sandboxed file system access for AI assistants to read, write, and manage project files with controlled command execution capabilities, all confined to a designated workspace directory.MIT
- FlicenseNot gradedqualityCmaintenanceProvides AI clients with safe, structured access to local filesystem, Git repositories, and project contexts, featuring file operations, git status/diff, project management, and built-in code review/bug analysis prompts.-
- AlicenseNot gradedqualityDmaintenanceEnables ChatGPT or any MCP client to operate safely on a designated workspace by listing, reading, searching, writing, and trashing files, inspecting Git status/log/diff, and optionally running allowlisted executables without a shell.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI clients to safely read, search, understand, and edit local project code and files, with Git inspection, code indexing, and controlled command execution within permissioned workspaces.6MIT