Skip to content

Comments

Add codemod to migrate MCP per-server network config to top-level#11110

Merged
pelikhan merged 3 commits intomainfrom
copilot/add-codemox-repair-mcp-config
Jan 21, 2026
Merged

Add codemod to migrate MCP per-server network config to top-level#11110
pelikhan merged 3 commits intomainfrom
copilot/add-codemox-repair-mcp-config

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Per-server MCP network configuration was deprecated in commit 0be4e52. Workflows using this pattern now require top-level network.allowed instead.

Changes

Codemod Implementation (codemod_mcp_network.go)

  • Extracts network.allowed domains from all MCP servers
  • Merges with existing top-level network.allowed if present
  • Removes per-server network blocks
  • Deduplicates domains across servers

Behavior

  • Skips servers without network.allowed or with empty arrays
  • Preserves all other MCP server fields (container, env, allowed tools)
  • Only applies when at least one server has network configuration with domains

Example

Before:

mcp-servers:
  server1:
    container: image1
    network:
      allowed: [example.com]
  server2:
    container: image2
    network:
      allowed: [api.com]

After:

network:
  allowed:
    - example.com
    - api.com
mcp-servers:
  server1:
    container: image1
  server2:
    container: image2

Testing

14 test cases covering single/multiple servers, merging scenarios, empty arrays, and field preservation.

Original prompt

Add a codemox to repair mcp network configuration into the top level network configuration.

See the changes in 0be4e52#diff-3d5394416b98c54ed7cfab6bccd87d4d86bc3bac4694f52e30f8bc39ccee6c13

Custom agent used: ci-cleaner
Tidies up the repository CI state by formatting sources, running linters, fixing issues, running tests, and recompiling workflows


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 21, 2026 22:18
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Add codemod to migrate MCP per-server network config to top-level
- Handles single and multiple servers with network configurations
- Merges duplicate domains across servers
- Merges with existing top-level network configuration
- Preserves all other MCP server fields
- Add comprehensive test coverage with 14 test cases
- Update codemod registry and test expectations

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add codemox to repair MCP network configuration Add codemod to migrate MCP per-server network config to top-level Jan 21, 2026
Copilot AI requested a review from pelikhan January 21, 2026 22:34
@pelikhan pelikhan marked this pull request as ready for review January 21, 2026 22:40
@pelikhan pelikhan merged commit cc9918c into main Jan 21, 2026
150 checks passed
@pelikhan pelikhan deleted the copilot/add-codemox-repair-mcp-config branch January 21, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants