MCP Server for the Microsoft CoPilot Retrieval API
468
Since mid-2025 Microsoft has provided a Retrieval API for Copilot.
The API leverages Semantic Search and automatically takes care of OneDrive and SharePoint document chunking, embedding, and storing vector representation of these documents. This saves the engineer from needing to bring their own Embedding Models, Vector DB, Chunker, and upsert flow.
It allows the central data-store to remain as M365. Rather than copying the data elsewhere.
For information on the API see: Retrieval API Documentation
The MCP server provides the following interface: Input is a natural language query. Response is a list of chunks (document fragments) of relevant text from OneDrive/SharePoint Documents.
cd RetrievalApiMcpServer
docker compose up -d
{
"mcpServers": {
"copilotRetrieval": {
"url": "http://localhost:5192/mcp"
}
}
}
You will need an App Registration in Entra ID (AAD). Update the values in the .env file
Default Docker ports exposed are: HTTP: 5192 HTTPS: 7198
No provisions has been added yet to manage the SSL cert. TODO. Typically the service is expected to run behind an SSL offloading Reverse Proxy.
GRAPH_TENANT_ID=REPLACEME # from Entra ID App Registration
GRAPH_CLIENT_ID=REPLACEME #
GRAPH_CLIENT_SECRET=REPLACEME #
[email protected] # user login hint
GRAPH_REDIRECT_URI=http://localhost:5192/auth/callback # e.g. https://myMcpServerUrl/auth/callback, make sure it's registered in App Registration in Entra ID
MOCK_COPILOT_RETRIEVAL=0 # for offline hacking, mock response from graph and bypass auth
PUBLIC_BASE_URL=https://myMcpServerUrl # if using a reverse proxy you can set this
Copilot Retrieval API only supports Auth Code tokens which need a user context. No AppOnly/ClientCredentials
As there's a single user context, care should be taken to understand the rate limiting restrictions MS places.
MIT Ashley Evans 2025
Content type
Image
Digest
sha256:1268f3880…
Size
90.6 MB
Last updated
12 months ago
docker pull hoshy99/copilot-mcp-server