Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

VS Code Github Copilot calling create_pull_request_with_copilot on remote MCP using fine-grained PAT gets 401

未关闭
#942 7 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
github, vscode

调研方向

首先,使用 issue 中描述的 VS Code 配置和 fine-grained PAT,针对远程 Copilot MCP endpoint 重现 create_pull_request_with_copilot。将其与 list_branches 和 repos MCP endpoint 进行比较,然后跟踪身份验证流程;完成的标准是该函数返回 pull request URL,而不是 401 响应。

由索引模型根据 Issue 内容生成。

描述

bug
Describe the bug

The create_pull_request_with_copilot function from the remote GitHub MCP server (https://api.githubcopilot.com/mcp/x/copilot) consistently returns "API returned status 401: Unauthorized" even when authentication appears to be properly configured. This affects the ability to create pull requests programmatically through GitHub Copilot's MCP integration.

Affected version

Remote GitHub MCP Server: https://api.githubcopilot.com/mcp/x/copilot
(This is the hosted service, not the self-hosted Docker version)

Steps to reproduce the behavior
  1. Create fine grained PAT

    Repository access
     This token has access to all repositories owned by the organization.
    Organization permissions
     Read access to organization administration, organization copilot seat management, and organization private registries
    Repository permissions
     Read access to metadata
     Read and Write access to actions, administration, code, codespaces, issues, pull requests, and workflows
    
  2. Make sure the owner of the PAT has a copilot seat and the copilot coding agent is enabled for the target repositories

    • I was able to assign a task to the coding agent using github.com UI in the target repo and get a pull request from it.
  3. Make sure other tools work with the PAT

    • I tested list_branches on the target repositories with the PAT and it worked
  4. Configure VS Code with GitHub Copilot authentication a the remote MCP server at https://api.githubcopilot.com/mcp/x/copilot

    "github_copilot": {
        "type": "http",
        "url": "https://api.githubcopilot.com/mcp/x/copilot",
        "headers": {
         "Authorization": "Bearer ${github_pat}"
        }
    },
    
  5. Call mcp_github_copilo_create_pull_request_with_copilot with valid parameters:

    {
        "owner": "org",
        "repo": "repo", 
        "base_ref": "release/2025.8.21",
        "title": "Fix bug",
        "problem_statement": "Fix this bug..."
    }
    
  6. Observe the 401 Unauthorized error response

    {
        "kind": "toolInvocationSerialized",
        "invocationMessage": {
        "value": "Running Perform task with GitHub Copilot coding agent",
        "isTrusted": false,
        "supportThemeIcons": false,
        "supportHtml": false
        },
        "pastTenseMessage": {
        "value": "Ran Perform task with GitHub Copilot coding agent ",
        "isTrusted": false,
        "supportThemeIcons": false,
        "supportHtml": false
        },
        "originMessage": {
        "value": "[github\\_copilot \\(MCP Server\\)](command:workbench.mcp.showConfiguration?%255B%2522mcp.config.usrlocal%2522%252C%2522mcp.config.usrlocal.github_copilot%2522%255D)",
        "isTrusted": true,
        "supportThemeIcons": false,
        "supportHtml": false
        },
        "isConfirmed": true,
        "isComplete": true,
        "resultDetails": {
        "input": "{\n  \"owner\": \"org\",\n  \"repo\": \"repo\",\n  \"base_ref\": \"release/2025.8.21\",\n  \"title\": \"Fix bug\",\n  \"problem_statement\": \"Fix bug...\"\n}",
        "output": [
            {
            "type": "embed",
            "isText": true,
            "value": "API returned status 401: Unauthorized\n"
            }
        ],
        "isError": true
        },
        "toolSpecificData": {
        "kind": "input",
        "rawInput": {
            "owner": "org",
            "repo": "repo",
            "base_ref": "release/2025.8.21",
            "title": "Fix bug",
            "problem_statement": "Fix bug..."
        }
        },
        "toolCallId": "eb01d33e-8afb-4b0e-b014-5a1150131e91",
        "toolId": "mcp_github_copilo_create_pull_request_with_copilot"
    }   
    
Expected vs actual behavior

Expected: The function should successfully create a pull request using GitHub Copilot's PR creation capabilities, returning a success response with the PR URL.

Actual: The function returns "API returned status 401: Unauthorized" indicating authentication failure, despite having valid GitHub Copilot authentication configured in VS Code.

Additional Context
  • Using the remote GitHub MCP server at https://api.githubcopilot.com/mcp/x/copilot (not Docker version)
  • The create_pull_request_with_copilot function is only available in this remote server, not in the self-hosted version
  • GitHub Copilot is properly authenticated in VS Code and other Copilot features work correctly
  • Other GitHub MCP functions from the repos server (https://api.githubcopilot.com/mcp/x/repos) work correctly with the same authentication setup
  • The issue appears to be specific to the Copilot MCP server endpoint or the PR creation function
  • This blocks automated workflows that depend on programmatic PR creation through Copilot
  • The error suggests either insufficient permissions for the Copilot service or an issue with the authentication flow between the MCP client and the remote Copilot server
主要语言
Go
星标
33.1k
派生
5k
平均合并
2 天 1 小时
30 天内合并 PR
25

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

github/github-mcp-server 的其他 Issue

查看 github/github-mcp-server 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。