Repository navigation
feat(mcp): share MCP servers with chosen projects (#976) - #1001
Conversation
A server that only some projects need had to be copied into each mcp.projects root, so changing it meant editing every copy. A server in mcp.servers can now set global: false: no global file gets it, and each root that lists it under use loads it. Removing it, or making it global again, updates every use list in the same save, and the preview names the projects it touches. Project configs refuse global: false, and a use entry must name a shared server. The dashboard follows the model. The MCP page sets where a server loads and lists the projects that use it, and a project's MCP tab separates servers that load everywhere, opt-in servers and its own. The project Skills, Agents and Hooks tabs and the target sync tab move to the same rail layout: filters sit beside a preview that can edit them from a row, so long skill lists and long rule lists both stay readable. Chinese UI text says MCP instead of a word for "server" readers did not recognise.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 31293d8832
ℹ️ 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".
| i = j; | ||
| } else re += lit(c); | ||
| } | ||
| return new RegExp(`^${re}$`); |
There was a problem hiding this comment.
Catch invalid character ranges in filter patterns
With a populated preview, entering [z-a] in an include or exclude field and pressing Enter or leaving the field throws an uncaught SyntaxError here. usePatternDraft accepts the pattern, and FilterCard immediately calls patternMatches while rendering its match count, so a filter typo replaces the editor with the error boundary instead of matching nothing. This affects both target and project editors, for skills and agents. Catch regex construction failures and return null, consistent with the malformed-pattern handling already used above.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 3934bb7. compilePattern now catches the error the RegExp constructor throws and returns null, so a rule such as [z-a] matches nothing instead of replacing the editor with the error page. That matches sync, where filepath.Match("[z-a]", name) returns false with no error. This is the only place in the change that builds a RegExp from user input, so the target and project editors are both covered. Test: patternMatches > matches nothing for a class whose range is out of order, as Go does in ui/src/components/targets/targetView.test.ts.
| if len(source.Users(name)) == 0 { | ||
| return []CheckFinding{{Level: "info", Check: "use", Message: "not used by any project"}} | ||
| } | ||
| defaults = source.SharedTargets(name) |
There was a problem hiding this comment.
Preserve project targets when filtering refused shared clients
When a shared server inherits project targets and one client refuses it, preflight uses these project-derived defaults, but Check subsequently calls accept("", source.Servers, source.Targets), which filters the global defaults instead. For example, with global targets [claude], a shared server named workspace, and a using project targeting [claude, cursor], Claude rejects its reserved name and accept produces explicit targets: []. Consequently, the valid Cursor entry's pending or conflict findings disappear from mcp check. Use the shared server's effective project targets during acceptance as well, preserving per-project inheritance.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b905380. When an Agent refuses a shared server that names no targets, Check no longer trims the global default targets. It plans the server as each using project's own entry, with that project's targets minus the refused Agents, and still reports those entries under the shared server. A shared server with explicit targets and a project's own servers were already trimmed against the right targets. Test: TestCheckKeepsTheProjectTargetsOfASharedServerOneAgentRefuses in internal/mcp/shared_test.go, built from your workspace example.
…server A shared server without targets follows the targets of each project that uses it. When one Agent refused it, mcp check trimmed the global default targets instead, so the entries the server writes for another Agent in that project dropped out of the report. Check now plans such a server as each using project's own entry, trimmed by the same refusals.
A rule such as [z-a] made the RegExp constructor throw while the filter card counted its matches, so a typo replaced the target editor with the error page. Such a rule now matches nothing.
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
The generated entry listed commit subjects. Replace it with what each change means for someone using skillshare, with examples and credits, and leave out two fixes for bugs that only existed inside #1001.
* chore(main): release 0.31.0 * chore(release): synchronize release metadata * docs(changelog): describe the 0.31.0 changes for users The generated entry listed commit subjects. Replace it with what each change means for someone using skillshare, with examples and credits, and leave out two fixes for bugs that only existed inside #1001. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Willie <[email protected]>
Type
proposals/only — see CONTRIBUTING.md)approvedlabel) — maintainer change; When selecting an MCP from other projects, it would be helpful if the system could support searching or filtering. #976 carriesfeature, notapproved. The design is inproposals/976-shared-mcp-servers.md.Linked Issue
Closes #976
Summary
A server that only some projects need had to be copied into each
mcp.projectsroot, so changing it meant editing every copy. A server inmcp.serverscan now setglobal: false. No global file gets it, and each root that lists it underuseloads it.Config and CLI
global: falsekeeps a server out of every global file.mcp.projects.<root>.useturns it on for that root.uselist in the same save.mcp listnames the projects that use each shared server, or says none do.--jsoncarries the same list undershared.useentry must name a shared server;global: false;targetsgoes to each using project's targets.mcp checkruns a shared server once, in the global list. Its live probe starts in the first project that uses it.mcp listshow each shared server's projects.Dashboard
uselists it changes.Docs
sharing-mcp,many-projects-one-config,mcp,target,ui,hooksandtargets/configurationare updated, with ja, ko, zh-Hans and zh-Hant copies.schemas/mcp.schema.json, the built-in skill reference, the proposal, and an E2E runbook (ai_docs/tests/mcp_shared_runbook.md) are also included.Checks run
make checkin the devcontainer: passes.typecheck,lint(no new warnings),vitest(121 files, 1047 tests) andbuildall pass.python3 scripts/ai-context.py checkpasses.mcp_shared_runbook.md: 4/4 steps passed.Not covered
mcp useandmcp unuseassignment commands: out of scope for v1. The dashboard and the config editor setuse.env: open question 4 in the proposal.Checklist
make check) — for code changes