Skip to content

fix(designer): Serialize non-managed MCP server connections to connections.json#9296

Merged
Elaina-Lee merged 4 commits into
mainfrom
fix/mcp-non-managed-connection-serialization
Jun 19, 2026
Merged

fix(designer): Serialize non-managed MCP server connections to connections.json#9296
Elaina-Lee merged 4 commits into
mainfrom
fix/mcp-non-managed-connection-serialization

Conversation

@Elaina-Lee

@Elaina-Lee Elaina-Lee commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

What & Why

Non-managed MCP server connections (auth types: None, Basic, Client Certificate) were not included in the deployment payload's connections.json, causing the validate API to fail with InvalidAgentWorkflow. Managed MCP connections (e.g., Kusto Query MCP Server) worked fine because they use ARM resource IDs.

getConnectionsDataToSerialize in the MCP utils serializer only processed ARM resource IDs via isArmResourceId(). Non-managed MCP connections use non-ARM IDs (/connectionProviders/mcpclient/connections/<name>) and were skipped entirely. Additionally, convertConnectionsDataToReferences did not handle agentMcpConnections, so MCP connections loaded from existing connections.json were never converted to Redux connection references.

IcM: 21000001042369

Impact of Change

  • Users: Non-managed MCP server connections (None, Basic, Client Certificate auth) now serialize correctly to connections.json, fixing workflow validation failures.
  • Developers: New exported isMcpConnectionReference() utility available in both designer v1 and v2 serializers.
  • System: No performance impact. Adds one conditional branch and one async fetch per MCP connection during serialization.

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in: Standalone designer with ARM mode, non-managed MCP server creation flow

Contributors

Screenshots/Videos

image image image

Copilot AI review requested due to automatic review settings June 19, 2026 00:37
@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

PR Title

  • Current: fix(designer): Serialize non-managed MCP server connections to connections.json
  • Issue: None — this is a clear, specific, high-quality title.
  • Recommendation: No change needed.

Commit Type

  • Properly selected (fix).
  • Only one commit type is selected, which matches the change.

⚠️ Risk Level

  • The selected risk level is Medium, which is reasonable for this change.
  • Advised risk from the diff: Medium.
  • No mismatch detected between the submitter’s label/body selection and the observed scope.

What & Why

  • Current: Clear explanation of the bug, why non-managed MCP connections were skipped, and how that caused InvalidAgentWorkflow.
  • Issue: None.
  • Recommendation: No change needed.

Impact of Change

  • The section is sufficiently detailed and accurately describes users, developers, and system impact.
  • Recommendation:
    • Users: Good as written.
    • Developers: Good as written.
    • System: Good as written.

Test Plan

  • Unit tests were added/updated in the diff, so the test plan passes.
  • The extra manual validation note is helpful and does not require E2E coverage.

⚠️ Contributors

  • Blank, but this is allowed.
  • Recommendation: Optional, but if PMs/designers/others contributed, please add them for credit.

Screenshots/Videos

  • Present and appropriate given the UI-facing nature of the change.
  • No action required.

Summary Table

Section Status Recommendation
Title No change needed
Commit Type No change needed
Risk Level No change needed
What & Why No change needed
Impact of Change No change needed
Test Plan Unit tests are present in the diff
Contributors ⚠️ Optional: add contributors if applicable
Screenshots/Videos No change needed

Overall: this PR passes review for title/body compliance. The advised risk level remains Medium, so there is no higher-risk adjustment needed.


Last updated: Fri, 19 Jun 2026 23:06:02 GMT

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.

Pull request overview

This PR fixes a deployment/validation gap in the MCP workflow serialization path by ensuring non-managed MCP client connections (non-ARM connection IDs like /connectionProviders/mcpclient/connections/<name>) are included in the serialized connections.json payload under agentMcpConnections, preventing validate API failures due to missing MCP connection entries.

Changes:

  • Updated MCP workflow serialization to detect non-ARM MCP connections and serialize them into agentMcpConnections by fetching details via ConnectionService().getConnection().
  • Extended convertConnectionsDataToReferences to convert agentMcpConnections entries into Redux connection references.
  • Added unit tests covering agentMcpConnections conversion scenarios.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
libs/designer/src/lib/core/mcp/utils/serializer.ts Adds serialization support for non-ARM MCP connections into agentMcpConnections using ConnectionService().getConnection().
libs/designer/src/lib/core/mcp/utils/helper.ts Adds agentMcpConnections → connection references conversion so MCP connections initialize correctly in Redux state.
libs/designer/src/lib/core/mcp/utils/test/helper.spec.ts Adds unit tests validating convertConnectionsDataToReferences behavior for agentMcpConnections.

@Elaina-Lee Elaina-Lee changed the title Fix non-managed MCP server connections not serialized to connections.json fix(designer): Serialize non-managed MCP server connections to connections.json Jun 19, 2026

@AbodeSaafan AbodeSaafan 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.

from a non ux engineer, it looks fine. We should get css to also test and confirm but we had a clear repro. Only concern is if we should get the "apikey" vs "key" fix in with this as well to fully unblock the feature

@Elaina-Lee

Copy link
Copy Markdown
Contributor Author

from a non ux engineer, it looks fine. We should get css to also test and confirm but we had a clear repro. Only concern is if we should get the "apikey" vs "key" fix in with this as well to fully unblock the feature

Communicated offline, this fix (apikey and key fix) has been verified here - that the fix had been merged.

Elaina-Lee and others added 4 commits June 19, 2026 16:01
…json

Non-managed identity MCP server connections (auth types None, Basic,
Client certificate, etc.) were not being included in the workflow
deployment payload, causing the validate API to fail.

Root cause: getConnectionsDataToSerialize only handled ARM resource IDs
via isArmResourceId check. Non-managed MCP connections use non-ARM IDs
(/connectionProviders/mcpclient/connections/<name>) and were skipped.

Fix:
- serializer.ts: Detect MCP connections and fetch their data via
  ConnectionService, constructing agentMcpConnections entries
- helper.ts: Add agentMcpConnections handling to
  convertConnectionsDataToReferences for proper state initialization
- Added unit tests for the new agentMcpConnections reference conversion
- Apply same agentMcpConnections fix to designer-v2 serializer and helper
- Tighten isMcpConnectionReference to exact match instead of loose includes()
- Add error logging in getMcpConnectionData instead of silent catch
- Remove unused _referenceKey parameter from getMcpConnectionData
- Add unit tests for isMcpConnectionReference and convertConnectionsDataToReferences

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MCP connections (connectionProviders/mcpclient/) had no handler in the
save flow's if/else chain, causing them to be silently dropped during
save/validate. This adds the missing handler to both laDesigner.tsx and
laDesignerV2.tsx, plus adds hasNewMcpConnectionKeys detection to
getConnectionsToUpdate in v2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The save flow deletes agent connections from connectionsData
unconditionally when processing connectionReferences, but the merge-back
step was inside an isAgentWorkflow() check. For "Stateful" workflows
with Agent actions (kind != "agentic"/"agent"), agent connections were
deleted and never restored, causing them to be permanently lost from
connections.json on the next deploy.

Move the agentConnections merge to run unconditionally (matching
agentMcpConnections and serviceProviderConnections behavior). Only the
MSI role assignment logic remains guarded by isAgentWorkflow().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Elaina-Lee Elaina-Lee force-pushed the fix/mcp-non-managed-connection-serialization branch from 3bb72cc to 877c3e0 Compare June 19, 2026 23:05
@github-actions

Copy link
Copy Markdown
Contributor

📊 Coverage Check

The following changed files need attention:

⚠️ libs/designer-v2/src/lib/core/mcp/utils/helper.ts - 46% covered (needs improvement)
⚠️ libs/designer-v2/src/lib/core/mcp/utils/serializer.ts - 16% covered (needs improvement)
⚠️ libs/designer/src/lib/core/mcp/utils/helper.ts - 43% covered (needs improvement)
⚠️ libs/designer/src/lib/core/mcp/utils/serializer.ts - 19% covered (needs improvement)

Please add tests for the uncovered files before merging.

@Elaina-Lee Elaina-Lee merged commit d59cb30 into main Jun 19, 2026
55 of 61 checks passed
@Elaina-Lee Elaina-Lee deleted the fix/mcp-non-managed-connection-serialization branch June 19, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants