Skip to content

Commit ed82c08

Browse files
authored
docs: rebuild the README around setup, tools and results (#38)
The tools were listed twice (Features, Tool Usage), repo_path, config_path and config were explained twice, and the Published On table repeated what the badges already said. - The header matches the core and Action READMEs: the v4 banner (light and dark), the site's line, five badges in the brand colors and links to the docs, the CLI, the Action and the App. - Quick start leads with `claude mcp add`; the client table and the Continue entry are unchanged. - The tools are one table, with the shared arguments and the read-only/fetch annotations stated once underneath; the example payloads fold into <details>. - Results keep the shape and cut the prose to three points. - Installation, Run Manually and the dev install become Development. - The Glama link was a 404; it now points at the listing's current address. The mcp-name line the MCP Registry reads for PyPI ownership is kept as it was.
1 parent 7c7da35 commit ed82c08

1 file changed

Lines changed: 96 additions & 188 deletions

File tree

‎README.md‎

Lines changed: 96 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,39 @@
1-
# commit-check-mcp
1+
<div align="center">
22

3-
[![PyPI version](https://img.shields.io/pypi/v/commit-check-mcp)](https://pypi.org/project/commit-check-mcp/)
4-
[![Python versions](https://img.shields.io/pypi/pyversions/commit-check-mcp)](https://pypi.org/project/commit-check-mcp/)
5-
[![Build](https://github.com/commit-check/commit-check-mcp/actions/workflows/main.yml/badge.svg)](https://github.com/commit-check/commit-check-mcp/actions/workflows/main.yml)
6-
[![Coverage](https://codecov.io/gh/commit-check/commit-check-mcp/graph/badge.svg)](https://codecov.io/gh/commit-check/commit-check-mcp)
7-
[![MCP server](https://img.shields.io/badge/MCP-server-0A7B83)](https://modelcontextprotocol.io/)
8-
[![MCP Registry](https://img.shields.io/badge/MCP%20Registry-io.github.commit--check/commit--check--mcp-7B3F00)](https://registry.modelcontextprotocol.io/?q=commit-check-mcp)
9-
[![Glama](https://img.shields.io/badge/Glama-commit--check--mcp-blue)](https://glama.ai/mcp/servers/github/commit-check/commit-check-mcp)
3+
<picture>
4+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/commit-check/.github/main/branding/banner-dark.png">
5+
<img src="https://raw.githubusercontent.com/commit-check/.github/main/branding/banner-light.png" alt="Commit Check">
6+
</picture>
107

11-
Model Context Protocol (MCP) server for [commit-check](https://github.com/commit-check/commit-check).
8+
**Catch bad commits before they merge — inside your AI agent.**
129

13-
`commit-check-mcp` exposes `commit-check` as local MCP tools so an MCP client can validate commit messages, branch names, author info, push safety, and repository state.
10+
[![PyPI](https://img.shields.io/pypi/v/commit-check-mcp?labelColor=0b1620&logo=pypi&logoColor=white&color=2c9ccd)](https://pypi.org/project/commit-check-mcp/)
11+
[![CI](https://img.shields.io/github/actions/workflow/status/commit-check/commit-check-mcp/main.yml?branch=main&labelColor=0b1620&label=CI)](https://github.com/commit-check/commit-check-mcp/actions/workflows/main.yml)
12+
[![Coverage](https://img.shields.io/codecov/c/github/commit-check/commit-check-mcp?labelColor=0b1620&color=2c9ccd&label=coverage)](https://codecov.io/gh/commit-check/commit-check-mcp)
13+
[![MCP Registry](https://img.shields.io/badge/MCP%20Registry-listed-2c9ccd?labelColor=0b1620)](https://registry.modelcontextprotocol.io/?q=commit-check-mcp)
14+
[![Glama](https://img.shields.io/badge/Glama-listed-2c9ccd?labelColor=0b1620)](https://glama.ai/mcp/servers/commit-check/commit-check-mcp)
1415

15-
## Features
16+
[Docs](https://commit-check.com/guides/mcp/) ·
17+
[Rules](https://commit-check.com/rules/) ·
18+
[CLI](https://github.com/commit-check/commit-check) ·
19+
[GitHub Action](https://github.com/commit-check/commit-check-action) ·
20+
[GitHub App](https://github.com/apps/commit-check)
1621

17-
This MCP server exposes commit-check validations as MCP tools:
22+
</div>
1823

19-
- `server_health` — returns server/sdk versions
20-
- `validate_commit_message` — validates a commit message
21-
- `validate_branch_name` — validates a branch name or the current repo branch
22-
- `validate_push_safety` — validates that a push is not a force push (force pushes are always rejected by this tool)
23-
- `validate_author_info` — validates author name/email or the repo's git author config
24-
- `validate_commit_context` — runs combined checks in one call
25-
- `validate_repository_state` — validates latest commit, current branch, author state, and optional push safety for a repo
26-
- `describe_validation_rules` — returns the effective config and enabled rules after merging defaults and repo config
24+
The [Model Context Protocol](https://modelcontextprotocol.io/) server for
25+
[Commit Check](https://github.com/commit-check/commit-check). It gives your
26+
coding agent the rules your CI enforces: the agent validates its commit
27+
message, branch name and author before it commits or pushes, and when a
28+
correction is unambiguous it gets the fix to apply.
2729

28-
All validation tools return the same structured commit-check result shape:
29-
30-
```json
31-
{
32-
"status": "pass|fail|skip",
33-
"warnings": 0,
34-
"checks": [
35-
{
36-
"rule_id": "CC001",
37-
"check": "message",
38-
"status": "pass|fail|warn|skip",
39-
"value": "...",
40-
"error": "...",
41-
"suggest": "...",
42-
"fix": "...",
43-
"docs_url": "https://commit-check.com/rules/#cc001"
44-
}
45-
]
46-
}
47-
```
48-
49-
`rule_id` is the stable id of the rule that produced the check and `docs_url`
50-
links to its documentation.
51-
52-
Only `fail` is a rejection. A check reports `skip` when it did not run — the
53-
author matched `ignore_authors`, or there was nothing to check — and the
54-
top-level `status` is `skip` only when **every** check skipped, so a run that
55-
validated nothing is never reported as a pass. A check reports `warn` when the
56-
config lists it under `warn`: the finding is complete, but it does not fail
57-
the run, the top-level `status` stays `pass`, and `warnings` counts them.
58-
59-
`suggest` is the advice a person reads. `fix` is the corrected value itself,
60-
present only when the correction is unambiguous — `Fix: add x` comes back with
61-
`"fix": "fix: add x"` — and an empty string otherwise, so an agent can apply
62-
a non-empty `fix` as it stands and fall back to `suggest` when it is empty.
63-
64-
A call that cannot run at all — an empty `message`, a `repo_path` that does not
65-
exist, a `repo_path` that is not a git repository when the tool has to read git
66-
state (see the `repo_path` note under [Tool Usage](#tool-usage)), a malformed or rejected
67-
commit-check config, a `push_refs` SHA that is not a commit in `repo_path` even
68-
after the force-push check tried to fetch it — is returned as an MCP tool error
69-
(`is_error`) whose text names the problem, for example
70-
`repo_path is not a git repository: /path/to/dir`,
71-
`invalid commit-check config: ...` or
72-
`push_refs: <sha> is not a commit in the repository; fetch it first, the force-push check cannot be judged`,
73-
rather than as a `pass`/`fail` result. In particular a push whose SHAs cannot
74-
be judged is never reported as a pass.
75-
76-
## Installation
30+
## Quick start
7731

7832
```bash
79-
pip install commit-check-mcp
33+
claude mcp add commit-check -- uvx commit-check-mcp
8034
```
8135

82-
This installs the `commit-check-mcp` CLI entrypoint.
83-
84-
For local development from this repository:
85-
86-
```bash
87-
pip install -e .
88-
```
89-
90-
## Use With An MCP Client
91-
92-
This server runs over stdio, so it is meant to be launched by an MCP client rather than used as a long-running HTTP service.
93-
94-
With `uvx` (recommended — no install needed):
95-
96-
```bash
97-
# Run once, no pip install required
98-
uvx commit-check-mcp
99-
```
100-
101-
> **Tip**: If `uv` is not installed, get it via `curl -LsSf https://astral.sh/uv/install.sh | sh`.
102-
103-
### Configure your client
104-
105-
Every client below launches the same command; only the config file and, for a
106-
few clients, the wrapper key differ. This is the object to register:
36+
Every other client launches the same command. This is the object to register:
10737

10838
```json
10939
{
@@ -116,6 +46,11 @@ few clients, the wrapper key differ. This is the object to register:
11646
}
11747
```
11848

49+
No `uv` yet? `curl -LsSf https://astral.sh/uv/install.sh | sh` — or use
50+
`pip install commit-check-mcp`, as in the last row below.
51+
52+
### Where each client keeps it
53+
11954
| Client | Where it goes | Notes |
12055
|---|---|---|
12156
| Claude Code | `claude mcp add commit-check -- uvx commit-check-mcp` | Add `--scope project` to write a shareable `.mcp.json` at the repo root (`--scope user` makes it available in all your projects). You can also commit a `.mcp.json` containing the block above; `"type": "stdio"` may be added inside the server object. MCP servers are **not** configured in `~/.claude/settings.json`. |
@@ -141,56 +76,37 @@ mcpServers:
14176
args: ["commit-check-mcp"]
14277
```
14378
144-
## Run Manually
145-
146-
```bash
147-
# If installed via pip
148-
commit-check-mcp
149-
150-
# Or via uvx (no install needed)
151-
uvx commit-check-mcp
152-
```
79+
## Tools
15380
154-
The server uses stdio transport, which is the recommended MCP default for local tool integrations.
155-
156-
## Tool Usage
157-
158-
After the client starts the server, it will expose these tools:
159-
160-
- `server_health`: returns server, SDK, and dependency versions
161-
- `validate_commit_message(message, config?, repo_path?, config_path?)`
162-
- `validate_branch_name(branch?, config?, repo_path?, config_path?)`
163-
- `validate_push_safety(push_refs?, config?, repo_path?, config_path?)`
164-
- `validate_author_info(author_name?, author_email?, config?, repo_path?, config_path?)`
165-
- `validate_commit_context(message?, branch?, author_name?, author_email?, config?, repo_path?, config_path?)`
166-
- `validate_repository_state(repo_path?, config?, config_path?, include_message?, include_branch?, include_author?, include_push?)`
167-
- `describe_validation_rules(config?, repo_path?, config_path?)`
168-
169-
Every parameter carries a description in the tool's JSON input schema, so an
170-
MCP client (and the model behind it) can see what each one expects without
171-
reading this file: for example `push_refs` documents the git pre-push line
172-
format `<local_ref> <local_sha> <remote_ref> <remote_sha>`. Each tool also has
173-
a display `title` and MCP tool annotations: `destructiveHint: false` and
174-
`idempotentHint: true` everywhere, `readOnlyHint: true` on the six tools that
175-
only read, and `readOnlyHint: false` with `openWorldHint: true` on
176-
`validate_push_safety` and `validate_repository_state`, because the force-push
177-
check may run `git fetch` to resolve a SHA, which updates `FETCH_HEAD` and
178-
remote-tracking refs (the working tree and commits are never touched). Clients
179-
that gate tool calls on those hints can auto-approve the read-only six. The
180-
server's `instructions` describe the intended
181-
loop: validate first, read `status` (only `fail` rejects, `skip` is not
182-
approval), apply a non-empty `fix` verbatim or follow `suggest`, then validate
183-
again.
184-
185-
The common optional arguments are:
186-
187-
- `repo_path`: repository directory to validate against; it must be a git repository when the tool reads git state (branch, author, or push refs omitted, `validate_repository_state`, or `push_refs` given, whose SHAs must resolve there), and may be a plain directory holding a config file when every other value is supplied
188-
- `config_path`: explicit TOML config file, used instead of the repository's own `cchk.toml`/`commit-check.toml`; relative paths resolve from `repo_path`
189-
- `config`: ad-hoc config overrides merged on top of defaults and repo config
190-
191-
## Common Examples
192-
193-
Validate a commit message using repo-local rules:
81+
| Tool | What it checks | Arguments |
82+
|---|---|---|
83+
| `validate_commit_message` | A commit message: Conventional Commits, subject length and case, body, sign-off, WIP and fixup markers, AI attribution | `message` |
84+
| `validate_branch_name` | A branch name, or the checked-out one, and its rebase target when configured | `branch?` |
85+
| `validate_author_info` | Author name and email; read from the repository's git config when omitted | `author_name?` `author_email?` |
86+
| `validate_commit_context` | Message, branch and author in one call, for whichever you pass | `message?` `branch?` `author_name?` `author_email?` |
87+
| `validate_push_safety` | That a push is not a force push (CC301) | `push_refs?` — pre-push lines; omit to compare the branch with its upstream |
88+
| `validate_repository_state` | The latest commit's message and author, the checked-out branch and, optionally, the push | `include_message` `include_branch` `include_author` (default `true`), `include_push` (default `false`) |
89+
| `describe_validation_rules` | Nothing: returns the merged config and the rules it enables | — |
90+
| `server_health` | Nothing: returns the server, commit-check and MCP SDK versions | — |
91+
92+
Every tool but `server_health` also takes:
93+
94+
- `repo_path` — the repository whose `cchk.toml` / `commit-check.toml` applies.
95+
It must be a git repository when the tool reads git state; a plain directory
96+
holding a config file is enough when you pass every value yourself.
97+
- `config_path` — a config file to use instead of the repository's own;
98+
relative paths resolve from `repo_path`.
99+
- `config` — inline overrides merged on top, e.g. `{"commit": {"require_body": true}}`.
100+
101+
No tool changes the working tree or the commits. `validate_push_safety` and
102+
`validate_repository_state` may run `git fetch` to resolve a SHA, so only they
103+
are annotated as not read-only; a client that gates on MCP tool hints can
104+
auto-approve the other six.
105+
106+
<details>
107+
<summary><b>Example arguments</b></summary>
108+
109+
Validate a message with the repository's rules:
194110

195111
```json
196112
{
@@ -199,27 +115,16 @@ Validate a commit message using repo-local rules:
199115
}
200116
```
201117

202-
Validate the current repository branch using an explicit config file:
118+
Check the repository as it stands, including the push:
203119

204120
```json
205121
{
206122
"repo_path": "/path/to/repo",
207-
"config_path": ".github/commit-check.toml"
208-
}
209-
```
210-
211-
Validate the full repository state:
212-
213-
```json
214-
{
215-
"repo_path": "/path/to/repo",
216-
"include_message": true,
217-
"include_branch": true,
218-
"include_author": true
123+
"include_push": true
219124
}
220125
```
221126

222-
Validate push safety from git pre-push hook ref metadata (`push_refs` must be non-empty when given; omit it to check the current branch against its upstream):
127+
Validate push safety from git pre-push ref metadata (`<local_ref> <local_sha> <remote_ref> <remote_sha>`):
223128

224129
```json
225130
{
@@ -228,7 +133,7 @@ Validate push safety from git pre-push hook ref metadata (`push_refs` must be no
228133
}
229134
```
230135

231-
Inspect the final merged rules that will be applied:
136+
See which rules apply once an override is merged in:
232137

233138
```json
234139
{
@@ -241,46 +146,49 @@ Inspect the final merged rules that will be applied:
241146
}
242147
```
243148

244-
## Repository-Aware Validation
245-
246-
`commit-check` is most useful when it runs against a real git repository and its `cchk.toml` or `commit-check.toml` file. This MCP server now supports that directly:
247-
248-
- `repo_path` — run git-based validations against a specific repository
249-
- `config_path` — point to an explicit TOML config file; relative paths are resolved from `repo_path`
250-
- `config` — apply ad-hoc overrides on top of defaults and repo config
149+
</details>
251150

252-
Typical patterns:
151+
## Results
253152

254-
- Validate an explicit message with a repository's rules
255-
- Validate the current repository state — the latest commit's message and author, and the current branch — without passing message/branch/author values manually
256-
- Validate push safety using pre-push ref metadata, or check the current branch against its upstream
257-
- Inspect which rules are actually enabled after config merging
258-
259-
Example payload for a repository-wide validation:
153+
Every `validate_*` tool returns the shape `commit-check --format json` prints:
260154

261155
```json
262156
{
263-
"repo_path": "/path/to/repo",
264-
"include_message": true,
265-
"include_branch": true,
266-
"include_author": true,
267-
"include_push": true
157+
"status": "pass|fail|skip",
158+
"warnings": 0,
159+
"checks": [
160+
{
161+
"rule_id": "CC001",
162+
"check": "message",
163+
"status": "pass|fail|warn|skip",
164+
"value": "...",
165+
"error": "...",
166+
"suggest": "...",
167+
"fix": "...",
168+
"docs_url": "https://commit-check.com/rules/#cc001"
169+
}
170+
]
268171
}
269172
```
270173

271-
Config precedence is:
174+
- Only `fail` is a rejection. `skip` means nothing was validated — never read
175+
it as approval — and `warn` is reported without failing the run.
176+
- On `fail`, apply a non-empty `fix` verbatim, otherwise follow `suggest`,
177+
then validate again. The server's instructions teach the agent this loop.
178+
- A call that cannot run at all — an empty `message`, a `repo_path` that does
179+
not exist or is not a git repository where one is needed, an invalid config, a `push_refs` SHA
180+
that cannot be resolved — comes back as an MCP tool error that names the
181+
problem, never as a pass.
272182

273-
1. `commit-check` built-in defaults
274-
2. repository config loaded from `repo_path`, or the file named by `config_path` when it is provided (it replaces the repository's own config file)
275-
3. inline `config` overrides passed to the tool
183+
## Development
276184

277-
## Published On
185+
```bash
186+
pip install -e .[dev]
187+
python -m pytest
188+
```
278189

279-
| Directory | Link |
280-
|---|---|
281-
| **Official MCP Registry** | [`io.github.commit-check/commit-check-mcp`](https://registry.modelcontextprotocol.io/?q=commit-check-mcp) |
282-
| **Glama.ai** | [`github/commit-check/commit-check-mcp`](https://glama.ai/mcp/servers/github/commit-check/commit-check-mcp) |
283-
| **PyPI** | [`commit-check-mcp`](https://pypi.org/project/commit-check-mcp/) |
190+
The server speaks stdio, so an MCP client launches it; run `uvx commit-check-mcp`
191+
by hand only to see that it starts.
284192

285193
---
286194

0 commit comments

Comments
 (0)