MCP server URL
Self-hosted Softeria ms-365-mcp-server (https://github.com/Softeria/ms-365-mcp-server) running on DigitalOcean, behind Cloudflare Tunnel + Cloudflare Access
Where does the issue occur?
When auth finishes and redirects back to Claude.ai
Transport used
streamable-http
Client registration type
Dynamic Client Registration (DCR)
SSE only: Does your server return the expected status code for POST requests?
Not applicable (my server does not use SSE)
When did you last reproduce this?
2026-03-28 17:00 GMT
Browser and OS
No response
Describe the issue
When connecting a custom remote MCP server to claude.ai that uses Microsoft Azure AD (Entra ID) as its upstream OAuth identity provider, the OAuth flow consistently fails after the user successfully authenticates with Microsoft. The failure occurs inside claude.ai's backend — the MCP server's /token endpoint is never called, confirmed via server-side logs.Two distinct error patterns are observed depending on the connection attempt:Pattern 1 — code: Field required
Returned as a JSON error in Anthropic's own validation format during the callback stage:
json{"type":"error","error":{"type":"invalid_request_error","message":"code: Field required"},"request_id":"req_011CZVnQcRWQ5GC8Rp167Ev9"}Pattern 2 — ofid authorization failure
Shown in the claude.ai UI after the Microsoft consent screen is accepted:
Authorization with the MCP server failed. You can check your credentials and permissions.In both cases, Microsoft successfully authenticates the user and redirects to https://claude.ai/api/mcp/auth_callback?code=XXX&state=YYY. Claude.ai's backend then fails to process the callback before ever contacting the MCP server's /token endpoint.
Issue details
Product: claude.ai web
Plan: Team
Date: 2026-03-28
Transport: Streamable HTTP
Auth: OAuth 2.1 with Dynamic Client Registration (DCR)
Upstream IdP: Microsoft Azure AD (Entra ID) — tenant-specific
MCP server: Self-hosted Softeria ms-365-mcp-server
URL: https://ms365-mcp.westend-dental.com
Infrastructure: DigitalOcean droplet behind Cloudflare Tunnel + Cloudflare Access
Error reference IDs:
req_011CZVnQcRWQ5GC8Rp167Ev9
req_011CZVnuHrrkzaP6z146EwoT
req_011CZVo8UPEZe3GJeTHZqFkS
ofid_8b4ebc5243fe881f
ofid_ef182e8bd15b391b
ofid_18e6f53c612c30aa
ofid_cb4c569412fa3f49
ofid_0aad3ac70e7713d3
OAuth metadata endpoint: https://ms365-mcp.westend-dental.com/.well-known/oauth-authorization-server
Redirect URIs registered in Entra:
https://claude.ai/api/mcp/auth_callback
https://claude.com/api/mcp/auth_callback
Azure AD app: public client flows enabled, grant types: authorization_code + refresh_token, PKCE: S256
Cloudflare Access bypass policies confirmed working for:
/.well-known/oauth-authorization-server
/register
/authorize
/token
Expected behavior
After the user authenticates with Microsoft and accepts the consent screen, Microsoft should redirect to https://claude.ai/api/mcp/auth_callback?code=XXX&state=YYY. Claude.ai's backend should then send the authorization code to the MCP server's /token endpoint, which exchanges it with Microsoft for an access token and returns it to claude.ai. The connector should show as Connected and MCP tools should become available.
Logs from your server
No server-side logs are generated during the failure — the MCP server's /token endpoint is never called by claude.ai. This was verified by checking journalctl -u ms365-mcp immediately after each failed connection attempt. All OAuth endpoints (/register, /authorize, /token) were independently verified to function correctly outside of claude.ai using curl and the MCP Inspector.
Additional context
The OAuth flow architecture is a proxy pattern: the MCP server's /authorize endpoint proxies to Microsoft's OAuth endpoint, and the /token endpoint exchanges the code with Microsoft Graph on the user's behalf. This is a common pattern for MCP servers acting as Microsoft Graph intermediaries.
The following were all attempted and confirmed not to resolve the issue:
Providing a pre-registered OAuth Client ID and Secret in claude.ai's Advanced connector settings (bypasses DCR)
Adding a claudeai custom scope to the Azure AD app registration's "Expose an API" section
Both https://claude.ai/api/mcp/auth_callback and https://claude.com/api/mcp/auth_callback registered as redirect URIs
Enabling --enable-dynamic-registration flag on the MCP server
The issue appears specific to Microsoft Azure AD as the upstream IdP. The code: Field required error message is Anthropic's own Pydantic/validation format, strongly suggesting the failure is in claude.ai's callback handler rather than in the MCP server or Microsoft's OAuth implementation.
MCP server URL
Self-hosted Softeria ms-365-mcp-server (https://github.com/Softeria/ms-365-mcp-server) running on DigitalOcean, behind Cloudflare Tunnel + Cloudflare Access
Where does the issue occur?
When auth finishes and redirects back to Claude.ai
Transport used
streamable-http
Client registration type
Dynamic Client Registration (DCR)
SSE only: Does your server return the expected status code for POST requests?
Not applicable (my server does not use SSE)
When did you last reproduce this?
2026-03-28 17:00 GMT
Browser and OS
No response
Describe the issue
When connecting a custom remote MCP server to claude.ai that uses Microsoft Azure AD (Entra ID) as its upstream OAuth identity provider, the OAuth flow consistently fails after the user successfully authenticates with Microsoft. The failure occurs inside claude.ai's backend — the MCP server's /token endpoint is never called, confirmed via server-side logs.Two distinct error patterns are observed depending on the connection attempt:Pattern 1 — code: Field required
Returned as a JSON error in Anthropic's own validation format during the callback stage:
json{"type":"error","error":{"type":"invalid_request_error","message":"code: Field required"},"request_id":"req_011CZVnQcRWQ5GC8Rp167Ev9"}Pattern 2 — ofid authorization failure
Shown in the claude.ai UI after the Microsoft consent screen is accepted:
Authorization with the MCP server failed. You can check your credentials and permissions.In both cases, Microsoft successfully authenticates the user and redirects to https://claude.ai/api/mcp/auth_callback?code=XXX&state=YYY. Claude.ai's backend then fails to process the callback before ever contacting the MCP server's /token endpoint.
Issue details
Product: claude.ai web Plan: Team Date: 2026-03-28 Transport: Streamable HTTP Auth: OAuth 2.1 with Dynamic Client Registration (DCR) Upstream IdP: Microsoft Azure AD (Entra ID) — tenant-specific MCP server: Self-hosted Softeria ms-365-mcp-server URL: https://ms365-mcp.westend-dental.com Infrastructure: DigitalOcean droplet behind Cloudflare Tunnel + Cloudflare Access Error reference IDs: req_011CZVnQcRWQ5GC8Rp167Ev9 req_011CZVnuHrrkzaP6z146EwoT req_011CZVo8UPEZe3GJeTHZqFkS ofid_8b4ebc5243fe881f ofid_ef182e8bd15b391b ofid_18e6f53c612c30aa ofid_cb4c569412fa3f49 ofid_0aad3ac70e7713d3 OAuth metadata endpoint: https://ms365-mcp.westend-dental.com/.well-known/oauth-authorization-server Redirect URIs registered in Entra: https://claude.ai/api/mcp/auth_callback https://claude.com/api/mcp/auth_callback Azure AD app: public client flows enabled, grant types: authorization_code + refresh_token, PKCE: S256 Cloudflare Access bypass policies confirmed working for: /.well-known/oauth-authorization-server /register /authorize /tokenExpected behavior
After the user authenticates with Microsoft and accepts the consent screen, Microsoft should redirect to https://claude.ai/api/mcp/auth_callback?code=XXX&state=YYY. Claude.ai's backend should then send the authorization code to the MCP server's /token endpoint, which exchanges it with Microsoft for an access token and returns it to claude.ai. The connector should show as Connected and MCP tools should become available.
Logs from your server
No server-side logs are generated during the failure — the MCP server's /token endpoint is never called by claude.ai. This was verified by checking journalctl -u ms365-mcp immediately after each failed connection attempt. All OAuth endpoints (/register, /authorize, /token) were independently verified to function correctly outside of claude.ai using curl and the MCP Inspector.Additional context
The OAuth flow architecture is a proxy pattern: the MCP server's /authorize endpoint proxies to Microsoft's OAuth endpoint, and the /token endpoint exchanges the code with Microsoft Graph on the user's behalf. This is a common pattern for MCP servers acting as Microsoft Graph intermediaries.
The following were all attempted and confirmed not to resolve the issue:
Providing a pre-registered OAuth Client ID and Secret in claude.ai's Advanced connector settings (bypasses DCR)
Adding a claudeai custom scope to the Azure AD app registration's "Expose an API" section
Both https://claude.ai/api/mcp/auth_callback and https://claude.com/api/mcp/auth_callback registered as redirect URIs
Enabling --enable-dynamic-registration flag on the MCP server
The issue appears specific to Microsoft Azure AD as the upstream IdP. The code: Field required error message is Anthropic's own Pydantic/validation format, strongly suggesting the failure is in claude.ai's callback handler rather than in the MCP server or Microsoft's OAuth implementation.