Skip to content

Add --connectivity to register-external-mcp-server - #498

Open
Lala Sushant Srivastava (lasrivas) wants to merge 2 commits into
mainfrom
feature/mcp-registration-connectivity
Open

Lala Sushant Srivastava (lasrivas) wants to merge 2 commits into
mainfrom
feature/mcp-registration-connectivity

Conversation

@lasrivas

@lasrivas Lala Sushant Srivastava (lasrivas) commented Sep 21, 2026

Copy link
Copy Markdown

Adds --connectivity public|private to a365 develop-mcp register-external-mcp-server. The admin says whether their MCP server is reachable on the internet or only inside the environment's VNet; the platform uses that to decide whether the connector keeps VNet injection. Platform side: bic/MCP-Platform#3774. Inert until that ships — an older platform ignores the unknown property. ## Summary - --connectivity option, plus connectivity in the JSON input file and the sample template. Explicit option beats input file beats the private default. - Validated in the handler rather than via FromAmong, matching --auth-type in the same command, so the error message is ours. Trimmed and case-insensitive; anything other than public/private exits 1 without calling the service. - The registration summary warns on public that the bypass applies only to environments enabled for it. ## What a reviewer should check Power Platform silently ignores the bypass for environments not enabled for it and still reports success, so the CLI can report what was asked for but never what took effect. Hence the warning rather than a claim.

Review feedback addressed

  • A supplied-but-blank --connectivity is now rejected. The guard was IsNullOrWhiteSpace, so --connectivity " " skipped validation entirely and the server registered as private -- the opposite of what someone typing the option intends. It also let a blank CLI value quietly beat a valid input-file value through the ??= merge. The guard is now is not null, and the error quotes the offending value.
  • The accepted path is covered, not just the rejected one. ResolveInputsAsync and ResolvedInput are internal (the test assembly already had InternalsVisibleTo) so tests assert the normalised value where it is resolved, including CLI-over-input-file precedence. Asserting on the outbound platform request is not reachable: AddMcpServerAsync sits behind concrete GraphApiService Entra app creation with no interface seam.
  • CHANGELOG entry added. No doc link -- register-external-mcp-server has no page under docs/.

Note the platform guard merged in bic/MCP-Platform#3774 still has the original IsNullOrWhiteSpace shape. That is not a behaviour gap (blank maps to private on both sides, and the CLI now rejects it before it gets there), but the two should converge in a follow-up.

Full suite after the fixes: 2030 passed, 0 failed, 12 skipped.

Lets the admin say whether the MCP server is internet-reachable or only
reachable inside the environment's VNet, which decides whether the connector
keeps VNet injection. Validated in the handler rather than via FromAmong so the
error message matches the command's other options.

The summary warns on 'public' that the bypass depends on environment enablement:
Power Platform silently ignores the request for environments not enabled for it
and still reports success, so we can report what was asked for but never what
took effect.

Inert until the platform side ships; an older platform ignores the unknown
property.

Co-authored-by: Copilot <[email protected]>
Copilot AI lite review requested due to automatic review settings September 21, 2026 20:07
@github-actions

Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Fix empty-value validation, add successful request-construction coverage, and document the option in the changelog.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Adds --connectivity public|private to external MCP server registration, supporting CLI/JSON input and forwarding the selected value to the platform.

Changes:

  • Adds connectivity option, input-model fields, request payload support, and sample JSON.
  • Implements precedence, normalization, validation, and public-connectivity warnings.
  • Adds validation-focused tests.
File Summary
src/​Tests/​Microsoft.Agents.A365.DevTools.Cli.Tests/​Commands/​RegisterCommandExecutorTests.cs Adds connectivity validation tests; successful request construction and precedence remain uncovered.
src/​Microsoft.Agents.A365.DevTools.Cli/​Templates/​register-external-mcp-server-sample.json Documents connectivity input and the private default.
src/​Microsoft.Agents.A365.DevTools.Cli/​Models/​RegisterExternalMcpServerInput.cs Adds JSON connectivity support.
src/​Microsoft.Agents.A365.DevTools.Cli/​Models/​AddMcpServerRequest.cs Adds connectivity to the platform request.
src/​Microsoft.Agents.A365.DevTools.Cli/​Commands/​RegisterCommandExecutor.cs Resolves, validates, summarizes, and forwards connectivity; empty values can bypass validation, and request construction needs coverage.
src/​Microsoft.Agents.A365.DevTools.Cli/​Commands/​DevelopMcpCommand.cs Registers the CLI option; a changelog entry is missing.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Microsoft.Agents.A365.DevTools.Cli/Commands/RegisterCommandExecutor.cs Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes, small ones. Also needs a CHANGELOG.md [Unreleased] entry for the new --connectivity option (one consumer-facing sentence with (#498)).

Comment thread src/Microsoft.Agents.A365.DevTools.Cli/Commands/RegisterCommandExecutor.cs Outdated
Reject a supplied-but-blank `--connectivity` rather than treating it as absent.
The old `IsNullOrWhiteSpace` guard let `--connectivity "  "` skip validation and
register the server as private -- the opposite of what someone typing the option
intends -- and let a blank CLI value quietly beat a valid input-file value
through the `??=` merge.

Cover the accepted path, not just the rejected one. `ResolveInputsAsync` and
`ResolvedInput` become internal (the test assembly already has
InternalsVisibleTo) so the normalised value can be asserted where it is
resolved, including CLI-over-input-file precedence. Reaching `AddMcpServerAsync`
itself is not testable: it sits behind concrete `GraphApiService` Entra app
creation.

Adds the missing CHANGELOG entry.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings September 24, 2026 01:03
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Add request-level assertions confirming normalized connectivity, including the default, reaches the platform payload.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
Resolved since last review (1)

@lasrivas

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree [company="Microsoft"]

@lasrivas

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Microsoft"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants