@bridge_gpt/mcp-server 0.2.23 → 0.2.25

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 CHANGED
@@ -18,7 +18,7 @@ The Bridge MCP is an end-to-end accelerator for shipping code within SFCC, power
18
18
  - [Worktree credentials and the `mcp-invoke` shim](#worktree-credentials-and-the-mcp-invoke-shim)
19
19
  - [Reference](#reference)
20
20
 
21
- For advanced epic/multi-agent orchestration, see [CONDUCTOR.md](./CONDUCTOR.md).
21
+ For advanced epic/multi-agent orchestration, see [CONDUCTOR.md](./docs/CONDUCTOR.md).
22
22
 
23
23
  ## Getting Started
24
24
 
@@ -30,12 +30,29 @@ From your **project root**, install and connect in one command:
30
30
  npx -y @bridge_gpt/mcp-server@latest install-bridge
31
31
  ```
32
32
 
33
- `install-bridge` scaffolds the project, writes your editor's MCP config with real
34
- values, verifies connectivity, persists your API key to the user-scoped credential
35
- store, and opens a fresh agent session to finish setup (`/install-bridge` then
36
- `/learn-repository`). The only inputs are an **API key** (generate one on the Bridge
37
- API web UI **Security** page) and a **repo name** — everything else is derived. Add
38
- `--dry-run` to preview every step without writing, pinging, or spawning anything.
33
+ Run bare like that in a terminal and it starts by asking
34
+ **`Do you have a Bridge API key? [Y/n]`**:
35
+
36
+ - **Yes** (or just press Enter) the existing-key flow. It asks for your **API key**
37
+ (generate one on the Bridge API web UI **Security** page) and a **repo name**
38
+ matching your server-side registration; everything else is derived.
39
+ - **No** — the **self-serve** flow. It asks for an **email**, then a name for your new
40
+ Bridge project, and creates the workspace and your own admin API key for you. No
41
+ account, no key, and no invite needed beforehand. Same as passing
42
+ `--email you@example.com` (see below).
43
+
44
+ That question is asked only for a *bare interactive* run. Passing any flag, setting
45
+ `BAPI_API_KEY`, or running without an interactive terminal skips it and keeps the
46
+ existing deterministic behavior.
47
+
48
+ From there `install-bridge` scaffolds the project, writes your editor's MCP config
49
+ with real values, verifies connectivity, persists your API key to the user-scoped
50
+ credential store, and opens a fresh agent session that runs `/install-bridge` to
51
+ derive and apply the remaining config, presents a **capability report** (what you can
52
+ use now and what you'll unlock), and closes by asking whether to index the
53
+ repository. It does **not** automatically run `/learn-repository` or index without
54
+ your consent — both remain available as separate steps. Add `--dry-run` to preview
55
+ every step without writing, pinging, or spawning anything.
39
56
 
40
57
  **Were you sent a bootstrap invite?** Then you don't need an API key or the web UI
41
58
  at all — run the command your operator gave you:
@@ -78,25 +95,66 @@ works as a fallback.)
78
95
  4. **Persists your key** to the user-scoped credential store
79
96
  (`~/.config/bridge/credentials.json`, target `bapi:<repo>`) so shell-spawned
80
97
  tooling (e.g. `start-tickets`) can resolve it.
81
- 5. **Opens a fresh agent session** that runs `/install-bridge` (to derive the
82
- remaining config fields from your codebase) and then `/learn-repository`.
98
+ 5. **Opens a fresh agent session** that runs `/install-bridge` to derive and apply
99
+ the remaining config fields from your codebase, presents the capability report
100
+ (Connected / Not yet connected / Tools you can use now / Tools you'll unlock /
101
+ Recommended next step), and closes with one optional `[Y/n] Index repository
102
+ now?` question. It does not chain `/learn-repository` and never indexes without
103
+ consent; run `/learn-repository` and `/parse-repository` yourself when you want
104
+ them.
83
105
 
84
- The only inputs are an **API key** and a **repo name** (everything else is
85
- derived). Resolution order:
106
+ In this **existing-key** flow the only inputs are an **API key** and a **repo name**
107
+ (everything else is derived). Resolution order:
86
108
 
87
109
  - **API key:** `--api-key <key>` → `BAPI_API_KEY` env → an interactive (no-echo)
88
110
  prompt. Generate one first on the Bridge API web UI **Security** page (see
89
- [Generate an API Key](#2-generate-an-api-key)); the command consumes a key, it
90
- never mints one — **`--invite` is the one exception** (below). The key is
91
- **never printed or logged**.
92
- - **Repo name:** `--repo <name>` `BAPI_REPO_NAME` env an inferred default you
93
- confirm interactively. It MUST match the server-side repository registration.
111
+ [Generate an API Key](#2-generate-an-api-key)); in this flow the command consumes
112
+ a key, it never mints one — **`--email` and `--invite` are the two exceptions**
113
+ (below), and each mints your first key. The key is **never printed or logged**.
114
+ - **Repo name:** `--repo <name>` and `BAPI_REPO_NAME` remain the deterministic
115
+ short-circuits and compatibility fallbacks when either is set it is used
116
+ directly, with no network round-trip. When **neither** is set, a compatible
117
+ server resolves the unique repository from your existing API key automatically
118
+ (a read-only lookup), so you don't have to supply it. If the server is older,
119
+ the key can't be uniquely resolved, or the lookup fails, `install-bridge` falls
120
+ back to an inferred default you confirm interactively (and requires `--repo`
121
+ when stdin is non-interactive). Whatever name is used MUST match the
122
+ server-side repository registration.
123
+
124
+ #### Self-serve email onboarding (`--email`) — no account, no key, no invite
125
+
126
+ The primary path for a **first-time user with nothing yet** — no Bridge account,
127
+ no API key, and no pre-issued invite. Run:
128
+
129
+ ```bash
130
+ npx -y @bridge_gpt/mcp-server@latest install-bridge --email you@example.com
131
+ ```
132
+
133
+ `install-bridge` requests a brand-new Bridge workspace for that email, receives an
134
+ invite token, and then feeds it into the **exact same** persist-before-exchange
135
+ bootstrap protocol as `--invite` below — so the project is created and your first
136
+ admin key is minted in one command. The minted token is used internally and **never
137
+ shown**.
138
+
139
+ The email may instead come from the `BAPI_SIGNUP_EMAIL` environment variable or a
140
+ **visible** interactive prompt (email is not a secret, so it is echoed as you type —
141
+ unlike the API key and the invite token, which use a hidden prompt). That prompt is
142
+ what answering **no** to `Do you have a Bridge API key? [Y/n]` on a bare run reaches,
143
+ so `install-bridge --email you@example.com` and a bare `install-bridge` + "no" land
144
+ in the same place. The email is still **never written to a log line**. No email
145
+ verification is performed and no message is sent to the address — it only labels your
146
+ new workspace. `--email` is mutually exclusive with `--api-key` and `--invite`.
147
+
148
+ Because this flow *creates* the project, it asks you to **name a new project**
149
+ (`Name your new Bridge project [<inferred>]: `) rather than to match an existing
150
+ server-side registration. The name must be globally unique; if it's taken, you're
151
+ asked for another one and the invite is not consumed. The same applies to `--invite`.
94
152
 
95
153
  #### Bootstrap-invite onboarding (`--invite`)
96
154
 
97
- With a **bootstrap invite** there is no pre-existing key and no web UI: this is the
98
- one mode where `install-bridge` **creates** the project and its first admin key
99
- instead of consuming one. Run `install-bridge --invite` and it:
155
+ With a **bootstrap invite** you were already given, there is no pre-existing key and
156
+ no web UI: like `--email` above, this mode **creates** the project and its first
157
+ admin key instead of consuming one. Run `install-bridge --invite` and it:
100
158
 
101
159
  1. **Prompts for the bootstrap invite token** with echo suppressed (the default —
102
160
  see below).
@@ -134,8 +192,12 @@ Useful flags:
134
192
  credential store, without prompting (re-running is otherwise non-destructive).
135
193
  - `--agent claude|cursor-agent` — which agent to launch for the agentic remainder
136
194
  (default `claude`).
195
+ - `--email <addr>` — self-serve signup: create a new workspace from just an email
196
+ (mutually exclusive with `--api-key` and `--invite`). Falls back to
197
+ `BAPI_SIGNUP_EMAIL`, then a visible prompt. Visible input, not a secret; still
198
+ never logged.
137
199
  - `--invite [token]` — redeem a bootstrap invite (mutually exclusive with
138
- `--api-key`). Omit the value to get the hidden prompt.
200
+ `--api-key` and `--email`). Omit the value to get the hidden prompt.
139
201
 
140
202
  That's it — once `install-bridge` finishes you're connected. If you prefer to do
141
203
  it by hand (or just want to understand each step), the manual flow below does the
@@ -502,10 +564,12 @@ Salesforce's official MCP server, `@salesforce/b2c-dx-mcp`, covers developer-exp
502
564
 
503
565
  **v1 is read-only and developer-sandbox-only** — no writes, and non-sandbox instances are rejected. Credentials stay local (in `dw.json` or `SFCC_*` env vars) and are never sent to Bridge.
504
566
 
567
+ For a step-by-step OCAPI client setup guide (including the Business Manager permissions grant), see [docs/install/sfcc-integration.md](./docs/install/sfcc-integration.md).
568
+
505
569
  <details>
506
570
  <summary><strong>Setup</strong></summary>
507
571
 
508
- The two diagnostic tools (`sfcc_setup_status`, `check_permissions`) are always available. The seven read tools must be enabled with a profile (step 3).
572
+ The two diagnostic tools (`sfcc_setup_status`, `check_permissions`) are always available. The read tools, the write tools, and `sfcc_log_query` must be enabled with a profile (step 3). Changing `BRIDGE_MCP_PROFILE` requires an MCP client restart.
509
573
 
510
574
  **Prerequisites:** a running SFCC **sandbox** and its hostname, plus an Account Manager API client (`client-id` + `client-secret`).
511
575
 
@@ -540,7 +604,7 @@ Without this, only the diagnostic tools are registered.
540
604
  All SFCC tools are read-only and target a developer sandbox. Oversized responses are automatically saved to `BAPI_DOCS_DIR/sfcc/` and previewed inline.
541
605
 
542
606
  **Diagnostics** (always available, no profile needed)
543
- - `sfcc_setup_status` — report on every prerequisite: Bridge API key, repo name, `version` config, `dw.json` presence/uniqueness, and AM token acquisition.
607
+ - `sfcc_setup_status` — report on every prerequisite: Bridge API key, repo name, `version` config, `dw.json` presence/uniqueness, AM (OCAPI) token acquisition, and the independent **SFCC Log Query (WebDAV)** capability that gates `sfcc_log_query`.
544
608
  - `check_permissions` — probe OCAPI access via `GET /system_object_definitions`; on 401/403, print the exact OCAPI Settings JSON to paste in Business Manager (split read-only vs. write/import grants).
545
609
 
546
610
  **System object model** (needs the `sfcc` profile)
@@ -559,6 +623,14 @@ All SFCC tools are read-only and target a developer sandbox. Oversized responses
559
623
  - `site_preference_search` — search/filter preferences within a group.
560
624
  - `site_preference_values_set` — **write** (sandbox only): set custom preference values via `PATCH /site_preferences/preference_groups/{group}/sandbox` with a flat map of `c_`-prefixed ids to string/number/boolean/string[] values. A bad group returns 404 `CustomPreferenceGroupNotFoundException`; echoes grant JSON on 403.
561
625
 
626
+ **On-demand log query** (needs the `sfcc` profile)
627
+ - `sfcc_log_query` — query redacted, filtered SFCC logs on demand. `environment` and `time_range` (`start`/`end`) are **required** — production, "all environments", and an open-ended period are never inferred. The tool calls a Bridge backend endpoint that runs the pull → redaction → filter pipeline server-side and returns scoped, redacted findings; **WebDAV credentials, retrieval, redaction, and filtering all stay server-side and single-sourced.** It holds no credentials of its own.
628
+ - **Guardrails.** Selection is bounded by log-file `prefixes` (max 5), the time range, a scanned-entry cap (`max_entries`, ≤ 2000), a finding cap, and a per-snippet length cap. High-volume prefix classes (`info`, `jobs`, `debug`, `customdebug`) impose a **stricter 6-hour** max range (vs. 24h for the error class) because `info-*` runs ~1 MB/day versus `error-*` at ~13 KB median — a wide window over a high-volume prefix is **rejected**, never silently narrowed.
629
+ - **Response order.** Resolved scope (`environment`, `time_range`, `applied_prefixes`) and cap `status` first, redacted `findings` second, retrieval/truncation `metadata` last.
630
+ - **Statuses & errors.** `ready`, `no_matching_findings`, `results_truncated`; plus `VALIDATION_ERROR` (bad/oversized scope, caught before any network call), `NOT_CONFIGURED` (503 — the log capability isn't set up; run `sfcc_setup_status`, whose step 6 reports it), and `BAD_GATEWAY`/`SERVICE_UNAVAILABLE` on a retrieval/backend failure.
631
+ - **Auth is separate from OCAPI.** Log retrieval uses **HTTP Basic auth** — a Business Manager username + a **40-character WebDAV access key** — *not* the OCAPI Account Manager OAuth token the other SFCC tools use. A valid AM bearer token 401s on `/Logs`. `sfcc_setup_status` step 5 (AM/OCAPI token) and step 6 (WebDAV log access) are independent: one can be green while the other is not.
632
+ - **Local / air-gapped fallback.** The primary path above is the only path this tool takes. For air-gapped development, the documented fallback is Salesforce's own **`@salesforce/b2c-dx-mcp`** (`logs_list_files`, configured from `dw.json`) — it is vendor-maintained and reads log files over WebDAV, so it is strictly less work than shelling the B2C CLI (`b2c logs get --since <window> --search <q> --json`). It is **not** the primary path because its credentials live client-side and its output has **not** passed Bridge's redaction/filter. If you use it, its output must be treated as raw: route it back through the same server-side Python `LogSource` composition and `RedactionPort`/T3 filter workflow — never paste or relay unredacted `b2c-dx-mcp` or CLI output to an LLM.
633
+
562
634
  ## CLI Subcommands
563
635
 
564
636
  Beyond `--init` / `--upgrade`, the package ships operational subcommands of the **single `bridge-api-mcp-server` bin** (not separate binaries) — so they travel with the package to every consumer. See [Usage Documentation → Start Tickets](#tier-1--regularly-useful) for *when* to use `start-tickets`; this section is the full CLI reference.
@@ -593,7 +665,7 @@ npx -y @bridge_gpt/mcp-server start-tickets --agent cursor-agent BAPI-248
593
665
 
594
666
  **Difficulty-based model routing.** Before launching each agent, the CLI selects an implementation **model tier** from the ticket's `difficulty` (1-2 → cheap, 3-5 → basic, 6+ → premium) and injects it as a `--model` flag at the spawn boundary. The Python backend returns only the coarse tier (`GET /jira/tickets/{KEY}/model-tier`, computing + caching difficulty on demand); this CLI alone maps a tier to the agent-specific alias (`claude`: `haiku`/`sonnet`/`opus`; `cursor-agent`: version-suffixed strings validated against `cursor-agent --list-models`). It is gated per repo by `difficulty_model_routing_enabled` (default **ON**) with an optional `difficulty_model_tier_overrides` JSON map (tier → alias). Routing is **fail-open**: missing credentials, an evaluation failure/timeout, a backend `fallback`, an invalid/unavailable alias, an unadvertised Cursor model, or an agent without `--model` support all omit `--model` (the agent uses its default) and surface a per-ticket warning rather than failing the spawn. `--dry-run` does **not** fetch tiers or inject `--model`.
595
667
 
596
- **Conductor observability (opt-in via `--conductor`, BAPI-394).** Conductor is **off by default**. With `--conductor`, a run mints a conductor `run_id`, emits events into the local ledger (`~/.config/bridge/events.db`), opens a supervisor peer tab, and (for Claude Code) injects a secret-free lifecycle hook into each worktree; it also sets `BRIDGE_MCP_PROFILE=conductor` so workers get the conductor MCP tools. Observability is best-effort — a conductor failure never blocks a spawn, and `--dry-run` performs no conductor side effects. (Epic-tick dispatch always enables conductor internally.) See **[CONDUCTOR.md](./CONDUCTOR.md)** for the full observability, git-hook, done-gate, and auto-merge reference.
668
+ **Conductor observability (opt-in via `--conductor`, BAPI-394).** Conductor is **off by default**. With `--conductor`, a run mints a conductor `run_id`, emits events into the local ledger (`~/.config/bridge/events.db`), opens a supervisor peer tab, and (for Claude Code) injects a secret-free lifecycle hook into each worktree; it also sets `BRIDGE_MCP_PROFILE=conductor` so workers get the conductor MCP tools. Observability is best-effort — a conductor failure never blocks a spawn, and `--dry-run` performs no conductor side effects. (Epic-tick dispatch always enables conductor internally.) See **[CONDUCTOR.md](./docs/CONDUCTOR.md)** for the full observability, git-hook, done-gate, and auto-merge reference.
597
669
 
598
670
  **Cross-platform spawning.** The CLI routes spawning per platform; `--dry-run` previews the platform-correct command form on any OS. An unsupported `process.platform` (not `darwin`/`win32`/`linux`) fails fast with a clear "unsupported platform" message.
599
671
 
@@ -631,7 +703,7 @@ npx -y @bridge_gpt/mcp-server executor --repo <name>
631
703
 
632
704
  ### Conductor (epic & multi-agent orchestration)
633
705
 
634
- Conductor is an **opt-in, off-by-default** layer for epic supervision, inter-agent messaging, done-gate evaluation, local git-hook event producers, and conditional auto-merge. Its full reference — the v2 architecture (server-side reconciler + local executor), `setup-epic`, `conductor install-git-hooks`, the supervisor `done_gate_config` / `auto_merge_enabled` settings, and the observability stream — lives in **[CONDUCTOR.md](./CONDUCTOR.md)**.
706
+ Conductor is an **opt-in, off-by-default** layer for epic supervision, inter-agent messaging, done-gate evaluation, local git-hook event producers, and conditional auto-merge. Its full reference — the v2 architecture (server-side reconciler + local executor), `setup-epic`, `conductor install-git-hooks`, the supervisor `done_gate_config` / `auto_merge_enabled` settings, and the observability stream — lives in **[CONDUCTOR.md](./docs/CONDUCTOR.md)**.
635
707
 
636
708
  > The v1 `conductor epic-tick` command is **frozen** — it throws on every invocation. There is nothing to schedule locally, and `conductor doctor` flags any epic-tick schedule left over from an earlier release so you can cancel it.
637
709