Skip to content

feat(mcp): JFrog Platform remote MCP (token auth) + install hint#19

Merged
michaelfrog merged 4 commits into
mainfrom
feat/jfrog-remote-mcp
Jun 29, 2026
Merged

feat(mcp): JFrog Platform remote MCP (token auth) + install hint#19
michaelfrog merged 4 commits into
mainfrom
feat/jfrog-remote-mcp

Conversation

@michaelfrog

Copy link
Copy Markdown
Collaborator

Summary

Adds the JFrog Platform remote MCP to the OpenCode plugin (token auth, headless), on top of the skills work (#16). When JFROG_URL + JFROG_ACCESS_TOKEN are set, the plugin registers config.mcp.jfrog so the JFrog platform tools appear in OpenCode alongside the skills.

What changed

  • Remote MCP injection in the config hook: config.mcp.jfrog → remote https://<host>/mcp, oauth:false, Authorization: Bearer <token>. Env-gated (host and token required), host precedence JFROG_URLJF_URLJFROG_PLATFORM_URL + scheme/trailing-slash normalization, idempotent (never clobbers a user-defined jfrog), JFROG_MCP_DISABLE opt-out. No network on load.
  • Token handling: OpenCode does not expand {env:…} in config a plugin injects at runtime, so the plugin reads the token from the environment and sets the resolved Bearer <token> header directly. The token lives in the in-memory session config (sourced from env); the plugin never writes it to disk. Prefer a short-lived jf atc token.
  • Install-jf hint: a tool.execute.before hook nudges once/session to install the CLI when jf is missing and a jf command runs. MCP setup problems (missing env, non-JWT token, 401) are surfaced by OpenCode's own mcp list/TUI + the README — a WARNING line is logged (debug) for a non-JWT token.
  • Functional refactor + tests: pure helpers (resolveMcpCredentials, mcpServerEntry, commandExists, looksLikeJwt); unit tests for registration, gating, idempotency, host/token precedence + normalization, reference-token-still-registers, and the install hint.
  • README: JFrog Platform MCP section — prerequisites (JWT not reference token), token handling, context cost, opt-out, and 401 troubleshooting.

Verification

  • lint / typecheck / test (26 pass) / build green; sync-skills:check + pack:check pass.
  • Manual: with a JWT → opencode mcp list shows ✓ jfrog connected + jfrog_* tools; reference token → 401 (surfaced by OpenCode) + debug WARNING; no env → not registered; JFROG_MCP_DISABLE=true → not registered.

Notes

  • The JFrog MCP exposes 56 tools (+32K tokens/request; OpenCode has no lazy tool loading). Enabled by default for parity with the Cursor/Claude plugins; opt out with JFROG_MCP_DISABLE=true or scope via tools globbing.
  • Squash-merge recommended.

michaelfrog and others added 3 commits June 24, 2026 09:58
In the same config hook that registers the vendored skills, inject
config.mcp.jfrog as an OpenCode remote MCP at https://<host>/mcp when both a
host (JFROG_URL / JF_URL / JFROG_PLATFORM_URL) and a token env (JFROG_ACCESS_TOKEN
/ JF_ACCESS_TOKEN) are present and JFROG_MCP_DISABLE is not set.

- Token auth, headless: oauth:false + Authorization: "Bearer {env:<TOKEN_VAR>}".
  The {env:} reference keeps the raw token out of the config (logs/state/rotation).
- Idempotent and non-destructive: never clobbers a user-defined mcp.jfrog.
- URL normalization (strip scheme + trailing slash); pure sync mutation, no
  network on load. Skips cleanly (log only) when unconfigured.
- Tests cover the full matrix; README documents setup, the JWT-token requirement,
  and the JFROG_MCP_DISABLE opt-out.

Co-authored-by: Cursor <cursoragent@cursor.com>
Default-on for parity with the Cursor/Claude plugins; note the ~32K (OpenCode) / ~44K (Cursor) per-request tool-schema cost and the JFROG_MCP_DISABLE / tools scoping escape hatches. Skills do not carry this cost.

Co-authored-by: Cursor <cursoragent@cursor.com>
…r + tests

- Inject the resolved Bearer token directly (OpenCode does not expand {env:} in
  plugin-injected config), so the JFrog MCP actually authenticates headlessly.
- Just-in-time install-jf hint via tool.execute.before; MCP setup issues
  (missing env, non-JWT token, 401) are surfaced by OpenCode's mcp list/TUI and
  the README, with a debug WARNING for non-JWT tokens.
- Functional refactor (pure helpers) + unit tests for registration, gating,
  idempotency, host/token precedence + normalization, and the install hint.
- README: JFrog MCP prerequisites, token handling, context cost, 401 troubleshooting.

Co-authored-by: Cursor <cursoragent@cursor.com>

@YoniMelki YoniMelki left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 findings, 2 confirmed bugs + 2 design issues:

  • Windows commandExists (line 53): split(':') hardcodes Unix PATH separator; .exe/.cmd extension not probed. hasJfCli is always false on Windows.
  • Silent http://https:// upgrade (line 97): normalizeHost strips scheme, mcpServerEntry hardcodes https://. On-prem HTTP instances get a broken MCP URL with no warning.
  • No dedup guard on error toast (line 115): The nudgeShown guard was removed with the info toast, but the broken-package error toast has no equivalent — it fires on every config call.
  • registerMcp skipped when skills broken (line 196): Two independent features are coupled; a missing skills/ dir silently prevents MCP registration.

Comment thread src/index.ts Outdated
Comment thread src/index.ts Outdated
Comment thread src/index.ts Outdated
Comment thread src/index.ts Outdated
…toast dedup, skills/MCP decoupling

- commandExists: use path.delimiter and probe Windows .exe/.cmd/.bat
- MCP base URL: preserve explicit http://, default https://, strip trailing slash
- skills-not-found error toast/log deduped via module-level guard (once per session)
- config hook registers skills and MCP unconditionally (independent features)

Co-authored-by: Cursor <cursoragent@cursor.com>
@michaelfrog michaelfrog merged commit 5948dae into main Jun 29, 2026
3 checks passed
@michaelfrog michaelfrog deleted the feat/jfrog-remote-mcp branch June 29, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants