mcp-git-coord

mcp-git-coord

Reduces token waste by caching code understanding in .mi context files and prevents agent conflicts by coordinating intent and file access across sessions.

Category
访问服务器

README

mcp-git-coord

Cut your $200/mo Claude Max token usage in half. Every AI coding session wastes tokens re-exploring code your last session already understood. mcp-git-coord fixes this — plus stops your team's agents from stepping on each other.

npm

Two problems, one tool

1. Token waste — agents re-explore the same code every session

Every time you start a new Claude Code / Cursor session, the agent reads hundreds of files to understand your codebase. That's thousands of tokens burned on knowledge that was already built in the last session — then thrown away.

.mi context files fix this. Each subdirectory maintains a .mi/ folder with pre-built understanding: architecture, data flow, key files, gotchas. Your agent reads a 200-line context doc instead of re-exploring 50 source files. Hooks remind the agent to read before coding and update after changing.

2. Coordination — agents working in silos create conflicts

When multiple developers use AI coding tools on the same repo, agents don't know about each other's work. They modify the same files, produce conflicting changes, and resolve merge conflicts by guessing — silently deleting features other people built.

Coordination tools fix this. Agents register their intent before working, detect conflicts before code is written, and provide human-controlled merge resolution with full team context.

Install

npm install -g mcp-git-coord

Or paste this into Claude Code, Cursor, or any MCP-compatible AI tool:

Install mcp-git-coord by following the instructions at https://raw.githubusercontent.com/OperatingSystem-1/mcp-git-coord/main/llms-full.txt

<details> <summary>Manual setup</summary>

Add to your MCP server config (.claude/settings.json for Claude Code, .cursor/mcp.json for Cursor):

{
  "mcpServers": {
    "git-coord": {
      "command": "npx",
      "args": ["-y", "mcp-git-coord"]
    }
  }
}

</details>

Quick start — set up .mi context files

After installing, run this in your AI coding tool:

Set up .mi context files for this project using mi_setup

This will:

  1. Scan your codebase — find directories with meaningful source code
  2. Create .mi/CONTEXT.md in each one — scaffolded with file listings and recent git history
  3. Install hooks — SessionStart (remind to read), PreToolUse on Read (nudge before changes), PostToolUse on Edit (remind to update), Stop (warn about stale docs)

Then fill in the _TODO_ sections in each generated context file. The more you invest in these docs, the fewer tokens every future session burns.

How .mi context files work

your-project/
├── src/
│   ├── .mi/
│   │   └── CONTEXT.md          ← "src/ architecture: API routes, DB layer, auth..."
│   ├── auth/
│   │   ├── .mi/
│   │   │   └── CONTEXT.md      ← "auth: OAuth flow, session management, JWT..."
│   │   ├── middleware.ts
│   │   └── session.ts
│   └── billing/
│       ├── .mi/
│       │   └── CONTEXT.md      ← "billing: Stripe integration, credit system..."
│       ├── stripe.ts
│       └── credits.ts
└── .claude/
    ├── hooks/                   ← auto-installed by mi_setup
    │   ├── mi-session-start.sh
    │   ├── mi-read-context.sh
    │   ├── mi-doc-reminder.sh
    │   └── mi-stop-check.sh
    └── settings.json            ← hooks registered here

The lifecycle:

  1. Session starts → hook lists available .mi files, agent reads the relevant ones
  2. Agent reads a file → hook reminds about .mi docs in that directory
  3. Agent edits a file → hook reminds to update the .mi doc if the change affects it
  4. Session ends → hook warns if source files changed but .mi docs weren't updated

The payoff: Instead of the agent spending 2,000+ tokens exploring src/auth/ from scratch, it reads a 150-line context doc that tells it everything: how OAuth works, where sessions are stored, what the JWT structure is, and what not to touch. That's a ~10x token reduction for that exploration, every single session.

How coordination works

Register intent before working

Agent → coord_register("Refactoring auth middleware", files: ["src/auth/middleware.ts"])
Server → "Registered. No conflicts."

Detect conflicts before code is written

Agent → coord_register("Adding rate limiting to auth", files: ["src/auth/middleware.ts"])
Server → "⚠️ Conflict: cursor-alex is refactoring auth middleware in the same file."

Plan around conflicts

Agent → coord_plan(my_intent, conflict)
Server → "Start with non-overlapping files. Defer auth/middleware.ts until their session completes."

Merge with full team context

Agent → coord_merge_check(target_branch: "dev")
Server →
  "2 file(s) have conflicting changes.
   src/auth/middleware.ts:
     Ours:   +15/-3 lines (refactored middleware signature)
     Theirs: +8/-2 lines (added rate limiter)
     Why:    cursor-alex was working on 'Adding rate limiting'

   Ask the user to resolve each conflict."

All tools

Context intelligence (.mi)

Tool What it does
mi_setup Scan codebase, create .mi/ context files, install hooks. Run once per project.
mi_scan List all .mi context files with size and last modified.
mi_status Check which .mi files are stale — source changed but docs not updated.

Coordination

Tool What it does
coord_register Register intent + files. Returns conflicts immediately.
coord_check Check if files or scopes have active work.
coord_active List all active sessions in the repo.
coord_complete Mark session as done.
coord_plan Given a conflict, suggest a non-overlapping approach.

Merge resolution

Tool What it does
coord_merge_check Analyze conflicts with target branch. Returns human-readable summaries with team context.
coord_merge_resolve Resolve a single conflict: keep ours, accept theirs, or apply custom content.

Add coordination rules to your project

Add this to your CLAUDE.md, .cursorrules, or equivalent:

## Coordination (mcp-git-coord)

Before starting work, always:
1. Call `mi_scan` to see available context files, read the relevant ones
2. Call `coord_register` with your intent and the files you plan to modify
3. If conflicts are returned, call `coord_plan` to find a non-overlapping approach
4. When done, call `coord_complete` with a summary
5. Update any .mi context files affected by your changes

Before merging, always:
1. Call `coord_merge_check` with the target branch
2. If conflicts exist, present each one to the user with the TL;DR
3. Do NOT resolve any conflict without explicit user approval
4. Use `coord_merge_resolve` for each file after the user decides

Development

git clone https://github.com/OperatingSystem-1/mcp-git-coord
cd mcp-git-coord
npm install
npm run dev

License

MIT


<a href="https://mitosislabs.ai"> <img src="assets/mitosis-logo.svg" alt="Mitosis Labs" width="40" /> </a>

Open sourced by Mitosis Labs — autonomous AI agents that persist, reproduce, and evolve.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选