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
Setup instructions
Provider
Merill Fernando
Release date
Mar 15, 2025
Language
TypeScript
Package
Stats
3.1K downloads
139 stars

Lokka is an MCP server that bridges Microsoft Azure/Graph APIs with any compatible MCP client, allowing you to manage your Azure and Microsoft 365 tenants through natural language queries. It works with AI models and clients that support the Model Context Protocol, giving you a simple way to interact with Microsoft cloud resources.

Installation and Setup

Prerequisites

  • A Microsoft Azure or Microsoft 365 tenant
  • An MCP-compatible client (Claude Desktop, Cursor, Goose, etc.)
  • Node.js environment to run the npm package

Installation Options

Lokka can be installed and configured to run with your MCP client using one of the following authentication methods.

Authentication Methods

Lokka supports three authentication approaches to fit different scenarios:

Client Credentials (App-Only Authentication)

This method uses traditional service-to-service authentication:

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

Interactive Authentication

For user-based authentication with an interactive login experience:

{
  "mcpServers": {
    "Lokka-Microsoft": {
      "command": "npx",
      "args": ["-y", "@merill/lokka"],
      "env": {
        "TENANT_ID": "<tenant-id>",
        "CLIENT_ID": "<client-id>",
        "USE_INTERACTIVE": "true",
        "REDIRECT_URI": "http://localhost:3000"
      }
    }
  }
}

Client-Provided Token

For scenarios where the MCP client provides access tokens:

{
  "mcpServers": {
    "Lokka-Microsoft": {
      "command": "npx",
      "args": ["-y", "@merill/lokka"],
      "env": {
        "USE_CLIENT_TOKEN": "true"
      }
    }
  }
}

Using Client-Provided Token Authentication

To use Lokka with client-provided tokens:

  1. Start the MCP server with the USE_CLIENT_TOKEN=true environment variable
  2. Use the set-access-token tool to provide a valid Microsoft Graph access token
  3. Verify authentication status with the get-auth-status tool
  4. Refresh tokens as needed using set-access-token again

Available Tools

Token Management Tools

  • set-access-token: Sets or updates access tokens for Microsoft Graph authentication
  • get-auth-status: Checks current authentication status and capabilities

Microsoft Graph Tool

  • Lokka-Microsoft: The main tool for interacting with Azure and Microsoft 365, supporting all authentication modes

Using Lokka

After configuring Lokka with your MCP client, you can start making natural language queries. Here are some examples:

  • "Create a new security group called 'Sales and HR' with a dynamic rule based on the department attribute."
  • "Find all the conditional access policies that haven't excluded the emergency access account"
  • "Show me all the device configuration policies assigned to the 'Call center' group"
  • "What was the most expensive service in Azure last month?"

Additional Resources

For more detailed information, visit the documentation at Lokka.dev:

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

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

See the official Claude Code MCP documentation for more details.

For 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 > Tools & Integrations and click "New MCP Server".

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

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

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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

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