
Lokka
MCP用自然语言通过 Microsoft Graph 查询和管理 Microsoft 365 与 Azure 租户:建用户和安全组、查设备与条件访问策略、看云费用,适合企业 IT 管理员和兼管 IT 的行政。需有相应权限的微软工作账号,默认浏览器登录,修改会直接生效。
Lokka
Lokka is a model-context-protocol server for the Microsoft Graph and Azure RM APIs that allows you to query and manage your Azure and Microsoft 365 tenants with AI.
Please see Lokka.dev for how to use Lokka with your favorite AI model and chat client.
Lokka lets you use Claude Desktop, or any MCP Client, to use natural language to accomplish things in your Azure and Microsoft 365 tenant through the Microsoft APIs.
e.g.:
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 accountShow me all the Intune device configuration policies assigned to the 'Call center' groupWhat was the most expensive service in Azure last month?

Authentication Methods
Lokka now supports multiple authentication methods to accommodate different deployment scenarios:
Interactive Auth
For user-based authentication with interactive login, you can use the following configuration:
This is the simplest config and uses the default Lokka app.
{
"mcpServers": {
"Lokka-Microsoft": {
"command": "npx",
"args": ["-y", "@merill/lokka"]
}
}
}
Interactive auth with custom app
If you wish to use a custom Microsoft Entra app, you can create a new app registration in Microsoft Entra and configure it with the following environment variables:
{
"mcpServers": {
"Lokka-Microsoft": {
"command": "npx",
"args": ["-y", "@merill/lokka"],
"env": {
"TENANT_ID": "<tenant-id>",
"CLIENT_ID": "<client-id>",
"USE_INTERACTIVE": "true"
}
}
}
}
App-Only Auth
Traditional app-only authentication. You can use either certificate (recommended) or client secret authentication with the following configuration.
See Install Guide for more details on how to create an Entra app.
App-Only Auth with Certificate
App only authentication using a PEM-encoded client certificate:
{
"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"
}
}
}
}
For comfort, in order to convert a PFX client certificate to a PEM-encoded certificate:
openssl pkcs12 -in /path/to/cert.pfx -out /path/to/cert.pem -nodes -clcerts
App-Only Auth with Client Secret
{
"mcpServers": {
"Lokka-Microsoft": {
"command": "npx",
"args": ["-y", "@merill/lokka"],
"env": {
"TENANT_ID": "<tenant-id>",
"CLIENT_ID": "<client-id>",
"CLIENT_SECRET": "<client-secret>"
}
}
}
}
Client-Provided Token
Token-based authentication where the MCP Client provides access tokens:
{
"mcpServers": {
"Lokka-Microsoft": {
"command": "npx",
"args": ["-y", "@merill/lokka"],
"env": {
"USE_CLIENT_TOKEN": "true"
}
}
}
}
When using client-provided token mode:
- Start the MCP server with
USE_CLIENT_TOKEN=true - Use the
set-access-tokentool to provide a valid Microsoft Graph access token - Use the
get-auth-statustool to verify authentication status - Refresh tokens as needed using
set-access-token
New Tools
Token Management Tools
set-access-token: Set or update access tokens for Microsoft Graph authenticationget-auth-status: Check current authentication status and capabilitiesadd-graph-permission: Request additional Microsoft Graph permission scopes interactively
Graph API Version Control
Lokka now supports controlling the default Microsoft Graph API version used for all requests:
- Default behavior: Uses
betaversion for access to latest features - Production mode: Set
USE_GRAPH_BETA=falseto force all requests to usev1.0version - Per-request override: You can still specify
graphApiVersionparameter in individual requests (unlessUSE_GRAPH_BETA=false)
When USE_GRAPH_BETA=false, all Graph API calls will use the stable v1.0 version, even if beta is explicitly requested in the graphApiVersion parameter.
Getting started
See the docs for more information on how to install and configure Lokka.
One-click install for VS Code
| Platform | VS Code | VS Code Insiders |
|---|---|---|
| Windows | ||
| macOS/Linux |
Components
Tools
-
Lokka-Microsoft- Call Microsoft Graph & Azure APIs. Supports querying Azure and Microsoft 365 tenants. Updates are also supported if permissions are provided.
- Input:
apiType(string): Type of Microsoft API to query. Options: 'graph' for Microsoft Graph (Entra) or 'azure' for Azure Resource Management.path(string): The Azure or Graph API URL path to call (e.g. '/users', '/groups', '/subscriptions').method(string): HTTP method to use (e.g., get, post, put, patch, delete)apiVersion(string): Azure Resource Management API version (required for apiType Azure)subscriptionId(string): Azure Subscription ID (for Azure Resource Management).queryParams(string): Array of query parameters like $filter, $select, etc. All parameters are strings.body(JSON): The request body (for POST, PUT, PATCH)
- Returns: Results from the Azure or Graph API call.
-
set-access-token(New in v0.2.0)- Set or update an access token for Microsoft Graph authentication when using client-provided token mode.
- Input:
accessToken(string): The access token obtained from Microsoft Graph authenticationexpiresOn(string, optional): Token expiration time in ISO format
- Returns: Confirmation of token update
-
get-auth-status(New in v0.2.0)- Check the current authentication status and mode of the MCP Server
- Returns: Authentication mode, readiness status, and capabilities
Environment Variables
The configuration of the server is done using environment variables. The following environment variables are supported:
| Name | Description | Required |
|---|---|---|
TENANT_ID | The ID of the Microsoft Entra tenant. | Yes (except for client-provided token mode) |
CLIENT_ID | The ID of the application registered in Microsoft Entra. | Yes (except for client-provided token mode) |
CLIENT_SECRET | The client secret of the application registered in Microsoft Entra. | Yes (for client credentials mode only) |
USE_INTERACTIVE | Set to "true" to enable interactive authentication mode. | No |
USE_CLIENT_TOKEN | Set to "true" to enable client-provided token authentication mode. | No |
USE_CERTIFICATE | Set to "true" to enable certificate authentication mode. | No |
CERTIFICATE_PATH | Path to the PEM-encoded certificate file for certificate authentication. | Yes (for certificate mode only) |
CERTIFICATE_PASSWORD | Password for the certificate file (if encrypted). | No |
REDIRECT_URI | Redirect URI for interactive authentication (default: http://localhost:3000). | No |
ACCESS_TOKEN | Initial access token for client-provided token mode. | No |
USE_GRAPH_BETA | Set to "false" to force all Graph API calls to use v1.0 instead of beta (default: true, allows beta). | No |
Contributors
- Interactive and Token-based Authentication (v0.2.0) - @darrenjrobinson
- Certificate Authentication (v0.2.1) - @nitzpo
Sponsors
Lokka is free and ad-free, with no investors behind it. If it saves you time, please consider sponsoring me on GitHub. 💙
Installation
To use this server with the Claude Desktop app, add the following configuration to the "mcpServers" section of your
claude_desktop_config.json:
Interactive Authentication
{
"mcpServers": {
"Lokka-Microsoft": {
"command": "npx",
"args": ["-y", "@merill/lokka"]
}
}
}
Client Credentials Authentication
{
"mcpServers": {
"Lokka-Microsoft": {
"command": "npx",
"args": ["-y", "@merill/lokka"],
"env": {
"TENANT_ID": "<tenant-id>",
"CLIENT_ID": "<client-id>",
"CLIENT_SECRET": "<client-secret>"
}
}
}
}
Make sure to replace <tenant-id>, <client-id>, and <client-secret> with the actual values from your Microsoft Entra application. (See Install Guide for more details on how to create an Entra app and configure the agent.)
相關資源

Prowler
CLI对 AWS、Azure、GCP、Kubernetes、GitHub、M365 等环境做安全基线与合规检查,内置 CIS、NIST、PCI-DSS、SOC2 等框架,可以生成报告,也能打开本地看板。需要先配置对应云账号的凭证。
prowler-cloud/prowler15.4k
Google Security Operations and Threat Intelligence MCP Server
MCPGoogle 官方安全 MCP 集合:接入 Google SecOps(Chronicle)、SecOps SOAR、Google 威胁情报(GTI)与 Security Command Center,用于告警调查、威胁狩猎、IOC 查询与云风险排查。需要 Google Cloud 凭据或 VirusTotal API Key。
google/mcp-security551
Azure MCP Server
MCP微软官方:一个服务器覆盖存储、Cosmos DB、AKS、App Service、Key Vault、Monitor 等数十种 Azure 服务,让 agent 查询和管理云资源。需先登录 Azure 账号。
microsoft/mcp3.9k
Microsoft Learn MCP Server
MCP检索并读取 Microsoft Learn 官方文档与 Azure、.NET 等代码示例,减少 agent 给出过时的微软技术答案。微软官方维护,远程接入免费且无需密钥。
MicrosoftDocs/mcp2k
Infracost
CLI在部署前估算 Terraform、Terragrunt、CloudFormation 与 AWS CDK 变更的云资源费用,并按 FinOps 策略做检查,可接入终端、编辑器、AI agent 与 CI。需登录 Infracost 账号,有免费额度。
infracost/infracost12.6k
Azure CLI
CLI微软 Azure 官方命令行(az),管理虚拟机、存储、资源组等 Azure 资源,支持 JMESPath 查询与表格、JSON 等输出格式,脚本场景有明确的退出码。使用前需 az login 登录。
Azure/azure-cli4.7k