Skip to content

Built-in GitHub MCP tools not available in prompt mode (-i flag), if current directory is pre-approved (race condition) #742

@tuminoid

Description

@tuminoid

If copilot is launched via -i, then the built-in Github MCP tools are not available, despite the CLI says you're connected to Github MCP, if the directory is pre-approved. As seen in the output, the -i prompt comes BEFORE connecting to Github MCP, and leads to ignoring all Github MCP for that session. If the directory is NOT pre-approved, then the Github MCP is loaded before answer that prompt, and then Github MCP tools are available.

➜ copilot --version
0.0.367
Commit: 9b421b4

~/tmp
at 09:00:46 ➜ copilot -i "list all mcp tools"
 Welcome to GitHub Copilot CLI
 Version 0.0.367 · Commit 9b421b4

 Copilot can write, test and debug code right from your terminal. Describe a task to get started or enter ? for help. Copilot uses AI, check for mistakes.

 ● Logged in with gh as user: tuminoid

 # here I was prompted to accept the directory as trusted and it managed to load github mcp before I answered
 ● Connected to GitHub MCP Server

 ● Folder /home/tumi/tmp has been added to trusted folders.

 > list all mcp tools

 ● Here are all the available MCP (Model Context Protocol) tools from GitHub:

   Repository & Code:

     - github-mcp-server-get_file_contents - Get file/directory contents from a repo
     - github-mcp-server-search_code - Search code across GitHub repositories
     - github-mcp-server-search_repositories - Find repositories by name/description/topics
     - github-mcp-server-list_branches - List branches in a repository

   Commits:

     - github-mcp-server-get_commit - Get details for a specific commit
     - github-mcp-server-list_commits - List commits of a branch

   Issues:

     - github-mcp-server-issue_read - Get issue details, comments, sub-issues, labels
     - github-mcp-server-list_issues - List issues in a repository
     - github-mcp-server-search_issues - Search issues across GitHub

   Pull Requests:

     - `github-mcp-server-pull_request_rea

 ● Operation cancelled by user

 Total usage est:       3 Premium requests
 Total duration (API):  2s
 Total duration (wall): 21s
 Total code changes:    0 lines added, 0 lines removed
 Usage by model:
     claude-opus-4.5      13.1k input, 57 output, 9.1k cache read (Est. 3 Premium requests)

 Shutting down...
‌

~/tmp took 22s
at 09:01:12 ➜ copilot -i "list all mcp tools"
 Welcome to GitHub Copilot CLI
 Version 0.0.367 · Commit 9b421b4

 Copilot can write, test and debug code right from your terminal. Describe a task to get started or enter ? for help. Copilot uses AI, check for mistakes.

 ● Logged in with gh as user: tuminoid

# here directory is pre-approved, and -i runs before connecting to Github MCP
 > list all mcp tools

 ● Connected to GitHub MCP Server

 ✔ Checking my documentation
   └ Fetched CLI documentation

 ● Based on the documentation, you can manage MCP (Model Context Protocol) tools using the /mcp command. Here are the available MCP management options:

   /mcp [show|add|edit|delete|disable|enable] [server-name]

     - /mcp show - Show current MCP server configuration
     - /mcp add - Add a new MCP server
     - /mcp edit - Edit an existing MCP server
     - /mcp delete - Delete an MCP server
     - /mcp disable - Disable an MCP server
     - /mcp enable - Enable an MCP server

   To see your currently configured MCP servers and tools, run /mcp show in the CLI.

 ~/tmp                                                                            

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions