MCPAuthFuncapp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCPAuthFuncappshow my Microsoft profile details"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCPAuthFuncapp
Overview
This Azure Function App implements a secure Model Context Protocol (MCP) backend service with Azure Active Directory authentication. It provides authenticated access to Microsoft Graph API through Azure API Management (APIM) and supports OAuth On-Behalf-Of (OBO) token exchange.
Related MCP server: Teams MCP
Architecture
[Client App] → [APIM Gateway] → [Azure Functions] → [Microsoft Graph API]
↓ ↓ ↓ ↓
Bearer Token → OBO Exchange → Graph Token → User DataFeatures
Authentication Flow
OAuth 2.0 On-Behalf-Of Flow: APIM policies automatically exchange user bearer tokens for Microsoft Graph API access tokens
Azure AD Integration: Seamless authentication with Azure Active Directory
Token Validation: Automatic token validation and refresh handled by APIM policies
Available Endpoints
/hello- Simple greeting endpointReturns personalized greeting message
Supports both query parameters and JSON body input
/echo- Request echo serviceReturns the exact request body sent
Useful for testing and debugging
/tools- MCP tools discoveryReturns available tools and their schemas
Supports Model Context Protocol standards
/me- User profile retrievalRequires Authentication: Bearer token in Authorization header
Retrieves authenticated user's profile from Microsoft Graph API
Automatic token exchange via APIM OBO flow
/status- Health check endpointService status and authentication state
Returns user context information
Security Features
Token-based Authentication: All sensitive endpoints require valid Bearer tokens
APIM Policy Protection: OAuth policies protect against unauthorized access
Pre-authorized Applications: Configured OAuth consent for trusted applications
Secure Token Exchange: On-Behalf-Of flow maintains security boundaries
APIM Policies
The included APIM policies provide:
OAuth Authentication: Validates incoming bearer tokens
Token Exchange: Automatic OBO flow for Microsoft Graph access
Error Handling: Comprehensive error responses for authentication failures
Security Headers: Proper CORS and security headers
Configuration
Environment Variables (replace placeholders)
{{CLIENT_ID_PLACEHOLDER}}- Azure AD Application ID{{CLIENT_SECRET_PLACEHOLDER}}- Azure AD Client Secret{{TENANT_ID_PLACEHOLDER}}- Azure AD Tenant ID{{APIM_GATEWAY_URL}}- APIM Gateway URL
Pre-authorized Applications
Configured in preauth.json for OAuth consent bypass (excluded from repository for security).
Development
Prerequisites
Python 3.9+
Azure Functions Core Tools
Azure CLI
Valid Azure AD App Registration
Local Development
# Install dependencies
pip install -r requirements.txt
# Start local development server
func startDeployment
Deploy Azure Function App
Configure APIM with included policy files
Update policy placeholders with actual values
Configure OAuth app registration and permissions
MCP Integration
This service is designed to work as a backend for Model Context Protocol implementations, providing:
Authenticated Microsoft Graph API access
Tool discovery and execution
Secure user context management
Security Notes
⚠️ Important:
Never commit actual secrets, IDs, or tokens to version control
Use Azure Key Vault for production secret management
Regularly rotate client secrets and review OAuth permissions
Monitor APIM analytics for unusual access patterns
This server cannot be deployed
Maintenance
Related MCP Connectors
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
The Grafbase MCP server sits in front of a GraphQL API and exposes an MCP protocol-compliant interface that allows AI agents and LLMs to explore and query GraphQL APIs using natural language. It provides tools to search schemas, introspect types and fields, and execute GraphQL queries while minimizing context bloat by returning only relevant schema subsets, with built-in support for authentication, authorization, and configurable access control.
Permissioned access to Outlook, OneDrive and Teams via the user's own Microsoft account
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
Related MCP Servers
- AlicenseCqualityAmaintenanceA Model Context Protocol server that enables interaction with Microsoft 365 services (Excel, Calendar, Mail, OneDrive, Teams, etc.) through the Graph API, allowing AI assistants to manage Microsoft 365 resources via natural language.18840,680 npm982MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that provides AI assistants with access to Microsoft Teams, enabling interaction with teams, channels, chats, and organizational data through Microsoft Graph APIs.19643 npm138MIT
- AlicenseNot gradedqualityDmaintenanceA comprehensive server that enables AI applications to interact with Microsoft 365 and Azure AD services through standardized Model Context Protocol interfaces.3MIT
- AlicenseNot gradedqualityDmaintenanceExposes backend APIs through Azure API Management as an MCP server to enable AI assistants to interact with product catalogs and order systems. It provides standardized tools for searching products, retrieving details, and managing orders via the Model Context Protocol.MIT