@bridge_gpt/mcp-server 0.1.4 → 0.1.5
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/README.md +4 -1
- package/build/index.js +57 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ MCP server for [Bridge API](https://bridgegpt-api.com) — exposes Jira integrat
|
|
|
9
9
|
| `BAPI_BASE_URL` | Yes | `https://bridgegpt-api.com` | Bridge API base URL |
|
|
10
10
|
| `BAPI_REPO_NAME` | Yes | _(none)_ | Jira project/repository identifier configured in Bridge API |
|
|
11
11
|
| `BAPI_API_KEY` | Yes | _(none)_ | API key obtained from the Bridge API setup UI |
|
|
12
|
+
| `BAPI_PROJECT_ROOT` | No | _(auto-set by --init)_ | Absolute path to project root. Anchors BAPI_DOCS_DIR and BAPI_PIPELINES_DIR resolution. Set automatically by --init. |
|
|
12
13
|
| `BAPI_DOCS_DIR` | No | `docs/tmp` | Local directory for saving plans, critiques, and research reports |
|
|
13
14
|
| `BAPI_PIPELINES_DIR` | No | `.bridge/pipelines` | Directory for user-defined custom pipeline JSON files |
|
|
14
15
|
|
|
@@ -122,7 +123,9 @@ Bridge API ships pre-built slash commands for Claude Code and Cursor. To scaffol
|
|
|
122
123
|
npx @bridge_gpt/mcp-server --init
|
|
123
124
|
```
|
|
124
125
|
|
|
125
|
-
|
|
126
|
+
Run from your project root. `--init` automatically detects MCP config files and sets `BAPI_PROJECT_ROOT` so that local file output works correctly regardless of which AI tool launches the server. It also writes command files to `.claude/commands/` and `.cursor/commands/`. Re-run after upgrading the package to get updated commands.
|
|
127
|
+
|
|
128
|
+
> **Codex users:** `--init` does not modify `~/.codex/config.toml`. Set `BAPI_PROJECT_ROOT` manually in your Codex MCP config.
|
|
126
129
|
|
|
127
130
|
## Available Tools
|
|
128
131
|
|
package/build/index.js
CHANGED
|
@@ -27,8 +27,9 @@ let userPipelineKeys = new Set();
|
|
|
27
27
|
const BASE_URL = process.env.BAPI_BASE_URL ?? "https://bridgegpt-api.com";
|
|
28
28
|
const REPO_NAME = process.env.BAPI_REPO_NAME ?? "";
|
|
29
29
|
const API_KEY = process.env.BAPI_API_KEY ?? "";
|
|
30
|
-
const
|
|
31
|
-
const
|
|
30
|
+
const PROJECT_ROOT = process.env.BAPI_PROJECT_ROOT ?? process.cwd();
|
|
31
|
+
const BAPI_DOCS_DIR = path.resolve(PROJECT_ROOT, process.env.BAPI_DOCS_DIR ?? "docs/tmp");
|
|
32
|
+
const BAPI_PIPELINES_DIR = path.resolve(PROJECT_ROOT, process.env.BAPI_PIPELINES_DIR ?? ".bridge/pipelines");
|
|
32
33
|
const GET_HEADERS = { "X-API-Key": API_KEY };
|
|
33
34
|
const POST_HEADERS = {
|
|
34
35
|
"X-API-Key": API_KEY,
|
|
@@ -208,6 +209,15 @@ async function pollForResult(getUrl, timeoutMs, label) {
|
|
|
208
209
|
// CLI: --init scaffolds slash commands into the current project
|
|
209
210
|
// ---------------------------------------------------------------------------
|
|
210
211
|
if (process.argv.includes("--init")) {
|
|
212
|
+
// Guard: must be run from project root
|
|
213
|
+
try {
|
|
214
|
+
await stat(path.join(process.cwd(), "package.json"));
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
console.error("Error: No package.json found in current directory.\n" +
|
|
218
|
+
"--init must be run from your project root (the directory containing package.json).");
|
|
219
|
+
process.exit(1);
|
|
220
|
+
}
|
|
211
221
|
try {
|
|
212
222
|
const cwd = process.cwd();
|
|
213
223
|
const dirs = [
|
|
@@ -369,6 +379,51 @@ automatically provided by the server.
|
|
|
369
379
|
console.log(` ${path.relative(cwd, examplePath)} (written)`);
|
|
370
380
|
}
|
|
371
381
|
console.log(` ${path.relative(cwd, instrDir)}/ (ensured)`);
|
|
382
|
+
// Inject BAPI_PROJECT_ROOT into detected MCP config files
|
|
383
|
+
const projectRoot = cwd;
|
|
384
|
+
const configTargets = [
|
|
385
|
+
{ path: path.join(cwd, ".mcp.json"), serverKeyPath: ["mcpServers", "bridge-api"] },
|
|
386
|
+
{ path: path.join(cwd, ".vscode", "mcp.json"), serverKeyPath: ["servers", "bridge-api"] },
|
|
387
|
+
];
|
|
388
|
+
const injectedConfigs = [];
|
|
389
|
+
for (const target of configTargets) {
|
|
390
|
+
try {
|
|
391
|
+
const raw = await readFile(target.path, "utf-8");
|
|
392
|
+
let parsed;
|
|
393
|
+
try {
|
|
394
|
+
parsed = JSON.parse(raw);
|
|
395
|
+
}
|
|
396
|
+
catch {
|
|
397
|
+
console.warn(` Warning: ${target.path} is not valid JSON — skipping`);
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
// Navigate to server entry
|
|
401
|
+
let serverEntry = parsed;
|
|
402
|
+
for (const key of target.serverKeyPath) {
|
|
403
|
+
serverEntry = serverEntry?.[key];
|
|
404
|
+
}
|
|
405
|
+
if (!serverEntry)
|
|
406
|
+
continue;
|
|
407
|
+
// Ensure env object exists
|
|
408
|
+
if (!serverEntry.env)
|
|
409
|
+
serverEntry.env = {};
|
|
410
|
+
const action = serverEntry.env.BAPI_PROJECT_ROOT ? "updated" : "injected";
|
|
411
|
+
serverEntry.env.BAPI_PROJECT_ROOT = projectRoot;
|
|
412
|
+
await writeFile(target.path, JSON.stringify(parsed, null, 2) + "\n", "utf-8");
|
|
413
|
+
injectedConfigs.push(` ${target.path} (${action})`);
|
|
414
|
+
}
|
|
415
|
+
catch {
|
|
416
|
+
// File doesn't exist — skip silently
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (injectedConfigs.length > 0) {
|
|
420
|
+
console.log(`Bridge API: set BAPI_PROJECT_ROOT in ${injectedConfigs.length} config file(s)`);
|
|
421
|
+
for (const line of injectedConfigs)
|
|
422
|
+
console.log(line);
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
console.log("Bridge API: no MCP config files found — set BAPI_PROJECT_ROOT manually in your MCP server config");
|
|
426
|
+
}
|
|
372
427
|
process.exit(0);
|
|
373
428
|
}
|
|
374
429
|
catch (err) {
|