-
Notifications
You must be signed in to change notification settings - Fork 780
Description
Context
I'm building a tool that uses copilot-sdk to create programmatic sessions. The tool runs as a subprocess invoked via the Copilot CLI.
Question
When I create a CopilotClient session programmatically, it does not have access to MCP tools that are available in the parent Copilot CLI. Specifically, github-mcp-server tools return "Tool does not exist" errors.
I've tried passing MCP server configurations via create_session():
session_config = {
"model": "claude-sonnet-4",
"mcp_servers": {
"github-mcp-server": {
"type": "sse",
"url": "https://api.githubcopilot.com/mcp/",
"headers": {"Authorization": f"Bearer {token}"},
"tools": ["*"]
}
}
}
session = await client.create_session(session_config)However, the github-mcp-server still isn't accessible. I suspect this is because it requires internal Copilot authentication rather than a PAT.
What works:
- Local stdio MCP servers from
~/.copilot/mcp-config.jsonload and function correctly - The
mcp_serversparameter inSessionConfigis being passed through
What doesn't work:
- Remote MCP servers (the SSE endpoint returns protocol errors with PAT auth)
- The built-in
github-mcp-serverfrom the parent CLI
Questions
- Is there a supported way to access
github-mcp-serverfrom programmatic SDK sessions? - Is there an API to inherit MCP configuration from the parent Copilot CLI process?
- Are there plans to expose a helper like
load_default_mcp_config()for common use cases?
Current Workaround
The agent falls back to using gh CLI commands for GitHub data access, which works but loses the benefits of structured MCP tool responses.
Environment
- copilot-sdk version: 0.1.19 (via
github-copilot-sdkpackage) - Python: 3.14
- Platform: macOS
Thank you for any guidance you can provide.