## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Agents use connected apps through MCP. Paperclip already hosts MCP Apps views and speaks stateless MCP 2026-07-28. > - The MCP Skills extension (SEP-2640, Final) lets an app publish skills (instructions and files) next to its tools. Hugging Face already serves 25. > - Paperclip did not read them, so agents missed each app's own workflow guidance. > - Skills are a prompt-injection surface. The spec makes manifest binding, verification, origin tagging and approval revocation host requirements. > - This pull request makes Paperclip a Skills host: discover, review, verify, and deliver app skills to the agents that use the app. > - The benefit is that connected apps can teach agents their workflows, under board control. ## Linked Issues or Issue Description **Problem** Connected MCP servers can publish skills with the `io.modelcontextprotocol/skills` extension. Paperclip ignored them. A board could not see, review or approve them, and agents never received them. **Proposed solution** Implement the host side of SEP-2640. List skills during catalog refresh, record them per connection and company, bind board approval to the full file manifest, and load approved skills into agent runs with verified, lazily fetched content. **Why it matters** Apps ship workflow guidance with their tools. Without the extension, each team must copy that guidance into company skills by hand, and it goes stale. Refs #21119, Refs #21140 (the MCP Apps and stateless MCP client work this builds on). ## What Changed - **Client capability.** Every stateless request declares `io.modelcontextprotocol/skills`. Legacy handshake sessions do not. The capabilities that `server/discover` advertises are remembered beside the protocol era. - **Discovery.** Catalog refresh calls `skills/list` (paged) only when the server declared the extension. A listing inside its `ttlMs` is reused. A skills failure never fails the tool refresh. Nothing runs while a run starts. - **Schema.** New `tool_mcp_skills` (company, connection, skill URI; frontmatter, sorted manifest, manifest digest, review state) and `tool_mcp_skill_files` (verified bytes keyed by connection, URI and digest). Both cascade with the connection. - **Governance.** New skills wait for review. Approval binds to the order-free digest of every `{uri, digest, size}`; a request for any other digest gets 409. A changed manifest or frontmatter revokes approval and logs `tool_mcp_skill.approval_revoked`. Dynamic, oversized and invalid skills are declined with a reason. Approve and decline use the company skill policy (`skills.install`, `external_package`, `mcp-connection:<id>`). - **Run time.** Approved skills of connections the agent can use load in parallel with other skill preparation, inside a 3 s budget. `SKILL.md` is read with the agent's grant and checked for size, SHA-256 and frontmatter. A failure calls `skills/get` and takes the skill out of use. Each skill becomes a per-run bundle on the connector skill path, named in its app's namespace, tagged with its origin. Paperclip writes the frontmatter: `allowed-tools` only if the board approved it. - **Supporting files.** `GET /api/agents/me/mcp-skills/:skillId/files?path=` serves manifest-listed files to an agent in an active run, through the skill's own connection. The sandbox bridge allows the route. - **Board API and UI.** `GET/POST /api/companies/:companyId/mcp-skills…` (list, read instructions, approve, decline). The Skills page shows "Skills from connected apps" with app, state, size, requested tools and plain-language notes. It renders nothing when no app publishes skills. - **Docs.** `doc/connections/MCP-SKILLS.md`, linked from `doc/connections/README.md`. - **Shared frontmatter parser.** It now decodes YAML single-quoted scalars. Before, 5 of Hugging Face's 25 skills kept their quotes and would fail the frontmatter check; now all 25 match. The generated runner copy is regenerated. File size notes: `server/src/services/tool-gateway.ts` grows by about 200 lines. The run-time reads must use its grant resolution and `callAssignedConnectionProtocol`, like MCP Apps view reads. Splitting the gateway is a separate refactor. `CompanySkills.tsx` and `CompanySkills.production.tsx` gain 2–4 lines each; the section lives in its own component. ## Verification - `server/src/__tests__/mcp-skills.test.ts` (15 tests) uses a fake stateless skills server and embedded Postgres. It covers: discovery only after the server declares the extension; the capability in `_meta`; `ttlMs` reuse; lazy fetch (no reads at listing or approval; `SKILL.md` at load; supporting files on read); a stale-digest approval refused; a reorder that keeps approval; a changed or added file that revokes it; dynamic skills declined; a same-size tampered `SKILL.md` rejected, refreshed with `skills/get`, and taken out of use; mismatched frontmatter rejected; reads outside the manifest refused; the same URI and name from two servers kept apart; company scoping; a slow app skipped within the budget and cached later; HTTP authorization (board only, agent needs an active run, run header must match) and activity logging. - Red/green: with the digest check disabled, the tamper test fails; with the manifest comparison disabled, the revocation test fails. Both pass with the code. - `server/src/__tests__/mcp-protocol-versions.test.ts`, `mcp-apps.test.ts`, `connection-instructions.test.ts`, `tool-gateway-discovery-http.test.ts`: 47 pass (two capability assertions updated for the new extension). - `packages/shared/src/frontmatter.test.ts` adds a single-quoted scalar case; the runner contract test passes (23 tests). - `ui/src/components/skills/ConnectedAppSkills.test.tsx` (3) and `ui/src/pages/CompanySkills.test.tsx` (44) pass. `packages/adapter-utils/src/sandbox-callback-bridge.test.ts` (89) passes. - `pnpm --filter @paperclipai/server typecheck` passes. UI `tsc` passes except the known missing generated Storybook catalog files. - `pnpm verify` returned exit 2 (doc change is a global CI input); required CI supplies broad coverage. - Live check against `https://huggingface.co/mcp` without credentials, through Paperclip's own services and the real egress guard: 25 skills discovered as pending; three approved; cold load 135 ms, cached load 13 ms; a supporting file read through the manifest; the bundle tagged with its origin. - Storybook: `Agents and reusable capabilities/Skills and Skill Studio/Connected app skills` (needs review, all states, tool request, name collision, reading instructions). ## Risks - **Migration:** two new tables only. No changes to existing tables. Safe with the previous release running. - **Run start:** companies without an approved app skill pay one indexed read. With approved skills the wait is capped at 3 s; late or failing skills are left out with a `skills.mcp_unavailable` run warning and never fail the run. - **Agent harness enforcement:** Paperclip cannot gate each code-execution tool call an agent makes while following an app's skill. Approval is explicit and per skill, the approval note says agents may run commands the skill describes, and `allowed-tools` is never granted without a separate tick. - **Shared-home adapters** receive app skills like company skills. A revoked skill leaves on the next skill sync. - Not in this PR: per-connection opt-in for dynamic skills; serving Paperclip's own skills from its public MCP endpoint; `resources/directory/read`; app skills on an agent's skills tab. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, via Claude Code with tool use (shell, file edits, local test runs, live HTTP checks). Extended reasoning enabled. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
8.8 KiB
MCP Skills: skills that connected apps publish
Some MCP servers publish skills next to their tools: a SKILL.md with
instructions and, often, supporting files. When a connected app does, its skills
appear on the Skills page under Skills from connected apps. The board
reviews each one. Approved skills reach the agents that can use that app.
The first public server Paperclip was checked against is Hugging Face
(https://huggingface.co/mcp, no sign-in needed). It publishes 25 skills.
The standard
These skills follow the MCP Skills extension:
- Specification: SEP-2640, beta (overview).
- Extension id:
io.modelcontextprotocol/skills. It is defined for stateless MCP (2026-07-28), so Paperclip only uses it with servers on that version. See MCP-PROTOCOL-VERSIONS.md. - Skill format: Agent Skills.
The protocol works like this:
- The server declares the extension in
server/discover:capabilities.extensions["io.modelcontextprotocol/skills"]. - The client declares it too, in each request's
_meta["io.modelcontextprotocol/clientCapabilities"].extensions. skills/listreturns one entry per skill: the URI of itsSKILL.md, its frontmatter verbatim, and a complete manifest of its files ({uri, digest: "sha256:…", size}), or"dynamic"for generated content. The result carriesttlMsandcacheScope.skills/get {uri}returns one entry in the same shape.- Files are read with
resources/read.resources/directory/readis optional; Paperclip does not use it, because the manifest already lists every file.
How Paperclip implements it
| Layer | What happens | Code |
|---|---|---|
| Client capability | Every stateless request declares io.modelcontextprotocol/skills. Handshake (legacy) sessions do not. |
mcpClientCapabilities in server/src/services/mcp-http.ts |
| Server capability | What server/discover advertised is remembered beside the connection's protocol version, so a refresh knows whether the server serves skills without asking again. |
rememberMcpServerCapabilities in mcp-http.ts |
| Discovery | A catalog refresh lists skills (skills/list, paged) after the tool catalog, only when the server declared the extension. A listing within its ttlMs is reused and changes nothing. A skills failure never fails the tool refresh. Nothing runs while an agent run starts. |
discoverSkills in server/src/services/tool-access/catalog/discovery.ts, refreshSkills in catalog/publication.ts |
| Record | One tool_mcp_skills row per skill, keyed by company, connection and skill URI. The name is a label only. The row keeps the verbatim frontmatter, the manifest sorted by URI, and the manifest digest. |
packages/db/src/schema/tool_access.ts, server/src/services/mcp-skills.ts |
| Review | New skills wait for review. Approving binds to the manifest digest the board saw; a request with any other digest is refused (409). A changed manifest or frontmatter moves an approved skill back to review. Reordering the manifest is not a change. | mcpSkillsService.applyEntry and approve |
| Run time | When a run starts, approved skills of the connections the agent can use (tools allowed or Ask first, and a grant that resolves) are loaded. SKILL.md is read with the agent's own grant, checked, and cached. Each becomes a per-run skill bundle on the connector skill path. |
resolveConnectionSkillsForRun in server/src/services/tool-gateway.ts, server/src/services/mcp-skill-runtime.ts, heartbeat/execution-configuration.ts |
| Supporting files | Bundles contain only SKILL.md. Agents read other files with GET /api/agents/me/mcp-skills/:skillId/files?path=…, which needs an active run, access to the app, and a path in the approved manifest. The sandbox bridge allows this route. |
server/src/routes/mcp-skills.ts, readConnectionSkillFile |
| API (board) | GET /api/companies/:companyId/mcp-skills, GET …/:skillId/content (read SKILL.md before deciding, with the viewer's own access), POST …/:skillId/approve with {manifestDigest, allowTools}, POST …/:skillId/decline. |
server/src/routes/mcp-skills.ts |
| UI | The Skills page lists connected-app skills with their app, state, size, requested tools and a plain-language note. It renders nothing when there are none. | ui/src/components/skills/ConnectedAppSkills.tsx |
Security requirements and how each is met
The spec's host requirements were treated as day-one requirements.
- Identity is (server, URI). Rows, approvals, the file cache, the agent file
route and bundle paths are keyed by connection and URI (or by the skill row,
which is). Two apps can serve
skill://refunds/SKILL.md; they are two skills. - No silent shadowing. A connected app's skill runs under a name in that
app's namespace (
<app>-<skill>). A remaining clash gets a suffix derived from the connection and URI. Nothing replaces a company skill or another app's skill. The board sees a note when names collide. - Verification before use. Every file read checks the byte size, then the
SHA-256, against the approved manifest.
SKILL.mdfrontmatter is parsed with the skills system's own parser and compared field by field with the listed frontmatter. A YAML form that parser cannot read faithfully fails closed. Content that fails is never used. Paperclip callsskills/get; if the manifest changed the skill goes back to review, and if the same manifest served different bytes the skill is taken out of use (verification_failed). An unknown skill (-32602) is marked as removed. - Reads stay in the manifest and in the origin. Only listed files are read, and only through the skill's own connection. A path outside the skill root or not in the manifest is refused.
- Lazy retrieval. Listing, approving and reviewing fetch no files.
SKILL.mdis fetched when a run loads the skill (or when the board opens it to read); a supporting file when an agent reads it. - Content-bound approval. Approval binds to every
{uri, digest, size}in the manifest. Any other manifest revokes it and is logged (tool_mcp_skill.approval_revoked). - Untrusted content, tagged origin. Each bundle starts with a note naming the app and the skill URI and saying the instructions come from that app. The description ends with "(Skill from the app.)".
- No implicit permission grants. Paperclip writes the bundle's frontmatter
itself:
name,description, andallowed-toolsonly when the board ticked "Also let it use" when approving. Other frontmatter fields from the app (hooks, metadata and so on) never reach the agent's skill loader. A nestedSKILL.mdis listed as a reference file, not a skill. - No implicit execution. Approval is explicit and per skill. The approval note says agents may follow the skill's instructions, including commands.
- Cache integrity. Verified bytes live in
tool_mcp_skill_files, written only by the server, keyed by connection, URI and digest, never changed in place, and re-hashed on every read. Nothing scans it for skills. Deleting a connection deletes its skills and cached files. - Dynamic skills are declined. A
"dynamic"skill has no digests, so it is shown as not available with a note and cannot be approved. Skills over the spec limits (512 files or 16 MiB) or with an invalid entry are shown the same way with their reason.
Governance
Approving or declining is a skill install decision. It needs board access, the
skill_config:update permission, and the company skill policy's
skills.install for source type external_package with source locator
mcp-connection:<connectionId>. A policy rule can therefore block skills from
one app or from all connected apps.
Performance
A run in a company without an approved connected-app skill pays one indexed
read. With approved skills, loading runs in parallel with the other skill
preparation. Against Hugging Face, loading three approved skills took 135 ms
cold and 13 ms from the cache. A run waits at most 3 seconds for connected-app
skills. A skill that cannot load in that time, or at all, is left out with a run
warning (skills.mcp_unavailable); it never fails the run. A read still in
flight at the deadline finishes in the background and fills the cache, so the
next run has the skill.
Not yet supported
- Opting in to dynamic skills per connection.
- Serving Paperclip's own company skills from its MCP endpoint
(
server/src/routes/public-mcp.ts). resources/directory/read, and loading a skill by URI from server instructions without a listing.- Showing connected-app skills on an agent's skills tab.