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.
To install and set up Lokka, you'll need to configure your MCP client and provide the necessary authentication credentials.
Before using Lokka, you need to create an app registration in Azure AD with appropriate permissions:
Make note of your Tenant ID, Client ID, and Client Secret as you'll need them for 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 createdOnce configured, you can start using Lokka with any compatible MCP client like Claude Desktop, Cursor, or Goose.
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
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.
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.
For detailed documentation and additional help, visit the official Lokka documentation.
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.
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"
]
}
}
}
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.
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.