Skip to content

365-MCP — Deployment Guide

A read-only Microsoft 365 / Entra ID security-auditing MCP server, exposed to Claude over a Cloudflare Tunnel and protected by Cloudflare Access.

This document describes the final working deployment only. It connects from Claude Code (CLI) and Claude Desktop via a Cloudflare Access service token. The claude.ai web connector does not work — see Known limitations.

Placeholders used throughout this guide — substitute your own values:

Placeholder Meaning
example.com your Cloudflare-managed domain (zone)
365-mcp.example.com the public hostname for the MCP server
cloudflared / tunnel-net your Cloudflare Tunnel container name / its Docker network
<tenant-guid> / <app-id-guid> / <secret> Entra tenant ID / app (client) ID / client secret
<team>.cloudflareaccess.com your Cloudflare Zero Trust team domain
<application-aud-tag> the Access application's AUD tag
<client-id>.access / <client-secret> the Cloudflare Access service token credentials

Architecture

Claude Code / Claude Desktop
        │  (HTTPS + CF-Access-Client-Id / CF-Access-Client-Secret headers)
Cloudflare edge ──[Access: Service Auth policy validates the service token]
        │  injects  Cf-Access-Jwt-Assertion  (signed identity JWT)
Cloudflare Tunnel (cloudflared)  →  http://365-mcp:3000
365-mcp container (FastMCP, streamable-HTTP at /sse)
        │  • re-validates the Cf-Access-Jwt-Assertion JWT (defense in depth)
        │  • client-credentials → Microsoft Graph (read-only)
Microsoft Graph API

Two independent auth layers:

  1. Cloudflare Access authenticates the caller at the edge (service token).
  2. The origin re-validates the Cf-Access-Jwt-Assertion JWT, so nothing on the internal Docker network can reach /sse without having gone through Access.

The MCP server authenticates to Microsoft Graph separately using an Entra app registration (client-credentials, read-only scopes).


Prerequisites

  • Docker + Docker Compose (optionally managed with a UI such as Dockge).
  • An existing Cloudflare Tunnel container (cloudflared) on the tunnel-net Docker network, with the zone example.com on Cloudflare.
  • Cloudflare Zero Trust enabled (free tier is fine).
  • Global Administrator on the Microsoft 365 tenant (to consent Graph permissions).