Repository navigation
feat(desktop): relay MCP server skills to threads - #3707
Merged
Merged
Conversation
A server can publish workflow skills through the io.modelcontextprotocol/skills extension, and may then stop sending instructions. GitHub's MCP server does that once skills are on (github/github-mcp-server#3685). PwrAgent's native bridge forwarded only tools, resources and prompts, so a thread saw neither the instructions nor the skills. The bridge now advertises the extension when the upstream server does, and forwards skills/list, skills/get and resources/directory/read. When the server offers skills and sends no instructions, its instructions become a bounded index of its skills, naming each SKILL.md, so hosts that do not speak the extension can still find and read them. A server's own instructions are never rewritten.
Review fixes for the skills relay: - The index's skills/list read spent the bridge's whole startup deadline, so a server whose skills/list stalled made the bridge exit and the thread lose every tool. It now has its own budget, at most 5 s and at most half of what startup has left, and degrades to no index. - The index read only the first page. It now reads up to four, keeps what it read if a later page fails, and lists a repeated skill once. - No index is built for a server without the resources capability: the bridge serves no resources/read, so the agent could not follow it. - The caller's own cancel now propagates instead of being logged as an upstream failure. - The closing line of a partial index no longer points hosts that lack the extension at a skills/list call they cannot make. - Removed the unused isMcpSkillsMethod helper.
The bridge relays only what it declares, so a capability it does not relay produces no error anywhere. The skills extension was missing that way until #3707. - mcp-bridge-capabilities.ts lists every server capability as relayed or not, with the reason, and names the extensions the bridge relays. - A test fails when the MCP SDK knows a capability the table does not, so an SDK upgrade must classify it. - An oracle test checks that, for a server advertising everything, the bridge's declarations and the table's unrelayed list split the server's capabilities exactly. Against the bridge before #3707 it fails on extensions:io.modelcontextprotocol/skills. - The owner logs, once per connection, what a real server advertised that threads will not see, including unclassified extensions.
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.
Summary
PwrAgent-managed MCP connections now pass an upstream server's skills through to thread agents. This is the first step toward adding GitHub's MCP server. github/github-mcp-server#3685 added 18 workflow skills, offered through the
io.modelcontextprotocol/skillsextension. Turning them on also removes the server's instructions, with no fallback for clients that don't support the extension.Before this change, the native bridge forwarded only tools, resources and prompts. A thread connected to such a server saw neither the instructions nor the skills.
What changed
mcp-skills-relay.ts(new, pure): detects the extension, lists its three methods, and builds a bounded skills index (skillsAwareInstructions).SKILL.md. Hosts that don't support the extension, which is most of them today, can read that file through their normal MCP resource reader.skill://URI or a name are dropped, and a repeated skill is listed once. Text is reduced to one line and capped. When the index is partial, it ends by saying so.mcp-connection-gateway-service.ts):describereportsskills. When the server sent no instructions and offers resources, it builds the index from up to four pages ofskills/list.skills/list,skills/getandresources/directory/readare forwarded only to a server that advertised the extension. Any other server getsMethodNotFound.mcp-connection-bridge-entry.ts): declares the extension, copied from the upstream server's declaration, and registers handlers for the three methods. Parameters and results pass through unchanged.PWRAGENT_SKILLS_EXTENSIONnow re-exports the shared constant.Catching the next silent drop
The bridge forwards only the capabilities it declares, so one it doesn't relay produces no error anywhere. That's how skills went missing. This PR makes that a recorded decision:
mcp-bridge-capabilities.tslists every MCP server capability as relayed or not, with a reason. Currently not relayed:logging,completions,tasksandexperimental. It also names the extensions the bridge relays.mcp-bridge-capabilities.test.tsfails when the MCP SDK knows a capability the table doesn't, so an SDK upgrade has to classify each new one.mcp-connection-bridge-entry.test.ts) gives the bridge a server that advertises everything. It checks that what the bridge declares, plus what the table calls unrelayed, adds up to exactly what the server advertised. Against the bridge before this PR, it fails onextensions:io.modelcontextprotocol/skills.Tests
mcp-skills-relay.property.test.ts(fast-check) checks five rules against generated input, including lists that repeat skills:mcp-connection-bridge-entry.test.ts:mcp-stdio-connections.test.ts: end to end against a real stdio fixture process.skills/list.skills/liststalls still answersdescribewithin its startup deadline, without an index. Before the review fixes, this test and the next one failed against this branch.Verification
pnpm test: the full suite ran (1,915 files and 27,693 tests passed), as did the three test files above.pnpm lint:oxlint,pnpm lint:oxlint:typed,pnpm typecheck,pnpm lint:boundariesandpnpm lint:codex-storageall pass.pnpm --filter @pwragent/desktop buildpasses, including the main-bundle boundary check. The builtmcp-connection-bridge.jsloads and runs.