Add connector namespaces#2250
Draft
alexyaang wants to merge 4 commits into
Draft
Conversation
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>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new Copilot CLI canvas extension, connector-namespaces, for browsing and connecting Azure “Connector Namespace” MCP connectors, plus companion test/preview harnesses to validate the UX and the end-to-end MCP handshake through the real unwrap proxy.
Changes:
- Adds the
connector-namespacescanvas extension (ARM auth, catalog fetch, install/reauth flows, loopback UI server, MCP unwrap proxy, state persistence). - Adds deterministic regression tests and a standalone preview server to guard recurring UI regressions.
- Adds a standalone MCP smoke-test harness to exercise the real proxy path end-to-end (connect → initialize → tools/list → safe tools/call).
Show a summary per file
| File | Description |
|---|---|
| extensions/connector-namespaces/test/smoke.mjs | Standalone orchestrator to install/connect/probe Microsoft MCP servers and write reports. |
| extensions/connector-namespaces/test/safe-tools.mjs | Heuristic + curated selection of safe read-only tools for automated tools/call. |
| extensions/connector-namespaces/test/README.md | Usage docs for the smoke-test harness and its consent model. |
| extensions/connector-namespaces/test/mcp-probe.mjs | Spawns the real unwrap proxy and drives initialize/tools/list/tools/call over stdio. |
| extensions/connector-namespaces/state.mjs | Persists selected gateway config; tracks session-added connectors. |
| extensions/connector-namespaces/server.test.mjs | Node tests covering CSRF/cross-site gating logic for POST /api/*. |
| extensions/connector-namespaces/server.mjs | Loopback HTTP server providing UI + API routes for the canvas. |
| extensions/connector-namespaces/renderer.test.mjs | Regression tests ensuring spinners aren’t frozen and banner dismiss remains effective. |
| extensions/connector-namespaces/README.md | Extension documentation (prereqs, install, usage, security notes). |
| extensions/connector-namespaces/preview/shots.mjs | Optional agent-browser script to capture visual evidence screenshots. |
| extensions/connector-namespaces/preview/server.mjs | Standalone preview server that stubs /api/* endpoints for deterministic UI states. |
| extensions/connector-namespaces/preview/README.md | Docs for running the preview server and optional screenshot capture. |
| extensions/connector-namespaces/preview/fixtures.mjs | Deterministic fixtures for preview server responses and catalog tiles. |
| extensions/connector-namespaces/preview/.gitignore | Ignores generated preview screenshots. |
| extensions/connector-namespaces/package.json | Declares the extension’s Node module metadata and Copilot SDK dependency. |
| extensions/connector-namespaces/mcp-unwrap-proxy.mjs | Stdio↔HTTP proxy that unwraps Logic Apps $content SSE envelopes into JSON-RPC lines. |
| extensions/connector-namespaces/LICENSE | MIT license for the extension content. |
| extensions/connector-namespaces/install.test.mjs | Unit tests guarding deterministic installed-state selection and safety invariants. |
| extensions/connector-namespaces/install.reauth.test.mjs | Tests ensuring reauth re-consents the existing connection without minting new resources. |
| extensions/connector-namespaces/install.mjs | Core install/reauth flows, ARM helpers, MCP config writer, and installed-state derivation. |
| extensions/connector-namespaces/extension.mjs | Canvas entry point wiring session, actions, and loopback server lifecycle. |
| extensions/connector-namespaces/createPage.mjs | HTML/JS renderer for “Create connector namespace” provisioning wizard page. |
| extensions/connector-namespaces/copilot-extension.json | Minimal extension metadata file (name/version). |
| extensions/connector-namespaces/categories.mjs | Frozen enum defining catalog routing categories (Microsoft vs Partners). |
| extensions/connector-namespaces/catalog.mjs | Fetches managed APIs and filters/categorizes MCP servers for the catalog UI. |
| extensions/connector-namespaces/canvas.json | Canvas metadata (id/name/description/author/screenshots). |
| extensions/connector-namespaces/armClient.mjs | Interactive Azure sign-in + ARM client helpers (paging, host guards, provisioning helpers). |
Review details
- Files reviewed: 28/29 changed files
- Comments generated: 5
- Review effort level: Low
Comment on lines
+22
to
+23
| const PROFILE_MCP_PATH = join(homedir(), ".copilot", "mcp-config.json"); | ||
| let s_workspaceRoot = null; |
| const opts = { only: null, limit: Infinity, openConsent: false, cleanup: true }; | ||
| for (const a of argv) { | ||
| if (a.startsWith("--only=")) opts.only = new Set(a.slice(7).split(",").map((s) => s.trim()).filter(Boolean)); | ||
| else if (a.startsWith("--limit=")) opts.limit = Number.parseInt(a.slice(8), 10) || Infinity; |
Comment on lines
+26
to
+46
| This extension lives in the private `serverless-paas-balam/polaris` repo, so | ||
| installing it pulls the files through GitHub's API. Before you start, your | ||
| Copilot CLI / `gh` login must be a member of the `serverless-paas-balam` org | ||
| **with SAML SSO authorized**. Verify it in two seconds: | ||
|
|
||
| ``` | ||
| gh api /repos/serverless-paas-balam/polaris --jq .visibility | ||
| ``` | ||
|
|
||
| If that prints `internal` (or `private`) you're set. If it returns `404`, your | ||
| token isn't authorized yet — run `gh auth login`, approve the SSO prompt for the | ||
| org, and retry. (GitHub returns `404`, not a permission error, when gating | ||
| private-repo reads, so don't let the status code fool you.) | ||
|
|
||
| ### Option A — from the repo (recommended) | ||
|
|
||
| Track `main` to get the latest committed version: | ||
|
|
||
| ``` | ||
| install_extension https://github.com/serverless-paas-balam/polaris/tree/main/.github/extensions/connector-namespaces | ||
| ``` |
Comment on lines
+43
to
+52
| function parseBody(req) { | ||
| return new Promise((resolve) => { | ||
| let data = ""; | ||
| req.on("data", (chunk) => { data += chunk; }); | ||
| req.on("end", () => { | ||
| try { resolve(JSON.parse(data)); } | ||
| catch { resolve({}); } | ||
| }); | ||
| }); | ||
| } |
| @@ -0,0 +1,279 @@ | |||
| // Regression guards for the connector-catalog renderer. | |||
| // | |||
| // Run: node --test .github/extensions/connector-namespaces/renderer.test.mjs | |||
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
npm startand verified thatREADME.mdis up to date.mainbranch for this pull request.Description
Type of Contribution
Additional Notes
By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.