Skip to content

Update existing MCP configs with required gh-aw server fields#41462

Merged
pelikhan merged 7 commits into
mainfrom
copilot/update-gh-aw-json-validation
Jun 25, 2026
Merged

Update existing MCP configs with required gh-aw server fields#41462
pelikhan merged 7 commits into
mainfrom
copilot/update-gh-aw-json-validation

Conversation

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Existing .github/mcp.json files were not being repaired or upgraded when the github-agentic-workflows entry was missing fields added in newer gh-aw versions. This change updates existing configs in place so the gh-aw MCP server entry consistently includes the required shape, including type and tools.

  • Behavior change

    • ensureMCPConfig now edits an existing .github/mcp.json instead of only printing manual update instructions.
    • If the github-agentic-workflows server is present but incomplete, the config is normalized to the current required form.
  • gh-aw server normalization

    • Ensures the gh-aw MCP entry has the expected:
      • type
      • command
      • args
      • tools
    • Preserves unrelated fields on the same server object (for example cwd) rather than replacing the object wholesale.
  • Config compatibility

    • Preserves unrelated MCP servers in the file.
    • Supports legacy configs that still use the servers key and updates the gh-aw entry there when needed.
  • CLI output

    • Adjusts init messaging from “Created .github/mcp.json” to “Configured .github/mcp.json” to reflect create-or-update behavior.
  • Example

    • Before:
{
  "mcpServers": {
    "github-agentic-workflows": {
      "command": "gh",
      "args": ["aw", "mcp-server"],
      "cwd": "${workspaceFolder}"
    }
  }
}
  • After:
{
  "mcpServers": {
    "github-agentic-workflows": {
      "type": "local",
      "command": "gh",
      "args": ["aw", "mcp-server"],
      "tools": ["compile", "audit", "logs", "inspect", "status", "audit-diff"],
      "cwd": "${workspaceFolder}"
    }
  }
}

Copilot AI and others added 3 commits June 25, 2026 14:00
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

⚠️ Assignment failed: Failed to assign copilot coding agent to this issue.

Error: copilot coding agent is not available for this repository

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Copilot AI and others added 3 commits June 25, 2026 18:17
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Done in 5f039f3. I ran the finisher pass, recompiled the two stale smoke lockfiles, and re-ran make fmt, make lint, make test-unit, make test, and make recompile locally. The last CI runs were green on 3390db0; CI for 5f039f3 is still stale and will need a maintainer re-trigger, and the PR is still draft.

Copilot AI requested a review from pelikhan June 25, 2026 18:39
@pelikhan pelikhan marked this pull request as ready for review June 25, 2026 18:53
Copilot AI review requested due to automatic review settings June 25, 2026 18:53

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 updates the gh aw init MCP configuration flow to normalize and repair an existing .github/mcp.json in place, ensuring the github-agentic-workflows MCP server entry includes the required fields (type, command, args, tools) rather than only printing manual update instructions.

Changes:

  • ensureMCPConfig now updates an existing .github/mcp.json in place (including legacy servers configs) and skips when already identical.
  • Adds helpers to select the correct server map (mcpServers vs legacy servers) and merge required gh-aw server fields while preserving cwd.
  • Adjusts init messaging from “Created” to “Configured” for .github/mcp.json, and updates tests and the repo’s .github/mcp.json accordingly.
Show a summary per file
File Description
pkg/cli/mcp_config_file.go Implements in-place normalization/repair of .github/mcp.json, including legacy key support.
pkg/cli/mcp_config_file_test.go Updates/extends tests to validate create, update, skip, and legacy-update behavior.
pkg/cli/init.go Updates verbose init output to reflect create-or-update semantics (“Configured”).
pkg/cli/init_mcp_test.go Renames/updates test to assert existing MCP config files are updated in place.
.github/mcp.json Updates repo MCP server entry to the normalized gh aw mcp-server form with tools list.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 5/5 changed files
  • Comments generated: 3

Comment on lines +72 to +75
if err := writeMCPConfigFile(mcpConfigPath, config); err != nil {
return err
}
mcpConfigLog.Printf("Updated existing file: %s", mcpConfigPath)
// If the file already exists, it renders console instructions instead of editing
// ensureMCPConfig creates or updates .github/mcp.json with gh-aw MCP server configuration.
func ensureMCPConfig(verbose bool) error {
mcpConfigLog.Print("Creating .github/mcp.json")
Comment on lines +130 to +136
expectedTools := []string{"compile", "audit", "logs", "inspect", "status", "audit-diff"}
if len(server.Tools) != len(expectedTools) {
t.Errorf("Expected tools %v, got %v", expectedTools, server.Tools)
}
if server.CWD != "${workspaceFolder}" {
t.Errorf("Expected cwd to be preserved, got %q", server.CWD)
}
@pelikhan pelikhan merged commit 2c7ccbc into main Jun 25, 2026
30 checks passed
@pelikhan pelikhan deleted the copilot/update-gh-aw-json-validation branch June 25, 2026 19:03
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.

4 participants