AI

Lokka MCP Authentication Enhancements


I’m excited to share some significant authentication enhancements I’ve contributed to the Lokka MCP Server for Microsoft Graph. These updates, detailed in this pull request and on NPM make an already excellent tool even more versatile.

First and foremost, a massive shout-out to Merill Fernando, the original author of Lokka MCP. Merill has done an absolutely awesome job creating and maintaining this project. His foundational work has been instrumental, and these enhancements simply build upon his implementation, providing more sophisticated authentication flows.

What’s New in Authentication? Leveraging MSAL for Flexibility

The core of these enhancements lies in providing more flexible and secure authentication options by leveraging the Microsoft Authentication Library (MSAL). MSAL simplifies the process of acquiring security tokens from the Microsoft identity platform, handling complex OAuth 2.0 and OpenID Connect protocols, token caching, and refresh mechanisms.

With these updates, Lokka MCP now supports three primary authentication methods for Microsoft Graph, accommodating a wider array of deployment scenarios:

  1. Client Credentials (Service-to-Service): This is the traditional application-only authentication flow and what has been in the Lokka MCP previously. It’s ideal for background services or daemons that need to access Microsoft Graph without a signed-in user. You configure your TENANT_ID, CLIENT_ID, and CLIENT_SECRET in the Lokka MCP environment variables. This is a robust method for automated tasks where a user interaction is not feasible.
  2. Interactive Delegated Authentication: This new method enables user-based authentication with an interactive login experience. When USE_INTERACTIVE is set to true, Lokka MCP can prompt a user to sign in through a browser, acquiring tokens on their behalf. This is crucial for scenarios where the MCP needs to operate with the permissions of a specific signed-in user, such as when interacting with a user’s personal mailbox or OneDrive. This flow utilises delegated permissions, meaning the MCP acts with the combined permissions granted to the application and the permissions the signed-in user possesses.
  3. Client-Provided Token Authentication: This highly versatile new mode (activated by setting USE_CLIENT_TOKEN to true) allows the MCP client to directly provide a valid Microsoft Graph access token to Lokka. This decouples token acquisition from the MCP server itself. It means you can integrate Lokka MCP into existing authentication infrastructures, where a separate process or application is responsible for obtaining and managing access tokens. Lokka now includes new tools like set-access-token to programmatically update the token and get-auth-status to check the current authentication state and mode. This is particularly powerful for complex architectures or when you need fine-grained control over token lifecycle management.

These additions significantly enhance Lokka MCP’s adaptability. Whether you’re integrating with diverse Entra ID configurations, adhering to specific corporate security policies, or building custom applications that manage authentication externally, these new methods provide the necessary flexibility.

Why This Matters for You

The technical details boil down to one critical advantage: these authentication enhancements make Lokka MCP much more versatile. By embracing different MSAL-based authentication flows, Lokka can now seamlessly integrate into a broader spectrum of environments. This translates to:

  • Increased Flexibility: Choose the authentication method that best fits your security posture and operational requirements.
  • Wider Application Scenarios: From automated background tasks to user-specific actions, Lokka can now support more use cases.
  • Simplified Integration: For those with existing token management systems, the client-provided token option streamlines integration.

The goal was to make Lokka MCP even more adaptable, ensuring it gets wider use and integration with applications administrators and endusers are building to bridge the gap between their application(s) and Microsoft Graph.

Enabling Interactive Authentication for Lokka in Claude Desktop

If you want to use Lokka in Claude Desktop with interactive authentication and delegated permissions in your claude_desktop_config.json configuration file provide Tenant_ID, Client_ID and User_Interactive as true as shown below. When you restart Claude Desktop (and start it in the future) your default browser will display the Entra Login window for your Application Registration. Login and the session will pass back to Claude Desktop.

"Lokka-Entra": {
  "command": "npx",
  "args": ["-y", "@merill/lokka"],
  "env": {
    "TENANT_ID": "<yourEntraTenantID>",
    "CLIENT_ID": "<yourLokkaAppRegClientID>",
    "USE_INTERACTIVE": "true"
  }
},

Continuing the MCP Journey

These authentication enhancements are another step in my ongoing exploration of MCPs. Check out my previous posts:

I’m always looking for ways to enhance and expand the utility of MCPs, and contributing back to projects like Merill’s Lokka MCP is a fantastic way to do that.

Stay tuned for more updates and explorations in the world of AI and integration.

Darren Robinson

Bespoke learnings from a Microsoft Identity and Access Management Architect using lots of Microsoft Identity Manager, Azure Active Directory, PowerShell, SailPoint IdentityNow and Lithnet products and services.

Recent Posts

EntraPulse – Your AI-Powered Gateway to Microsoft Graph & Docs

Today, I’m super excited to finally announce the Beta release of EntraPulse Lite – a…

2 months ago

AI Inception: Building AI Solutions with AI for AI

Last month I had the pleasure of speaking at the Sydney event for Global Azure.…

3 months ago

A Have I Been Pwned MCP Server for Claude

Model Context Protocol (MCP) is a powerful framework that extends AI clients like Claude and…

5 months ago

Azure AI Developer Hackathon

I've just completed participating in the Azure AI Developer Hackathon that was looking to provide…

6 months ago

Dynamics 365 CE (Sales, CRM) IAM PowerShell Module

Updated: July 2025 v1.0.2 Fixes issue setting D365SalesGlobals enabling session management for D365 Sales API…

6 months ago

Dynamics 365 F&O IAM PowerShell Module

Over the years I've written many an integration with identity sources. Dynamics 365 F&O though…

6 months ago

This website uses cookies.