Files
awesome-copilot/extensions/connector-namespaces/sandbox.test.mjs
T
Alex Yang [MSFT] 191309165e Add Azure Connector Namespaces canvas extension 🤖🤖🤖 (#2250)
* Add MCP Connectors (connector-namespaces) canvas extension

A Copilot CLI canvas extension for browsing and adding MCP connectors
from an Azure Connector Namespace into a Copilot session. Sign-in is
dependency-free (OAuth 2.0 auth-code + PKCE via the Azure CLI public
client, loopback redirect); network access is restricted to the public
Azure Resource Manager endpoint. MIT licensed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update Connector Namespaces canvas extension

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Harden Connector Namespaces canvas extension

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Sanitize connector icon brand colors

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add Connector Namespace playground actions

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

* Replace sandbox skill with native tool

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

* Clarify connector disconnect action

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

* Color disconnect action red

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

* Add connector extension plugin manifest

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

* Address connector canvas review feedback

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

* Remove legacy connector canvas manifest

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

* Address remaining connector review feedback

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

* Harden connector review fixes

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

* Harden connector convergence

Address the latest connector review batch across config persistence, executable trust, reauthentication, JSON-RPC transport, smoke safety, and accessibility.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

* Use native HTTP connector configs

Persist Connector Namespace MCP servers as direct HTTPS entries with API-key headers, remove the stdio unwrap proxy, and exercise the native Streamable HTTP path in smoke coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

* Secure persisted connector state

Create the Connector Namespace artifacts directory and saved gateway config with private permissions, and align the reduced-motion regression notes with the static fallback behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a986299f-86be-46c3-9562-cbf7d25174cf

---------

Co-authored-by: Alex Yang <yangalex@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-16 10:29:48 +10:00

55 lines
2.0 KiB
JavaScript

import { test } from "node:test";
import assert from "node:assert/strict";
import { buildSandboxUrl, resolveSandboxConnector } from "./sandbox.mjs";
const config = {
subscriptionId: "f34b22a3-2202-4fb1-b040-1332bd928c84",
resourceGroup: "jack sandboxgroup rg",
gatewayName: "yeah-github-cli",
};
const catalog = [
{ apiName: "WorkIQTeamsMCP-1a81f9", displayName: "Work IQ Teams MCP" },
{ apiName: "WorkIQSharePointMCP-abcd", displayName: "Work IQ SharePoint MCP" },
{ apiName: "OtherMCP-1234", displayName: "Other MCP" },
];
const installedState = {
"WorkIQTeamsMCP-1a81f9": { installed: true },
"WorkIQSharePointMCP-abcd": { installed: true },
"OtherMCP-1234": { installed: false },
};
test("buildSandboxUrl creates the namespace playground deep link", () => {
assert.equal(
buildSandboxUrl(config, "WorkIQTeamsMCP-1a81f9"),
"https://connectors.azure.com/f34b22a3-2202-4fb1-b040-1332bd928c84/jack%20sandboxgroup%20rg/yeah-github-cli/mcp-playground?server=WorkIQTeamsMCP-1a81f9",
);
});
test("resolveSandboxConnector finds a My MCP by display-name fragment", () => {
const result = resolveSandboxConnector(catalog, installedState, "teams");
assert.deepEqual(result.connector, {
id: "WorkIQTeamsMCP-1a81f9",
displayName: "Work IQ Teams MCP",
});
});
test("resolveSandboxConnector never returns catalog entries outside My MCPs", () => {
const result = resolveSandboxConnector(catalog, installedState, "Other MCP");
assert.equal(result.connector, null);
assert.equal(result.reason, "not_found_in_my_mcps");
assert.deepEqual(result.available.map((connector) => connector.id), [
"WorkIQTeamsMCP-1a81f9",
"WorkIQSharePointMCP-abcd",
]);
});
test("resolveSandboxConnector reports ambiguous names with matches", () => {
const result = resolveSandboxConnector(catalog, installedState, "work iq");
assert.equal(result.connector, null);
assert.equal(result.reason, "ambiguous");
assert.equal(result.matches.length, 2);
});