Get the FREE Ultimate OpenClaw Setup Guide →

copilot-retrieval-api

MCP Server to access CoPilot Retrieval API

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio lowcodelegend-copilot-retrieval-api-mcp-server docker run -d -p 5192:5192 -p 7198:7198 lowcodelegend/copilot-retrieval-api-image \
  --env ASPNETCORE_URLS="http://0.0.0.0:5192" \
  --env GRAPH_CLIENT_ID="REPLACEME" \
  --env GRAPH_TENANT_ID="REPLACEME" \
  --env PUBLIC_BASE_URL="https://myMcpServerUrl" \
  --env GRAPH_LOGIN_HINT="me@myO365Tenant.com" \
  --env GRAPH_ALLOWED_UPN="copilotServiceAccountUser@myO365Tenant.com" \
  --env GRAPH_REDIRECT_URI="http://localhost:5192/auth/callback" \
  --env GRAPH_CLIENT_SECRET="REPLACEME" \
  --env MOCK_COPILOT_RETRIEVAL="0"

How to use

This MCP server exposes Microsoft Copilot Retrieval API capabilities. It enables a single authenticated user context to query OneDrive/SharePoint documents and retrieve relevant document chunks via the Retrieval API. After starting the service (via Docker in the recommended setup), authenticate by visiting the /login endpoint to complete the Entra ID (AAD) flow. Once authentication is successful, you can send natural language queries to the MCP endpoint and receive a list of document fragments that best match your query. To use in your MCP client, configure the MCP server entry with the server URL (for example http://localhost:5192/mcp) so that your client can request retrieval results.

The server abstracts away embedding, vector storage, and chunking concerns by leveraging the Microsoft 365 Retrieval API. It handles the underlying Graph authentication and provides a simple interface that returns relevant text chunks from your OneDrive/SharePoint data. Ensure your app registration has the appropriate Graph permissions and that the required environment variables are set before starting the container.

How to install

Prerequisites

  • Docker and Docker Compose (if using docker-compose) installed on your machine
  • Access to an Microsoft Entra ID (AAD) app registration with the necessary Graph permissions

Installation steps

  1. Clone or download the MCP server repository for copilot-retrieval-api.
  2. Prepare environment variables either in a .env file or inline in your docker-compose.yaml:
  3. Start the service with Docker (recommended):
    • If using a prebuilt image: docker run -d -p 5192:5192 -p 7198:7198 lowcodelegend/copilot-retrieval-api-image
    • Or, using docker-compose with a docker-compose.yaml that defines the service image and ports: docker compose up -d
  4. Open http://localhost:5192/login to authenticate and authorize Graph access. Once authenticated, you can begin sending queries to http://localhost:5192/mcp.

Optional: If you prefer not to use Docker, adapt the configuration to your environment (e.g., a local dotnet run) according to the project’s hosting requirements.

Additional notes

Notes and tips:

  • The service is designed to run behind an SSL offloading reverse proxy; SSL termination is not handled in the container by default. Ensure your reverse proxy is configured and PUBLIC_BASE_URL is set accordingly.
  • Authentication uses Auth Code flow with a single user context. The user must have a full Copilot license.
  • If you need offline testing, set MOCK_COPILOT_RETRIEVAL=1 to bypass live Graph calls.
  • Rate limits apply due to a single user context; monitor usage to avoid hitting API limits.
  • If you update environment variables, restart the container to apply changes.
  • The default HTTP/HTTPS ports exposed are 5192 and 7198; adjust your reverse proxy and firewall rules accordingly.

Related MCP Servers

Sponsor this space

Reach thousands of developers