From 14c48cf9f539759cc6758449962497d832e3f2c1 Mon Sep 17 00:00:00 2001 From: Rhys Sullivan <39114868+RhysSullivan@users.noreply.github.com> Date: Mon, 4 May 2026 00:44:22 -0700 Subject: [PATCH] Fix source name persistence and sidebar truncation - refreshSource: prefer existing saved name over MCP manifest name so user renames survive a refresh - updateSource: re-register source via ctx.core.sources.update inside the same transaction as the storage write so the sidebar/home page reflect renames immediately instead of after a full reload - cloud sidebar: title attribute on source name for hover tooltip Partial fix for #391 (secret label editing still pending). --- apps/cloud/src/web/shell.tsx | 2 +- packages/plugins/mcp/src/sdk/plugin.ts | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/apps/cloud/src/web/shell.tsx b/apps/cloud/src/web/shell.tsx index a8f4825d9..53cdd4656 100644 --- a/apps/cloud/src/web/shell.tsx +++ b/apps/cloud/src/web/shell.tsx @@ -101,7 +101,7 @@ function SourceList(props: { pathname: string; onNavigate?: () => void }) { ].join(" ")} > - {s.name} + {s.name} {s.kind} diff --git a/packages/plugins/mcp/src/sdk/plugin.ts b/packages/plugins/mcp/src/sdk/plugin.ts index ed7d3b811..7bbd031df 100644 --- a/packages/plugins/mcp/src/sdk/plugin.ts +++ b/packages/plugins/mcp/src/sdk/plugin.ts @@ -719,7 +719,7 @@ export const mcpPlugin = definePlugin((options?: McpPluginOptions) => { ); const existing = yield* ctx.storage.getSource(namespace, scope); - const sourceName = manifest.server?.name ?? existing?.name ?? namespace; + const sourceName = existing?.name ?? manifest.server?.name ?? namespace; yield* ctx .transaction( @@ -782,13 +782,24 @@ export const mcpPlugin = definePlugin((options?: McpPluginOptions) => { ...(input.auth !== undefined ? { auth: input.auth } : {}), ...(input.queryParams !== undefined ? { queryParams: input.queryParams } : {}), }; + const nextName = input.name?.trim() || existing.name; - yield* ctx.storage.putSource({ - namespace, - scope, - name: input.name?.trim() || existing.name, - config: updatedConfig, - }); + yield* ctx.transaction( + Effect.gen(function* () { + yield* ctx.storage.putSource({ + namespace, + scope, + name: nextName, + config: updatedConfig, + }); + yield* ctx.core.sources.update({ + id: namespace, + scope, + name: nextName, + url: updatedConfig.endpoint, + }); + }), + ); }).pipe( Effect.withSpan("mcp.plugin.update_source", { attributes: { "mcp.source.namespace": namespace },