Skip to main content
Glama
README.md
# git-mcp

[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Node](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](package.json)
[![CI](https://github.com/yevheniikravchuk/git-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/yevheniikravchuk/git-mcp/actions/workflows/ci.yml)

Domain-neutral git utility service packaged for Model Context Protocol (MCP) agents. It exposes REST endpoints for repository status, diffs, and commits while enforcing a configurable root allowlist.

## Features

- `/health` endpoint reporting configured root directories.
- `/v1/git/status` returning branch, upstream, ahead/behind counts, and per-file codes.
- `/v1/git/diff` streaming raw `git diff` output for a ref.
- Additional helpers for commit operations (extendable by downstream projects).

## Installation

```bash
pnpm install git-mcp
# or
npm install git-mcp
```

## Usage

```ts
import { createApp } from "git-mcp";

const app = createApp();
app.listen({ host: "127.0.0.1", port: 8787 });
```

Set `MCP_GIT_ROOTS` to a colon-separated list of allowed directories (defaults to `process.cwd()`).

## Development

```bash
pnpm install
pnpm run lint
pnpm run test
pnpm run build
```

## License

MIT — see [LICENSE](LICENSE).