Skip to content

feat: fold glean-vnext runtime MCP server into the glean plugin - #3

Open
eshwar-sundar-glean wants to merge 9 commits into
mainfrom
eshwar/glean-vnext-fold-into-glean
Open

feat: fold glean-vnext runtime MCP server into the glean plugin#3
eshwar-sundar-glean wants to merge 9 commits into
mainfrom
eshwar/glean-vnext-fold-into-glean

Conversation

@eshwar-sundar-glean

@eshwar-sundar-glean eshwar-sundar-glean commented Jul 25, 2026

Copy link
Copy Markdown

Summary

Moves the glean-vnext runtime MCP server out of glean-experimental-plugins into this repo as a source plugin (sources/glean-vnext/) and folds it into the existing glean emitted plugin via the from: array for claude/cursor/codex. The shipped glean plugin now coexists with the portable skills: it bundles a local stdio MCP server (glean-local) exposing find_skills/run_tool/setup, the glean_run skill, and an auto-approve PreToolUse hook. Users may still connect a remote Glean MCP server; the local server is named glean-local to avoid a name clash.

Draft PRs

What changed

  • sources/glean-vnext/ — new source plugin: plugin.pluginpack.json (additionalFiles map), .mcp.json (base), targets/codex/.mcp.json (codex override), start.mjs, runtime package.json, src/ (15 TS), build.mjs (esbuild), tests/ (14 vitest), skills/glean_run, hooks/.
  • pluginpack.config.tsglean-vnext added to each glean from:; hooks added to claude/cursor components.
  • package.jsonbuild:bundle chained into prebuild; test:bundle/typecheck:bundle; server deps + esbuild/vitest/tsx/typescript; CVE overrides.
  • Hook — server env lookup checks mcpServers["glean-local"] first (fixes prod bug from rename).

Tests

  • npm test green (69/65/56 managed files).
  • npm run test:bundle 189/189.
  • typecheck:bundle clean.

Requires pluginpack ^0.9.0

Depends on gleanwork/pluginpack#11 (additionalFiles + per-target .mcp.json override), published as 0.9.0. This repo now depends on ^0.9.0 directly — no npm link needed.

The pluginpack-action runs npx pluginpack build directly (not npm run build), so the repo prebuild never fires. sources/glean-vnext/dist/index.js is gitignored, so publish.yml's publish job runs npm run build:bundle explicitly before the sync action.

Release CI verified end-to-end

Dispatched publish.yml on this branch in sync mode. All three matrix jobs passed (Install → Build server bundle → Resolve pinned pluginpack version (0.9.0) → Mint token → Sync), and gleanwork/pluginpack-action opened one machine-owned pluginpack/sync-<target> PR per output repo (never pushed to their default branches).

Workflow run: https://github.com/gleanwork/agent-plugins/actions/runs/30330444116

Target Output repo Sync PR hooks/
claude gleanwork/claude-plugins gleanwork/claude-plugins#37
cursor gleanwork/cursor-plugins gleanwork/cursor-plugins#10 — (vnext disabled for cursor for now)
codex gleanwork/codex-plugins gleanwork/codex-plugins#2 — (by design)
  • claude: full vnext runtime — .mcp.json, dist/index.js, start.mjs, package.json, skills/glean_run/, plus hooks/.
  • cursor: vnext is not emitted for now — cursor ships only the portable skills (dropped glean-vnext from its from: and the hooks component).
  • codex: same runtime with 0 hooks files — per-target components config working as designed.
  • Per-target MCP override: codex .mcp.jsonargs: ["./start.mjs"] + "cwd": "."; claude → args: ["${CLAUDE_PLUGIN_ROOT}/start.mjs"]. Local server named glean-local in both.

Testing doc

The manual test workflow (Claude/Cursor/Codex) is maintained as a separate handoff artifact outside this repo (not product content), alongside the pluginpack dataflow doc.

Sequence diagrams

Build time — vnext folded into the glean plugin

sequenceDiagram
    participant Dev as developer
    participant PB as npm test
    participant Pre as prebuild<br/>build:bundle (esbuild)
    participant PP as pluginpack build
    participant Merge as glean = from[glean-lib, shared, <target>, glean-vnext]

    Dev->>PB: npm test
    PB->>Pre: esbuild src/ -> sources/glean-vnext/dist/index.js
    Pre-->>PB: bundle ready
    PB->>PP: pluginpack build (per target)
    PP->>Merge: merge source plugins into one glean plugin
    Note over Merge: skills: 18 portable + glean_run<br/>files: dist/index.js, start.mjs, package.json<br/>.mcp.json: glean-local (codex override = ./start.mjs + cwd)<br/>hooks: claude/cursor only
    Merge-->>PP: emitted glean plugin
    PP-->>Dev: dist/{claude 65, cursor 69, codex 56} + Validation passed
Loading

Runtime — local server in the host (Claude/Cursor/Codex)

sequenceDiagram
    actor User
    participant Host as Host (Claude Code)
    participant Launch as start.mjs
    participant Srv as dist/index.js<br/>glean-local MCP server
    participant Hook as auto-approve hook
    participant Glean as Glean backend

    Host->>Launch: node ${CLAUDE_PLUGIN_ROOT}/start.mjs
    Launch->>Srv: import dist/index.js (stdio)
    Srv-->>Host: tools: find_skills, run_tool, setup (state: unconfigured)

    User->>Host: "set up Glean, email me@acme.com"
    Host->>Srv: setup({email})
    Srv->>Glean: resolve Server URL -> OAuth (browser) -> fetch tool catalog
    Glean-->>Srv: tokens + remote tools
    Srv-->>Host: configured (dynamic tools > 0)

    User->>Host: "find a skill / run it"
    Host->>Srv: find_skills -> run_tool
    Host->>Hook: PreToolUse(run_tool)
    Note over Hook: ENABLE_HITL=true -> auto-approve<br/>(HITL elicitation is the single gate)
    Hook-->>Host: allow (no native prompt)
    Srv->>Glean: execute tool
    Glean-->>Host: result
Loading

Add sources/glean-vnext/ as a source plugin and merge it into the existing
`glean` emitted plugin (from: array) for claude/cursor/codex. The shipped
`glean` plugin now coexists with the portable skills: it bundles a local
stdio MCP server (glean-local) exposing find_skills/run_tool/setup, the
glean_run skill, and an auto-approve PreToolUse hook. A user may still
connect a remote Glean MCP server separately; the local server is named
glean-local to avoid clashing with a remote glean.

Source plugin layout (sources/glean-vnext/):
  - plugin.pluginpack.json: files map (dist/index.js, start.mjs, package.json)
  - .mcp.json: base config (glean-local, \${CLAUDE_PLUGIN_ROOT}/start.mjs)
  - targets/codex/.mcp.json: codex override (./start.mjs + cwd ".")
  - src/ (15 TS files) + build.mjs: server source + esbuild bundler
  - tests/ (14 vitest files): server unit tests
  - skills/glean_run, hooks/, start.mjs, package.json (runtime)

Build wiring:
  - build:bundle runs esbuild (src -> sources/glean-vnext/dist/index.js)
  - prebuild now chains sync-changelog && build:bundle before pluginpack build
  - test:bundle / typecheck:bundle run the server suite scoped to the source dir
  - deps: @modelcontextprotocol/sdk, yaml (runtime); esbuild, tsx, typescript,
    vitest, @types/node (dev); overrides pin hono/esbuild/vite for CVEs

config (pluginpack.config.ts):
  - claude glean: from += glean-vnext, components += hooks
  - cursor glean: from += glean-vnext, components += hooks
  - codex glean:  from += glean-vnext (no hooks; matches existing codex shape)

Hook: server env lookup now checks mcpServers["glean-local"] first, falls back
to the legacy "glean" key.

Tests: npm test (build+validate) green (69/65/56 managed files);
npm run test:bundle 189/189; typecheck clean.

Requires @gleanwork/pluginpack@^0.8.0 (per-target MCP override + plugin-root
files features). Until published, use npm link @gleanwork/pluginpack against
the pluginpack branch.
@eshwar-sundar-glean
eshwar-sundar-glean force-pushed the eshwar/glean-vnext-fold-into-glean branch from 0f08d41 to 8508c28 Compare July 27, 2026 11:00
Relocated to a personal docs folder (Desktop/docs/pluginsUnification) alongside
the pluginpack-dataflow companion doc; it is a handoff/testing artifact, not
product content that belongs in the plugin source repo.
@eshwar-sundar-glean
eshwar-sundar-glean marked this pull request as ready for review July 27, 2026 16:28
Match the pluginpack review rename (gleanwork/pluginpack#11): the plugin-root
files map key is now `additionalFiles`. npm test green (69/65/56).
…tures)

pluginpack 0.9.0 shipped the per-target MCP override + additionalFiles
features (gleanwork/pluginpack#11). Bump the dep off ^0.7.0 so `npm ci` in
publish.yml installs 0.9.0 and the pluginpack-action builds each target's
payload WITH the vnext runtime files/MCP. Removes the local npm-link workaround
entirely. npm test green against the published version (69/65/56).
The pluginpack-action runs `npx pluginpack diff/build` directly, not
`npm run build`, so the repo prebuild (esbuild) never fires. Since
sources/glean-vnext/dist/index.js is gitignored, add an explicit build:bundle
step in the publish job or pluginpack's additionalFiles source read fails for
every target. (The validate job already builds it via npm test.)
@eshwar-sundar-glean

Copy link
Copy Markdown
Author

Release CI verified end-to-end (build → per-target payload → sync PRs)

Dispatched publish.yml on this branch in sync mode. All three matrix jobs passed (Install → Build server bundle → Resolve pinned pluginpack version (0.9.0) → Mint token → Sync), and the gleanwork/pluginpack-action opened one machine-owned pluginpack/sync-<target> PR per output repo (never pushed to their default branches).

Workflow run: https://github.com/gleanwork/agent-plugins/actions/runs/30330444116

Target Output repo Sync PR hooks/
claude gleanwork/claude-plugins gleanwork/claude-plugins#37
cursor gleanwork/cursor-plugins gleanwork/cursor-plugins#10
codex gleanwork/codex-plugins gleanwork/codex-plugins#2 — (by design)

Payload verified in the emitted output

  • claude / cursor: full vnext runtime — .mcp.json, dist/index.js, start.mjs, package.json, skills/glean_run/, plus hooks/ (auto-approve + hooks.json).
  • codex: same runtime with 0 hooks files — per-target components config working as designed.

Both pluginpack 0.9.0 features exercised for real

  • Per-target MCP override: codex .mcp.jsonargs: ["./start.mjs"] + "cwd": "."; claude → args: ["${CLAUDE_PLUGIN_ROOT}/start.mjs"]. Local server named glean-local in both.
  • additionalFiles: the bundled server files land at each plugin root, built in CI by the Build server bundle step (the pluginpack-action runs npx pluginpack build directly, so the repo prebuild is added explicitly in the publish job).

Note: each sync PR also carries pending updates to the existing using-glean / using-glean-productivity skills and CHANGELOGs — pre-existing drift between this repo and the install repos, not introduced by vnext.

— sent via Glean Pi

Comment thread .github/workflows/publish.yml Outdated
Drop glean-vnext from the cursor glean plugin's `from:` and remove the
now-orphaned `hooks` component. Cursor ships only the portable skills; claude
and codex still bundle the local runtime server + hooks + glean_run skill.
npm test green (cursor 62, claude 65, codex 56).
Comment thread .gitignore
# Generated build output (published to the target repos by CI)
dist/
# glean-vnext runtime MCP server bundle (regenerated by build:bundle / prebuild)
sources/glean-vnext/dist/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

references to vnext should go away now

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