Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: GitHub MCP server works in Docker without Docker-in-Docker (#1282)

Rohit Malhotra8c2cc3997d73
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index a95e518528..a477eaba98 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -90,10 +90,12 @@ jobs:
AGENT_SERVER_VERSION=$(node -p "require('./config/defaults.json').versions.agentServer")
AGENT_SERVER_IMAGE_BASE=$(node -p "require('./config/defaults.json').images.agentServer")
AUTOMATION_VERSION=$(node -p "require('./config/defaults.json').versions.automation")
+ GITHUB_MCP_SERVER_VERSION=$(node -p "require('./config/defaults.json').versions.githubMcpServer")
AGENT_CANVAS_VERSION=$(node -p "require('./package.json').version")
echo "agent_server_version=$AGENT_SERVER_VERSION" >> "$GITHUB_OUTPUT"
echo "default_agent_server_image=${AGENT_SERVER_IMAGE_BASE}:${AGENT_SERVER_VERSION}-python" >> "$GITHUB_OUTPUT"
echo "default_automation_version=$AUTOMATION_VERSION" >> "$GITHUB_OUTPUT"
+ echo "github_mcp_server_version=$GITHUB_MCP_SERVER_VERSION" >> "$GITHUB_OUTPUT"
echo "agent_canvas_version=$AGENT_CANVAS_VERSION" >> "$GITHUB_OUTPUT"
- name: Compute metadata and tags
@@ -191,6 +193,7 @@ jobs:
build-args: |
AGENT_SERVER_IMAGE=${{ steps.prep.outputs.agent_server_image }}
AUTOMATION_VERSION=${{ steps.prep.outputs.automation_version }}
+ GITHUB_MCP_SERVER_VERSION=${{ steps.config.outputs.github_mcp_server_version }}
AGENT_CANVAS_VERSION=${{ steps.config.outputs.agent_canvas_version }}
OPENHANDS_BUILD_GIT_SHA=${{ env.RELEVANT_SHA }}
OPENHANDS_BUILD_GIT_REF=${{ env.RELEVANT_REF }}
diff --git a/AGENTS.md b/AGENTS.md
index 9bc9753f50..9843406e42 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -594,6 +594,7 @@ When adding code that needs a new string, decide up front which rule it falls un
- Custom secrets are NOT auto-attached by the agent-server. `POST /api/conversations` only persists what the client sends in `request.secrets`; the persisted secrets store (`/api/settings/secrets`) is never read at conversation-start. `buildStartConversationRequestWithEncryptedSettings` enumerates `SecretsService.getSecrets()` and turns each entry into a `LookupSecret` whose `url` points back at `/api/settings/secrets/{name}` and whose `headers` carry `X-Session-API-Key` for auth. Pre-1.21.x agent-server SDKs would silently drop that header during validation when `secrets_encrypted=true` (the cipher in the validation context tried to `cipher.decrypt(plaintext_session_key)`, failed, and the validator removed the header β€” the conversation runtime then got 401s for every saved secret). The SDK fix preserves plaintext header values when decryption fails; if you still see saved secrets unavailable inside a conversation, verify the running agent-server bundles a `LookupSecret._validate_secrets` that falls back to plaintext on decrypt failure.
- MCP page layout: MCP is a **top-level** nav entry at `/mcp` (rendered by `src/routes/mcp.tsx`), shown right below "Skills" in `src/components/features/sidebar/sidebar.tsx`. The legacy `/settings/mcp` route still works as a redirect via `src/routes/mcp-settings-redirect.tsx`, and `src/routes/mcp-settings.tsx` re-exports the new page so the published `MCPSettings` library symbol (in `src/components/settings/index.ts`) keeps the same shape. Marketplace catalog data and MCP logo mappings live in the MCP-capable entries from `@openhands/extensions/integrations`; the Slack API catalog option should point at `https://github.com/zencoderai/slack-mcp-server` and use `@zencoderai/slack-mcp-server`. Deprecated marketplace entries removed upstream (for example GitLab / Google Maps / Postgres / Puppeteer / SQLite) should disappear from the marketplace grid. The Installed section still needs to render and search arbitrary non-catalog custom servers via the raw server `name` / `command` fallback in `src/utils/mcp-marketplace-utils.ts` + `InstalledServerCard`. Tavily is a regular stdio MCP entry (`tavily-mcp` + `TAVILY_API_KEY`), not a special built-in sentinel anymore. Components are colocated under `src/components/features/mcp-page/` and reuse the existing `MCPServerForm` for the "Add custom server" / edit flow.
+- MCP catalog runtime patching: `getMcpMarketplaceCatalog()` in `src/utils/mcp-marketplace-utils.ts` pipes every catalog entry through patch functions before the UI sees it. Two patches exist: `patchLinearEntry` (rewrites the deprecated Linear SSE endpoint to streamable HTTP) and `patchGitHubEntry` (rewrites the `docker run` transport to the native `github-mcp-server stdio` binary, only when `getDeploymentMode() === "docker"`). The `getDeploymentMode()` helper is exported from `src/api/agent-server-adapter.ts` and reads the `mode` field from the runtime services info. The Docker image pre-installs the `github-mcp-server` Go binary at `/usr/local/bin/github-mcp-server` via a dedicated Dockerfile download stage (`github-mcp-download`). This avoids a Docker-in-Docker requirement β€” GitHub is the only catalog entry that uses `docker` as its stdio command; all others use `npx` or `uvx`. When adding similar patches for other entries, follow the same pattern: guard on `entry.id`, check environment conditionally, spread immutably.
- Library packaging notes:
- Public npm entrypoints now come from `src/index.ts` β†’ `src/lib/index.ts`, with domain barrels under `src/components/{conversation,terminal,browser,files,settings,sidebar}/index.ts`.
diff --git a/__tests__/utils/mcp-marketplace-utils.test.ts b/__tests__/utils/mcp-marketplace-utils.test.ts
index 899647fdab..498cc3a291 100644
--- a/__tests__/utils/mcp-marketplace-utils.test.ts
+++ b/__tests__/utils/mcp-marketplace-utils.test.ts
@@ -1,4 +1,4 @@
-import { describe, expect, it } from "vitest";
+import { describe, expect, it, vi } from "vitest";
import {
findCatalogEntryForServer,
findInstalledMatch,
@@ -9,8 +9,15 @@ import {
isMarketplaceEntryAvailable,
marketplaceEntryMatchesQuery,
} from "#/utils/mcp-marketplace-utils";
+import * as agentServerAdapter from "#/api/agent-server-adapter";
import { INTEGRATION_CATALOG as MCP_MARKETPLACE } from "@openhands/extensions/integrations";
+vi.mock("#/api/agent-server-adapter", async (importOriginal) => {
+ const actual =
+ await importOriginal<typeof import("#/api/agent-server-adapter")>();
+ return { ...actual, getDeploymentMode: vi.fn(() => null) };
+});
+
const mcpMarketplace = getMcpMarketplaceCatalog(MCP_MARKETPLACE);
const slackEntry = mcpMarketplace.find((e) => e.id === "slack")!;
const tavilyEntry = mcpMarketplace.find((e) => e.id === "tavily")!;
@@ -254,3 +261,51 @@ describe("findCatalogEntryForServer", () => {
expect(match?.id).toBe("linear");
});
});
+
+describe("patchGitHubEntry (via getMcpMarketplaceCatalog)", () => {
+ const mockedGetDeploymentMode = vi.mocked(
+ agentServerAdapter.getDeploymentMode,
+ );
+
+ function getGitHubStdioTransport(catalog: ReturnType<typeof getMcpMarketplaceCatalog>) {
+ const github = catalog.find((e) => e.id === "github");
+ expect(github).toBeDefined();
+ const option = github!.connectionOptions.find(
+ (o) => o.transport?.kind === "stdio",
+ );
+ expect(option?.transport?.kind).toBe("stdio");
+ const transport = option!.transport!;
+ if (transport.kind !== "stdio") throw new Error("expected stdio");
+ return transport;
+ }
+
+ it("leaves the GitHub entry unchanged when not in docker mode", () => {
+ mockedGetDeploymentMode.mockReturnValue(null);
+ const transport = getGitHubStdioTransport(
+ getMcpMarketplaceCatalog(MCP_MARKETPLACE),
+ );
+ expect(transport.command).toBe("docker");
+ expect(transport.args[0]).toBe("run");
+ });
+
+ it("rewrites the GitHub command to native binary in docker mode", () => {
+ mockedGetDeploymentMode.mockReturnValue("docker");
+ const transport = getGitHubStdioTransport(
+ getMcpMarketplaceCatalog(MCP_MARKETPLACE),
+ );
+ expect(transport.command).toBe("github-mcp-server");
+ expect(transport.args).toEqual(["stdio"]);
+ });
+
+ it("does not affect other entries in docker mode", () => {
+ mockedGetDeploymentMode.mockReturnValue("docker");
+ const catalog = getMcpMarketplaceCatalog(MCP_MARKETPLACE);
+ const tavily = catalog.find((e) => e.id === "tavily");
+ const stdioOption = tavily?.connectionOptions.find(
+ (o) => o.transport?.kind === "stdio",
+ );
+ expect(stdioOption?.transport?.kind).toBe("stdio");
+ if (stdioOption?.transport?.kind !== "stdio") throw new Error("expected stdio");
+ expect(stdioOption.transport.command).not.toBe("github-mcp-server");
+ });
+});
diff --git a/config/defaults.json b/config/defaults.json
index 0496274f83..f787546f8a 100644
--- a/config/defaults.json
+++ b/config/defaults.json
@@ -5,7 +5,8 @@
"agentServer": "1.26.0",
"agentCanvas": "1.0.0-rc.3",
"automation": "1.0.0a6",
- "automationSdk": "1.22.1"
+ "automationSdk": "1.22.1",
+ "githubMcpServer": "1.2.0"
},
"images": {
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 28b088a87d..131825b8de 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -61,6 +61,28 @@ RUN node -e " \
require('fs').writeFileSync('/tmp/defaults.env', lines.join('\n') + '\n'); \
"
+# ── Stage 1c: Download github-mcp-server binary ─────────────────────────────
+# The upstream GitHub MCP server is a Go binary distributed via GitHub Releases.
+# The @openhands/extensions catalog entry uses `docker run` as the default
+# transport, which fails inside the agent-canvas Docker container (no Docker
+# daemon). Pre-installing the binary lets the frontend patch the catalog entry
+# to use the native binary instead.
+FROM node:24-slim AS github-mcp-download
+
+ARG TARGETARCH
+ARG GITHUB_MCP_SERVER_VERSION
+
+RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*
+
+# Map Docker TARGETARCH (amd64/arm64) to GitHub release naming (x86_64/arm64).
+# The *) fallback defaults to x86_64 for any unrecognised architecture so the
+# build doesn't silently produce an image without the binary. If a new arch is
+# added to the Docker build matrix, add an explicit case here.
+RUN ARCH_SUFFIX=$(case "${TARGETARCH}" in amd64) echo "x86_64";; arm64) echo "arm64";; *) echo "x86_64";; esac) && \
+ curl -fsSL "https://github.com/github/github-mcp-server/releases/download/v${GITHUB_MCP_SERVER_VERSION}/github-mcp-server_Linux_${ARCH_SUFFIX}.tar.gz" \
+ | tar -xz -C /usr/local/bin github-mcp-server && \
+ chmod +x /usr/local/bin/github-mcp-server
+
# ── Stage 2: Combined image ──────────────────────────────────────────────────
FROM ${AGENT_SERVER_IMAGE} AS final
@@ -95,6 +117,11 @@ RUN if command -v apt-get >/dev/null 2>&1; then \
RUN uv pip install --system "openhands-automation==${AUTOMATION_VERSION}" 2>/dev/null \
|| pip install --no-cache-dir "openhands-automation==${AUTOMATION_VERSION}"
+# Install pre-built github-mcp-server binary so the GitHub MCP integration
+# works without Docker-in-Docker (the catalog entry is patched at runtime to
+# use this binary instead of `docker run`).
+COPY --from=github-mcp-download /usr/local/bin/github-mcp-server /usr/local/bin/github-mcp-server
+
# Copy the frontend build output.
# react-router.config.ts unpacks build/client/ into build/ for non-Vercel builds.
COPY --from=frontend-build /build/build /opt/agent-canvas/frontend
diff --git a/scripts/docker-build.mjs b/scripts/docker-build.mjs
index 8474b1c992..e220d5ae8a 100644
--- a/scripts/docker-build.mjs
+++ b/scripts/docker-build.mjs
@@ -25,6 +25,7 @@ const config = JSON.parse(
const agentServerImage = `${config.images.agentServer}:${config.versions.agentServer}-python`;
const automationVersion = config.versions.automation;
+const githubMcpServerVersion = config.versions.githubMcpServer;
// Parse CLI: --tag <name> and everything after -- is passed to docker build
let tag = "agent-canvas:local";
@@ -50,15 +51,18 @@ const cmd = [
`AGENT_SERVER_IMAGE=${agentServerImage}`,
"--build-arg",
`AUTOMATION_VERSION=${automationVersion}`,
+ "--build-arg",
+ `GITHUB_MCP_SERVER_VERSION=${githubMcpServerVersion}`,
"-t",
tag,
...extraArgs,
".",
];
-console.log(`Agent Server image : ${agentServerImage}`);
-console.log(`Automation version : ${automationVersion}`);
-console.log(`Tag : ${tag}`);
+console.log(`Agent Server image : ${agentServerImage}`);
+console.log(`Automation version : ${automationVersion}`);
+console.log(`GitHub MCP Server : ${githubMcpServerVersion}`);
+console.log(`Tag : ${tag}`);
console.log(`\n$ ${cmd.join(" ")}\n`);
try {
diff --git a/src/api/agent-server-adapter.ts b/src/api/agent-server-adapter.ts
index 2e06ec0d7d..385dde9072 100644
--- a/src/api/agent-server-adapter.ts
+++ b/src/api/agent-server-adapter.ts
@@ -166,6 +166,14 @@ function parseRuntimeServicesInfo(): RuntimeServicesInfo | null {
}
}
+/**
+ * Return the deployment mode from the runtime services info, e.g. "docker",
+ * "dev:automation", etc. Returns `null` when no runtime info is configured.
+ */
+export function getDeploymentMode(): string | null {
+ return parseRuntimeServicesInfo()?.mode ?? null;
+}
+
/**
* Render the runtime services info into a markdown block suitable for
* appending to the system prompt via `AgentContext.system_message_suffix`.
diff --git a/src/utils/mcp-marketplace-utils.ts b/src/utils/mcp-marketplace-utils.ts
index 9b7f7d7251..6533d0348f 100644
--- a/src/utils/mcp-marketplace-utils.ts
+++ b/src/utils/mcp-marketplace-utils.ts
@@ -4,6 +4,7 @@ import type {
IntegrationConnectionOption,
IntegrationTransport,
} from "@openhands/extensions/integrations";
+import { getDeploymentMode } from "#/api/agent-server-adapter";
export type { MarketplaceEntry };
@@ -103,11 +104,52 @@ function patchLinearEntry(entry: MarketplaceEntry): MarketplaceEntry {
};
}
+/**
+ * The upstream catalog ships the GitHub MCP server with `command: "docker"`
+ * (`docker run … ghcr.io/github/github-mcp-server`). This requires Docker-
+ * in-Docker when agent-canvas itself runs inside the Docker image, which
+ * isn't available. The Docker image pre-installs the native Go binary at
+ * `/usr/local/bin/github-mcp-server`, so we rewrite the transport to use
+ * it directly.
+ *
+ * Only applied when `getDeploymentMode()` returns `"docker"`.
+ */
+function patchGitHubEntry(entry: MarketplaceEntry): MarketplaceEntry {
+ if (entry.id !== "github") return entry;
+ if (getDeploymentMode() !== "docker") return entry;
+ return {
+ ...entry,
+ installHint:
+ "Requires a GitHub Personal Access Token (classic or fine-grained).",
+ // The upstream @openhands/extensions catalog defines the GitHub entry
+ // with `command: "docker"` (i.e. `docker run …`). We match on that
+ // exact value to replace it with the pre-installed native binary.
+ // If the upstream ever changes the command string, this patch becomes
+ // a no-op and the original transport is preserved β€” the worst case is
+ // the user falls back to the Docker-based transport (which still works
+ // outside the Docker image).
+ connectionOptions: entry.connectionOptions.map((option) =>
+ option.transport?.kind === "stdio" &&
+ option.transport.command === "docker"
+ ? {
+ ...option,
+ transport: {
+ ...option.transport,
+ command: "github-mcp-server",
+ args: ["stdio"],
+ },
+ }
+ : option,
+ ),
+ };
+}
+
export function getMcpMarketplaceCatalog(
catalog: MarketplaceEntry[],
): MarketplaceEntry[] {
return catalog
.map(patchLinearEntry)
+ .map(patchGitHubEntry)
.filter((entry) => !!getDefaultMcpConnectionOption(entry));
}
diff --git a/tests/e2e/mock-llm/mock-llm-mcp-github.spec.ts b/tests/e2e/mock-llm/mock-llm-mcp-github.spec.ts
new file mode 100644
index 0000000000..48a57272f2
--- /dev/null
+++ b/tests/e2e/mock-llm/mock-llm-mcp-github.spec.ts
@@ -0,0 +1,268 @@
+/**
+ * Mock-LLM E2E test: GitHub MCP server install via the MCP marketplace UI.
+ *
+ * This test exercises the full MCP install flow β€” navigating to the MCP page,
+ * finding the GitHub marketplace card, opening the install modal, filling in
+ * the PAT field, and submitting. The `POST /api/mcp/test` endpoint is
+ * intercepted to return a mock success response so the test doesn't need a
+ * real `github-mcp-server` binary or Docker daemon.
+ *
+ * Runs in both npm (`mock-llm.config.ts`) and Docker (`mock-llm-docker.config.ts`)
+ * paths. In Docker mode, asserts that `patchGitHubEntry` rewrote the command to
+ * the pre-installed native binary (`github-mcp-server stdio`); in npm mode,
+ * asserts the original `docker run …` transport is shown.
+ *
+ * Verifies:
+ * 1. The MCP page renders with the GitHub marketplace card visible
+ * 2. Clicking the card opens the install modal with the correct command
+ * 3. Filling in the PAT and submitting succeeds (with mocked test endpoint)
+ * 4. After install the GitHub server appears in the installed list
+ * 5. The installed server can be deleted via the UI
+ */
+
+import { test, expect } from "@playwright/test";
+import {
+ BACKEND_URL,
+ SESSION_API_KEY,
+ seedLocalStorage,
+ routeSessionApiKey,
+ dismissAnalyticsModal,
+ waitForTestId,
+ ensureMockLLMProfile,
+} from "./utils/mock-llm-helpers";
+
+const FAKE_PAT = "github_pat_test_1234567890abcdef";
+
+/**
+ * When running inside the Docker image (`--mode docker` in runtime services
+ * info), `patchGitHubEntry` rewrites the catalog command from `docker run …`
+ * to the pre-installed native binary. The Docker Playwright config sets
+ * `MOCK_LLM_DOCKER_IMAGE`, so we can use its presence to know which command
+ * value to expect.
+ */
+const IS_DOCKER_E2E = !!process.env.MOCK_LLM_DOCKER_IMAGE;
+/** Pattern to match inside the read-only command field value. */
+const EXPECTED_COMMAND_PATTERN = IS_DOCKER_E2E
+ ? /github-mcp-server\s+stdio/
+ : /docker/;
+
+test.describe.configure({ mode: "serial" });
+
+test.describe("MCP GitHub server install flow", () => {
+ test.beforeEach(async ({ page }) => {
+ await seedLocalStorage(page);
+ });
+
+ test.afterEach(async ({ request }) => {
+ // Clear any MCP config so subsequent tests start clean
+ await request
+ .patch(`${BACKEND_URL}/api/settings`, {
+ headers: {
+ "X-Session-API-Key": SESSION_API_KEY,
+ "Content-Type": "application/json",
+ },
+ data: { agent_settings_diff: { mcp_config: null } },
+ })
+ .catch(() => {});
+ });
+
+ test("step 1: GitHub card is visible on the MCP marketplace page", async ({
+ page,
+ }) => {
+ await routeSessionApiKey(page);
+ await page.goto("/mcp", { waitUntil: "domcontentloaded" });
+ await dismissAnalyticsModal(page);
+
+ // Wait for the marketplace section to render
+ await waitForTestId(page, "mcp-marketplace-section");
+ const marketplaceGrid = page.getByTestId("mcp-marketplace-grid");
+ await expect(marketplaceGrid).toBeVisible({ timeout: 10_000 });
+
+ // Verify the GitHub card exists
+ const githubCard = page.getByTestId("mcp-marketplace-card-github");
+ await expect(githubCard).toBeVisible();
+
+ // The card should display the name "GitHub"
+ await expect(githubCard).toContainText("GitHub");
+ });
+
+ test("step 2: clicking GitHub card opens the install modal with correct fields", async ({
+ page,
+ }) => {
+ await routeSessionApiKey(page);
+ await page.goto("/mcp", { waitUntil: "domcontentloaded" });
+ await dismissAnalyticsModal(page);
+ await waitForTestId(page, "mcp-marketplace-grid");
+
+ // Click the GitHub marketplace card
+ await page.getByTestId("mcp-marketplace-card-github").click();
+
+ // The install modal should appear
+ const modal = page.getByTestId("mcp-install-modal");
+ await expect(modal).toBeVisible({ timeout: 5_000 });
+
+ // Verify the modal is for the GitHub entry
+ await expect(modal).toHaveAttribute("data-marketplace-id", "github");
+
+ // The modal should show the command field (read-only).
+ // In Docker mode the field shows the patched native binary command;
+ // in the npm path it shows the original `docker run …` transport.
+ const commandField = page.getByTestId(
+ "mcp-install-field-command-readonly",
+ );
+ await expect(commandField).toBeVisible();
+ await expect(commandField).toHaveValue(EXPECTED_COMMAND_PATTERN);
+
+ // The PAT field should be present and empty
+ const patField = page.getByTestId(
+ "mcp-install-field-GITHUB_PERSONAL_ACCESS_TOKEN",
+ );
+ await expect(patField).toBeVisible();
+ });
+
+ test("step 3: full install flow β€” fill PAT, submit, verify installed", async ({
+ page,
+ }) => {
+ // We need an LLM profile configured for settings to work properly
+ await ensureMockLLMProfile(page);
+
+ await routeSessionApiKey(page);
+
+ // Intercept the MCP test endpoint to return success β€” we don't have
+ // the real github-mcp-server binary in the test environment.
+ await page.route("**/api/mcp/test", async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: "application/json",
+ body: JSON.stringify({ ok: true }),
+ });
+ });
+
+ await page.goto("/mcp", { waitUntil: "domcontentloaded" });
+ await dismissAnalyticsModal(page);
+ await waitForTestId(page, "mcp-marketplace-grid");
+
+ // Click the GitHub card to open the install modal
+ await page.getByTestId("mcp-marketplace-card-github").click();
+ const modal = page.getByTestId("mcp-install-modal");
+ await expect(modal).toBeVisible({ timeout: 5_000 });
+
+ // Fill in the PAT β€” SettingsInput puts data-testid on the <input> directly
+ const patInput = page.getByTestId(
+ "mcp-install-field-GITHUB_PERSONAL_ACCESS_TOKEN",
+ );
+ await patInput.fill(FAKE_PAT);
+
+ // Click install
+ await page.getByTestId("mcp-install-submit").click();
+
+ // The modal should close after successful install
+ await expect(modal).not.toBeVisible({ timeout: 10_000 });
+
+ // The GitHub server should now appear in the installed list
+ const installedList = page.getByTestId("mcp-installed-list");
+ await expect(installedList).toBeVisible({ timeout: 10_000 });
+
+ // The installed server card should exist
+ const serverItems = installedList.getByTestId("mcp-server-item");
+ await expect(serverItems.first()).toBeVisible();
+
+ // Verify via the settings API that the server was actually persisted
+ const settingsResp = await page.request.get(
+ `${BACKEND_URL}/api/settings`,
+ {
+ headers: { "X-Session-API-Key": SESSION_API_KEY },
+ },
+ );
+ expect(settingsResp.ok()).toBe(true);
+ const settings = await settingsResp.json();
+ const mcpConfig = settings?.agent_settings?.mcp_config;
+ expect(mcpConfig).toBeTruthy();
+
+ // The GitHub server should be stored as a stdio server named "github"
+ // with the PAT in its env
+ const mcpServers = mcpConfig?.mcpServers ?? mcpConfig?.stdio_servers;
+ expect(mcpServers).toBeTruthy();
+
+ // Check that there's a server named "github" somewhere in the config
+ const hasGithub =
+ mcpServers?.github != null ||
+ (Array.isArray(mcpServers) &&
+ mcpServers.some(
+ (s: Record<string, unknown>) => s.name === "github",
+ ));
+ expect(hasGithub).toBe(true);
+ });
+
+ test("step 4: installed GitHub server can be deleted", async ({ page }) => {
+ // First install the server via the API so we have something to delete
+ const installResp = await page.request.patch(
+ `${BACKEND_URL}/api/settings`,
+ {
+ headers: {
+ "X-Session-API-Key": SESSION_API_KEY,
+ "Content-Type": "application/json",
+ },
+ data: {
+ agent_settings_diff: {
+ mcp_config: {
+ mcpServers: {
+ github: {
+ command: "github-mcp-server",
+ args: ["stdio"],
+ env: {
+ GITHUB_PERSONAL_ACCESS_TOKEN: FAKE_PAT,
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ );
+ expect(installResp.ok()).toBe(true);
+
+ await routeSessionApiKey(page);
+ await page.goto("/mcp", { waitUntil: "domcontentloaded" });
+ await dismissAnalyticsModal(page);
+
+ // The installed list should show the github server
+ const installedList = page.getByTestId("mcp-installed-list");
+ await expect(installedList).toBeVisible({ timeout: 10_000 });
+
+ const serverItem = installedList.getByTestId("mcp-server-item").first();
+ await expect(serverItem).toBeVisible();
+
+ // The installed card has a CirclePlusCheckToggle β€” clicking it while
+ // isSelected=true triggers onDelete. Find and click the toggle button
+ // inside the server card (it shows a checkmark icon).
+ const toggleButton = serverItem.locator(
+ '[data-testid^="mcp-installed-toggle-"]',
+ );
+ await toggleButton.click();
+
+ // A confirmation modal should appear β€” click confirm
+ const confirmButton = page.getByTestId("confirm-button");
+ await expect(confirmButton).toBeVisible({ timeout: 5_000 });
+ await confirmButton.click();
+
+ // After deletion the installed list should show the empty state
+ await expect(
+ page.getByTestId("mcp-installed-empty"),
+ ).toBeVisible({ timeout: 10_000 });
+
+ // Verify via the settings API that the server was removed
+ const settingsResp = await page.request.get(
+ `${BACKEND_URL}/api/settings`,
+ {
+ headers: { "X-Session-API-Key": SESSION_API_KEY },
+ },
+ );
+ expect(settingsResp.ok()).toBe(true);
+ const settings = await settingsResp.json();
+ const mcpConfig = settings?.agent_settings?.mcp_config;
+ const mcpServers = mcpConfig?.mcpServers;
+ const githubStillPresent = mcpServers?.github != null;
+ expect(githubStillPresent).toBe(false);
+ });
+});