Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 31, 2025

The schema advertises tools.github.version as "type": ["string", "number"] with examples like 20 and 3.11, but numeric versions were silently ignored due to string-only type checks in two code paths.

Changes

  • pkg/parser/mcp.go: Extended version parsing to handle int, int64, uint64, and float64 types
  • pkg/workflow/mcp_servers.go: Updated getGitHubDockerImageVersion() with same type handling
  • Tests: Added coverage for integer and float version values in both parser and workflow packages

Type Handling

switch v := version.(type) {
case string:
    versionStr = v
case int, int64, uint64:
    versionStr = fmt.Sprintf("%d", v)
case float64:
    versionStr = fmt.Sprintf("%g", v)  // Avoids trailing zeros
}

YAML numeric values are parsed as uint64 (positive integers) or float64 by goccy/go-yaml, now correctly converted to Docker image tags.

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Fix GitHub MCP version field to accept numeric types</issue_title>
<issue_description>## Objective

Fix GitHub MCP version field to accept numeric types as advertised in schema, enabling proper version pinning with numeric values.

Context

The schema defines tools.github.version as "type": ["string", "number"] with examples including 20 and 3.11, but the implementation only handles strings. Numeric versions are silently ignored.

Location: pkg/parser/mcp.go:372

Current Implementation

if version, exists := toolConfig["version"]; exists {
    if versionStr, ok := version.(string); ok {  // ❌ Only string!
        dockerImage := "ghcr.io/github/github-mcp-server:" + versionStr
    }
}

Recommended Fix

if version, exists := toolConfig["version"]; exists {
    var versionStr string
    switch v := version.(type) {
    case string:
        versionStr = v
    case int, int64, uint64:
        versionStr = fmt.Sprintf("%d", v)
    case float64:
        versionStr = fmt.Sprintf("%g", v)
    }
    if versionStr != "" {
        dockerImage := "ghcr.io/github/github-mcp-server:" + versionStr
    }
}

Files to Modify

  • Update: pkg/parser/mcp.go (line 372)
  • Update: pkg/parser/mcp_test.go (add test cases)

Acceptance Criteria

  • String versions work: tools.github.version: "v1.0.0"
  • Integer versions work: tools.github.version: 20
  • Float versions work: tools.github.version: 3.11
  • Test cases cover all type scenarios
  • Docker image construction works correctly with numeric versions

Estimated Effort

~10 minutes implementation
Related to #8221

AI generated by Plan Command for discussion #8218

Comments on the Issue (you are @copilot in this section)


💡 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.

- Updated pkg/parser/mcp.go to handle numeric version types (int, int64, uint64, float64)
- Updated pkg/workflow/mcp_servers.go getGitHubDockerImageVersion() to handle numeric types
- Added test cases for integer and float versions in mcp_test.go
- Added test cases for numeric versions in version_field_test.go
- All tests pass successfully
- Manual testing confirms integer (20) and float (3.11) versions work correctly

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix MCP version field to accept numeric types Fix GitHub MCP version field to accept numeric types Dec 31, 2025
Copilot AI requested a review from mnkiefer December 31, 2025 01:34
@pelikhan pelikhan marked this pull request as ready for review December 31, 2025 01:35
@pelikhan pelikhan merged commit 4acc906 into main Dec 31, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/fix-mcp-version-field branch December 31, 2025 01:35
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.

[plan] Fix GitHub MCP version field to accept numeric types

3 participants