Files
awesome-copilot/extensions/connector-namespaces/sandbox.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

50 lines
1.8 KiB
JavaScript

const SANDBOX_ORIGIN = "https://connectors.azure.com";
function requiredString(value, name) {
const text = String(value || "").trim();
if (!text) throw new Error(`missing ${name}`);
return text;
}
export function buildSandboxUrl(config, server) {
const subscriptionId = requiredString(config?.subscriptionId, "subscriptionId");
const resourceGroup = requiredString(config?.resourceGroup, "resourceGroup");
const gatewayName = requiredString(config?.gatewayName, "gatewayName");
const serverName = requiredString(server, "server");
const path = [subscriptionId, resourceGroup, gatewayName, "mcp-playground"]
.map(encodeURIComponent)
.join("/");
const url = new URL(`/${path}`, SANDBOX_ORIGIN);
url.searchParams.set("server", serverName);
return url.toString();
}
export function resolveSandboxConnector(catalog, installedState, query) {
const requested = requiredString(query, "server").toLowerCase();
const available = catalog
.filter((connector) => installedState[connector.apiName]?.installed)
.map((connector) => ({
id: connector.apiName,
displayName: connector.displayName,
}));
const exact = available.filter((connector) =>
connector.id.toLowerCase() === requested ||
connector.displayName.toLowerCase() === requested
);
if (exact.length === 1) return { connector: exact[0], available };
const partial = available.filter((connector) =>
connector.id.toLowerCase().includes(requested) ||
connector.displayName.toLowerCase().includes(requested)
);
if (partial.length === 1) return { connector: partial[0], available };
return {
connector: null,
reason: partial.length > 1 ? "ambiguous" : "not_found_in_my_mcps",
matches: partial,
available,
};
}