fix(mcp): stop conflict resolution looping between Agents (#919)

When Agents hold different definitions of one server, importing one
Agent's version was refused with "unresolved conflicts prevented
adoption", because any conflict in the plan blocked it, including
another Agent's. The source was saved anyway, so the Agents that had
matched the old definition now conflicted, and importing from them
flipped the source back. Replace with source sent one resolution at a
time, so with two conflicts the plan stayed blocked and the dialog
could never apply.

Gate adoption only on the resolved entries' own conflicts, in the API
save and in the interactive CLI import. Replace with source now settles
every conflict of that server at once. After a conflict import, a
translated hint names the Agents in the same scope that still need
Replace with source, and the remaining adoption error is translated.
This commit is contained in:
Willie
2026-11-16 15:48:20 +08:00
committed by GitHub
parent d8bac85fac
commit 5a6873ec96
31 changed files with 209 additions and 18 deletions
+6 -3
View File
@@ -128,10 +128,13 @@ func reviewMCPMutations(service *mcp.Service, mutations []mcp.Mutation, o mcpOpt
}
choices := []checklistItemData{{label: "Save only", desc: "Update the source; leave Agent files unchanged"}}
if p.Blocked {
// Another Agent's conflict does not stop saving an import; only the imported entry's own does.
var resolutions []mcp.Resolution
for _, mutation := range mutations {
if len(mutation.Resolutions) > 0 {
return fmt.Errorf("resolve MCP conflicts before importing; no settings saved")
}
resolutions = append(resolutions, mutation.Resolutions...)
}
if p.ResolutionConflicts(resolutions) {
return fmt.Errorf("resolve MCP conflicts before importing; no settings saved")
}
} else {
choices = append([]checklistItemData{{label: "Save and sync", desc: "Apply the previewed changes to Agent files"}}, choices...)
+24
View File
@@ -113,6 +113,30 @@ func TestMCPBatchImportCancelAndSaveOnly(t *testing.T) {
}
}
// Codex holds a different docs than Claude. Importing Claude's still saves, so the user can
// replace Codex's next instead of being told to resolve a conflict the import cannot settle.
func TestMCPImportSavesDespiteAnotherAgentsConflict(t *testing.T) {
s := mcpTUIService(t)
if err := os.WriteFile(s.ConfigPath, []byte("mcp: {targets: [claude, codex], servers: {}}\n"), 0600); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(s.Home, ".claude.json"), []byte(`{"mcpServers":{"docs":{"command":"a"}}}`), 0600); err != nil {
t.Fatal(err)
}
if err := os.MkdirAll(filepath.Join(s.Home, ".codex"), 0700); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(s.Home, ".codex", "config.toml"), []byte("[mcp_servers.docs]\ncommand = \"b\"\n"), 0600); err != nil {
t.Fatal(err)
}
candidates := []mcp.Candidate{{Name: "docs", Server: mcp.Server{Command: "a"}, From: "claude"}}
// The server, both Agents, then Save only: the one choice a blocked plan offers.
prompts := &scriptedMCPPrompts{choices: [][]int{{0}, {0, 1}, {0}}}
if err := mcpBatchImportWizard(s, candidates, mcpOptions{}, prompts); err != nil {
t.Fatalf("another Agent's conflict refused the import: %v", err)
}
}
func TestMCPReviewDryRunNeverPromptsOrWrites(t *testing.T) {
s := mcpTUIService(t)
before, _ := os.ReadFile(s.ConfigPath)
+12 -1
View File
@@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"path/filepath"
"slices"
"gopkg.in/yaml.v3"
"skillshare/internal/utils"
@@ -173,6 +174,14 @@ func (s *Service) PreviewMutations(mutations []Mutation) (*Plan, error) {
return s.previewResolved(source, batchResolutions(mutations))
}
// ResolutionConflicts reports whether an entry one of resolutions names is still a conflict.
// Other entries may conflict without stopping a save that only adopts or replaces these.
func (p *Plan) ResolutionConflicts(resolutions []Resolution) bool {
return slices.ContainsFunc(p.Changes, func(c Change) bool {
return c.Action == "conflict" && slices.ContainsFunc(resolutions, func(r Resolution) bool { return r.Target == c.Target && r.Name == c.Name })
})
}
func batchResolutions(mutations []Mutation) []Resolution {
var resolutions []Resolution
for _, m := range mutations {
@@ -419,7 +428,9 @@ func (s *Service) MutateBatch(mutations []Mutation, revision string, sync bool)
if !sync {
// Saving an explicit import also records the native baseline. The next
// sync can update it, but still detects any edits made in the meantime.
if len(resolutions) > 0 && preview.Blocked {
// Only the resolved entries have to settle: another Agent that holds a
// different definition of the server stays a conflict of its own.
if len(resolutions) > 0 && preview.ResolutionConflicts(resolutions) {
return nil, fmt.Errorf("source saved; unresolved conflicts prevented adoption")
}
// Stopping to manage a server drops those records instead, so sync leaves its entries be.
+34
View File
@@ -171,6 +171,40 @@ func TestTickingTheImportedAgentLaterTakesItsEntryOver(t *testing.T) {
}
}
// Two Agents hold different definitions of one server. Importing one of them takes that
// entry over even though the other is still a conflict, so the user can replace the other
// next instead of importing back and forth.
func TestImportAdoptsDespiteAnotherAgentsConflict(t *testing.T) {
s := testService(t)
claude := filepath.Join(s.Home, ".claude.json")
// Laid out as sync writes it, so taking it over leaves nothing else to do.
if err := os.WriteFile(claude, []byte("{\n \"mcpServers\": {\n \"docs\": {\n \"command\": \"a\"\n }\n }\n}\n"), 0600); err != nil {
t.Fatal(err)
}
codex := filepath.Join(s.Home, ".codex", "config.toml")
if err := os.MkdirAll(filepath.Dir(codex), 0700); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(codex, []byte("[mcp_servers.docs]\ncommand = \"b\"\n"), 0600); err != nil {
t.Fatal(err)
}
server := Server{Command: "a"}
adopt := []Resolution{{Target: "claude", Name: "docs", Action: "adopt"}}
if _, err := s.Mutate(Mutation{Name: "docs", Server: &server, Replace: true, Resolutions: adopt}, "", false); err != nil {
t.Fatalf("another Agent's conflict refused the import: %v", err)
}
plan, err := s.Preview()
if err != nil {
t.Fatal(err)
}
if c := changeFor(plan, claude, "docs"); c == nil || c.Action != "unchanged" {
t.Fatalf("the imported entry was not taken over: %+v", c)
}
if c := changeFor(plan, codex, "docs"); c == nil || c.Action != "conflict" {
t.Fatalf("the other Agent's entry must stay a conflict: %+v", c)
}
}
func TestAgentDefaultsAreNotDrift(t *testing.T) {
s := testService(t)
if _, err := s.Apply(""); err != nil {
@@ -12,7 +12,7 @@ import { MCPTargetOrder } from './targetOrder';
vi.mock('../CodeEditor', () => ({
default: ({ value, onChange, ariaLabel }: { value: string; onChange: (v: string) => void; ariaLabel: string }) => <textarea aria-label={ariaLabel} value={value} onChange={(e) => onChange(e.target.value)} />,
}));
vi.mock('../../api/mcp', async (load) => ({ ...await load<typeof import('../../api/mcp')>(), mcpApi: { import: vi.fn(), save: vi.fn(), render: vi.fn().mockResolvedValue({ rendered: [] }) } }));
vi.mock('../../api/mcp', async (load) => ({ ...await load<typeof import('../../api/mcp')>(), mcpApi: { import: vi.fn(), save: vi.fn(), preview: vi.fn(), render: vi.fn().mockResolvedValue({ rendered: [] }) } }));
const renderDialog = (props: Partial<Parameters<typeof MCPImportDialog>[0]> = {}, order: readonly string[] = mcpTargets) =>
render(<QueryClientProvider client={new QueryClient()}><I18nProvider><ToastProvider><MCPTargetOrder.Provider value={order}><MCPImportDialog source="target" servers={{ github: { command: 'npx' } }} defaultTargets={['claude', 'cursor']} paths={{ claude: '/home/me/.claude.json', codex: '/home/me/.codex/config.toml' }} detected={['claude']} onClose={vi.fn()} onImported={vi.fn()} {...props} /></MCPTargetOrder.Provider></ToastProvider></I18nProvider></QueryClientProvider>);
@@ -22,6 +22,7 @@ describe('MCP import dialog', () => {
vi.clearAllMocks(); localStorage.clear();
HTMLElement.prototype.scrollIntoView = vi.fn();
vi.mocked(mcpApi.save).mockResolvedValue({ applied: [], backupIds: [] });
vi.mocked(mcpApi.preview).mockResolvedValue({ revision: '', sourcePath: '', blocked: false, changes: [] });
});
it('imports every new server from a target and adopts the entries that target keeps', async () => {
+14 -3
View File
@@ -15,7 +15,7 @@ import { useToast } from '../Toast';
import { useT, plural } from '../../i18n';
import { useAppContext } from '../../context/AppContext';
import { shortenHome } from '../../lib/paths';
import { describeEndpoint, describeError, hasToolPolicy, targetLabel, parsePiOptions } from './mcpView';
import { describeEndpoint, describeError, hasToolPolicy, otherConflicts, targetLabel, parsePiOptions } from './mcpView';
import { MCPTargetOrder } from './targetOrder';
import type { AddMode } from './mcpServerDraft';
import { queryKeys } from '../../lib/queryKeys';
@@ -318,6 +318,13 @@ function ImportPreview({ selection, targets, project, onPreviewName }: { selecti
}
/** The other Agents whose entry of the imported server still conflicts with the source. */
async function conflictsLeft(conflict: { target: string; name: string }, project?: string) {
// The import itself succeeded; a preview that fails shows on the page once it reloads.
const plan = await mcpApi.preview().catch(() => null);
return otherConflicts(plan?.changes ?? [], conflict, project).map(targetLabel);
}
export default function MCPImportDialog(props: Props) {
const { source, servers, defaultTargets, paths, conflict, project, availableTargets: offered, onMode, onClose, onImported } = props;
const t = useT();
@@ -370,11 +377,15 @@ export default function MCPImportDialog(props: Props) {
try {
await mcpApi.save(mutation);
} catch (e) {
failed.push(`${c.name}: ${(e as Error).message}`);
failed.push(`${c.name}: ${describeError(t, (e as Error).message)}`);
}
}
const done = chosen.length - failed.length;
if (done > 0) toast(t(plural('mcp.toast.imported', done), { count: done }), 'success');
// Another Agent may hold a different definition of the server just imported. Say which,
// and how to settle it, rather than leave the next import to flip the conflict back.
const left = conflict && done > 0 ? await conflictsLeft(conflict, project) : [];
if (left.length > 0) toast(t('mcp.toast.conflictsLeft', { name: conflict!.name, from: targetLabel(conflict!.target), targets: left.join(', ') }), 'warning');
else if (done > 0) toast(t(plural('mcp.toast.imported', done), { count: done }), 'success');
if (failed.length) toast(failed.join('\n'), 'error');
onImported();
};
+22 -1
View File
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import type { MCPPlan } from '../../api/mcp';
import { buildMatrix, denyRemovesAll, describeError, describeMessage, canImportConflict, groupByFile, isResolvable, joinCommand, projectFileTargets, mcpClient, mcpNotice, parsePiOptions, parseToolChange, parseToolNotice, pinFindingKey, serverCount, setToolChecked, splitCommand, switchTargets, targetLabel, toolRules, toolSummary } from './mcpView';
import { buildMatrix, denyRemovesAll, describeError, describeMessage, canImportConflict, groupByFile, isResolvable, joinCommand, projectFileTargets, mcpClient, mcpNotice, otherConflicts, parsePiOptions, parseToolChange, parseToolNotice, pinFindingKey, serverCount, setToolChecked, splitCommand, switchTargets, targetLabel, toolRules, toolSummary } from './mcpView';
import { mcpTargets } from '../../api/mcp';
const change = (name: string, target: string, action: string, message?: string) => ({ name, target, action, message, path: `/${target}.json` });
@@ -143,6 +143,27 @@ describe('groupByFile', () => {
});
});
// After importing one Agent's version, the others still holding a different one are what
// the user must replace next; another scope's conflicts are not settled by this import.
describe('otherConflicts', () => {
const unmanaged = 'existing entry is not managed; import it to explicitly adopt it';
const changes = [
change('docs', 'claude', 'conflict', unmanaged),
change('docs', 'codex', 'conflict', unmanaged),
{ ...change('docs', 'cursor', 'conflict', unmanaged), root: '/work/app' },
change('docs', 'vscode', 'conflict', 'managed by another Skillshare config: /other.yaml'),
change('other', 'gemini', 'conflict', unmanaged),
];
it('names the other Agents of the same server and scope that can be replaced', () => {
expect(otherConflicts(changes, { target: 'claude', name: 'docs' })).toEqual(['codex']);
});
it("keeps a project's import to that project", () => {
expect(otherConflicts(changes, { target: 'claude', name: 'docs' }, '/work/app')).toEqual(['cursor']);
});
});
describe('canImportConflict', () => {
// Import reads the Agent's global file, which holds the server and never the project's switch.
it('offers no import for a changed switch, which only a replace can settle', () => {
+5
View File
@@ -123,6 +123,7 @@ const importErrorKeys: Record<string, string> = {
'invalid server JSON': 'mcp.importError.json',
'invalid TOML; target was not changed': 'mcp.importError.toml',
'no MCP entries found': 'mcp.importError.noEntries',
'source saved; unresolved conflicts prevented adoption': 'mcp.importError.notAdopted',
'no MCP entries found; select the matching client format': 'mcp.importError.noEntries',
};
@@ -346,6 +347,10 @@ export const isResolvable = (change: MCPChange) =>
change.action === 'conflict' &&
['mcp.conflictChanged', 'mcp.conflictUnmanaged', 'mcp.conflictOrphaned', 'mcp.conflictPiOverride'].includes(conflictKeys[conflictPrefix(change.message ?? '')]);
/** The other Agents whose entry of the server still conflicts in the same scope: the global source, or one mcp.projects root. */
export const otherConflicts = (changes: MCPChange[], conflict: { target: string; name: string }, project?: string) =>
[...new Set(changes.filter((c) => c.name === conflict.name && c.target !== conflict.target && (c.root ?? '') === (project ?? '') && isResolvable(c)).map((c) => c.target))];
/** Whether importing can settle a conflict. It reads the Agent's global file, which never holds a project's switch,
* and Pi's project override has no server to import. */
export const canImportConflict = (change: MCPChange) =>
+2
View File
@@ -1696,6 +1696,7 @@
"mcp.toast.unmanaged": "{name} wird nicht mehr verwaltet; die Einträge bleiben in den Dateien",
"mcp.toast.restored": "Backup wiederhergestellt",
"mcp.toast.replaced": "Durch die Quelle ersetzt",
"mcp.toast.conflictsLeft": "{name} verwendet jetzt die Einstellungen aus {from}. Um sie auch in {targets} zu verwenden, wähle „Durch Quelle ersetzen“.",
"mcp.removeBlocked": "Eine Konfigurationsdatei wurde außerhalb von skillshare geändert, daher kann vorerst nur die Quelle aktualisiert werden.",
"mcp.restorePreview": "Vorschau",
"mcp.moreActions": "Weitere Aktionen für {name}",
@@ -2728,6 +2729,7 @@
"mcp.importError.json": "Kein gültiges JSON oder JSONC. Syntax prüfen.",
"mcp.importError.toml": "Kein gültiges TOML. Syntax prüfen.",
"mcp.importError.noEntries": "Keine MCP-Server darin gefunden. Den Teil einfügen, der die Server enthält.",
"mcp.importError.notAdopted": "Der Server wurde gespeichert, aber der Eintrag dieses Agents weicht noch ab, daher hat skillshare ihn nicht übernommen. Wähle dort „Durch Quelle ersetzen“.",
"projects.origin.local": "Dieser Rechner",
"projects.title": "Projekte",
"projects.subtitle": "Ordner, die deine Skills, Agents und MCP-Server erhalten. Ein Sync aktualisiert alle.",
+2
View File
@@ -1696,6 +1696,7 @@
"mcp.toast.unmanaged": "Stopped managing {name}; its entries stay in the files",
"mcp.toast.restored": "Backup restored",
"mcp.toast.replaced": "Replaced with source",
"mcp.toast.conflictsLeft": "{name} now uses the settings from {from}. To use them in {targets} too, choose Replace with source.",
"mcp.removeBlocked": "A config file was changed outside skillshare, so for now only the source can be updated.",
"mcp.restorePreview": "Preview",
"mcp.moreActions": "More actions for {name}",
@@ -2728,6 +2729,7 @@
"mcp.importError.json": "Not valid JSON or JSONC. Check the syntax.",
"mcp.importError.toml": "Not valid TOML. Check the syntax.",
"mcp.importError.noEntries": "No MCP servers found in it. Paste the part that holds the servers.",
"mcp.importError.notAdopted": "The server was saved, but that Agent's entry still differs from it, so skillshare did not take it over. Choose Replace with source on it.",
"projects.origin.local": "This machine",
"projects.title": "Projects",
"projects.subtitle": "Folders that get your skills, agents and MCP servers. One Sync updates all of them.",
+2
View File
@@ -1696,6 +1696,7 @@
"mcp.toast.unmanaged": "Se dejó de gestionar {name}; sus entradas siguen en los archivos",
"mcp.toast.restored": "Copia restaurada",
"mcp.toast.replaced": "Reemplazado por la fuente",
"mcp.toast.conflictsLeft": "{name} ahora usa la configuración de {from}. Para usarla también en {targets}, elige «Reemplazar con el origen».",
"mcp.removeBlocked": "Un archivo de configuración cambió fuera de skillshare, así que por ahora solo se puede actualizar la fuente.",
"mcp.restorePreview": "Vista previa",
"mcp.moreActions": "Más acciones para {name}",
@@ -2728,6 +2729,7 @@
"mcp.importError.json": "No es JSON ni JSONC válido. Revisa la sintaxis.",
"mcp.importError.toml": "No es TOML válido. Revisa la sintaxis.",
"mcp.importError.noEntries": "No se encontraron servidores MCP. Pega la parte que contiene los servidores.",
"mcp.importError.notAdopted": "El servidor se guardó, pero la entrada de ese Agent sigue siendo distinta, así que skillshare no la tomó a su cargo. Elige «Reemplazar con el origen» en ella.",
"projects.origin.local": "Esta máquina",
"projects.title": "Proyectos",
"projects.subtitle": "Carpetas que reciben tus skills, agents y servidores MCP. Un Sync las actualiza todas.",
+2
View File
@@ -1696,6 +1696,7 @@
"mcp.toast.unmanaged": "مدیریت {name} متوقف شد؛ ورودی‌های آن در فایل‌ها باقی می‌مانند",
"mcp.toast.restored": "پشتیبان بازگردانی شد",
"mcp.toast.replaced": "با منبع جایگزین شد",
"mcp.toast.conflictsLeft": "{name} اکنون از تنظیمات {from} استفاده می‌کند. برای استفاده از آن در {targets} هم، «جایگزینی با مبدأ» را انتخاب کنید.",
"mcp.removeBlocked": "یک فایل پیکربندی بیرون از skillshare تغییر کرده، پس فعلاً فقط منبع به‌روز می‌شود.",
"mcp.restorePreview": "پیش‌نمایش",
"mcp.moreActions": "کارهای بیشتر برای {name}",
@@ -2728,6 +2729,7 @@
"mcp.importError.json": "JSON یا JSONC معتبر نیست. نحو را بررسی کنید.",
"mcp.importError.toml": "TOML معتبر نیست. نحو را بررسی کنید.",
"mcp.importError.noEntries": "هیچ سرور MCP در آن پیدا نشد. بخشی را که سرورها در آن هستند جای‌گذاری کنید.",
"mcp.importError.notAdopted": "سرور ذخیره شد، اما مدخل آن Agent هنوز متفاوت است، پس skillshare مدیریت آن را بر عهده نگرفت. روی آن «جایگزینی با مبدأ» را انتخاب کنید.",
"projects.origin.local": "این دستگاه",
"projects.title": "پروژه‌ها",
"projects.subtitle": "پوشه‌هایی که اسکیل‌ها، Agentها و سرورهای MCP شما را می‌گیرند. یک Sync همه را به‌روز می‌کند.",
+2
View File
@@ -1696,6 +1696,7 @@
"mcp.toast.unmanaged": "{name} n’est plus géré ; ses entrées restent dans les fichiers",
"mcp.toast.restored": "Sauvegarde restaurée",
"mcp.toast.replaced": "Remplacé par la source",
"mcp.toast.conflictsLeft": "{name} utilise désormais les réglages de {from}. Pour les utiliser aussi dans {targets}, choisissez « Remplacer par la source ».",
"mcp.removeBlocked": "Un fichier de configuration a été modifié hors de skillshare ; pour l’instant, seule la source peut être mise à jour.",
"mcp.restorePreview": "Aperçu",
"mcp.moreActions": "Plus d’actions pour {name}",
@@ -2728,6 +2729,7 @@
"mcp.importError.json": "JSON ou JSONC non valide. Vérifiez la syntaxe.",
"mcp.importError.toml": "TOML non valide. Vérifiez la syntaxe.",
"mcp.importError.noEntries": "Aucun serveur MCP trouvé. Collez la partie qui contient les serveurs.",
"mcp.importError.notAdopted": "Le serveur a été enregistré, mais l'entrée de cet Agent diffère encore, donc skillshare ne l'a pas prise en charge. Choisissez « Remplacer par la source » sur cette entrée.",
"projects.origin.local": "Cette machine",
"projects.title": "Projets",
"projects.subtitle": "Dossiers qui reçoivent vos skills, agents et serveurs MCP. Un seul Sync les met tous à jour.",
+2
View File
@@ -1696,6 +1696,7 @@
"mcp.toast.unmanaged": "{name} tidak dikelola lagi; entrinya tetap ada di file",
"mcp.toast.restored": "Cadangan dipulihkan",
"mcp.toast.replaced": "Diganti dengan sumber",
"mcp.toast.conflictsLeft": "{name} sekarang memakai pengaturan dari {from}. Untuk memakainya juga di {targets}, pilih \"Ganti dengan sumber\".",
"mcp.removeBlocked": "File konfigurasi diubah di luar skillshare, jadi untuk sekarang hanya sumber yang bisa diperbarui.",
"mcp.restorePreview": "Pratinjau",
"mcp.moreActions": "Tindakan lain untuk {name}",
@@ -2728,6 +2729,7 @@
"mcp.importError.json": "Bukan JSON atau JSONC yang valid. Periksa sintaksnya.",
"mcp.importError.toml": "Bukan TOML yang valid. Periksa sintaksnya.",
"mcp.importError.noEntries": "Tidak ada server MCP di dalamnya. Tempel bagian yang berisi server.",
"mcp.importError.notAdopted": "Server sudah disimpan, tetapi entri di Agent itu masih berbeda, jadi skillshare tidak mengambil alihnya. Pilih \"Ganti dengan sumber\" pada entri itu.",
"projects.origin.local": "Mesin ini",
"projects.title": "Proyek",
"projects.subtitle": "Folder yang menerima skill, agent, dan server MCP Anda. Satu Sync memperbarui semuanya.",
+2
View File
@@ -1696,6 +1696,7 @@
"mcp.toast.unmanaged": "{name} の管理を停止しました。設定ファイルの内容はそのまま残ります",
"mcp.toast.restored": "バックアップを復元しました",
"mcp.toast.replaced": "ソースで置き換えました",
"mcp.toast.conflictsLeft": "{name} は {from} の設定を使うようになりました。{targets} でも同じ設定を使うには「ソースで上書き」を選んでください。",
"mcp.removeBlocked": "設定ファイルが skillshare の外で変更されたため、今はソースだけを更新できます。",
"mcp.restorePreview": "プレビュー",
"mcp.moreActions": "{name} のその他の操作",
@@ -2728,6 +2729,7 @@
"mcp.importError.json": "有効な JSON / JSONC ではありません。構文を確認してください。",
"mcp.importError.toml": "有効な TOML ではありません。構文を確認してください。",
"mcp.importError.noEntries": "MCP サーバーが見つかりません。サーバーが書かれている部分を貼り付けてください。",
"mcp.importError.notAdopted": "サーバーは保存されましたが、その Agent のエントリがまだ異なるため、skillshare は管理を引き継ぎませんでした。そのエントリで「ソースで上書き」を選んでください。",
"projects.origin.local": "このマシン",
"projects.title": "プロジェクト",
"projects.subtitle": "skills、agents、MCP servers を受け取るフォルダーです。一度の Sync ですべて更新されます。",
+2
View File
@@ -1696,6 +1696,7 @@
"mcp.toast.unmanaged": "{name} 관리를 중지했습니다. 설정 파일의 항목은 그대로 남습니다",
"mcp.toast.restored": "백업을 복원했습니다",
"mcp.toast.replaced": "소스로 교체했습니다",
"mcp.toast.conflictsLeft": "이제 {name}은(는) {from}의 설정을 사용합니다. {targets}에서도 같은 설정을 쓰려면 \"원본으로 덮어쓰기\"를 선택하세요.",
"mcp.removeBlocked": "설정 파일이 skillshare 밖에서 변경되어 지금은 소스만 업데이트할 수 있습니다.",
"mcp.restorePreview": "미리보기",
"mcp.moreActions": "{name} 추가 작업",
@@ -2728,6 +2729,7 @@
"mcp.importError.json": "올바른 JSON 또는 JSONC가 아닙니다. 문법을 확인하세요.",
"mcp.importError.toml": "올바른 TOML이 아닙니다. 문법을 확인하세요.",
"mcp.importError.noEntries": "MCP 서버를 찾지 못했습니다. 서버가 들어 있는 부분을 붙여 넣으세요.",
"mcp.importError.notAdopted": "서버는 저장되었지만 해당 Agent의 항목이 여전히 달라 skillshare가 관리를 넘겨받지 않았습니다. 그 항목에서 \"원본으로 덮어쓰기\"를 선택하세요.",
"projects.origin.local": "이 기기",
"projects.title": "프로젝트",
"projects.subtitle": "skills, agents, MCP servers를 받는 폴더입니다. Sync 한 번으로 모두 업데이트됩니다.",
+2
View File
@@ -1696,6 +1696,7 @@
"mcp.toast.unmanaged": "{name} deixou de ser gerenciado; as entradas continuam nos arquivos",
"mcp.toast.restored": "Backup restaurado",
"mcp.toast.replaced": "Substituído pela origem",
"mcp.toast.conflictsLeft": "{name} agora usa as configurações de {from}. Para usá-las também em {targets}, escolha \"Substituir pela origem\".",
"mcp.removeBlocked": "Um arquivo de configuração foi alterado fora do skillshare, então por enquanto só a origem pode ser atualizada.",
"mcp.restorePreview": "Prévia",
"mcp.moreActions": "Mais ações para {name}",
@@ -2728,6 +2729,7 @@
"mcp.importError.json": "Não é JSON nem JSONC válido. Confira a sintaxe.",
"mcp.importError.toml": "Não é TOML válido. Confira a sintaxe.",
"mcp.importError.noEntries": "Nenhum servidor MCP encontrado. Cole a parte que contém os servidores.",
"mcp.importError.notAdopted": "O servidor foi salvo, mas a entrada desse Agent ainda é diferente, então o skillshare não a assumiu. Escolha \"Substituir pela origem\" nela.",
"projects.origin.local": "Esta máquina",
"projects.title": "Projetos",
"projects.subtitle": "Pastas que recebem seus skills, agents e servidores MCP. Um Sync atualiza todas.",
+2
View File
@@ -1696,6 +1696,7 @@
"mcp.toast.unmanaged": "已停止管理 {name},配置文件里的内容保持不变",
"mcp.toast.restored": "已恢复备份",
"mcp.toast.replaced": "已用来源替换",
"mcp.toast.conflictsLeft": "{name} 已改用 {from} 的设置。要让 {targets} 也使用这份设置,请点击“使用来源覆盖”。",
"mcp.removeBlocked": "有配置文件在 skillshare 之外被修改,目前只能更新来源。",
"mcp.restorePreview": "预览",
"mcp.moreActions": "{name} 的更多操作",
@@ -2728,6 +2729,7 @@
"mcp.importError.json": "不是有效的 JSON 或 JSONC,请检查语法。",
"mcp.importError.toml": "不是有效的 TOML,请检查语法。",
"mcp.importError.noEntries": "里面找不到 MCP 服务器。请粘贴包含服务器的那一段。",
"mcp.importError.notAdopted": "服务器已保存,但该 Agent 的条目仍与它不同,所以 skillshare 没有接管。请对它点击“使用来源覆盖”。",
"projects.origin.local": "此机器",
"projects.title": "项目",
"projects.subtitle": "会获得你的 skills、agents 和 MCP servers 的文件夹。一次 Sync 全部更新。",
+2
View File
@@ -1696,6 +1696,7 @@
"mcp.toast.unmanaged": "已停止管理 {name},設定檔裡的內容保留原樣",
"mcp.toast.restored": "已還原備份",
"mcp.toast.replaced": "已用來源取代",
"mcp.toast.conflictsLeft": "{name} 已改用 {from} 的設定。要讓 {targets} 也使用這份設定,請按「以來源覆寫」。",
"mcp.removeBlocked": "有設定檔在 skillshare 之外被改過,目前只能更新來源。",
"mcp.restorePreview": "預覽",
"mcp.moreActions": "{name} 的更多操作",
@@ -2728,6 +2729,7 @@
"mcp.importError.json": "不是有效的 JSON 或 JSONC,請檢查語法。",
"mcp.importError.toml": "不是有效的 TOML,請檢查語法。",
"mcp.importError.noEntries": "裡面找不到 MCP 伺服器。請貼上包含伺服器的那一段。",
"mcp.importError.notAdopted": "伺服器已儲存,但該 Agent 的項目仍與它不同,所以 skillshare 沒有接管。請對它按「以來源覆寫」。",
"projects.origin.local": "此機器",
"projects.title": "專案",
"projects.subtitle": "會取得你的 skills、agents 和 MCP servers 的資料夾。一次 Sync 全部更新。",
+21
View File
@@ -35,6 +35,27 @@ describe('MCP page', () => {
await waitFor(() => expect(mcpApi.import).toHaveBeenCalledWith({ from: 'cursor', root: '/work/app' }));
});
// Replacing one Agent at a time left the other conflict blocking the sync, so the dialog could never apply.
it('replaces every conflicting entry of the server at once', async () => {
const user = userEvent.setup();
const unmanaged = 'existing entry is not managed; import it to explicitly adopt it';
vi.mocked(mcpApi.list).mockResolvedValue({
source: { path: '', configPath: '', targets: ['claude', 'codex'], servers: { docs: { command: 'npx' } } },
projectConfigs: [], paths: { claude: '/.claude.json', codex: '/.codex/config.toml' }, detected: ['claude', 'codex'], local: false, openable: [], projectPaths: {}, projectExisting: {}, previewError: '', backups: [], unmanaged: [],
plan: { revision: '', sourcePath: '', blocked: true, changes: [
{ target: 'claude', path: '/.claude.json', name: 'docs', action: 'conflict', message: unmanaged },
{ target: 'codex', path: '/.codex/config.toml', name: 'docs', action: 'conflict', message: unmanaged },
] },
} as Awaited<ReturnType<typeof mcpApi.list>>);
vi.mocked(mcpApi.preview).mockResolvedValue({ revision: '', sourcePath: '', blocked: false, changes: [] });
render(<MemoryRouter><QueryClientProvider client={new QueryClient()}><I18nProvider><ToastProvider><MCPPage /></ToastProvider></I18nProvider></QueryClientProvider></MemoryRouter>);
await user.click((await screen.findAllByRole('button', { name: 'Replace with source' }))[0]);
expect(mcpApi.preview).toHaveBeenCalledWith({ resolutions: [
{ target: 'claude', name: 'docs', action: 'replace' },
{ target: 'codex', name: 'docs', action: 'replace' },
] });
});
// Each save sends the revision it previewed; a second one racing it would be refused.
it('holds the other toggles while a save is on its way', async () => {
const user = userEvent.setup();
+5 -1
View File
@@ -346,7 +346,11 @@ export default function MCPPage() {
setImporting({ conflict: { target, name }, project });
return;
}
const mutation: MCPMutation = { resolutions: [{ target, name, action: 'replace' }] };
// The source holds one definition, so replacing settles every Agent that conflicts on this
// server at once. One at a time, the others would keep the sync blocked.
// A conflict row offers this only when it is resolvable, so the clicked target is among them.
const targets = new Set(model.conflicts.filter((c) => c.name === name && isResolvable(c)).map((c) => c.target));
const mutation: MCPMutation = { resolutions: [...targets].map((x) => ({ target: x, name, action: 'replace' })) };
setBusy(true);
try {
setReplace({ plan: await mcpApi.preview(mutation), mutation });
@@ -252,7 +252,11 @@ entry; **Save only** then records that entry as the baseline without changing th
file, so the next sync rewrites it and still detects edits made in the meantime.
It never overrides other conflicting native entries. In the MCP dashboard, a conflict
you can settle offers an import action named after the Agent, such as **Import from
cursor**, to adopt that version, or **Replace with source** to overwrite that entry.
cursor**, to adopt that version, or **Replace with source** to overwrite it. Replace
overwrites every Agent whose entry of that server conflicts, since sync waits until
all of them are settled. When Agents hold different versions of one server, import the
version you want, then replace the rest: the import adopts that Agent's entry even
while other Agents still conflict, and the dashboard names the Agents that are left.
A conflict held by another Skillshare configuration that still exists offers neither,
because only that configuration can release the entry.
+5 -1
View File
@@ -903,7 +903,11 @@ and writes no files until you choose for that entry:
An entry that matches the source is adopted as it is. For a conflict in a folder under
`mcp.projects`, the button reads that folder's file and imports into that project.
- Replace it with the source definition: **Replace with source** in the dashboard, or
`--replace` on import.
`--replace` on import. The dashboard button replaces every Agent's conflicting entry
of that server at once.
If Agents hold different versions of the server, import the one you want first. The
import adopts that Agent's entry even while others still conflict; replace those next.
## Serve skills over MCP {#serve-skills-over-mcp}
@@ -239,7 +239,10 @@ Source にすでにその名前が存在する場合は、ダッシュボード
次の Sync でそれが書き換えられ、その間に行われた編集も引き続き検出されます。これは他の競合する
ネイティブエントリを上書きすることは決してありません。MCP ダッシュボードでは、対処できる競合に
**Import from cursor** のように Agent 名を冠したインポートアクションがあり、そのバージョンを採用するか、
**Replace with source** でそのエントリを上書きできます。まだ存在する別の Skillshare 設定が所有している
**Replace with source** でそのエントリを上書きできます。Replace は、そのサーバーのエントリが競合している
すべての Agent をまとめて上書きします。sync はそのすべてが解決するまで待つためです。Agent ごとに
同じサーバーの異なるバージョンを持っている場合は、使いたいバージョンをインポートしてから残りを置き換えます。
インポートは他の Agent がまだ競合していてもその Agent のエントリを採用し、ダッシュボードは残った Agent を示します。まだ存在する別の Skillshare 設定が所有している
競合には、そのどちらも表示されません。そのエントリを解放できるのはその設定だけだからです。
Agent がすでに同じ名前で持っているサーバーを引き継ぐ方法も同じです。それを source に追加します。Agent のエントリが
@@ -721,6 +721,10 @@ Agent ファイルがすでに使っている名前でサーバーを追加し
採用されます。`mcp.projects` 配下のフォルダーでの競合では、ボタンはそのフォルダーのファイルを読み込み、
その project にインポートします。
- source の定義で置き換える: ダッシュボードの **Replace with source**、またはインポート時の `--replace`。
ダッシュボードのボタンは、そのサーバーで競合しているすべての Agent のエントリをまとめて置き換えます。
Agent ごとにサーバーのバージョンが異なる場合は、まず使いたいものをインポートします。インポートは他の
Agent がまだ競合していてもその Agent のエントリを採用します。残りはその後で置き換えます。
## MCP で Skill を提供する {#serve-skills-over-mcp}
@@ -237,7 +237,10 @@ Source에 이미 해당 이름이 있다면 대시보드의 **Edit** 작업이
다시 쓰면서도 그동안 이루어진 편집을 여전히 감지합니다. 다른 충돌하는 네이티브 항목을
덮어쓰지는 않습니다. MCP 대시보드에서 처리할 수 있는 충돌은 **Import from cursor**처럼
Agent 이름을 딴 import 작업을 제공하여 그 버전을 채택하거나, **Replace with source**로
해당 항목을 덮어쓸 수 있습니다. 아직 존재하는 다른 Skillshare 설정이 소유한 충돌에는
해당 항목을 덮어쓸 수 있습니다. Replace는 그 서버 항목이 충돌하는 모든 Agent를 한 번에
덮어씁니다. sync는 그 모두가 해결될 때까지 기다리기 때문입니다. Agent마다 같은 서버의 다른
버전을 가지고 있다면 원하는 버전을 import한 뒤 나머지를 교체하세요. import는 다른 Agent가
아직 충돌 중이어도 그 Agent의 항목을 채택하고, 대시보드는 남은 Agent를 알려 줍니다. 아직 존재하는 다른 Skillshare 설정이 소유한 충돌에는
두 작업이 모두 제공되지 않습니다. 해당 설정만이 그 항목을 놓아줄 수 있기 때문입니다.
Agent가 같은 이름으로 이미 가진 서버를 넘겨받을 때도 이 방법을 씁니다. 서버를 source에
@@ -835,6 +835,10 @@ plan은 `existing entry is not managed` 충돌을 보고하고, 그 항목에
그대로 채택됩니다. `mcp.projects` 아래 폴더의 충돌이라면 버튼은 그 폴더의 파일을 읽고
해당 project로 가져옵니다.
- source 정의로 교체: 대시보드의 **Replace with source**, 또는 import의 `--replace`.
대시보드 버튼은 그 서버에서 충돌하는 모든 Agent의 항목을 한 번에 교체합니다.
Agent마다 서버 버전이 다르면 원하는 것을 먼저 import하세요. import는 다른 Agent가 아직
충돌 중이어도 그 Agent의 항목을 채택합니다. 나머지는 그다음에 교체하세요.
## Serve skills over MCP {#serve-skills-over-mcp}
@@ -239,7 +239,10 @@ CLI 的 `--replace`。在 Import 时,`--replace` 也会重写被导入 Agent
文件,因此下一次同步会重写它,并且仍能检测到期间所做的编辑。它
绝不会覆盖其他有冲突的原生条目。在 MCP 控制台中,可以处理的
冲突会提供一个以该 Agent 命名的导入操作,例如 **Import from
cursor**,用于采用该版本;或 **Replace with source**,用于覆写该条目。
cursor**,用于采用该版本;或 **Replace with source**,用于覆写该条目。Replace 会一次覆写所有在该 server 上
有冲突的 Agent,因为 sync 要等它们全部处理完。若各 Agent 持有同一个 server 的不同
版本,先导入你要的版本,再替换其余的:即使其他 Agent 仍有冲突,导入也会接管该 Agent
的条目,控制台会列出剩下的 Agent。
如果某个冲突是由另一份仍然存在的 Skillshare 配置所拥有,则这两个
操作都不会出现,因为只有那份配置才能释放该条目。
@@ -814,7 +814,10 @@ server,反之亦然。若要重新管理某个条目,请 import 它。
**Import from** 按钮,例如 **Import from Cursor**。与 source 相符的条目会按原样被接管。若 conflict 位于
`mcp.projects` 下的文件夹,按钮会读取该文件夹的文件,并导入到那个 project。
- 用 source 定义替换它:仪表盘中的 **Replace with source**,或在 import 时使用
`--replace`。
`--replace`。仪表盘按钮会一次替换该 server 所有有冲突的 Agent 条目。
若各 Agent 的 server 版本不同,先导入你要的那个。即使其他 Agent 仍有冲突,导入也会
接管该 Agent 的条目;之后再替换其余的。
## 通过 MCP 提供 skill {#serve-skills-over-mcp}
@@ -224,7 +224,10 @@ CLI 會停止,而不是覆寫一個正常運作的項目。設定好回報的
記錄為基準,不會改動檔案,因此下一次同步會改寫它,並且仍然能偵測到期間所做的編輯。
它絕不會覆寫其他有衝突的原生項目。在 MCP dashboard 中,你能處理的衝突會提供一個以
Agent 命名的匯入動作,例如 **Import from cursor**,用以採用該版本,或
**Replace with source** 以覆寫該項目。若某則衝突的項目由另一份仍然存在的 Skillshare
**Replace with source** 以覆寫該項目。Replace 會一次覆寫所有在該伺服器上有衝突的
Agent,因為同步要等它們全部處理完。若各 Agent 持有同一個伺服器的不同版本,先匯入你要的
版本,再取代其餘的:即使其他 Agent 仍有衝突,匯入也會接管該 Agent 的項目,dashboard
會列出剩下的 Agent。若某則衝突的項目由另一份仍然存在的 Skillshare
設定檔所擁有,兩者都不會出現,因為只有那份設定檔能釋放該項目。
接手某個 Agent 裡已有同名的伺服器,也是用這個方式:把它加進來源。若該 Agent 的項目
@@ -780,7 +780,10 @@ dashboard 會讀取目前範圍的 Agent 設定檔,以及 `mcp.projects` 底
**Import from** 按鈕,例如 **Import from Cursor**。與 source 相符的項目會直接被採用。若 conflict 位於
`mcp.projects` 底下的資料夾,按鈕會讀取該資料夾的檔案,並匯入到那個 project。
- 以 source 定義取代它:dashboard 中的 **Replace with source**,或匯入時加上
`--replace`。
`--replace`。dashboard 的按鈕會一次取代該伺服器所有有衝突的 Agent 項目。
若各 Agent 的伺服器版本不同,先匯入你要的那個。即使其他 Agent 仍有衝突,匯入也會
接管該 Agent 的項目;之後再取代其餘的。
## 透過 MCP 提供 skills {#serve-skills-over-mcp}