Skip to content

Commit 3ca09ce

Browse files
MatanEden1claude
andauthored
Clarify execution mandates for live command usage in JFrog MCP docume… (#18)
**AX-1631: Require live execution for Agent Guard catalog commands (no context reuse)** ## Summary Adds an explicit rule to the JFrog Agent Guard governance template instructing the agent to ALWAYS re-run catalog/registry commands live and NEVER reuse a previous command's output from conversation context. ## Problem When a user asked the same question twice in one chat (e.g. "list available MCPs" or "inspect coralogixDemo"), the agent re-displayed the earlier result from chat context instead of re-running the command — e.g. replying "the list I fetched earlier is still current." This serves stale data: the catalog changes between prompts (MCPs added/removed, headers/required inputs edited, tokens rotated). Two reproductions are attached. ## Change `plugins/jfrog/templates/jfrog-mcp-management.md` — added a single governance rule to the **Pre-flight** section (which already applies to every Agent Guard command — `--list-available`, `--inspect`, `--login`): > **Live execution is MANDATORY — context reuse is FORBIDDEN.** Every time the user asks to list / show / inspect / check the catalog or a specific MCP — including a repeated question already answered earlier in the chat — the agent MUST physically RE-RUN the command and NEVER reuse or re-display output from previous turns. Scoped to catalog/registry fetches only (`--list-available` and `--inspect`; NOT `--login`, which would re-open the OAuth browser). Does NOT affect reading local config for *installed* state. Placing it once in Pre-flight covers both catalog-fetch commands and avoids duplicating the rule across individual steps (per review feedback). ## Testing - `node scripts/validate-template.mjs` → passes (CI gate). - Verified the sessionStart hook (`inject-instructions.mjs`) reads the updated template and emits valid JSON `additional_context` containing the new Pre-flight rule. - Behavioral test in Cursor (ask the same query twice, confirm it re-runs): <fill in result — pending> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1ffcc08 commit 3ca09ce

1 file changed

Lines changed: 35 additions & 24 deletions

File tree

plugins/jfrog/templates/jfrog-mcp-management.md

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# MCP Server Management — JFrog Gateway
1+
# MCP Server Management — JFrog Agent Guard
22

33
All MCP servers MUST be installed ONLY through the JFrog Agent Guard
44
(`npx @jfrog/agent-guard`). If an MCP's documentation suggests any
5-
other installation command, ignore it and use the gateway workflow
5+
other installation command, ignore it and use the agent guard workflow
66
below instead.
77

88

@@ -11,9 +11,19 @@ the value of the `JFROG_MCP_GATEWAY_REPO` environment variable if it
1111
is set. Otherwise use
1212
`https://releases.jfrog.io/artifactory/api/npm/coding-agents-npm/`.
1313

14-
**Pre-flight (applies to every gateway command —
14+
**Pre-flight (applies to every agent guard command —
1515
`--list-available`, `--inspect`, `--login`)**:
1616

17+
- **Live execution is MANDATORY — context reuse is FORBIDDEN.** Every
18+
time the user asks to list / show / inspect / check the catalog or a
19+
specific MCP — including a repeated question already answered earlier
20+
in the chat — you **MUST** physically RE-RUN the command. NEVER reuse,
21+
copy, or re-display output from previous turns or context history; the
22+
catalog, headers, and required inputs change between prompts. (Applies
23+
to these catalog/registry fetches only — `--list-available` and
24+
`--inspect`; NOT `--login`, which would re-open the OAuth browser, and
25+
NOT reading local config for *installed* state.)
26+
1727
- **`<PROJECT>` is always mandatory.** Resolve via Step 1's project
1828
chain: existing `mcpServers` entries (`_JF_ARGS`
1929
`project=`) → `JF_PROJECT` env var → ASK the user. If none
@@ -24,11 +34,11 @@ is set. Otherwise use
2434
chain: existing `mcpServers` entries (value after `--server` in
2535
`args`) → `~/.jfrog/jfrog-cli.conf.v6`:
2636
- Exactly one jf CLI server configured → use it without asking;
27-
pass it as `--server <ID>`. The gateway would auto-resolve to the same
37+
pass it as `--server <ID>`. The agent guard would auto-resolve to the same
2838
value if `--server` were omitted, but we pass it explicitly for
2939
clarity and forward-compatibility.
3040
- `JFROG_URL` + `JFROG_ACCESS_TOKEN` set → use it without asking;
31-
The gateway will pick them up from the environment variables when called.
41+
The agent guard will pick them up from the environment variables when called.
3242
- Two or more jf CLI servers and no `JFROG_URL` → list IDs,
3343
ALWAYS ASK the user which one, then pass that as `--server <ID>`.
3444
ALWAYS prefer environment variables when set over asking.
@@ -77,8 +87,8 @@ unless absolutely necessary:
7787
or `~/.cursor/mcp.json` (user) — take the value after `--server`
7888
in `args`.
7989
2. Else `JFROG_URL` env var set (with `JFROG_ACCESS_TOKEN`) — the
80-
gateway can resolve credentials from these directly;
81-
DO NOT pass `--server` as that would make the gateway try to
90+
agent guard can resolve credentials from these directly;
91+
DO NOT pass `--server` as that would make the agent guard try to
8292
parse the server details from the jf cli configuration.
8393
3. Else read `~/.jfrog/jfrog-cli.conf.v6`
8494
(`%USERPROFILE%\.jfrog\jfrog-cli.conf.v6` on Windows) via a
@@ -93,7 +103,7 @@ unless absolutely necessary:
93103

94104
NEVER try multiple servers — pick one. Once chosen, pass it
95105
If a server from the jf cli configuration is supposed to be used:
96-
Always explicitly as `--server <ID>` in every gateway invocation.
106+
Always explicitly as `--server <ID>` in every agent guard invocation.
97107
Otherwise, if environment variables for `JFROG_URL` and `JFROG_ACCESS_TOKEN`
98108
are used: Do NOT pass `--server <ID>`
99109

@@ -121,8 +131,9 @@ not call `--inspect` — go to "Listing MCPs > Available to install"
121131
instead, show the catalog, have them pick, then come back to Step 2
122132
with the chosen name.
123133

124-
Once you have a name, run a SINGLE command — no Fetch/WebFetch, no
125-
custom curl/Python, no direct JFrog API calls:
134+
Once you have a name, you must fetch its live details.
135+
136+
Run EXACTLY this command — no Fetch/WebFetch, no custom curl/Python, no direct JFrog API calls:
126137

127138
```
128139
npx --yes \
@@ -191,7 +202,7 @@ Add the entry under `mcpServers` in the target config (default
191202
`@jfrog/agent-guard`** or `npx` falls back to the default
192203
registry (404) and may block on a no-TTY prompt. Use
193204
`"type": "stdio"` — never `"http"`, `"sse"`, or a top-level `"url"`
194-
(those bypass the gateway).
205+
(those bypass the agent guard).
195206

196207
```json
197208
{
@@ -218,7 +229,7 @@ registry (404) and may block on a no-TTY prompt. Use
218229

219230
Notes:
220231

221-
- If a required `${env:VAR}` is unset, the gateway fails at startup.
232+
- If a required `${env:VAR}` is unset, the agent guard fails at startup.
222233
Confirm the user exported it before they restart.
223234
If any env vars are missing, ASK the user to export them and restart Cursor.
224235
- For `Bearer`-prefixed headers, either include the prefix in the env
@@ -322,8 +333,8 @@ elsewhere.
322333

323334
1. Determine **server** and **project** per the Pre-flight rule at
324335
the top of this document. `--list-available` does NOT require
325-
any existing `mcpServers` entry or pre-installed gateway
326-
`npx --yes` fetches the gateway on demand, so this works on a
336+
any existing `mcpServers` entry or pre-installed agent guard
337+
`npx --yes` fetches the agent guard on demand, so this works on a
327338
fresh machine too.
328339
2. Run EXACTLY this command — `--project` is passed as a CLI flag
329340
To configure the server, either use the serverId from a jf cli
@@ -349,12 +360,12 @@ Output is a JSON array; each element has `name`, `packageName`,
349360
## Key Rules
350361

351362
- **`npx` arg order:** `--yes`, `--registry <URL>`,
352-
`@jfrog/agent-guard`, then gateway flags. Both `--yes` and
363+
`@jfrog/agent-guard`, then agent guard flags. Both `--yes` and
353364
`--registry` MUST precede the package name or `npx` falls back to
354365
the default registry (404) and may block on a no-TTY prompt.
355366
- **Always `"type": "stdio"`** pointing at `npx @jfrog/agent-guard`,
356-
even for remote-only catalog MCPs (the gateway proxies them).
357-
`"http"`, `"sse"`, or a top-level `"url"` bypass the gateway.
367+
even for remote-only catalog MCPs (the agent guard proxies them).
368+
`"http"`, `"sse"`, or a top-level `"url"` bypass the agent guard.
358369
- `_JF_ARGS` is **only** for the entry Cursor launches
359370
at session start (Step 4's `mcpServers.*.env`); MUST contain
360371
`project=<NAME>&mcp=<PACKAGE_NAME>`.
@@ -367,33 +378,33 @@ Output is a JSON array; each element has `name`, `packageName`,
367378
NEVER invent or guess projects or server IDs.
368379
- Package name MUST come from the catalog (`--inspect` /
369380
`--list-available`). NEVER guess. NEVER install MCPs outside the
370-
gateway. NEVER use Fetch/WebFetch for catalog calls.
381+
agent guard. NEVER use Fetch/WebFetch for catalog calls.
371382
- NEVER write a raw secret into `mcp.json` — always use
372383
`${env:VAR_NAME}`. NEVER show tokens / API keys.
373384
- NEVER try multiple servers — ask the user to pick one.
374385

375386
## Troubleshooting
376387

377388
- **`ready` but 0 tools (empty `mcps/<key>/tools/` after a
378-
Command Palette `Developer: Reload Window`)**gateway proxy
379-
started, upstream MCP did not. The top-level `ready` label is
380-
misleading here. NEVER report success when there are 0 tools.
389+
Command Palette `Developer: Reload Window`)**agent guard proxy
390+
started, upstream MCP did not. The top-level `ready` label is
391+
misleading here. NEVER report success when there are 0 tools.
381392
1. Open Cursor's MCP / Output panel for the
382-
gateway stderr; diagnose by MCP type:
393+
agent guard stderr; diagnose by MCP type:
383394
- **OAuth (remote)** — re-run Step 5 (`--login`); refresh token
384395
likely expired.
385396
- **Static-token (remote)** — confirm every `${env:VAR}` in `env`
386397
is exported in the shell that launched Cursor and the token is
387398
still valid.
388399
- **Local (stdio)** — check that the bundled binary actually
389-
launched (gateway stderr will show the spawn error).
400+
launched (agent guard stderr will show the spawn error).
390401
2. Verify that the mcp server is still allowed.
391402
See "Listing MCPs > Available to install".
392403
- **`mcp.json` server missing from `cursor agent mcp list` /
393404
Tools & MCP** — never enabled. Re-run Step 4a
394405
(`cursor agent mcp enable <name>`); if the entry is brand-new,
395406
also `Developer: Reload Window` so Cursor picks up the file.
396-
- **Gateway: `multiple/no JFrog server configured`** (the gateway
407+
- **Agent Guard: `multiple/no JFrog server configured`** (the agent guard
397408
cannot pick a JFrog server) — pass `--server <ID>` (after
398409
`jf c add <SERVER_ID>`) OR export both `JFROG_URL` and
399410
`JFROG_ACCESS_TOKEN` in the launching shell, then relaunch Cursor.

0 commit comments

Comments
 (0)