You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-2Lines changed: 16 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,19 @@ Skills are vendored from [jfrog/jfrog-skills](https://github.com/jfrog/jfrog-ski
18
18
19
19
## JFrog MCP Gateway integration
20
20
21
-
When the plugin is enabled, every Claude Code session starts with the rules in [`templates/jfrog-mcp-management.md`](templates/jfrog-mcp-management.md) injected into the model's context (via the [`additionalContext`](https://docs.anthropic.com/en/docs/claude-code/hooks#sessionstart)`SessionStart` hook output). **No instructions file is written to your repo** — the rules live only in the plugin and reach the model directly through the hook.
21
+
When the plugin is enabled, every Claude Code session starts by asking the JFrog MCP Gateway whether the current tenant is entitled to the AI Catalog feature (`npx @jfrog/mcp-gateway --should-inject`). If the gateway returns **entitled**, the rules in [`templates/jfrog-mcp-management.md`](templates/jfrog-mcp-management.md) are injected into the model's context via the [`additionalContext`](https://docs.anthropic.com/en/docs/claude-code/hooks#sessionstart)`SessionStart` hook output. **No instructions file is written to your repo** — the rules live only in the plugin and reach the model directly through the hook.
22
+
23
+
The check fails closed: anything other than a clean "entitled" response (entitlement denied, no JFrog server resolvable, network/`npx` failure, timeout) skips the injection so the plugin stays inert when the gateway can't authoritatively say "yes".
24
+
25
+
You can short-circuit the check with the `JF_MCP_GATEWAY_FORCE_ENABLE` env var in the shell that launches Claude Code — this is mainly for tests, demos, and air-gapped setups:
26
+
27
+
| Value | Effect |
28
+
| --- | --- |
29
+
|`true`| Always inject the instructions; skip the entitlement check entirely. |
30
+
|`false`| Never inject; skip the entitlement check entirely. |
31
+
| unset / anything else | Run `--should-inject` and respect its decision (default). |
32
+
33
+
Set `JF_MCP_GATEWAY_DEBUG=1` to have the hook log its decision to stderr (visible in Claude Code's logs panel) for troubleshooting.
22
34
23
35
The rules tell Claude to:
24
36
@@ -27,7 +39,9 @@ The rules tell Claude to:
27
39
- Write the entry to **`.mcp.json` (project scope) by default** — creating the file if it doesn't exist — so the entry stays alongside the project and the team can share it via git. Only fall back to `~/.claude.json` (user scope) when you ask for it explicitly. Either way, secrets stay out of the file via `${ENV_VAR}` expansion (Claude Code has no native interactive secret prompt).
28
40
- Run the gateway's `--login` automatically for OAuth-only remote MCPs.
29
41
30
-
After a new MCP entry is written, you must (1) **export every `${VAR}` referenced by the entry** in the shell that will launch Claude Code so the gateway has them at server-start time (an unset variable shows as `[Contains warnings]` in `/mcp` — informational only — and any tool call needing that value will fail at runtime), (2) **quit and relaunch Claude Code** in the same directory, and (3) **approve the server** at the `Approve MCP server <name> from .mcp.json?` prompt. Claude Code only reads `mcpServers` at session start, and `.mcp.json` entries require explicit per-project approval (stored under `projects.<cwd>.enabledMcpjsonServers` in `~/.claude.json`). The "Project MCPs (.../.mcp.json)" section in `/mcp` only appears once at least one server in the file is approved. Verify with `/mcp` or `claude mcp list`.
42
+
After a new MCP entry is written, you must (1) **export every `${VAR}` referenced by the entry** in the shell that will launch Claude Code so the gateway has them at server-start time (an unset variable shows as `[Contains warnings]` in `/mcp` — informational only — and any tool call needing that value will fail at runtime), and (2) **quit and relaunch Claude Code** in the same directory. The first time you launch in a project, Claude Code prompts you both for workspace trust and once per `.mcp.json` server (`Approve MCP server <name> from .mcp.json?`); accept each one. On subsequent launches the `mcpServers` block loads silently. Verify with `/mcp` (under "Project MCPs (.../.mcp.json)") or `claude mcp list`.
43
+
44
+
Note: in Claude Code v2.1.x, per-project approve/reject decisions are persisted in **`<cwd>/.claude/settings.local.json`** (`enabledMcpjsonServers` / `disabledMcpjsonServers`), **not** in `~/.claude.json`. `claude mcp reset-project-choices` and deleting `projects.<cwd>` from `~/.claude.json` do **not** touch that file, so a previously-rejected `.mcp.json` server stays silently disabled and is never re-prompted. To re-enable it, edit `<cwd>/.claude/settings.local.json`, remove the entry from `disabledMcpjsonServers`, append it to `enabledMcpjsonServers`, and relaunch.
31
45
32
46
To **enforce** the gateway as the only allowed transport in a project, add an `allowedMcpServers` policy to `.claude/settings.json`:
0 commit comments