Skip to main content
Glama
Cross Repo Ops MCP

Cross Repo Ops MCP

by DHCross

Cross Repo Ops MCP

A repo-neutral MCP (Model Context Protocol) capability layer for controlled local repository operations.

What It Does

Cross Repo Ops MCP provides a security-hardened stdio JSON-RPC server that exposes bounded, policy-controlled operations on local git repositories:

  • Read: tree listing, ripgrep search, bounded file reads, git status/diff

  • Write: context-checked patches with create/modify support (writable repos only)

  • Tasks: approved named task execution (allowlist-only, no arbitrary shell)

  • Git: branch list/create/switch, commit (explicit files only), push (origin only, pushable repos only)

Related MCP server: git-remote-mcp

Architecture

Cross Repo Ops MCP is a repo-neutral capability layer for controlled local repository operations. It is designed to sit beside an XcodeIDEapp project, borrowing ideas from IDE dashboard scaffolding patterns, but remains generic and does not depend on any specific IDE or project structure.

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

The server is policy-driven: repos, capabilities, excluded paths, and approved tasks are all declared in a JSON config. No project-specific logic is hardcoded in the core.

Modules

Module

Responsibility

policy.py

Centralized repository capability policy (allowlist, writable/pushable flags, excluded paths, task allowlist, limits, timeouts)

guard.py

Single authoritative path-validation boundary (traversal, symlink, absolute-path, containment checks)

repo.py

Tree listing, ripgrep search, bounded file read, git status/diff

patch.py

Context-checked patch application with create/modify support

git.py

Branch, commit, and push operations with safety guards

tasks.py

Named task allowlist resolution and execution

server.py

stdio JSON-RPC MCP server

errors.py

Error types

Security Model

  • Repository allowlist: Only repos explicitly listed in the policy are accessible.

  • Capability flags: writable and pushable are per-repo, default false.

  • Path containment: All paths are resolved and checked against the repo root. Traversal (..), absolute paths, and symlinks are rejected.

  • Sensitive file exclusion: .env, *.pem, API keys, tokens, credentials, and binary files are blocked from read and write.

  • Patch safety: old_text must match exactly; multiple matches require context to disambiguate. create=true refuses to overwrite existing files.

  • Task allowlist: Tasks are resolved by name from a server-side allowlist, not from user input. No arbitrary shell commands.

  • Git safety: Bulk staging (git add -A) is rejected. Commits are limited to explicitly listed files. Sensitive files cannot be committed. Branch names are validated against injection. Push is limited to origin for pushable repos only.

  • Output limits: All operations have configurable output caps (read chars, search results, tree entries, diff chars, task output).

Installation

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

Usage

Run the MCP server

python3 -m cross_repo_ops

The server listens on stdin/stdout for JSON-RPC 2.0 messages.

Custom policy

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

Policy file format

{
  "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 Tools

Tool

Description

repo_tree

List files/directories with safety exclusions

repo_search

Ripgrep search with bounded output

repo_read

Read a bounded slice of a non-sensitive text file

git_status

Inspect git status

git_diff

View unstaged/staged/commit diffs

apply_patch

Apply a context-checked patch (writable repos only)

run_task

Run an approved named task (allowlist only)

git_branch

List/create/switch branches (writable repos for create/switch)

git_commit

Stage and commit explicit files (writable repos only)

git_push

Push to origin (pushable repos only)

Testing

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

32 tests covering:

  • Allowed and blocked reads

  • Path traversal, absolute path, and symlink escape rejection

  • Sensitive file read/write/commit blocking

  • Writable vs read-only repo enforcement

  • Patch with correct/stale context

  • Patch targeting excluded files

  • Named task allowlist (success, unknown name, shell injection attempt)

  • Task timeout and output truncation

  • Git status/diff

  • Branch name injection safeguards

  • Commit safeguards (empty message, sensitive files, bulk staging, pre-staged files)

  • Push rejection for non-pushable repos

  • Server missing-argument handling

License

MIT

Available Tools

10 tools
apply_patchB

Apply a bounded, context-checked patch to a file in a writable repository. If old_text is empty and create=true, creates the file.

Inputs: path (required), repo (required), new_text (required), old_text (required), +2 more.

git_branchC

List or safely create a branch in a repository.

Inputs: repo (required), action (required), branch_name.

git_commitC

Stage and commit files in a writable repository.

Inputs: repo (required), files (required), message (required).

git_diffC

View the diff of unstaged or staged changes in a repository.

Inputs: repo (required), path, commit, staged, +1 more.

git_pushC

Push the current or specified branch to origin in a pushable repository.

Inputs: repo (required), branch, remote.

git_statusC

Inspect the current Git repository status.

Inputs: repo (required).

repo_readB

Read a bounded slice of a non-sensitive text file from an allowed repository.

Inputs: path (required), repo (required), max_lines, start_line.

repo_treeC

List files and directories in an allowed repository with safety exclusions.

Inputs: repo (required), path, max_entries, include_hidden.

run_taskB

Run an approved named task for a repository. No arbitrary shell commands are accepted.

Inputs: name (required), repo (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 10 tools

    Disambiguation5/5

    Each tool maps cleanly to a distinct action: repo_* covers content browsing/search, git_* covers repository state operations, and apply_patch/run_task cover modifications. Adjacent tools like git_status and git_diff are clearly separated by purpose. No two tools appear to do the same thing.

    Naming Consistency4/5

    Most tools follow a clear domain-prefix pattern: repo_* for content operations and git_* for VCS operations. The exceptions are apply_patch and run_task, which use bare verb_noun names but remain readable and consistent with the overall snake_case style.

    Tool Count5/5

    Ten tools is an ideal size for this scope; each tool covers a distinct operation without redundancy. The set feels intentionally scoped rather than padded.

    Completeness4/5

    The read/search → patch → branch → commit → push workflow provides a complete edit-and-publish lifecycle. Minor gaps include no repository enumeration, no git pull/fetch, and no way to list approved run_task tasks, but these do not block the primary workflow.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables safe filesystem and git operations confined within a single allowed directory tree, using symlink-resolved path containment to protect against path traversal. Users can read, write, list, and search files, as well as initialize repos and run status, stage, commit, diff, and log operations through MCP.
      11
      MIT
    • A
      license
      C
      quality
      C
      maintenance
      Enables MCP clients to inspect and modify local git repositories by running commands such as status, log, diff, add, commit, branch, and stash. Push operations are not performed locally; instead diffs are sent to a configurable HTTP API that handles the upload, with all other remote git commands blocked.
      27
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables read-only, allowlisted filesystem and Git inspection of explicitly configured local repositories through MCP, with bounded reads and no arbitrary path or write access.
      6 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients to inspect local Git repositories through five focused, read-only tools for repository trees, literal text search, numbered file reads, bounded git diffs, and project summaries while confining paths, skipping secret-like and binary files, and enforcing output limits.
      MIT