GitHub Copilot Spaces provide powerful capabilities for organizing and accessing domain-specific knowledge through Model Context Protocol (MCP) servers. However, there’s currently a known issue preventing Copilot Spaces from working seamlessly with coding agents. This guide walks you through the workaround to enable full functionality.
Problem
When attempting to use GitHub Copilot Spaces with coding agents, you may encounter two primary issues:
- Local MCP Configuration Issue: The standard MCP server configuration for Copilot Spaces fails to connect properly (GitHub Issue #1241, GitHub Issue #1496)
- Coding Agent Integration Failure: Even when working locally, coding agents cannot access the Copilot Spaces tools, returning “tool not found” errors
The recommended solution of adding "X-MCP-Toolssets": "copilot_spaces" The header does not resolve these issues. This only adds the list_copilot_spaces , and you won’t be able to retrieve the content using the get_copilot_space.
TL;DR;
- Set up a Copilot space in either your user directory or an organization
- Create a PAT token for the MCP to use, no specific Spaces scope available (yet)
- Add the specific GitHub spaces mcp server with the PAT token to your repository (this can be changed to the default github-mcp-server when it is properly deployed there
- Start your cloud agent
Set up the Copilot spaces
Navigate to github.com/copilot/spaces and create a new space “General Library”, choose to add text content, and give it a name and a list of books.

Locally
To enable Copilot Spaces locally, you need to manually configure your MCP server connection.
Your personal mcp.json file is typically located at:
Windows: C:\Users\<username>\AppData\Roaming\Code\User\mcp.json
macOS: ~/Library/Application Support/Code/User/mcp.json
Linux: ~/.config/Code/User/mcp.json
{
"githubspacesmcp": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/x/copilot_spaces"
}
}
Now you can request the content of the space to be fetched from your vscode IDE, don’t forget to enable it in your tools to be used.


Enabling Copilot Spaces for Coding Agents
When requesting the same from a coding agent, github.com/copilot/agents, this will not work because it is an empty repository with no information. Copilot starts to drift off. You can see it does start the github-mcp-server; however, there is no spaces tool available in there.


To fix this we need to add the mcp server to the repositories list of MCP servers to be used.

Cause oAuth does not work for MCP when using Coding Agents, you are required to work with PAT tokens that need to be provided to the agent during runtime. This works both with the classic token and the fine-grained token. To do so, follow the next steps
- Navigate to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click Generate new token → Generate new token (classic)
- Configure your token:
- Name:
Copilot Spaces MCP Access(or your preferred name) - Resource owner: Select either user if created in the userspace or the organization when the space is created in an organization
- Expiration: Select an appropriate expiration period
- Scopes: Select the following:
- ✅
repo(Full control of private repositories) - ✅
user:read(Read all user profile data)
- ✅
- Name:
- Click Generate token
- Important: Copy the token immediately and store it securely (you won’t be able to see it again)
- Navigate to GitHub Settings → Developer settings → Personal access tokens → Fine-grained tokens
- Click Generate new token
- Configure your token:
- Name:
Copilot Spaces MCP Access(or your preferred name) - Resource owner: Select either the user if created in the userspace or the organization when the space is created in an organization
- Expiration: Select an appropriate expiration period
- Scopes: Select a scope as small as possible, as the space is not hosted in a space where you can keep this to public repositories only.
- Name:
- Click Generate token
- Important: Copy the token immediately and store it securely (you won’t be able to see it again)
In your repository settings, go to your mcp configuration and enter the following: this will allow the tools list_copilot_spaces and get_copilot_space
{
"mcpServers": {
"githubspacesmcp": {
"type": "http",
"url": "https://api.githubcopilot.com/mcp/x/copilot_spaces",
"tools": ["*"],
"headers": {
"Authorization": "Bearer ${COPILOT_MCP_SPACES_PAT}"
}
}
}
}
Key Configuration Elements:
"tools": ["*"]– Enables all available tools from the Copilot Spaces MCP server"Authorization": "Bearer ${COPILOT_MCP_SPACES_PAT}"– References the environment variable containing your PAT
Configure Repository Environment
- Navigate to your repository on GitHub
- Go to Settings → Environments
- Create a new environment named
copilot(or select an existing one) - Under Environment secrets, click Add secret
- Configure the secret:
- Name:
COPILOT_MCP_SPACES_PAT - Value: Paste the Personal Access Token you created
- Name:
- Click Add secret

Result
Now you can ask the Copilot agent to try again; it is not only requesting the GitHub Spaces MCP, but it is also being authenticated with your PAT token. This time, Copilot will be able to retrieve my list of books.


Have fun coding
You must be logged in to post a comment.