-
Notifications
You must be signed in to change notification settings - Fork 980
Description
Bug
When a CustomAgentConfig specifies a bare MCP server name in its Tools list (e.g. Tools = ["github-mcp-server"]), and that MCP server is configured via SessionConfig.McpServers, the agent sees zero MCP tools after being selected via Rpc.Agent.SelectAsync(). The bare server name is not expanded to the individual MCP tool names.
Versions
- SDK:
GitHub.Copilot.SDK 0.1.33-preview.0 - CLI:
GitHub Copilot CLI 1.0.5 - Runtime:
.NET 8.0
Expected Behavior
When an agent has Tools = ["github-mcp-server"] and the session has a McpRemoteServerConfig named "github-mcp-server", the agent should see the 18 tools exposed by that MCP server (e.g. github-mcp-server-actions_list, github-mcp-server-list_pull_requests, etc.).
Actual Behavior
The model only sees skill and report_intent (always-injected tools). Zero MCP tools are visible. The bare server name "github-mcp-server" in the agent's Tools list is not resolved to the individual MCP tool names.
Repro Output
MCP server: github-mcp-server
Type: http
URL: https://api.enterprise.githubcopilot.com/mcp/readonly
Agent: mcp-agent
Tools: [github-mcp-server]
Creating session...
Session created.
Selecting agent 'mcp-agent' via Rpc.Agent.SelectAsync...
Agent selected.
Asking model to list all its tools...
--- Model Response ---
skill, report_intent
--- End Response ---
Tools reported: 0 (ignoring skill, report_intent)
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 McpToolAgentScoped
{
public async Task RunAsync(string cliPath)
{
var mcpServer = new McpRemoteServerConfig
{
Url = "https://api.enterprise.githubcopilot.com/mcp/readonly",
Type = "http",
Tools = new List<string> { "*" }
};
var agent = new CustomAgentConfig
{
Name = "mcp-agent",
Description = "Agent with access to github-mcp-server tools",
Prompt = "You have access to github-mcp-server tools.",
Tools = new List<string> { "github-mcp-server" }
};
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
},
CustomAgents = new List<CustomAgentConfig> { agent },
OnPermissionRequest = PermissionHandler.ApproveAll,
};
await using var session = await client.CreateSessionAsync(sessionConfig);
await session.Rpc.Agent.SelectAsync("mcp-agent");
// 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($"Agent Tools: [github-mcp-server]");
Console.WriteLine($"Model sees: {content}");
// BUG: Model sees only "skill, report_intent" — zero MCP tools
}
}Notes
- The MCP server itself works — when no agent scoping is used and
AvailableTools = ["github-mcp-server"]is set at the session level, the tools ARE visible (though with different names than expected — see related issue). - The CLI does not expand bare MCP server names in
CustomAgentConfig.Toolsto the individual<server>-<tool>names. - VS Code handles this by doing MCP tool discovery (via
tools/listJSON-RPC) and expanding bare server names before passing to the CLI. The SDK/CLI should handle this natively.