Lokka is a model-context-protocol server that enables you to manage Microsoft 365 and Azure resources using natural language through AI assistants. It acts as a bridge between AI models and Microsoft APIs, allowing you to perform tasks like creating security groups, finding conditional access policies, or analyzing Azure costs with simple English commands.
The simplest way to install Lokka is with interactive authentication, which uses the default Lokka app:
{
"mcpServers": {
"Lokka-Microsoft": {
"command": "npx",
"args": ["-y", "@merill/lokka"]
}
}
}
If you prefer to use your own app registration:
{
"mcpServers": {
"Lokka-Microsoft": {
"command": "npx",
"args": ["-y", "@merill/lokka"],
"env": {
"TENANT_ID": "<tenant-id>",
"CLIENT_ID": "<client-id>",
"USE_INTERACTIVE": "true"
}
}
}
}
For more secure deployments, certificate-based authentication is recommended:
{
"mcpServers": {
"Lokka-Microsoft": {
"command": "npx",
"args": ["-y", "@merill/lokka"],
"env": {
"TENANT_ID": "<tenant-id>",
"CLIENT_ID": "<client-id>",
"CERTIFICATE_PATH": "/path/to/certificate.pem",
"CERTIFICATE_PASSWORD": "<optional-certificate-password>",
"USE_CERTIFICATE": "true"
}
}
}
}
To convert a PFX certificate to PEM format:
openssl pkcs12 -in /path/to/cert.pfx -out /path/to/cert.pem -nodes -clcerts
{
"mcpServers": {
"Lokka-Microsoft": {
"command": "npx",
"args": ["-y", "@merill/lokka"],
"env": {
"TENANT_ID": "<tenant-id>",
"CLIENT_ID": "<client-id>",
"CLIENT_SECRET": "<client-secret>"
}
}
}
}
{
"mcpServers": {
"Lokka-Microsoft": {
"command": "npx",
"args": ["-y", "@merill/lokka"],
"env": {
"USE_CLIENT_TOKEN": "true"
}
}
}
}
The main tool for interacting with Microsoft APIs. Examples of what you can ask:
You can control which version of the Microsoft Graph API is used:
beta
version for access to the latest featuresUSE_GRAPH_BETA=false
to force all requests to use the stable v1.0
versiongraphApiVersion
parameter in individual requests (unless USE_GRAPH_BETA=false
)Lokka supports various environment variables for configuration:
Variable | Purpose | Required |
---|---|---|
TENANT_ID |
Microsoft Entra tenant ID | Yes (except for client token mode) |
CLIENT_ID |
Microsoft Entra application ID | Yes (except for client token mode) |
CLIENT_SECRET |
Application client secret | For client credentials mode only |
USE_INTERACTIVE |
Enable interactive login | No |
USE_CLIENT_TOKEN |
Enable client-provided token mode | No |
USE_CERTIFICATE |
Enable certificate authentication | No |
CERTIFICATE_PATH |
Path to PEM certificate file | For certificate mode only |
CERTIFICATE_PASSWORD |
Certificate password (if encrypted) | No |
REDIRECT_URI |
Custom redirect URI (default: http://localhost:3200) | No |
USE_GRAPH_BETA |
Force Graph API version (default: true) | No |
For more detailed information, visit Lokka.dev.
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.
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 > 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>"
}
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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