Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mcp-overview-plugin-banner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"dashboard": patch
---

The MCP server Overview brings back the plugin banner with the plugin picker, Publish and Install. "Published to N plugins" now opens a table of each plugin, the role it came through (linked to the role), and the access that role grants. The Settings plugins tile shows the supported clients.
15 changes: 15 additions & 0 deletions client/dashboard/src/components/client-icon-fan.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// A little fanned stack of client badges — purely decorative, gestures at
// "this is what publishing unlocks" without claiming these are the only
// supported clients.
export function ClientIconFan(): React.JSX.Element {
return (
<div className="relative hidden h-36 shrink-0 sm:block" aria-hidden="true">
<div className="absolute inset-6 rounded-full bg-black/15 blur-2xl" />
<img
src="/icons/decorative/plugin-clients.webp"
alt=""
className="relative h-full w-full mr-10 object-contain drop-shadow-xl"
/>
</div>
);
}
72 changes: 66 additions & 6 deletions client/dashboard/src/components/mcp-plugin-permissions.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { McpServerReadinessBar } from "./mcp-server-readiness-bar";
import { ConfigProvider } from "@/components/ui/context/ConfigContext";
import { TooltipProvider } from "@/components/ui/Tooltip";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import {
cleanup,
fireEvent,
render,
screen,
waitFor,
} from "@testing-library/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import type { ReactNode } from "react";
import { MemoryRouter } from "react-router";
Expand Down Expand Up @@ -29,6 +35,8 @@ const state = vi.hoisted(() => ({
"https://example.test/marketplace?token=synthetic-admin-token",
},
})),
settings: vi.fn(() => ({ data: { effectiveName: "example-marketplace" } })),
resourceAudience: vi.fn(() => ({ data: undefined })),
mutation: vi.fn(() => ({ isPending: false, mutateAsync: vi.fn() })),
mcpServer: { id: "server-a", name: "Server" } as {
id: string;
Expand Down Expand Up @@ -78,6 +86,12 @@ vi.mock("@gram/client/react-query/removePluginServer", () => ({
vi.mock("@gram/client/react-query/publishPlugins", () => ({
usePublishPluginsMutation: state.mutation,
}));
vi.mock("@gram/client/react-query/resourceAudience.js", () => ({
useResourceAudience: state.resourceAudience,
}));
vi.mock("@gram/client/react-query/marketplaceSettings", () => ({
useMarketplaceSettings: state.settings,
}));
vi.mock("@/contexts/Fetcher", () => ({
useFetcher: () => ({ fetch: vi.fn() }),
}));
Expand Down Expand Up @@ -282,13 +296,14 @@ beforeEach(() => {
});
afterEach(cleanup);
const scope = { gramProject: "project-slug", gramSession: "session-a" };
function banner() {
function banner(variant?: "banner" | "settings") {
const client = new QueryClient();
const content = () => (
<QueryClientProvider client={client}>
<TooltipProvider>
<ConfigProvider theme="light" setTheme={() => {}}>
<PluginStatusBanner
variant={variant}
server={{
kind: "mcp-server",
id: "server-a",
Expand All @@ -304,9 +319,43 @@ function banner() {
return { ...view, refresh: () => view.rerender(content()) };
}
describe("MCP plugin permission boundaries", () => {
it("offers the plugin picker as a Plugins settings section", () => {
it("unmounts the real token-bearing install dialog on admin-to-writer downgrade", async () => {
state.grants = [{ scope: "org:admin" }, { scope: "plugin:write" }];
const view = banner();
fireEvent.click(screen.getByRole("button", { name: "Install" }));
fireEvent.click(screen.getByRole("button", { name: "Claude Code" }));
await waitFor(() =>
expect(document.body.textContent).toContain("synthetic-admin-token"),
);
expect(state.settings).toHaveBeenCalled();
vi.clearAllMocks();
state.grants = [{ scope: "plugin:write" }];
view.refresh();
expect(document.body.textContent).not.toContain("synthetic-admin-token");
expect(screen.queryByRole("button", { name: "Install" })).toBeNull();
expect(state.settings).not.toHaveBeenCalled();
expect(state.plugins).toHaveBeenCalledWith(
scope,
undefined,
expect.objectContaining({ throwOnError: false }),
);
expect(screen.getByRole("button", { name: "Cached plugin" })).toBeTruthy();
expect(screen.getByRole("button", { name: "Update" })).toBeTruthy();
});

it("does not mount install queries for a writer who administers another organization", () => {
state.grants = [
{ scope: "plugin:write" },
{ scope: "org:admin", selectors: [{ resourceId: "org-b" }] },
];
banner();
expect(state.settings).not.toHaveBeenCalled();
expect(screen.queryByRole("button", { name: "Install" })).toBeNull();
expect(screen.getByRole("button", { name: "Update" })).toBeTruthy();
});
it("offers the header's plugin picker as a Plugins settings section", () => {
state.grants = [{ scope: "plugin:write" }];
banner("settings");
expect(screen.getByRole("heading", { name: "Plugins" })).toBeTruthy();
expect(screen.getByRole("button", { name: "Plugins" })).toBeTruthy();
expect(screen.getByRole("button", { name: "Update" })).toBeTruthy();
Expand All @@ -330,7 +379,7 @@ describe("MCP plugin permission boundaries", () => {
],
},
} as unknown as ReturnType<typeof state.plugins>);
banner();
banner("settings");
fireEvent.click(screen.getByRole("button", { name: "Plugins" }));
const names = screen
.getAllByRole("checkbox")
Expand Down Expand Up @@ -402,7 +451,7 @@ describe("MCP plugin permission boundaries", () => {
],
},
])(
"does not mount plugin section queries or mutation controls without write access: %j",
"does not mount banner queries or mutation controls without write access: %j",
({ grants }) => {
state.grants = grants;
const view = banner();
Expand All @@ -413,7 +462,7 @@ describe("MCP plugin permission boundaries", () => {
},
);
it.each(["plugin:write", "org:admin"])(
"scopes writer plugin section queries for %s",
"scopes writer banner queries for %s",
(grant) => {
state.grants = [{ scope: grant }];
banner();
Expand All @@ -428,6 +477,17 @@ describe("MCP plugin permission boundaries", () => {
expect.objectContaining({ refetchInterval: 5000 }),
);
expect(state.mutation).toHaveBeenCalled();
expect(state.resourceAudience).toHaveBeenCalledWith(
{ resourceKind: "mcp", resourceId: "server-a" },
undefined,
expect.objectContaining({ enabled: grant === "org:admin" }),
);
if (grant === "org:admin") {
expect(screen.getByRole("button", { name: "Install" })).toBeTruthy();
} else {
expect(screen.queryByRole("button", { name: "Install" })).toBeNull();
expect(state.settings).not.toHaveBeenCalled();
}
},
);
});
Expand Down
5 changes: 5 additions & 0 deletions client/dashboard/src/components/mcp/McpDetailFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export function McpDetailFrame({
{activeTab === "overview" && chrome?.overviewSetup ? (
<div className="mb-6">{chrome.overviewSetup}</div>
) : null}
{activeTab === "overview" && chrome?.overviewBanner ? (
// The banner renders nothing for viewers who can't manage
// plugins, so the gap goes with it.
<div className="mb-6 empty:hidden">{chrome.overviewBanner}</div>
) : null}
{children}
</ReadinessIssuesProvider>
</DetailFrame>
Expand Down
2 changes: 2 additions & 0 deletions client/dashboard/src/components/mcp/mcpDetailChrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export interface McpDetailChrome {
items: DetailSidebarNavItem[];
/** Overview's first card while a guided provider setup is unfinished. */
overviewSetup?: ReactNode;
/** Overview's lead card: how the server reaches the team, with Install. */
overviewBanner?: ReactNode;
}

/** A header readiness check, with what the chip and popover need on top. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ vi.mock("@gram/client/react-query/listEnvironments.js", () => ({
vi.mock("@gram/client/react-query/getMcpMetadata.js", () => ({
useGetMcpMetadata: () => ({ data: undefined, isPending: false }),
}));
vi.mock("@/pages/mcp/overview/PluginStatusBanner", () => ({
PluginStatusBanner: () => null,
}));
vi.mock("@gram/client/react-query/serverClientAssociations.js", () => ({
useServerClientAssociations: () => ({
data: { requiredClientIds: [] },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PluginStatusBanner } from "@/pages/mcp/overview/PluginStatusBanner";
import { SimpleTooltip } from "@/components/ui/Tooltip";
import {
pluginServerRef,
Expand Down Expand Up @@ -237,7 +238,7 @@ export function useMcpServerDetailChrome(): McpDetailChrome | null {
const pluginRef: HostedServerRef | undefined = mcpServer
? pluginServerRef(mcpServer, canonicalToolset)
: undefined;
// Same membership rule as Settings' Plugins section.
// Same membership rule as the header's plugin card.
const memberPlugins = pluginRef
? (pluginsData?.plugins ?? []).filter((plugin) =>
plugin.servers?.some((s) => serverMatchesRef(s, pluginRef)),
Expand Down Expand Up @@ -557,6 +558,9 @@ export function useMcpServerDetailChrome(): McpDetailChrome | null {
) : (
overviewSetupGuide
),
overviewBanner: pluginRef ? (
Comment thread
adaam2 marked this conversation as resolved.
Resolved
<PluginStatusBanner variant="banner" server={pluginRef} />
) : undefined,
items,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ function toolLabelFromUrn(urn: string): string {
export function MCPOverviewTab({
server,
logsTarget,
toolbarStart,
}: {
server: HostedServerRef;
logsTarget?: ParsedTargetFilter | null;
/** Shown at the start of the row that holds View logs and the range. */
toolbarStart?: React.ReactNode;
}): React.JSX.Element {
const client = useGramContext();
const project = useProject();
Expand Down Expand Up @@ -150,8 +147,7 @@ export function MCPOverviewTab({
/>
)}

<div className="flex items-center gap-2">
<div className="min-w-0 flex-1">{toolbarStart}</div>
<div className="flex items-center justify-end gap-2">
{serverLogsHref && (
<Button asChild variant="secondary">
<Link to={serverLogsHref}>View logs</Link>
Expand Down

This file was deleted.

Loading
Loading