Lokka (Microsoft Graph) MCP server

Provides a bridge between Microsoft Graph API and natural language interaction, enabling conversational management of Microsoft 365 tenants without complex API calls.
Back to servers
Provider
Merill Fernando
Release date
Mar 15, 2025
Language
TypeScript
Package
Stats
2.0K downloads
106 stars

Lokka is an MCP (Model Context Protocol) server that bridges Microsoft Azure/Graph APIs with compatible MCP clients, enabling natural language interaction with your Azure and Microsoft 365 tenants. With Lokka, you can manage resources, query configurations, and automate tasks using conversational language instead of complex API calls or PowerShell commands.

Installation

To install and set up Lokka, you'll need to configure your MCP client and provide the necessary authentication credentials.

Prerequisites

  • Node.js and npm installed on your system
  • Access to an Azure/Microsoft 365 tenant
  • Client credentials (Tenant ID, Client ID, and Client Secret)

Setting Up Authentication

Before using Lokka, you need to create an app registration in Azure AD with appropriate permissions:

  1. Sign in to the Azure Portal
  2. Navigate to Azure Active Directory → App registrations → New registration
  3. Grant the required Microsoft Graph and Azure Management API permissions
  4. Create a client secret

Make note of your Tenant ID, Client ID, and Client Secret as you'll need them for configuration.

MCP Client Configuration

Add Lokka to your MCP client's configuration file. Below is the standard configuration format:

{
  "mcpServers": {
    "Lokka-Microsoft": {
      "command": "npx",
      "args": ["-y", "@merill/lokka"],
      "env": {
        "TENANT_ID": "<tenant-id>",
        "CLIENT_ID": "<client-id>",
        "CLIENT_SECRET": "<client-secret>"
      }
    }
  }
}

Replace the placeholder values with your actual Azure AD credentials:

  • <tenant-id>: Your Azure AD tenant ID
  • <client-id>: The application ID of your app registration
  • <client-secret>: The client secret you created

Usage

Once configured, you can start using Lokka with any compatible MCP client like Claude Desktop, Cursor, or Goose.

Example Queries

Here are some examples of natural language queries you can use with Lokka:

  • Managing security groups:

    Create a new security group called 'Sales and HR' with a dynamic rule based on the department attribute.
    
  • Reviewing security configurations:

    Find all the conditional access policies that haven't excluded the emergency access account
    
  • Device management:

    Show me all the device configuration policies assigned to the 'Call center' group
    

Asking for Help

If you're unsure what capabilities are available, you can ask Lokka itself for assistance. Your AI assistant will use Lokka to retrieve relevant information about your tenant and available commands.

Advanced Usage

For more complex scenarios, you can chain commands or ask for multi-step processes. For example:

First, find all guest users who haven't signed in for 30 days, then create a security group called 'Inactive Guests' and add them to it.

Troubleshooting

Common Issues

  • Authentication Errors: Verify your tenant ID, client ID, and client secret are correct and that the app has sufficient permissions
  • Command Not Found: Ensure Node.js and npm are properly installed and in your PATH
  • Permission Denied: Check that your app registration has the required API permissions

Getting Help

For detailed documentation and additional help, visit the official Lokka documentation.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later