@gyeonghokim/gerrit-cli 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +360 -324
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -1,324 +1,360 @@
1
- # gerrit-mcp-server
2
-
3
- [![CI](https://github.com/GyeongHoKim/gerrit-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/GyeongHoKim/gerrit-mcp-server/actions/workflows/ci.yml)
4
- [![npm](https://img.shields.io/npm/v/@gyeonghokim/gerrit-mcp-server)](https://www.npmjs.com/package/@gyeonghokim/gerrit-mcp-server)
5
- [![Go](https://img.shields.io/badge/go-1.26-00ADD8)](https://go.dev)
6
- [![License](https://img.shields.io/badge/license-Elastic--2.0-005571)](LICENSE)
7
-
8
- Connect your AI coding agent to Gerrit code review.
9
-
10
- Ask your agent to find the changes waiting on you, read a diff, draft line comments, and publish a
11
- review — without leaving the session and without pasting change numbers back and forth.
12
-
13
- It ships as **two frontends over the same code**, so you can pick how much of your agent's context
14
- you want to spend:
15
-
16
- | | What it is | Context cost |
17
- | --- | --- | --- |
18
- | **`gerrit-cli` + skill** | A command-line binary, plus an [agent skill](skills/gerrit-cli/SKILL.md) that teaches an agent to drive it | One line, until the skill triggers |
19
- | **`gerrit-mcp-server`** | A [Model Context Protocol](https://modelcontextprotocol.io) server over **stdio** | 22 tool schemas, for the whole session |
20
-
21
- The skill route is the lighter one and works with any agent that reads skills. The MCP server needs
22
- no shell access and works with any MCP client: Claude Code, Codex, Cursor, Zed, Continue, or your
23
- own.
24
-
25
- Either way it is a single static binary with no runtime dependencies. You self-host it; nothing is
26
- sent anywhere except to the Gerrit host you configure.
27
-
28
- ## Quick start
29
-
30
- Both routes start the same way.
31
-
32
- **Create a Gerrit auth token.** In Gerrit, go to *Settings → HTTP Credentials* and generate one.
33
- See [Credentials](#credentials) below if your Gerrit is older.
34
-
35
- Node is needed only so that `npm` or `npx` can fetch the right binary for your machine. The binaries
36
- are Go and have no Node runtime dependency.
37
-
38
- ### Route A `gerrit-cli` + agent skill
39
-
40
- The lighter one. Nothing sits in your agent's context until it needs Gerrit.
41
-
42
- **1. Install the binary.**
43
-
44
- ```bash
45
- npm i -g @gyeonghokim/gerrit-cli
46
- ```
47
-
48
- **2. Install the skill.** This works for Claude Code, Codex, Cursor and many others.
49
-
50
- ```bash
51
- npx skills add GyeongHoKim/gerrit-mcp-server
52
- ```
53
-
54
- **3. Configure it.** Run this yourself in a terminal — it asks for your token on stdin, and will
55
- refuse to run where nothing can type into it.
56
-
57
- ```bash
58
- gerrit-cli init
59
- ```
60
-
61
- **4. Check it.** `gerrit-cli config` reports every setting and where it came from, naming anything
62
- still missing. Then ask your agent: *"What changes am I reviewing?"*
63
-
64
- To allow the commands that modify Gerrit, set `GERRIT_ALLOW_WRITE=true` — see
65
- [Available tools and commands](#available-tools-and-commands).
66
-
67
- You can also use the CLI on its own, without an agent:
68
-
69
- ```bash
70
- gerrit-cli query-changes --query "is:open reviewer:self -owner:self"
71
- gerrit-cli get-file-diff --change-id 12345 --file src/main.go
72
- gerrit-cli help
73
- ```
74
-
75
- ### Route B — MCP server
76
-
77
- No shell access needed, and it works with any MCP client.
78
-
79
- **Add the server to your client.**
80
-
81
- <details open>
82
- <summary><b>Claude Code</b></summary>
83
-
84
- ```bash
85
- claude mcp add gerrit \
86
- --env GERRIT_URL=https://gerrit.example.com \
87
- --env GERRIT_USER=your-username \
88
- --env GERRIT_TOKEN=your-token \
89
- -- npx -y @gyeonghokim/gerrit-mcp-server
90
- ```
91
-
92
- </details>
93
-
94
- <details>
95
- <summary><b>Codex</b></summary>
96
-
97
- Add this to `~/.codex/config.toml`, or to `.codex/config.toml` for a single trusted project:
98
-
99
- ```toml
100
- [mcp_servers.gerrit]
101
- command = "npx"
102
- args = ["-y", "@gyeonghokim/gerrit-mcp-server"]
103
- # npx downloads the binary on first run, which can exceed the 10s default.
104
- startup_timeout_sec = 60
105
-
106
- [mcp_servers.gerrit.env]
107
- GERRIT_URL = "https://gerrit.example.com"
108
- GERRIT_USER = "your-username"
109
- GERRIT_TOKEN = "your-token"
110
- ```
111
-
112
- Or let the CLI write it for you:
113
-
114
- ```bash
115
- codex mcp add gerrit \
116
- --env GERRIT_URL=https://gerrit.example.com \
117
- --env GERRIT_USER=your-username \
118
- --env GERRIT_TOKEN=your-token \
119
- -- npx -y @gyeonghokim/gerrit-mcp-server
120
- ```
121
-
122
- </details>
123
-
124
- <details>
125
- <summary><b>Cursor, Zed, and other clients</b></summary>
126
-
127
- Add this to the client's MCP configuration file:
128
-
129
- ```jsonc
130
- {
131
- "mcpServers": {
132
- "gerrit": {
133
- "command": "npx",
134
- "args": ["-y", "@gyeonghokim/gerrit-mcp-server"],
135
- "env": {
136
- "GERRIT_URL": "https://gerrit.example.com",
137
- "GERRIT_USER": "your-username",
138
- "GERRIT_TOKEN": "your-token"
139
- }
140
- }
141
- }
142
- }
143
- ```
144
-
145
- </details>
146
-
147
- **Ask for something.** "What changes am I reviewing?" or "Summarise the diff on change 12345."
148
-
149
- ## Credentials
150
-
151
- Gerrit authenticates REST clients with HTTP Basic using a token from your account settings, and
152
- expects authenticated requests to be prefixed with `/a/`. Both binaries handle the prefix for you.
153
-
154
- Generate a token under *Settings HTTP Credentials*. On Gerrit 3.13 and newer you can name the
155
- token and give it a lifetime (`90 days`, `1 year`, and so on) — worth doing, so the credential this
156
- holds is scoped and expires on its own. Older Gerrit versions call the same thing an *HTTP
157
- password*; it still works, as that endpoint is now an alias that creates a token with the id
158
- `legacy`.
159
-
160
- **Where the token lives depends on which frontend you use.**
161
-
162
- `gerrit-mcp-server` reads the environment and only the environment, so its credentials live in your
163
- MCP client's config file and nowhere else. It never reads a file of its own.
164
-
165
- `gerrit-cli` has no client config to inherit from, so `gerrit-cli init` writes one under the OS
166
- configuration directory:
167
-
168
- | OS | Path |
169
- | --- | --- |
170
- | Linux | `$XDG_CONFIG_HOME/gerrit-cli/config.json`, or `~/.config/gerrit-cli/config.json` |
171
- | macOS | `~/Library/Application Support/gerrit-cli/config.json` |
172
- | Windows | `%AppData%\gerrit-cli\config.json` |
173
-
174
- Set `GERRIT_CONFIG` to put it somewhere else. Environment variables always take precedence over the
175
- file, so a one-off `GERRIT_TOKEN=... gerrit-cli ...` works and CI never needs a file at all.
176
- `gerrit-cli config` prints where each value actually came from.
177
-
178
- What holds for both:
179
-
180
- - **The token only ever travels in an `Authorization` header.** It is never passed as a process
181
- argument, so it cannot be read out of `ps`, and it is never written to a log line or an error
182
- message. `gerrit-cli init` has no `--token` flag for exactly this reason.
183
- - **Nothing goes anywhere but your Gerrit host.**
184
-
185
- What is worth knowing about the file:
186
-
187
- - On Linux and macOS it is written `0600`, readable only by you. On Windows it inherits the ACL of
188
- `%AppData%`, which is already restricted to your account plus SYSTEM and Administrators — setting
189
- a tighter one needs a dependency this project does not take. If your `%AppData%` is redirected to
190
- a network share, prefer keeping `GERRIT_TOKEN` in your environment instead.
191
- - **`gerrit-cli init` echoes the token as you type it.** Hiding terminal input needs a dependency
192
- this project does not take either. Pipe it in if that matters:
193
- `printf 'https://gerrit.example.com
194
- alice
195
- %s
196
- ' "$TOKEN" | gerrit-cli init -non-interactive`
197
- - **Do not commit it, and do not commit an MCP config either.** A project-level `.mcp.json` holding
198
- `GERRIT_TOKEN` is a credential in your repository. Keep it in your user-level client config, or
199
- gitignore it.
200
- - **Use a dedicated token with a lifetime**, so it can be revoked without touching your other
201
- credentials.
202
- - Your Gerrit permissions still apply. Neither frontend can see or do anything your account cannot.
203
-
204
- ## Configuration
205
-
206
- Both frontends read the same variables. For the MCP server they live in your client's config; for
207
- the CLI they are optional, since `gerrit-cli init` writes the same settings to a file.
208
-
209
- | Variable | Required | Default | Description |
210
- | --- | --- | --- | --- |
211
- | `GERRIT_URL` | yes | | Base URL of the Gerrit host, for example `https://gerrit.example.com` |
212
- | `GERRIT_USER` | yes | | Your Gerrit username |
213
- | `GERRIT_TOKEN` | yes | — | Auth token from *Settings HTTP Credentials* |
214
- | `GERRIT_ALLOW_WRITE` | no | `false` | Set to `true` to enable the tools and commands that modify Gerrit |
215
- | `GERRIT_TIMEOUT` | no | `30s` | Per-request timeout |
216
- | `GERRIT_LOG_LEVEL` | no | `info` | `debug`, `info`, `warn`, or `error`. Logs go to stderr |
217
- | `GERRIT_CONFIG` | no | | `gerrit-cli` only. Path to the configuration file, overriding the default |
218
-
219
- ## Available tools and commands
220
-
221
- **The two frontends expose exactly the same set**, and a test in the repository holds them there.
222
- A CLI command is its MCP tool name with the underscores written as dashes — `query_changes` becomes
223
- `query-changes` and `gerrit-cli` accepts either spelling.
224
-
225
- Reads are always available. **Writes are off unless you set `GERRIT_ALLOW_WRITE=true`**, so an
226
- agent cannot abandon a change or post a review by accident. The MCP server does not register the
227
- write tools at all; `gerrit-cli` still lists them in its help, marked, but refuses to run one.
228
-
229
- ### Read
230
-
231
- | Tool | Description |
232
- | --- | --- |
233
- | `query_changes` | Search changes with Gerrit query syntax (`status:open owner:self`) |
234
- | `get_change_details` | Full summary of one change |
235
- | `get_commit_message` | Commit message of the current patch set |
236
- | `list_change_files` | Files touched by the latest patch set |
237
- | `get_file_diff` | Diff for one file in a change |
238
- | `list_change_comments` | Published comments on a change |
239
- | `list_draft_comments` | Your unpublished draft comments |
240
- | `changes_submitted_together` | Changes that would submit alongside this one |
241
- | `suggest_reviewers` | Reviewer suggestions for a change |
242
- | `get_bugs_from_cl` | Bug ids referenced in the commit message |
243
-
244
- Every value is a flag; `gerrit-cli` has no positional arguments. Run `gerrit-cli help <command>`
245
- for one command's flags that is authoritative and cannot go stale.
246
-
247
- There is deliberately **no `--json` output**. Everything passes through the same renderer that keeps
248
- responses inside a sensible token budget, and handing an agent raw Gerrit JSON would undo that.
249
-
250
- ### Writerequires `GERRIT_ALLOW_WRITE=true`
251
-
252
- | Tool | Description |
253
- | --- | --- |
254
- | `post_review_comment` | Add a draft comment on a line, or reply in a thread |
255
- | `publish_drafts` | Publish your draft comments as a review |
256
- | `delete_draft_comment` | Delete one draft comment |
257
- | `delete_draft_comments` | Delete every draft on a change |
258
- | `add_reviewer` | Add a reviewer or CC |
259
- | `set_topic` | Set or clear the topic |
260
- | `set_ready_for_review` | Take a change out of WIP |
261
- | `set_work_in_progress` | Mark a change WIP |
262
- | `create_change` | Create a change |
263
- | `abandon_change` | Abandon a change |
264
- | `revert_change` | Revert a change |
265
- | `revert_submission` | Revert a whole submission |
266
-
267
- ## Exit codes
268
-
269
- `gerrit-cli` reports what to do about a failure, not just that one happened. Rendered output goes to
270
- stdout and everything else to stderr, so the answer is safe to pipe.
271
-
272
- | Code | Meaning |
273
- | --- | --- |
274
- | 0 | Success |
275
- | 1 | Something else failed; read stderr |
276
- | 2 | Bad arguments |
277
- | 3 | Not configured run `gerrit-cli init` |
278
- | 4 | Not permitted the account, or `GERRIT_ALLOW_WRITE` |
279
- | 5 | No such change, file or comment |
280
- | 6 | The change is not in a state that allows this |
281
-
282
- ## Supported Gerrit versions
283
-
284
- Built against the Gerrit **3.14** REST API and tested against it. Expected to work with **3.12 and
285
- newer**; older versions are missing some of the draft comment endpoints.
286
-
287
- ## Other ways to install
288
-
289
- `npm` is the easy path, but the binaries stand alone.
290
-
291
- ```bash
292
- # Go toolchain
293
- go install github.com/GyeongHoKim/gerrit-mcp-server/cmd/gerrit-mcp-server@latest
294
- go install github.com/GyeongHoKim/gerrit-mcp-server/cmd/gerrit-cli@latest
295
- ```
296
-
297
- Or download the archive for your platform from the
298
- [releases page](https://github.com/GyeongHoKim/gerrit-mcp-server/releases). It contains both
299
- binaries and the agent skill, and you can point your MCP client's `command` straight at
300
- `gerrit-mcp-server`. No Node required.
301
-
302
- ## Development
303
-
304
- ```bash
305
- mise install # toolchain, pinned in mise.toml
306
- just setup # dependencies and git hooks
307
- just ci # everything CI runs
308
- just --list # all tasks
309
- ```
310
-
311
- See [AGENTS.md](AGENTS.md) for architecture, conventions, and the Gerrit API details worth knowing
312
- before you touch the client.
313
-
314
- ## License
315
-
316
- [Elastic License 2.0](LICENSE).
317
-
318
- **Using this at work is fine.** ELv2 places exactly three restrictions on you: you may not offer
319
- this software to third parties as a hosted or managed service, you may not circumvent license key
320
- functionality, and you may not strip the copyright notices. Running it, modifying it, forking it,
321
- and deploying it across your engineering organisation are all expressly permitted.
322
-
323
- Note that ELv2 is source-available rather than OSI-approved open source. If your organisation
324
- screens dependencies by license, it may need to be allowlisted.
1
+ # gerrit-mcp-server
2
+
3
+ [한국어 문서](README.ko.md)
4
+
5
+ [![CI](https://github.com/GyeongHoKim/gerrit-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/GyeongHoKim/gerrit-mcp-server/actions/workflows/ci.yml)
6
+ [![npm](https://img.shields.io/npm/v/@gyeonghokim/gerrit-mcp-server)](https://www.npmjs.com/package/@gyeonghokim/gerrit-mcp-server)
7
+ [![Go](https://img.shields.io/badge/go-1.26-00ADD8)](https://go.dev)
8
+ [![License](https://img.shields.io/badge/license-Elastic--2.0-005571)](LICENSE)
9
+
10
+ Connect your AI coding agent to Gerrit code review.
11
+
12
+ Ask your agent to find the changes waiting on you, read a diff, draft line comments, and publish a
13
+ review without leaving the session and without pasting code review comments back and forth.
14
+
15
+ It ships as **two frontends over the same code**, so you can pick how much of your agent's context
16
+ you want to spend:
17
+
18
+ | | What it is | Context cost |
19
+ | --- | --- | --- |
20
+ | **`gerrit-cli` + skill** | A command-line binary, plus an [agent skill](skills/gerrit-cli/SKILL.md) that teaches an agent to drive it | One line, until the skill triggers |
21
+ | **`gerrit-mcp-server`** | A [Model Context Protocol](https://modelcontextprotocol.io) server over **stdio** | 22 tool schemas, for the whole session |
22
+
23
+ The skill route is the lighter one and works with any agent that reads skills. The MCP server needs
24
+ no shell access and works with any MCP client: Claude Code, Codex, Cursor, Zed, Continue, or your
25
+ own.
26
+
27
+ Either way it is a single static binary with no runtime dependencies. You self-host it; nothing is
28
+ sent anywhere except to the Gerrit host you configure.
29
+
30
+ ## Quick start
31
+
32
+ Both routes start the same way.
33
+
34
+ **Create a Gerrit auth token.** In Gerrit, go to *Settings → HTTP Credentials* and generate one.
35
+ See [Credentials](#credentials) below if your Gerrit is older.
36
+
37
+ Node is needed only so that `npm` or `npx` can fetch the right binary for your machine. The binaries
38
+ are Go and have no Node runtime dependency.
39
+
40
+ ### Route A `gerrit-cli` + agent skill
41
+
42
+ The lighter one. Nothing sits in your agent's context until it needs Gerrit.
43
+
44
+ **1. Install the binary.**
45
+
46
+ ```bash
47
+ npm i -g @gyeonghokim/gerrit-cli
48
+ ```
49
+
50
+ **2. Install the skill.** This works for Claude Code, Codex, Cursor and many others.
51
+
52
+ ```bash
53
+ npx skills add GyeongHoKim/gerrit-mcp-server
54
+ ```
55
+
56
+ **3. Configure it.** Run this yourself in a terminal — it asks for your token on stdin, and will
57
+ refuse to run where nothing can type into it.
58
+
59
+ ```bash
60
+ gerrit-cli init
61
+ ```
62
+
63
+ **4. Check it.** `gerrit-cli config` reports every setting and where it came from, naming anything
64
+ still missing. Then ask your agent: *"What’s the verified score for XXX Change Id’s review?"*
65
+
66
+ To allow the commands that modify Gerrit, set `GERRIT_ALLOW_WRITE=true` — see
67
+ [Available tools and commands](#available-tools-and-commands).
68
+
69
+ You can also use the CLI on its own, without an agent:
70
+
71
+ ```bash
72
+ gerrit-cli query-changes --query "is:open reviewer:self -owner:self"
73
+ gerrit-cli get-file-diff --change-id 12345 --file src/main.go
74
+ gerrit-cli help
75
+ ```
76
+
77
+ ### Route B MCP server
78
+
79
+ No shell access needed, and it works with any MCP client.
80
+
81
+ **Add the server to your client.**
82
+
83
+ <details open>
84
+ <summary><b>Claude Code</b></summary>
85
+
86
+ ```bash
87
+ claude mcp add gerrit \
88
+ --env GERRIT_URL=https://gerrit.example.com \
89
+ --env GERRIT_USER=your-username \
90
+ --env GERRIT_TOKEN=your-token \
91
+ -- npx -y @gyeonghokim/gerrit-mcp-server
92
+ ```
93
+
94
+ </details>
95
+
96
+ <details>
97
+ <summary><b>Codex</b></summary>
98
+
99
+ Add this to `~/.codex/config.toml`, or to `.codex/config.toml` for a single trusted project:
100
+
101
+ ```toml
102
+ [mcp_servers.gerrit]
103
+ command = "npx"
104
+ args = ["-y", "@gyeonghokim/gerrit-mcp-server"]
105
+ # npx downloads the binary on first run, which can exceed the 10s default.
106
+ startup_timeout_sec = 60
107
+
108
+ [mcp_servers.gerrit.env]
109
+ GERRIT_URL = "https://gerrit.example.com"
110
+ GERRIT_USER = "your-username"
111
+ GERRIT_TOKEN = "your-token"
112
+ ```
113
+
114
+ Or let the CLI write it for you:
115
+
116
+ ```bash
117
+ codex mcp add gerrit \
118
+ --env GERRIT_URL=https://gerrit.example.com \
119
+ --env GERRIT_USER=your-username \
120
+ --env GERRIT_TOKEN=your-token \
121
+ -- npx -y @gyeonghokim/gerrit-mcp-server
122
+ ```
123
+
124
+ </details>
125
+
126
+ <details>
127
+ <summary><b>Cursor, Zed, and other clients</b></summary>
128
+
129
+ Add this to the client's MCP configuration file:
130
+
131
+ ```jsonc
132
+ {
133
+ "mcpServers": {
134
+ "gerrit": {
135
+ "command": "npx",
136
+ "args": ["-y", "@gyeonghokim/gerrit-mcp-server"],
137
+ "env": {
138
+ "GERRIT_URL": "https://gerrit.example.com",
139
+ "GERRIT_USER": "your-username",
140
+ "GERRIT_TOKEN": "your-token"
141
+ }
142
+ }
143
+ }
144
+ }
145
+ ```
146
+
147
+ </details>
148
+
149
+ **Ask for something.** "What changes am I reviewing?" or "Summarise the diff on change 12345."
150
+
151
+ ## Credentials
152
+
153
+ Gerrit authenticates REST clients with HTTP Basic using a token from your account settings, and
154
+ expects authenticated requests to be prefixed with `/a/`. Both binaries handle the prefix for you.
155
+
156
+ Generate a token under *Settings HTTP Credentials*. On Gerrit 3.13 and newer you can name the
157
+ token and give it a lifetime (`90 days`, `1 year`, and so on) worth doing, so the credential this
158
+ holds is scoped and expires on its own. Older Gerrit versions call the same thing an *HTTP
159
+ password*; it still works, as that endpoint is now an alias that creates a token with the id
160
+ `legacy`.
161
+
162
+ **Where the token lives depends on which frontend you use.**
163
+
164
+ `gerrit-mcp-server` reads the environment and only the environment, so its credentials live in your
165
+ MCP client's config file and nowhere else. It never reads a file of its own.
166
+
167
+ `gerrit-cli` has no client config to inherit from, so `gerrit-cli init` writes one under the OS
168
+ configuration directory:
169
+
170
+ | OS | Path |
171
+ | --- | --- |
172
+ | Linux | `$XDG_CONFIG_HOME/gerrit-cli/config.json`, or `~/.config/gerrit-cli/config.json` |
173
+ | macOS | `~/Library/Application Support/gerrit-cli/config.json` |
174
+ | Windows | `%AppData%\gerrit-cli\config.json` |
175
+
176
+ Set `GERRIT_CONFIG` to put it somewhere else. Environment variables always take precedence over the
177
+ file, so a one-off `GERRIT_TOKEN=... gerrit-cli ...` works and CI never needs a file at all.
178
+ `gerrit-cli config` prints where each value actually came from.
179
+
180
+ What holds for both:
181
+
182
+ - **The token only ever travels in an `Authorization` header.** It is never passed as a process
183
+ argument, so it cannot be read out of `ps`, and it is never written to a log line or an error
184
+ message. `gerrit-cli init` has no `--token` flag for exactly this reason.
185
+ - **Nothing goes anywhere but your Gerrit host.**
186
+
187
+ What is worth knowing about the file:
188
+
189
+ - On Linux and macOS it is written `0600`, readable only by you. On Windows it inherits the ACL of
190
+ `%AppData%`, which is already restricted to your account plus SYSTEM and Administrators — setting
191
+ a tighter one needs a dependency this project does not take. If your `%AppData%` is redirected to
192
+ a network share, prefer keeping `GERRIT_TOKEN` in your environment instead.
193
+ - **`gerrit-cli init` echoes the token as you type it.** Hiding terminal input needs a dependency
194
+ this project does not take either. Pipe it in if that matters:
195
+ `printf 'https://gerrit.example.com
196
+ alice
197
+ %s
198
+ ' "$TOKEN" | gerrit-cli init -non-interactive`
199
+ - **Do not commit it, and do not commit an MCP config either.** A project-level `.mcp.json` holding
200
+ `GERRIT_TOKEN` is a credential in your repository. Keep it in your user-level client config, or
201
+ gitignore it.
202
+ - **Use a dedicated token with a lifetime**, so it can be revoked without touching your other
203
+ credentials.
204
+ - Your Gerrit permissions still apply. Neither frontend can see or do anything your account cannot.
205
+
206
+ ## Configuration
207
+
208
+ Both frontends read the same variables. For the MCP server they live in your client's config; for
209
+ the CLI they are optional, since `gerrit-cli init` writes the same settings to a file.
210
+
211
+ | Variable | Required | Default | Description |
212
+ | --- | --- | --- | --- |
213
+ | `GERRIT_URL` | yes | — | Base URL of the Gerrit host, for example `https://gerrit.example.com` |
214
+ | `GERRIT_USER` | yes | | Your Gerrit username |
215
+ | `GERRIT_TOKEN` | yes | | Auth token from *Settings → HTTP Credentials* |
216
+ | `GERRIT_ALLOW_WRITE` | no | `false` | Set to `true` to enable the tools and commands that modify Gerrit |
217
+ | `GERRIT_TIMEOUT` | no | `30s` | Per-request timeout |
218
+ | `GERRIT_LOG_LEVEL` | no | `info` | `debug`, `info`, `warn`, or `error`. Logs go to stderr |
219
+ | `GERRIT_CONFIG` | no | — | `gerrit-cli` only. Path to the configuration file, overriding the default |
220
+
221
+ ## Available tools and commands
222
+
223
+ **The two frontends expose exactly the same set**, and a test in the repository holds them there.
224
+ A CLI command is its MCP tool name with the underscores written as dashes — `query_changes` becomes
225
+ `query-changes` and `gerrit-cli` accepts either spelling.
226
+
227
+ Reads are always available. **Writes are off unless you set `GERRIT_ALLOW_WRITE=true`**, so an
228
+ agent cannot abandon a change or post a review by accident. The MCP server does not register the
229
+ write tools at all; `gerrit-cli` still lists them in its help, marked, but refuses to run one.
230
+
231
+ The same asymmetry applies to operations your Gerrit is too old for — see
232
+ [Supported Gerrit versions](#supported-gerrit-versions).
233
+
234
+ ### Read
235
+
236
+ | Tool | Description |
237
+ | --- | --- |
238
+ | `query_changes` | Search changes with Gerrit query syntax (`status:open owner:self`) |
239
+ | `get_change_details` | Full summary of one change |
240
+ | `get_commit_message` | Commit message of the current patch set |
241
+ | `list_change_files` | Files touched by the latest patch set |
242
+ | `get_file_diff` | Diff for one file in a change |
243
+ | `list_change_comments` | Published comments on a change |
244
+ | `list_draft_comments` | Your unpublished draft comments |
245
+ | `changes_submitted_together` | Changes that would submit alongside this one |
246
+ | `suggest_reviewers` | Reviewer suggestions for a change |
247
+ | `get_bugs_from_cl` | Bug ids referenced in the commit message |
248
+
249
+ Every value is a flag; `gerrit-cli` has no positional arguments. Run `gerrit-cli help <command>`
250
+ for one command's flags that is authoritative and cannot go stale.
251
+
252
+ `gerrit-cli` also has five commands of its own that no MCP tool corresponds to: `help`, `version`,
253
+ `config`, `init`, and `doctor`, which reports your host's Gerrit release and what that rules out.
254
+
255
+ There is deliberately **no `--json` output**. Everything passes through the same renderer that keeps
256
+ responses inside a sensible token budget, and handing an agent raw Gerrit JSON would undo that.
257
+
258
+ ### Write requires `GERRIT_ALLOW_WRITE=true`
259
+
260
+ | Tool | Description |
261
+ | --- | --- |
262
+ | `post_review_comment` | Add a draft comment on a line, or reply in a thread |
263
+ | `publish_drafts` | Publish your draft comments as a review |
264
+ | `delete_draft_comment` | Delete one draft comment |
265
+ | `delete_draft_comments` | Delete every draft on a change |
266
+ | `add_reviewer` | Add a reviewer or CC |
267
+ | `set_topic` | Set or clear the topic |
268
+ | `set_ready_for_review` | Take a change out of WIP (needs Gerrit 2.15+) |
269
+ | `set_work_in_progress` | Mark a change WIP (needs Gerrit 2.15+) |
270
+ | `create_change` | Create a change |
271
+ | `abandon_change` | Abandon a change |
272
+ | `revert_change` | Revert a change |
273
+ | `revert_submission` | Revert a whole submission (needs Gerrit 3.2+) |
274
+
275
+ ## Exit codes
276
+
277
+ `gerrit-cli` reports what to do about a failure, not just that one happened. Rendered output goes to
278
+ stdout and everything else to stderr, so the answer is safe to pipe.
279
+
280
+ | Code | Meaning |
281
+ | --- | --- |
282
+ | 0 | Success |
283
+ | 1 | Something else failed; read stderr |
284
+ | 2 | Bad arguments |
285
+ | 3 | Not configured run `gerrit-cli init` |
286
+ | 4 | Not permitted — the account, `GERRIT_ALLOW_WRITE`, or a Gerrit too old for this operation |
287
+ | 5 | No such change, file or comment |
288
+ | 6 | The change is not in a state that allows this |
289
+
290
+ ## Supported Gerrit versions
291
+
292
+ Built and tested against the Gerrit **3.14** REST API. Supported down to **2.14**.
293
+
294
+ Almost everything works unchanged on an old host — including the draft comment endpoints, which
295
+ earlier versions of this document blamed. Three write operations genuinely do not exist:
296
+
297
+ | Operation | Needs |
298
+ | --- | --- |
299
+ | `set_work_in_progress` / `set-work-in-progress` | Gerrit 2.15+ |
300
+ | `set_ready_for_review` / `set-ready-for-review` | Gerrit 2.15+ |
301
+ | `revert_submission` / `revert-submission` | Gerrit 3.2+ |
302
+
303
+ The two frontends handle that the same way they handle write access. `gerrit-mcp-server` asks the
304
+ host which release it is as it starts, and never offers a tool it cannot serve, so the tool list
305
+ your client sees is right from the first time it asks. `gerrit-cli` lists the commands with the
306
+ release each needs and reports exit 4 if you run one anyway, naming both the release required and
307
+ the one your host reports.
308
+
309
+ **If the release cannot be determined, everything is offered.** A proxy that swallows the version
310
+ endpoint, or a patched internal fork that backported an endpoint, should not lose an operation that
311
+ works so an unknown version hides nothing, and anything genuinely missing still fails with a
312
+ clear message.
313
+
314
+ One more difference worth knowing: Gerrit did not report comment counts before 3.0, so
315
+ `get_change_details` omits that line on an older host rather than claiming zero.
316
+
317
+ ```bash
318
+ gerrit-cli doctor # which release your host runs, and what that rules out
319
+ ```
320
+
321
+ ## Other ways to install
322
+
323
+ `npm` is the easy path, but the binaries stand alone.
324
+
325
+ ```bash
326
+ # Go toolchain
327
+ go install github.com/GyeongHoKim/gerrit-mcp-server/cmd/gerrit-mcp-server@latest
328
+ go install github.com/GyeongHoKim/gerrit-mcp-server/cmd/gerrit-cli@latest
329
+ ```
330
+
331
+ Or download the archive for your platform from the
332
+ [releases page](https://github.com/GyeongHoKim/gerrit-mcp-server/releases). It contains both
333
+ binaries and the agent skill, and you can point your MCP client's `command` straight at
334
+ `gerrit-mcp-server`. No Node required.
335
+
336
+ ## Development
337
+
338
+ ```bash
339
+ mise install # toolchain, pinned in mise.toml
340
+ just setup # dependencies and git hooks
341
+ just ci # everything CI runs
342
+ just --list # all tasks
343
+ ```
344
+
345
+ If you are AI Coding Agent(Codex, Claude Code, OpenCode, etc.), See [AGENTS.md](AGENTS.md) for architecture, conventions, and the Gerrit API details worth knowing
346
+ before you touch the client.
347
+
348
+ ## License
349
+
350
+ [Elastic License 2.0](LICENSE).
351
+
352
+ > It is prohibited to deploy this MCP server as a commercial service.
353
+
354
+ **Using this at work is fine.** ELv2 places exactly three restrictions on you: you may not offer
355
+ this software to third parties as a hosted or managed service, you may not circumvent license key
356
+ functionality, and you may not strip the copyright notices. Running it, modifying it, forking it,
357
+ and deploying it across your engineering organisation are all expressly permitted.
358
+
359
+ Note that ELv2 is source-available rather than OSI-approved open source. If your organisation
360
+ screens dependencies by license, it may need to be allowlisted.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gyeonghokim/gerrit-cli",
3
- "version": "0.0.1",
3
+ "version": "1.0.0",
4
4
  "description": "Command-line client for Gerrit code review, and the binary behind the gerrit-cli agent skill.",
5
5
  "license": "Elastic-2.0",
6
6
  "author": "GyeongHoKim",
@@ -34,10 +34,10 @@
34
34
  "node": ">=18"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@gyeonghokim/gerrit-mcp-server-linux-x64": "0.0.1",
38
- "@gyeonghokim/gerrit-mcp-server-linux-arm64": "0.0.1",
39
- "@gyeonghokim/gerrit-mcp-server-darwin-x64": "0.0.1",
40
- "@gyeonghokim/gerrit-mcp-server-darwin-arm64": "0.0.1",
41
- "@gyeonghokim/gerrit-mcp-server-win32-x64": "0.0.1"
37
+ "@gyeonghokim/gerrit-mcp-server-linux-x64": "1.0.0",
38
+ "@gyeonghokim/gerrit-mcp-server-linux-arm64": "1.0.0",
39
+ "@gyeonghokim/gerrit-mcp-server-darwin-x64": "1.0.0",
40
+ "@gyeonghokim/gerrit-mcp-server-darwin-arm64": "1.0.0",
41
+ "@gyeonghokim/gerrit-mcp-server-win32-x64": "1.0.0"
42
42
  }
43
43
  }