gitlab-duo-mcp-bridge 0.1.0 → 0.3.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.
- package/LICENSE +21 -0
- package/README.md +29 -3
- package/dist/src/config.js +16 -1
- package/dist/src/index.js +5 -0
- package/dist/src/server.js +2 -1
- package/dist/src/setup.js +354 -0
- package/package.json +10 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DataTalesByAgos
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# gitlab-duo-mcp-bridge
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/gitlab-duo-mcp-bridge)
|
|
4
|
+
[](https://www.npmjs.com/package/gitlab-duo-mcp-bridge)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
|
|
3
8
|
A tiny **MCP server** that wraps the **GitLab Duo CLI** as a single, clean,
|
|
4
9
|
fault-tolerant tool: **`duo_review`**.
|
|
5
10
|
|
|
@@ -69,9 +74,30 @@ result back as clean JSON. You don't copy code around — Duo gathers it itself.
|
|
|
69
74
|
|
|
70
75
|
## Quick start (plug and play)
|
|
71
76
|
|
|
72
|
-
No clone, no build, no paths to figure out.
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
No clone, no build, no paths to figure out. You can configure your environment automatically with a single command, or add it manually.
|
|
78
|
+
|
|
79
|
+
### 1. Automatic installation (Recommended)
|
|
80
|
+
|
|
81
|
+
Run the automatic configurator from your terminal:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx gitlab-duo-mcp-bridge setup
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
This script will automatically detect and configure all active MCP clients on your system:
|
|
88
|
+
- **Claude Desktop** (both standard and Windows Microsoft Store packages)
|
|
89
|
+
- **Cursor**
|
|
90
|
+
- **Cline** (VS Code)
|
|
91
|
+
- **Roo Code / Roo Cline** (VS Code)
|
|
92
|
+
- **Windsurf**
|
|
93
|
+
- **Zed**
|
|
94
|
+
- **Continue**
|
|
95
|
+
|
|
96
|
+
Once run, simply restart or reload your editor/agent.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### 2. Manual configuration
|
|
75
101
|
|
|
76
102
|
**Claude Code:**
|
|
77
103
|
|
package/dist/src/config.js
CHANGED
|
@@ -30,13 +30,28 @@ function isTruthy(value) {
|
|
|
30
30
|
return false;
|
|
31
31
|
return ["1", "true", "yes", "on"].includes(value.trim().toLowerCase());
|
|
32
32
|
}
|
|
33
|
+
export function resolveModel(model) {
|
|
34
|
+
if (!model)
|
|
35
|
+
return undefined;
|
|
36
|
+
const MODEL_MAPPING = {
|
|
37
|
+
sonnet: "claude_sonnet_4_6",
|
|
38
|
+
haiku: "claude_haiku_4_5_20251001",
|
|
39
|
+
opus: "claude_opus_4_5_20251101",
|
|
40
|
+
"gpt5-codex": "gpt_5_codex",
|
|
41
|
+
gpt5: "gpt_5",
|
|
42
|
+
"gpt5-mini": "gpt_5_mini",
|
|
43
|
+
gemini: "gemini_2_5_flash_vertex",
|
|
44
|
+
};
|
|
45
|
+
const key = model.trim().toLowerCase();
|
|
46
|
+
return MODEL_MAPPING[key] ?? model;
|
|
47
|
+
}
|
|
33
48
|
export function loadConfig(env = process.env) {
|
|
34
49
|
return {
|
|
35
50
|
command: trimmedOrUndefined(env.DUO_CLI_COMMAND) ?? "glab",
|
|
36
51
|
baseArgs: splitArgs(env.DUO_CLI_BASE_ARGS, ["duo", "cli", "run"]),
|
|
37
52
|
goalFlag: trimmedOrUndefined(env.DUO_CLI_GOAL_FLAG) ?? "--goal",
|
|
38
53
|
modelFlag: trimmedOrUndefined(env.DUO_CLI_MODEL_FLAG) ?? "--model",
|
|
39
|
-
model: trimmedOrUndefined(env.GITLAB_DUO_MODEL),
|
|
54
|
+
model: resolveModel(trimmedOrUndefined(env.GITLAB_DUO_MODEL)),
|
|
40
55
|
extraArgs: splitArgs(env.DUO_CLI_EXTRA_ARGS, []),
|
|
41
56
|
timeoutMs: parseIntOr(env.DUO_TIMEOUT_MS, 120_000),
|
|
42
57
|
cwd: trimmedOrUndefined(env.DUO_CLI_CWD),
|
package/dist/src/index.js
CHANGED
|
@@ -8,7 +8,12 @@
|
|
|
8
8
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9
9
|
import { loadConfig } from "./config.js";
|
|
10
10
|
import { createServer } from "./server.js";
|
|
11
|
+
import { runSetup } from "./setup.js";
|
|
11
12
|
async function main() {
|
|
13
|
+
if (process.argv[2] === "setup") {
|
|
14
|
+
await runSetup();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
12
17
|
const config = loadConfig();
|
|
13
18
|
const server = createServer(config);
|
|
14
19
|
const transport = new StdioServerTransport();
|
package/dist/src/server.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
+
import { resolveModel } from "./config.js";
|
|
7
8
|
import { buildReviewGoal } from "./goal.js";
|
|
8
9
|
import { runDuo } from "./duoRunner.js";
|
|
9
10
|
import { buildPointerGoal, writeGoalFile, } from "./goalFile.js";
|
|
@@ -119,7 +120,7 @@ export async function handleReview(config, input) {
|
|
|
119
120
|
baseArgs: config.baseArgs,
|
|
120
121
|
goalFlag: config.goalFlag,
|
|
121
122
|
modelFlag: config.modelFlag,
|
|
122
|
-
model: input.model ?? config.model,
|
|
123
|
+
model: resolveModel(input.model) ?? config.model,
|
|
123
124
|
extraArgs: config.extraArgs,
|
|
124
125
|
timeoutMs: input.timeoutMs ?? config.timeoutMs,
|
|
125
126
|
cwd: effectiveCwd,
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import readline from "node:readline/promises";
|
|
5
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
6
|
+
import { exec } from "node:child_process";
|
|
7
|
+
import { promisify } from "node:util";
|
|
8
|
+
const execAsync = promisify(exec);
|
|
9
|
+
export async function runSetup() {
|
|
10
|
+
const home = os.homedir();
|
|
11
|
+
const platform = os.platform();
|
|
12
|
+
const appData = process.env.APPDATA || "";
|
|
13
|
+
const localAppData = process.env.LOCALAPPDATA || "";
|
|
14
|
+
// Define client configurations and their paths
|
|
15
|
+
const targets = [];
|
|
16
|
+
const newConfigEntry = {
|
|
17
|
+
command: "npx",
|
|
18
|
+
args: ["-y", "gitlab-duo-mcp-bridge"],
|
|
19
|
+
};
|
|
20
|
+
if (platform === "win32") {
|
|
21
|
+
// Claude Desktop (Standard)
|
|
22
|
+
if (appData) {
|
|
23
|
+
targets.push({
|
|
24
|
+
name: "Claude Desktop (Standard)",
|
|
25
|
+
path: path.join(appData, "Claude", "claude_desktop_config.json"),
|
|
26
|
+
key: "mcpServers",
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
// Claude Desktop (MSIX)
|
|
30
|
+
if (localAppData) {
|
|
31
|
+
targets.push({
|
|
32
|
+
name: "Claude Desktop (MSIX)",
|
|
33
|
+
path: path.join(localAppData, "Packages", "Claude_pzs8sxrjxfjjc", "LocalCache", "Roaming", "Claude", "claude_desktop_config.json"),
|
|
34
|
+
key: "mcpServers",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// Cursor
|
|
38
|
+
targets.push({
|
|
39
|
+
name: "Cursor",
|
|
40
|
+
path: path.join(home, ".cursor", "mcp.json"),
|
|
41
|
+
key: "mcpServers",
|
|
42
|
+
});
|
|
43
|
+
// Cline
|
|
44
|
+
if (appData) {
|
|
45
|
+
targets.push({
|
|
46
|
+
name: "Cline (VS Code)",
|
|
47
|
+
path: path.join(appData, "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"),
|
|
48
|
+
key: "mcpServers",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Roo Code
|
|
52
|
+
if (appData) {
|
|
53
|
+
targets.push({
|
|
54
|
+
name: "Roo Code (VS Code)",
|
|
55
|
+
path: path.join(appData, "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"),
|
|
56
|
+
key: "mcpServers",
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
// Windsurf
|
|
60
|
+
if (appData) {
|
|
61
|
+
targets.push({
|
|
62
|
+
name: "Windsurf",
|
|
63
|
+
path: path.join(appData, "Windsurf", "mcp_settings.json"),
|
|
64
|
+
key: "mcpServers",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else if (platform === "darwin") {
|
|
69
|
+
// Claude Desktop
|
|
70
|
+
targets.push({
|
|
71
|
+
name: "Claude Desktop",
|
|
72
|
+
path: path.join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json"),
|
|
73
|
+
key: "mcpServers",
|
|
74
|
+
});
|
|
75
|
+
// Cursor
|
|
76
|
+
targets.push({
|
|
77
|
+
name: "Cursor",
|
|
78
|
+
path: path.join(home, ".cursor", "mcp.json"),
|
|
79
|
+
key: "mcpServers",
|
|
80
|
+
});
|
|
81
|
+
// Cline
|
|
82
|
+
targets.push({
|
|
83
|
+
name: "Cline (VS Code)",
|
|
84
|
+
path: path.join(home, "Library", "Application Support", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"),
|
|
85
|
+
key: "mcpServers",
|
|
86
|
+
});
|
|
87
|
+
// Roo Code
|
|
88
|
+
targets.push({
|
|
89
|
+
name: "Roo Code (VS Code)",
|
|
90
|
+
path: path.join(home, "Library", "Application Support", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"),
|
|
91
|
+
key: "mcpServers",
|
|
92
|
+
});
|
|
93
|
+
// Windsurf
|
|
94
|
+
targets.push({
|
|
95
|
+
name: "Windsurf",
|
|
96
|
+
path: path.join(home, ".codeium", "windsurf", "mcp_config.json"),
|
|
97
|
+
key: "mcpServers",
|
|
98
|
+
});
|
|
99
|
+
// Zed
|
|
100
|
+
targets.push({
|
|
101
|
+
name: "Zed",
|
|
102
|
+
path: path.join(home, ".config", "zed", "settings.json"),
|
|
103
|
+
key: "context_servers",
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
// Linux and others
|
|
108
|
+
// Claude Desktop
|
|
109
|
+
targets.push({
|
|
110
|
+
name: "Claude Desktop",
|
|
111
|
+
path: path.join(home, ".config", "Claude", "claude_desktop_config.json"),
|
|
112
|
+
key: "mcpServers",
|
|
113
|
+
});
|
|
114
|
+
// Cursor
|
|
115
|
+
targets.push({
|
|
116
|
+
name: "Cursor",
|
|
117
|
+
path: path.join(home, ".cursor", "mcp.json"),
|
|
118
|
+
key: "mcpServers",
|
|
119
|
+
});
|
|
120
|
+
// Cline
|
|
121
|
+
targets.push({
|
|
122
|
+
name: "Cline (VS Code)",
|
|
123
|
+
path: path.join(home, ".config", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"),
|
|
124
|
+
key: "mcpServers",
|
|
125
|
+
});
|
|
126
|
+
// Roo Code
|
|
127
|
+
targets.push({
|
|
128
|
+
name: "Roo Code (VS Code)",
|
|
129
|
+
path: path.join(home, ".config", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json"),
|
|
130
|
+
key: "mcpServers",
|
|
131
|
+
});
|
|
132
|
+
// Windsurf
|
|
133
|
+
targets.push({
|
|
134
|
+
name: "Windsurf",
|
|
135
|
+
path: path.join(home, ".codeium", "windsurf", "mcp_config.json"),
|
|
136
|
+
key: "mcpServers",
|
|
137
|
+
});
|
|
138
|
+
// Zed
|
|
139
|
+
targets.push({
|
|
140
|
+
name: "Zed",
|
|
141
|
+
path: path.join(home, ".config", "zed", "settings.json"),
|
|
142
|
+
key: "context_servers",
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
// Continue-specific path (Always uses a dedicated JSON file under ~/.continue/mcpServers/)
|
|
146
|
+
targets.push({
|
|
147
|
+
name: "Continue (IDE)",
|
|
148
|
+
path: path.join(home, ".continue", "mcpServers", "gitlab-duo.json"),
|
|
149
|
+
key: "raw",
|
|
150
|
+
});
|
|
151
|
+
process.stderr.write("Starting setup of gitlab-duo-mcp-bridge...\n\n");
|
|
152
|
+
const rl = readline.createInterface({ input, output });
|
|
153
|
+
process.stderr.write("Where would you like to configure gitlab-duo-mcp-bridge?\n");
|
|
154
|
+
process.stderr.write(" 1. Globally (system-wide for detected IDEs & MCP clients)\n");
|
|
155
|
+
process.stderr.write(" 2. Locally (in the current project directory)\n\n");
|
|
156
|
+
let choice = "1";
|
|
157
|
+
try {
|
|
158
|
+
const choiceAnswer = await rl.question("Enter choice (1 or 2) [1]: ");
|
|
159
|
+
if (choiceAnswer.trim() === "2" || choiceAnswer.trim().toLowerCase() === "locally") {
|
|
160
|
+
choice = "2";
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
// Gracefully fallback to choice "1" on any error
|
|
165
|
+
}
|
|
166
|
+
if (choice === "2") {
|
|
167
|
+
rl.close();
|
|
168
|
+
process.stderr.write("\nConfiguring locally in the current project directory...\n\n");
|
|
169
|
+
const localPath = path.join(process.cwd(), "mcp.json");
|
|
170
|
+
try {
|
|
171
|
+
let config = {};
|
|
172
|
+
try {
|
|
173
|
+
const content = await fs.readFile(localPath, "utf8");
|
|
174
|
+
if (content.trim() !== "") {
|
|
175
|
+
config = JSON.parse(content);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
if (err.code !== "ENOENT") {
|
|
180
|
+
process.stderr.write(`⚠️ Could not read or parse existing mcp.json at ${localPath}: ${err.message}\n`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (!config.mcpServers) {
|
|
184
|
+
config.mcpServers = {};
|
|
185
|
+
}
|
|
186
|
+
config.mcpServers["gitlab-duo"] = newConfigEntry;
|
|
187
|
+
await fs.writeFile(localPath, JSON.stringify(config, null, 2), "utf8");
|
|
188
|
+
process.stderr.write(`✅ Successfully configured locally: mcp.json\n └─ Path: ${localPath}\n\n`);
|
|
189
|
+
process.stderr.write("🎉 Configuration complete!\n");
|
|
190
|
+
process.stderr.write("Remember to restart or reload your AI client/agent to detect the 'duo_review' tool.\n");
|
|
191
|
+
await checkGitLabConnection();
|
|
192
|
+
printMiniGuide();
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
process.stderr.write(`❌ Error configuring locally at ${localPath}: ${err.message}\n`);
|
|
196
|
+
}
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
process.stderr.write("\nScanning for active MCP client configuration directories...\n\n");
|
|
200
|
+
const detectedTargets = [];
|
|
201
|
+
for (const target of targets) {
|
|
202
|
+
const parentDir = path.dirname(target.path);
|
|
203
|
+
try {
|
|
204
|
+
await fs.access(parentDir);
|
|
205
|
+
detectedTargets.push(target);
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
// Parent directory does not exist, so client is likely not installed or used. Skip it.
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (detectedTargets.length === 0) {
|
|
212
|
+
rl.close();
|
|
213
|
+
process.stderr.write("⚠️ No active MCP client configuration directories were found.\n");
|
|
214
|
+
process.stderr.write("If you use Claude Desktop, Cursor, Cline, Roo Code, Windsurf, Zed, or Continue, please make sure they are installed and have been opened at least once.\n");
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
process.stderr.write("We detected the following MCP client(s):\n");
|
|
218
|
+
detectedTargets.forEach((target, index) => {
|
|
219
|
+
process.stderr.write(` ${index + 1}. ${target.name}\n`);
|
|
220
|
+
});
|
|
221
|
+
process.stderr.write("\n");
|
|
222
|
+
let selectedTargets = detectedTargets;
|
|
223
|
+
try {
|
|
224
|
+
const answer = await rl.question("Do you want to configure all detected clients? (Y/n): ");
|
|
225
|
+
const parsedAnswer = answer.trim().toLowerCase();
|
|
226
|
+
if (parsedAnswer !== "" && parsedAnswer !== "y" && parsedAnswer !== "yes") {
|
|
227
|
+
selectedTargets = [];
|
|
228
|
+
for (const target of detectedTargets) {
|
|
229
|
+
const individualAnswer = await rl.question(`Configure ${target.name}? (y/N): `);
|
|
230
|
+
if (individualAnswer.trim().toLowerCase().startsWith("y")) {
|
|
231
|
+
selectedTargets.push(target);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
finally {
|
|
237
|
+
rl.close();
|
|
238
|
+
}
|
|
239
|
+
if (selectedTargets.length === 0) {
|
|
240
|
+
process.stderr.write("\n⚠️ No clients were selected for configuration.\n");
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
process.stderr.write("\n");
|
|
244
|
+
let configuredCount = 0;
|
|
245
|
+
for (const target of selectedTargets) {
|
|
246
|
+
const parentDir = path.dirname(target.path);
|
|
247
|
+
try {
|
|
248
|
+
let config = {};
|
|
249
|
+
if (target.key === "raw") {
|
|
250
|
+
// For dedicated JSON files (like Continue's config files under ~/.continue/mcpServers/)
|
|
251
|
+
// We write the standard structure directly.
|
|
252
|
+
config = {
|
|
253
|
+
mcpServers: {
|
|
254
|
+
"gitlab-duo": newConfigEntry,
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
try {
|
|
260
|
+
const content = await fs.readFile(target.path, "utf8");
|
|
261
|
+
// Handle empty or whitespace files safely
|
|
262
|
+
if (content.trim() !== "") {
|
|
263
|
+
config = JSON.parse(content);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
catch (err) {
|
|
267
|
+
if (err.code !== "ENOENT") {
|
|
268
|
+
process.stderr.write(`⚠️ Could not read or parse ${target.name} at ${target.path}: ${err.message}\n`);
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
const key = target.key;
|
|
273
|
+
if (!config[key]) {
|
|
274
|
+
config[key] = {};
|
|
275
|
+
}
|
|
276
|
+
config[key]["gitlab-duo"] = newConfigEntry;
|
|
277
|
+
}
|
|
278
|
+
// Ensure directory exists (just in case)
|
|
279
|
+
await fs.mkdir(parentDir, { recursive: true });
|
|
280
|
+
// Write config back
|
|
281
|
+
await fs.writeFile(target.path, JSON.stringify(config, null, 2), "utf8");
|
|
282
|
+
process.stderr.write(`✅ Successfully configured: ${target.name}\n └─ Path: ${target.path}\n`);
|
|
283
|
+
configuredCount++;
|
|
284
|
+
}
|
|
285
|
+
catch (err) {
|
|
286
|
+
process.stderr.write(`❌ Error configuring ${target.name} at ${target.path}: ${err.message}\n`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
process.stderr.write("\n");
|
|
290
|
+
if (configuredCount > 0) {
|
|
291
|
+
process.stderr.write(`🎉 Configuration complete! Successfully configured ${configuredCount} MCP client(s).\n`);
|
|
292
|
+
process.stderr.write("Remember to restart or reload your AI client to detect the 'duo_review' tool.\n");
|
|
293
|
+
await checkGitLabConnection();
|
|
294
|
+
printMiniGuide();
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
process.stderr.write("⚠️ No clients were configured.\n");
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
async function checkGitLabConnection() {
|
|
301
|
+
process.stderr.write("\nChecking GitLab CLI installation and connection...\n");
|
|
302
|
+
try {
|
|
303
|
+
const { stdout } = await execAsync("glab auth status");
|
|
304
|
+
process.stderr.write("✅ GitLab CLI and connection verified successfully!\n");
|
|
305
|
+
if (stdout) {
|
|
306
|
+
process.stderr.write(stdout
|
|
307
|
+
.trim()
|
|
308
|
+
.split("\n")
|
|
309
|
+
.map((line) => ` ${line}`)
|
|
310
|
+
.join("\n") + "\n\n");
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
catch (err) {
|
|
314
|
+
process.stderr.write("⚠️ Connection check failed or GitLab CLI not fully authenticated:\n");
|
|
315
|
+
if (err.code === "ENOENT" || (err.message && err.message.includes("not found"))) {
|
|
316
|
+
process.stderr.write(" Could not find the 'glab' executable. Please make sure GitLab CLI is installed and added to your PATH.\n\n");
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
const errorOutput = err.stderr || err.stdout || err.message || String(err);
|
|
320
|
+
process.stderr.write(errorOutput
|
|
321
|
+
.trim()
|
|
322
|
+
.split("\n")
|
|
323
|
+
.map((line) => ` ${line}`)
|
|
324
|
+
.join("\n") + "\n\n");
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function printMiniGuide() {
|
|
329
|
+
process.stderr.write(`📋 QUICK COMMAND & USAGE GUIDE
|
|
330
|
+
=============================
|
|
331
|
+
|
|
332
|
+
1. How to ask your AI agent to run a review:
|
|
333
|
+
- "Review my current uncommitted changes with @duo_review"
|
|
334
|
+
- "Run @duo_review on src/auth.ts and src/db.ts"
|
|
335
|
+
- "Use @duo_review with model: sonnet to review this project"
|
|
336
|
+
|
|
337
|
+
2. AI Model Abstractions (Friendly Names):
|
|
338
|
+
You can use simple, friendly model names instead of complex GitLab identifiers!
|
|
339
|
+
The bridge automatically maps them for you:
|
|
340
|
+
|
|
341
|
+
• sonnet -> claude_sonnet_4_6
|
|
342
|
+
• haiku -> claude_haiku_4_5_20251001
|
|
343
|
+
• opus -> claude_opus_4_5_20251101
|
|
344
|
+
• gpt5 -> gpt_5
|
|
345
|
+
• gpt5-mini -> gpt_5_mini
|
|
346
|
+
• gpt5-codex -> gpt_5_codex
|
|
347
|
+
• gemini -> gemini_2_5_flash_vertex
|
|
348
|
+
|
|
349
|
+
3. How to use friendly models:
|
|
350
|
+
- In your agent's config or env: set GITLAB_DUO_MODEL="sonnet"
|
|
351
|
+
- In your prompt: "Review with @duo_review using model: gemini"
|
|
352
|
+
|
|
353
|
+
=============================\n\n`);
|
|
354
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitlab-duo-mcp-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "MCP server that wraps the GitLab Duo CLI as a clean, fault-tolerant duo_review tool for AI coding agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/src",
|
|
11
11
|
"README.md",
|
|
12
|
+
"LICENSE",
|
|
12
13
|
".env.example"
|
|
13
14
|
],
|
|
14
15
|
"engines": {
|
|
@@ -33,6 +34,14 @@
|
|
|
33
34
|
"ai-agents"
|
|
34
35
|
],
|
|
35
36
|
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/DataTalesByAgos/gitlab-duo-mcp-bridge.git"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/DataTalesByAgos/gitlab-duo-mcp-bridge/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/DataTalesByAgos/gitlab-duo-mcp-bridge#readme",
|
|
36
45
|
"dependencies": {
|
|
37
46
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
38
47
|
"zod": "^3.25.0"
|