Skip to main content
Glama
DHCross

Cross Repo Ops MCP

by DHCross

Cross Repo Ops MCP

一个仓库中立的 MCP(Model Context Protocol)能力层,用于受控的本地仓库操作。

功能

Cross Repo Ops MCP 提供了一个安全加固的 stdio JSON-RPC 服务器,可在本地 git 仓库上暴露有界、受策略控制的操作:

  • 读取:目录树列表、ripgrep 搜索、有界文件读取、git status/diff

  • 写入:带 create/modify 支持的上下文校验补丁(仅可写仓库)

  • 任务:已批准的命名任务执行(仅限允许列表,不允许任意 shell 命令)

  • Git:列出/创建/切换分支、提交(仅显式列出的文件)、推送(仅 origin,且仅可推送仓库)

Related MCP server: void-bridge

架构

Cross Repo Ops MCP 是一个仓库中立的能力层,用于受控的本地仓库操作。它被设计为位于 XcodeIDEapp 项目旁边,借鉴了 IDE 仪表盘脚手架模式的思路,但保持通用,不依赖任何特定的 IDE 或项目结构。

Cross Repo Ops MCP = controlled local repository actions (read, patch, git, tasks)

该服务器是策略驱动的:仓库、能力、排除路径和已批准任务都在 JSON 配置中声明。核心中没有硬编码任何项目特定的逻辑。

模块

模块

职责

policy.py

集中式仓库能力策略(允许列表、writable/pushable 标志、排除路径、任务允许列表、限制、超时)

guard.py

单一权威路径验证边界(遍历、符号链接、绝对路径、包含性检查)

repo.py

目录树列表、ripgrep 搜索、有界文件读取、git status/diff

patch.py

带 create/modify 支持的上下文校验补丁应用

git.py

带安全防护的分支、提交和推送操作

tasks.py

命名任务允许列表的解析与执行

server.py

stdio JSON-RPC MCP 服务器

errors.py

错误类型

安全模型

  • 仓库允许列表:只有策略中显式列出的仓库才可访问。

  • 能力标志writablepushable 按仓库设置,默认 false

  • 路径包含性:所有路径都会解析并对照仓库根目录进行检查。拒绝路径遍历(..)、绝对路径和符号链接。

  • 敏感文件排除.env*.pem、API 密钥、令牌、凭据和二进制文件被阻止读取和写入。

  • 补丁安全old_text 必须精确匹配;多个匹配时需要 context 来消除歧义。create=true 拒绝覆盖已有文件。

  • 任务允许列表:任务按名称从服务器端允许列表中解析,而非来自用户输入。不允许任意 shell 命令。

  • Git 安全:拒绝批量暂存(git add -A)。提交仅限于显式列出的文件。敏感文件不能被提交。分支名称会针对注入进行校验。推送仅限于 origin,且仅限可推送仓库。

  • 输出限制:所有操作都有可配置的输出上限(读取字符数、搜索结果数、目录树条目数、diff 字符数、任务输出)。

安装

# No external dependencies required — Python 3.10+ standard library only.
cd cross-repo-ops
pip install -e .  # optional, for package install

使用方法

运行 MCP 服务器

python3 -m cross_repo_ops

服务器在 stdin/stdout 上监听 JSON-RPC 2.0 消息。

自定义策略

CROSS_REPO_OPS_CONFIG=/path/to/policy.json python3 -m cross_repo_ops

策略文件格式

{
  "repos": {
    "myrepo": {
      "root": "/path/to/repo",
      "writable": true,
      "pushable": false
    }
  },
  "tasks": {
    "myrepo": {
      "build": {
        "command": ["xcodebuild", "-scheme", "MyApp", "build"],
        "cwd": "{root}",
        "timeout": 180
      },
      "test": {
        "command": ["xcodebuild", "test", "-scheme", "MyApp"],
        "cwd": "{root}",
        "timeout": 300
      }
    }
  }
}

MCP 工具

工具

描述

repo_tree

列出文件/目录,并应用安全排除

repo_search

带输出上限的 ripgrep 搜索

repo_read

读取非敏感文本文件的有界片段

git_status

检查 git 状态

git_diff

查看未暂存/已暂存/提交的 diff

apply_patch

应用上下文校验的补丁(仅可写仓库)

run_task

运行已批准的命名任务(仅限允许列表)

git_branch

列出/创建/切换分支(创建/切换需要可写仓库)

git_commit

暂存并提交显式列出的文件(仅可写仓库)

git_push

推送到 origin(仅可推送仓库)

测试

python3 -m unittest tests.test_security tests.test_adversarial -v

32 个测试,涵盖:

  • 允许和阻止的读取

  • 路径遍历、绝对路径和符号链接逃逸的拒绝

  • 敏感文件的读取/写入/提交阻止

  • 可写与只读仓库的强制实施

  • 正确/过时上下文的补丁

  • 针对排除文件的补丁

  • 命名任务允许列表(成功、未知名称、shell 注入尝试)

  • 任务超时和输出截断

  • Git status/diff

  • 分支名称注入防护

  • 提交防护(空消息、敏感文件、批量暂存、预先暂存的文件)

  • 对不可推送仓库的推送拒绝

  • 服务器缺少参数的处理

许可证

MIT

F
license - not found
B
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants to safely interact with local code repositories through MCP tools for search, context building, and workspace management, while keeping all operations local and human-controlled for patch approval.
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Exposes a secure, path-confined bridge to a local workspace and git remotes, enabling MCP clients to search, read, write, reset files, and perform git operations.
  • A
    license
    A
    quality
    B
    maintenance
    Enables ChatGPT and Codex to safely work with explicitly authorized local project folders through MCP, providing constrained file reading, searching, patch editing, Git inspection, and whitelisted tasks without exposing arbitrary shell, deletion, or deployment capabilities.
    17
    MIT

View all related MCP servers

Related MCP Connectors

  • Remote MCP for Android CLI agent build gate, structured receipts, audit logs, and reviewer-ready evi

  • A MCP server built for developers enabling Git based project management with project and personal…

  • Git-native policy layer for AI agents: check_action verdicts against rules approved via PR.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DHCross/cross-repo-ops'

If you have feedback or need assistance with the MCP directory API, please join our Discord server