Serve Glean skills over the MCP skills extension - #47
Open
aditya-scio wants to merge 1 commit into
Open
Conversation
Advertise the draft SEP-2640 skills extension
(`io.modelcontextprotocol/skills`) so hosts that import skills from the MCP
server — ChatGPT plugins — pick up the skills the signed-in user has in Glean,
instead of only the one skill packaged in the plugin directory.
- skills/list pages Glean's experimental Platform Skills API
(GET /api/skills, cursor-paginated) and, for each ENABLED skill, downloads
its bundle (GET /api/skills/{id}/content) to emit a catalog entry: a
skill://glean/<name>/SKILL.md uri, the full parsed SKILL.md frontmatter, and
every bundle file with a sha256 digest.
- skills/get returns one entry; resources/read serves the bytes (text for
UTF-8, blob otherwise) from an in-process cache, falling back to a bounded
crawl when the host reads a uri this process never listed.
- resources/list only reports what was already listed, so host startup never
triggers bundle downloads.
- src/zip.ts: minimal central-directory ZIP reader (stored + deflate) so
bundles need no new dependency.
Auth and origin reuse the token setup already captured; unconfigured or
signed-out sessions serve an empty catalog.
aditya-scio
requested review from
eshwar-sundar-glean,
garvit-scio,
mohit-gupta-glean and
swarup-padhi-glean
as code owners
August 3, 2026 21:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements OpenAI's Import skills from the MCP server flow, so hosts that import skills from the MCP server (ChatGPT plugins) pick up the skills the signed-in user has in Glean instead of only the one skill packaged under
plugins/glean/skills/.Skills come from the experimental Platform Skills API:
GET /api/skillsfor metadata (cursor-paginated),GET /api/skills/{id}/contentfor the bundle — same origin and bearer tokensetupalready captured, withX-Glean-Include-Experimental: true.Surface
capabilities.extensions["io.modelcontextprotocol/skills"]is advertised at initialize, alongsideresources(required to registerresources/read).skills/listcursormaps to the Platform API cursor. Each entry:skill://glean/<name>/SKILL.mduri, full parsed SKILL.md frontmatter, every bundle file with asha256:digest.skills/getresources/readtextfor UTF-8,blobotherwise. Served from an in-process cache, with a bounded crawl as fallback when the host reads a uri this process never listed.resources/listUnconfigured or signed-out sessions serve an empty catalog;
setupremains the only path that drives OAuth. Non-ENABLED, oversized (spec import limits: 256 KiB SKILL.md, 1 MiB/file, 5 MiB/skill, 100 files) and duplicate-named skills are skipped and logged toglean-server.log.Changes
src/skills-catalog.ts— catalog build, caching, and the three handlerssrc/zip.ts— minimal central-directory ZIP reader (stored + deflate), so bundles need no new dependencysrc/index.ts— capabilities + registrationzodpromoted to a direct dependency, imported aszod/v4to match the SDK's entrypoint (bundle grows ~25 KB, not ~400 KB)Verification
npm run typecheckclean;npm test201 passing (12 new intests/skills-catalog.test.ts, covering the zip reader, bundle normalization, digests, cursor passthrough, auth headers, skip/crawl paths)skills/list→skills/get→resources/read, wrapper directory stripped, advertised digests matching the served bytesNotes
🤖 Generated with Claude Code