Skip to content

AI: MCP server tools not exposed with expected naming when using AvailableTools #861

@KnicKnic

Description

@KnicKnic

Bug

When SessionConfig.AvailableTools is set to a bare MCP server name (e.g. ["github-mcp-server"]) and the MCP server is configured via SessionConfig.McpServers as an HTTP remote server, the MCP server's tools are not surfaced with the expected <server>-<tool> naming convention. The model reports tools like read_file, edit_file, create_file, view_directory, ask_user instead of the expected github-mcp-server-actions_list, github-mcp-server-list_pull_requests, etc.

Versions

  • SDK: GitHub.Copilot.SDK 0.1.33-preview.0
  • CLI: GitHub Copilot CLI 1.0.5
  • Runtime: .NET 8.0

Expected Behavior

When AvailableTools = ["github-mcp-server"] and the session has an McpRemoteServerConfig for "github-mcp-server" pointing to https://api.enterprise.githubcopilot.com/mcp/readonly, the model should see the 18 MCP tools with proper prefixed names:

github-mcp-server-actions_list, github-mcp-server-actions_get, github-mcp-server-get_job_logs,
github-mcp-server-list_pull_requests, github-mcp-server-search_pull_requests,
github-mcp-server-pull_request_read, github-mcp-server-list_issues, github-mcp-server-search_issues,
github-mcp-server-issue_read, github-mcp-server-list_commits, github-mcp-server-get_commit,
github-mcp-server-list_branches, github-mcp-server-search_code, github-mcp-server-search_repositories,
github-mcp-server-get_file_contents, github-mcp-server-search_users, github-mcp-server-list_copilot_spaces,
github-mcp-server-get_copilot_space

Actual Behavior

The model reports 9 tools with generic names that don't match the expected MCP tool naming convention:

read_file, edit_file, create_file, view_directory, powershell, grep, glob, ask_user, sql

None of the 18 expected github-mcp-server-* tools are visible.

Repro Output

MCP server: github-mcp-server
  Type: http
  URL:  https://api.enterprise.githubcopilot.com/mcp/readonly
  AvailableTools: ["github-mcp-server"]

Creating session with remote MCP server + AvailableTools...
Session created.

Asking model to list all its tools...

--- Model Response ---
read_file, edit_file, create_file, view_directory, powershell, grep, glob, ask_user, sql
--- End Response ---

Tools reported: 9 (ignoring skill, report_intent)
  - read_file
  - edit_file
  - create_file
  - view_directory
  - powershell
  - grep
  - glob
  - ask_user
  - sql

Expected MCP tools: 18
Found:   0
Missing: 18
Missing MCP tools:
  - github-mcp-server-actions_list
  - github-mcp-server-actions_get
  - github-mcp-server-get_job_logs
  - github-mcp-server-list_pull_requests
  - github-mcp-server-search_pull_requests
  - github-mcp-server-pull_request_read
  - github-mcp-server-list_issues
  - github-mcp-server-search_issues
  - github-mcp-server-issue_read
  - github-mcp-server-list_commits
  - github-mcp-server-get_commit
  - github-mcp-server-list_branches
  - github-mcp-server-search_code
  - github-mcp-server-search_repositories
  - github-mcp-server-get_file_contents
  - github-mcp-server-search_users
  - github-mcp-server-list_copilot_spaces
  - github-mcp-server-get_copilot_space

Self-Contained Repro Code

using GitHub.Copilot.SDK;

public class McpToolSpecified
{
    public async Task RunAsync(string cliPath)
    {
        var mcpServer = new McpRemoteServerConfig
        {
            Url = "https://api.enterprise.githubcopilot.com/mcp/readonly",
            Type = "http",
            Tools = new List<string> { "*" }
        };

        await using var client = new CopilotClient(new CopilotClientOptions { CliPath = cliPath });
        await client.StartAsync();

        var sessionConfig = new SessionConfig
        {
            Model = "gpt5-mini",
            McpServers = new Dictionary<string, object>
            {
                ["github-mcp-server"] = mcpServer
            },
            AvailableTools = new List<string> { "github-mcp-server" },
            OnPermissionRequest = PermissionHandler.ApproveAll,
        };

        await using var session = await client.CreateSessionAsync(sessionConfig);

        // Ask the model what tools it sees
        var done = new TaskCompletionSource();
        string? content = null;
        using var sub = session.On(evt =>
        {
            switch (evt)
            {
                case AssistantMessageEvent msg: content = msg.Data.Content; break;
                case SessionIdleEvent: done.TrySetResult(); break;
                case SessionErrorEvent err: done.TrySetException(new Exception(err.Data.Message)); break;
            }
        });
        await session.SendAsync(new MessageOptions
        {
            Prompt = "List every tool name you have access to. Output ONLY a comma-separated list."
        });
        await done.Task;

        Console.WriteLine($"AvailableTools: [github-mcp-server]");
        Console.WriteLine($"Model sees: {content}");
        // BUG: Model sees generic tool names, not github-mcp-server-* prefixed MCP tools
    }
}

Notes

  • Without AvailableTools at all (just McpServers), the MCP tools also don't appear — model only sees core CLI tools (see separate McpToolDiscovery test).
  • The tool names the model reports (read_file, edit_file, etc.) appear to be the CLI's own built-in tools with different naming, not the MCP server's tools.
  • This suggests the CLI may not be connecting to the remote HTTP MCP server at all, or the AvailableTools bare server name is being interpreted as something else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions