Skip to content

feat(mcp): serve skills over MCP (SEP-2640) with a tool fallback - #431

Merged
runkids merged 26 commits into
mainfrom
runkids/428-mcp-serve-skills
Oct 6, 2026
Merged

runkids merged 26 commits into
mainfrom
runkids/428-mcp-serve-skills

Conversation

@runkids

@runkids runkids commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)

None of these fit: this is a feature implementation by the maintainer.

Linked Issue

Closes #428

What changes

skillshare mcp serve — a read-only MCP server for the skills skillshare already manages, for Agents that can reach an MCP endpoint but not the synced folders (VMs, hosted assistants, MCP gateways).

  • Implements the Skills extension (io.modelcontextprotocol/skills, SEP-2640) on go-sdk v1.8.0: skills/list (cursor pagination, whole entries), skills/get (-32602 for unknown URIs), resources/read, declared through server/discover.
  • Each entry: URI from the source path (skill://_team/tools/pdf/SKILL.md), the full frontmatter, and every file with a sha256 digest and size.
  • --target NAME applies that target's selection; global by default, -p for a project. The source is reread at most every 5 s, hashing every file again (size and mtime cannot prove a file unchanged).
  • Skips, with a warning, skills the extension cannot carry: a name that breaks the Agent Skills rules or differs from its directory, more than 512 files / 16 MiB, or a nested skill that is not served. --check lists them without serving (this replaces the audit check suggested in the issue, which made audit output noisy).
  • stdio by default; --http ADDR serves Streamable HTTP and requires SKILLSHARE_MCP_TOKEN off loopback. Reads are confined to listed files inside the skill directory.
  • Tool fallback: most clients do not support the extension yet (as of October 2026: Codex, Cursor, VS Code, Goose and Pi 1.0.4 have none; Claude Code 2.1.278 ships it switched off). The server also offers list_skills and read_skill, hidden from any client that declares the extension, so it never sees a skill twice. This also makes the skills reachable through a gateway that passes tools on, such as Executor today.

Dashboard — Add server gets a Skillshare tab: name, which skills (all, or one target's selection) and the Agents, with the command shown read-only. Agents that already get skills by sync are marked, and ticking one warns that it would see each skill twice. Editing such a server reopens the tab.

Refactor — sync.SelectTargetSkills (enabled → include/exclude → frontmatter targets) replaces ten repeated FilterSkills + FilterSkillsByTarget call sites in status, doctor, diff, analyze, sync naming, the dashboard handlers and mcp serve. Callers that did not drop disabled skills get discoveries without them, so their output is unchanged.

Devcontainer — ensure-agent-clis.sh now pins Pi to 1.0.4 and reinstalls when the volume holds another version; it previously never upgraded, which left 0.99.2 in place. Included because it was used to verify this change.

Checks run

  • make check in the devcontainer, on a clean copy of the tree (git-based tests cannot run inside the worktree): exit 0, all tests passed.
  • UI: tsc -b, eslint, vitest on src/components/mcp, src/pages, src/i18n: 360 passed, 1 failed. The failure, MCPServerList.test.tsx "shows a server's Pi exposure on its row", fails the same way without this change: it looks for "· on demand, through code", which en.json does not contain.
  • Website: npm ci && npm run build, all locales generated, no broken links. python3 scripts/ai-context.py check: ok.
  • MCP conformance suite from main (c37eec8; the npm release 0.1.16 predates the SEP-2640 scenarios) over --http: sep-2640-skills-enumeration 32/32, sep-2640-skills-manifest 4/4 with 2 warnings (resource name/description untestable because SKILL.md is not in resources/list, which the SEP allows), sep-2640-skills-directory skipped (no directoryRead), tools-list 3/3.
  • MCP Inspector 2.9.0 --cli … --method skills/list --verify --require-digests: 8 skills and 36 files verified, no conformance errors.
  • Pi 1.0.4 pi mcp list: connected, tools list_skills and read_skill.
  • 1,000 skills / 3,000 files: first list 115 ms, cached 10 ms, refresh rebuild ~136 ms.
  • E2E runbook ai_docs/tests/mcp_serve_runbook.md: 7/7, run before the tool fallback and the dashboard tab were added.

Not run: a model actually calling list_skills/read_skill (the devcontainer's Pi has no model API key), and Windows.

Checklist

  • I've read CONTRIBUTING.md
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff — the devcontainer Pi pin is a separate concern, kept in its own commit
  • Scope is focused — one concern per PR — the feature, its dashboard tab and the selection refactor it needed are one topic, but they are four commits

Agents on a disposable VM, in a hosted assistant or behind an MCP gateway can
reach an MCP endpoint but not the folder skills sync to, so they got tools and
none of the user's skills (#428).

`skillshare mcp serve` is a read-only server for the skills skillshare already
manages. It declares io.modelcontextprotocol/skills and implements skills/list,
skills/get and resources/read: one entry per skill, its URI from the source
path, the full frontmatter, and every file with a sha256 digest and size.
--target applies that target's selection, and the source is reread at most
every 5 seconds so install, update, enable and disable show up without a
restart; unchanged files keep their digest. stdio is the default; --http
serves Streamable HTTP and needs SKILLSHARE_MCP_TOKEN off loopback.

Skills the extension cannot carry are skipped with a warning instead of being
published incomplete: a name that breaks the Agent Skills rules or differs from
its directory, more than 512 files or 16 MiB, or a nested skill that is not
served. --check lists them without serving. The naming rules moved to
internal/skillpkg so sync and the server share them.

Few clients support the extension yet, so the server also offers list_skills
and read_skill tools. A client that declares the extension does not see them,
so it never gets each skill twice.

sync.SelectTargetSkills is the one place that turns discovered skills into a
target's selection (enabled, include/exclude, frontmatter targets).

Refs: #428
Status, doctor, diff, the dashboard's target and diff handlers and analyze each
repeated FilterSkills followed by FilterSkillsByTarget, and only some dropped
disabled skills first. Routing them through SelectTargetSkills keeps their
answers identical to sync and mcp serve when a selection rule changes.

The callers that did not drop disabled skills get discoveries without them, so
their output does not change.
Serving skills over MCP is meant for people who do not want to type the
command, so Add server gets a Skillshare tab next to the fields and the paste
tabs. It asks only for a name, which skills (all enabled ones, or one skills
target's selection) and the Agents, and shows the command it will run. It
marks the Agents that already get skills by sync, including through another
target's folder such as ~/.agents/skills, and warns when one is ticked,
because that Agent would see each skill twice.

Editing a server that runs skillshare mcp serve opens the same tab, in the
global page and under mcp.projects. The tab is named after Skillshare rather
than skills so it can hold more of what skillshare serves later.
…ffers

ensure-agent-clis.sh installed each Agent CLI only when its package was
missing, so the dev-home volume kept Pi 0.99.2 after 1.0 shipped and checks
ran against an old client. A package can now carry a version; a pinned one is
reinstalled when the volume holds another version, and moving to a new Pi is a
one-line change. Claude Code and Codex stay unpinned and keep the old
behaviour.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T09:06:33.971906Z 1c7cf12 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2954ae7727

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/skillserve/catalog.go Resolved
A root under mcp.projects is served from the global config, where its
project targets (app@claude) live, so the Skillshare tab now offers that
project's targets beside the global ones and saves no -p, which would
fail in a folder with no .skillshare/.

A nested skill skipped for any reason, not only one left unselected, now
skips its parents too: they were settled before the child was validated
and published its files as their own.

Also from review: a skill whose frontmatter JSON cannot carry (a
non-string key) is skipped instead of failing the whole skills/list page;
a listed file with a backslash in its name can be read; and stdio serve
exits 0 on SIGINT/SIGTERM without writing to stdout after the session.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ad3ffab5a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/skillserve/catalog.go Resolved
Comment thread cmd/skillshare/main.go Resolved
Comment thread internal/utils/frontmatter.go Resolved
Size and mtime cannot prove a file is unchanged (cp -p, rsync -t), and a
stale digest makes hosts that verify digests reject the file for good,
so every rebuild hashes every file again; 1,000 skills rebuild in about
140 ms, at most once per refresh interval.

Serve errors now go to stderr: stdout is the protocol stream, and a
startup error printed there is not JSON-RPC.

SKILL.md must begin with its frontmatter, as the Agent Skills format
requires; a later --- block no longer passes.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd4f499be7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/src/components/mcp/mcpServerDraft.ts Resolved
Comment thread internal/skillpkg/skillpkg.go Resolved
A managed project's name may hold spaces, so the Skillshare tab built
`--target my app@claude`, which the save path split into two words and
serve rejected as an unknown target. The command is now joined from
quoted words.

The Agent Skills format caps a description at 1,024 characters, and
hosts validating entries reject longer ones, so serve skips such a skill
with a warning instead of advertising it. The docs list every skip reason.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96593f9411

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/skillshare/main.go Resolved
Comment thread internal/utils/frontmatter.go Resolved
Comment thread internal/skillpkg/skillpkg.go Resolved
…atter

The first command after an upgrade reports legacy data it moved. For
mcp serve that notice landed on stdout ahead of the handshake, so it now
goes to stderr like serve's other messages.

A SKILL.md that opens frontmatter but never closes it could still parse,
so serve published a file hosts read as having no frontmatter; it is now
skipped with a warning.
The Agent Skills format caps compatibility at 500 characters, and hosts
that validate entries reject longer ones, so serve skips such a skill
with a warning, as it does for an overlong description.

metadata is deliberately not held to the format's string values: lists
there are common, tool-fallback clients read them fine, and skipping
those skills would hide them from every client to satisfy a few.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d13e03adfc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/skillserve/catalog.go Resolved
Comment thread internal/utils/frontmatter.go Resolved
Comment thread internal/skillpkg/skillpkg.go Resolved
Comment thread internal/skillpkg/skillpkg.go Resolved
The catalog is reused for up to 5 s, so a file edited after skills/list
was read live and failed the client's digest check. A read now hashes
what it returns and reports the file as changed when the digest no
longer matches; the next refresh lists it again.

Also: a BOM-prefixed SKILL.md is parsed from the stripped bytes instead
of being skipped, a non-text compatibility is rejected rather than
treated as absent, and an oversized SKILL.md is skipped before it is
read into memory.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b5bad20e50

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/skillpkg/skillpkg.go Resolved
Comment thread internal/utils/frontmatter.go Resolved
The manifest lists no links, so a skill whose SKILL.md is a link was
published without its own file and could not be read. It is now skipped
with a warning.

The Agent Skills reference parser requires the file to begin with ---
exactly, so an indented delimiter no longer opens frontmatter. A CRLF
file still parses.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78857ad6f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/skillserve/catalog.go Resolved
The size came from the directory walk and the digest from a later read,
so a file replaced in between was listed with an old size and a new
digest, which verifying clients reject. Both now come from the same read.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ac0926cce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/skillserve/server.go Resolved
Comment thread internal/skillserve/catalog.go Resolved
The cursor was an offset, so a catalog rebuilt between pages shifted the
next page when a skill was added or removed ahead of it, repeating or
dropping entries. Skills are now ordered by URI and the cursor is the
last URI returned.

Hashing now stops past the package's remaining size budget, so a file
that grew after the walk is skipped rather than advertised over 16 MiB
or hashed without bound.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

SKILL.md was parsed, then read again to hash, so a save in between paired
old frontmatter with the new file's digest and size, and hosts that
compare frontmatter against the file rejected the skill. The digest now
comes from the parsed bytes; a later read of a changed file is refused
until the next refresh.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 97844aa7f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/skillshare/mcp_serve.go Resolved
Comment thread internal/skillpkg/skillpkg.go Resolved
Comment thread internal/skillpkg/skillpkg.go Resolved
… reads

The Agent Skills reference validator accepts lowercase Unicode letters
and digits after NFKC normalization and counts the 64-character limit in
characters, so names such as 技能-審查 or café were skipped although they
are valid. ValidateName now applies the same rules. sync's target naming
shares it and accepts those names too. golang.org/x/text becomes a
direct dependency at the version already in the module graph.

SKILL.md was size-checked and then read whole, so a file that grew in
between was still read into memory; the read itself now stops past 16 MiB.
A non-loopback --http listener accepted a bearer token over plain HTTP,
so anyone on the path could read the token and the skills. Off loopback
it now also needs --tls-cert and --tls-key and serves HTTPS; loopback
stays plain, so a TLS-terminating proxy in front still works.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2647e79ef9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/skillserve/catalog.go Resolved
The review fixes left the per-file size and digest split across two
packages: a stat-based budget in the walk, a second bounded read in the
catalog, a SKILL.md special case hashed once per file, and the digest
format written out three times. skillpkg.Load now reads every file once
within one package budget and records its digest and size, so the
catalog only maps them, and skillpkg.Digest is the one digest format.

Also: Build settles skills in one deepest-first loop, the skills/list
cursor uses sort.Search, ParseFrontmatterMap splits the file once, mcp
serve names each value flag once, and the migration report is not
called twice in main.
The name rules are checked after NFKC, but the directory is the skill
path's last segment, which the Skills extension requires to equal the
name. A fullwidth abc in directory abc passed and was published under
a URI that did not match its name; the comparison is now exact.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6166ed27b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/utils/frontmatter.go Resolved
Splitting the file into lines cost one string header per line, so a
16 MiB newline-heavy body allocated about 256 MiB per parse. The parser
now scans lines up to the closing --- and keeps only offsets.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76a49ada77

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/skillpkg/skillpkg.go Resolved
Changing the served target rebuilt the command from the dashboard scope,
so editing `skillshare mcp serve -p --target old` in the global
dashboard silently dropped -p; the command now keeps its own flag.

Skill names were trimmed before validation, so a name and directory
padded with the same spaces passed. Names are no longer trimmed, and the
spaces fail the character rule.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db3840b031

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/skillserve/server.go Resolved
The Streamable HTTP handler had no cross-origin check, so a web page
could call a loopback server that runs without a token. It now uses the
SDK's CrossOriginProtection, which refuses cross-site browser requests
and leaves non-browser clients alone.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 699dcb86ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
c.Skills = append(c.Skills, skill)
c.bySkill[skill.URI] = skill
maps.Copy(c.byFile, files)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve each nested skill's manifest snapshot

When a served skill contains another served skill and a nested file changes between the deepest-first load of the child and the later load of its parent, both packages generate the same URI for that file, and this copy overwrites the child's servedFile digest with the parent's newer digest. The child's skills/get entry still advertises its earlier digest and frontmatter, but resources/read validates against and can return the parent's snapshot, so clients reject the resource as inconsistent. Avoid overwriting overlapping child entries, or build overlapping manifests from one coordinated snapshot.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Confirmed. Fixed in 321d3be: before a parent registers its files, Build checks each URI a nested skill already registered; if the digests differ, the tree changed between the two reads, so the parent is skipped for this build (served after the next refresh) instead of overwriting the nested skill's entry. The race itself is not reproducible deterministically; TestBuild_ServesParentAndNestedSkillTogether guards that an unchanged tree still serves both.

A parent lists its nested skills' files under the same URIs and was
loaded after them, so a file changed between the two reads had the
nested skill's entry overwritten by the parent's newer digest, and reads
of it no longer matched what the nested skill advertised. The parent is
now skipped for that build and served after the next refresh.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 321d3beeed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/skillpkg/skillpkg.go Outdated
if !info.Mode().IsRegular() {
return nil, fmt.Errorf("SKILL.md is not a regular file")
}
content, err := readAtMost(skillPath, MaxBytes)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make the link check and SKILL.md open atomic

Fresh evidence beyond the earlier symlink fix is the remaining gap between Lstat and readAtMost: if SKILL.md is atomically replaced by a symlink after line 56, os.Open follows the link and the package publishes frontmatter, size, and digest from a file that the no-links policy intended to exclude. An escaping link will subsequently be rejected by os.OpenRoot during resources/read, leaving an advertised but unreadable skill, while an in-tree link may be served despite the policy. Open with no-follow semantics and validate the opened handle rather than checking the pathname separately.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Confirmed. Fixed in 1c7cf12: SKILL.md and every walked file are opened through openSame, which compares the opened handle with the Lstat info using os.SameFile and refuses a mismatch, so a file swapped for a link after the check is never read. This keeps the check portable instead of relying on O_NOFOLLOW. The race itself is not reproducible deterministically; the existing link tests still pass.

Files were checked with Lstat and then opened by path, so one replaced
by a link in between was followed and published. Each read now checks
that the opened file is the one Lstat described, and skips the skill
otherwise.
@runkids

runkids commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c7cf1259c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/utils/frontmatter.go Outdated
return nil, fmt.Errorf("no frontmatter at the start")
}
start = len(line)
} else if string(bytes.TrimSpace(line)) == "---" {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require an unindented closing delimiter

Fresh evidence beyond the fixed opening-delimiter case: the closing check still applies TrimSpace, so a file containing --- as its apparent terminator is accepted and advertised even though that line is YAML content rather than a valid column-zero frontmatter delimiter. Native Agent Skills parsers can consequently report unclosed or invalid frontmatter for a skill that mcp serve --check accepts; strip only \r\n here, as the opening check does.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Confirmed. Fixed in 69f7dfa: the closing delimiter must be exactly --- too (only \r\n stripped), so an indented line no longer closes the frontmatter. Covered in TestBuild_SkipsSkillWhoseFrontmatterIsNotAtTheStart.

Comment thread internal/skillserve/catalog.go Resolved
The closing --- was matched after trimming spaces, so an indented line,
which is YAML content, closed the frontmatter. It now has to be exactly
---, like the opening one; a CRLF ending is still fine.
Discovery and the package loads read the tree separately. A nested skill
created in between was published only as a file of its parent, with no
entry of its own. Discover again after the loads and rebuild, up to three
times, until both agree.
@runkids
runkids merged commit 74b04fe into main Oct 6, 2026
8 checks passed
@runkids
runkids deleted the runkids/428-mcp-serve-skills branch October 6, 2026 09:26
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.

Serve skills over MCP (SEP-2640) for agents that can only reach an MCP endpoint

1 participant