Skip to content

feat(mcp): share MCP servers with chosen projects (#976) - #1001

Merged
runkids merged 3 commits into
mainfrom
runkids/mcp-shared-servers
Nov 24, 2026
Merged

runkids merged 3 commits into
mainfrom
runkids/mcp-shared-servers

Conversation

@runkids

@runkids runkids commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Type

Linked Issue

Closes #976

Summary

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.

Config and CLI

  • global: false keeps a server out of every global file. mcp.projects.<root>.use turns it on for that root.
  • Removing a shared server, or making it global again, updates every use list in the same save.
    • The preview names the projects it touches.
    • mcp list names the projects that use each shared server, or says none do. --json carries the same list under shared.
  • Validation:
    • a use entry must name a shared server;
    • project configs refuse global: false;
    • an account target cannot be named on a shared server.
  • A shared server with no targets goes to each using project's targets.
  • mcp check runs a shared server once, in the global list. Its live probe starts in the first project that uses it.
  • The list TUI and mcp list show each shared server's projects.

Dashboard

  • MCP page:
    • The server dialog sets Loads in: Every project / Only projects that turn it on.
    • Shared rows show Opt-in · N projects.
    • Removing a shared server previews the use lists it changes.
  • Project page:
    • The MCP tab splits servers into on everywhere, opt-in and defined here, with a per-project switch for opt-in servers.
    • The Skills, Agents and Hooks tabs share one rail layout: targets, the sync box, filters and where files are written.
  • Target page, sync tab: the include/exclude rules moved to a right-hand rail.
    • Each rule shows how many rows it matches. A rule that matches nothing has a dashed border, and more than six rules fold.
    • Hovering a rule marks its rows. Hovering a row offers Exclude, Include or Unexclude.
    • Rows a change flips are tinted briefly, and the card head says what changed.
    • The rail scrolls with the page until its bottom shows, then sticks, so long skill lists and long rule lists both stay readable.
  • The target page's MCP tab no longer lists shared servers. They load only in projects.
  • Chinese UI text says MCP instead of 伺服器 / 服务器.

Docs

  • sharing-mcp, many-projects-one-config, mcp, target, ui, hooks and targets/configuration are 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 check in the devcontainer: passes.
  • UI: typecheck, lint (no new warnings), vitest (121 files, 1047 tests) and build all pass.
  • Website build passes for every locale.
  • python3 scripts/ai-context.py check passes.
  • E2E runbook mcp_shared_runbook.md: 4/4 steps passed.
    • It ran before the final round of fixes in this branch; those fixes are covered by unit and integration tests.
  • The dashboard was checked by hand in a trial environment.
    • It had 51 skills and 15 exclude rules.
    • The target and project tabs, the hover linking, the sticky rail and the sticky filter head were checked at 1440×900 and 1440×700.
  • Not run: the Windows guest. The change touches no link or path handling.

Not covered

  • Converting existing per-project copies into one shared server: out of scope for v1, per the proposal.
  • mcp use and mcp unuse assignment commands: out of scope for v1. The dashboard and the config editor set use.
  • Per-project overrides of a shared server, such as its env: open question 4 in the proposal.
  • Turning a shared server back to Every project lists the projects it leaves. Unlike removal, it does not preview each file.

Checklist

  • I've read CONTRIBUTING.md, including its AI-assisted contributions section
  • I've reviewed every line of the diff and can explain it — written with an AI assistant and reviewed in automated passes; the maintainer's own line-by-line review is still pending.
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR — besides shared servers, this redesigns the project tabs and the target sync tab. The new MCP tab needed that layout, so the other tabs moved to it in the same change.

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T09:53:46.520413Z 3934bb7 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: 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".

Comment thread ui/src/components/targets/targetView.ts Outdated
i = j;
} else re += lit(c);
}
return new RegExp(`^${re}$`);

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 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 👍 / 👎.

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.

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.

Comment thread internal/mcp/check.go
if len(source.Users(name)) == 0 {
return []CheckFinding{{Level: "info", Check: "use", Message: "not used by any project"}}
}
defaults = source.SharedTargets(name)

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 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 👍 / 👎.

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.

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.
@runkids

runkids commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 3934bb7547

ℹ️ 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".

@runkids
runkids merged commit 0cd966d into main Nov 24, 2026
10 checks passed
@runkids
runkids deleted the runkids/mcp-shared-servers branch November 24, 2026 11:12
runkids added a commit that referenced this pull request Nov 24, 2026
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.
runkids added a commit that referenced this pull request Nov 24, 2026
* 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]>
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.

When selecting an MCP from other projects, it would be helpful if the system could support searching or filtering.

1 participant