Logotipo de Lokka (Microsoft Graph)

Lokka (Microsoft Graph)

Comunidad
merill

MCP (Model Context Protocol) for Microsoft 365. Includes support for Microsoft Graph and other services

Editormerill
Repositoriolokka
IdiomaJavaScript
Forks
80
Estrellas
299
Herramientas disponibles
31
Tipo de transportestdio
Categorías
LicenciaMIT
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    Lokka (Microsoft Graph) ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 31 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    299 estrellas y 80 forks en el repositorio enlazado.

Lokka

npm version downloads downloads per month GitHub stars license

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 account
  • Show me all the Intune device configuration policies assigned to the 'Call center' group
  • What was the most expensive service in Azure last month?

How does Lokka work?

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.

json
{
  "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:

json
{
  "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:

json
{
  "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:

bash
openssl pkcs12 -in /path/to/cert.pfx -out /path/to/cert.pem -nodes -clcerts

App-Only Auth with Client Secret

json
{
  "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:

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

When using client-provided token mode:

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

New Tools

Token Management Tools

  • set-access-token: Set or update access tokens for Microsoft Graph authentication
  • get-auth-status: Check current authentication status and capabilities
  • add-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 beta version for access to latest features
  • Production mode: Set USE_GRAPH_BETA=false to force all requests to use v1.0 version
  • Per-request override: You can still specify graphApiVersion parameter in individual requests (unless USE_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

PlatformVS CodeVS Code Insiders
WindowsInstall in VS CodeInstall in VS Code Insiders
macOS/LinuxInstall in VS CodeInstall in VS Code Insiders

Components

Tools

  1. 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.
  2. 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 authentication
      • expiresOn (string, optional): Token expiration time in ISO format
    • Returns: Confirmation of token update
  3. 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:

NameDescriptionRequired
TENANT_IDThe ID of the Microsoft Entra tenant.Yes (except for client-provided token mode)
CLIENT_IDThe ID of the application registered in Microsoft Entra.Yes (except for client-provided token mode)
CLIENT_SECRETThe client secret of the application registered in Microsoft Entra.Yes (for client credentials mode only)
USE_INTERACTIVESet to "true" to enable interactive authentication mode.No
USE_CLIENT_TOKENSet to "true" to enable client-provided token authentication mode.No
USE_CERTIFICATESet to "true" to enable certificate authentication mode.No
CERTIFICATE_PATHPath to the PEM-encoded certificate file for certificate authentication.Yes (for certificate mode only)
CERTIFICATE_PASSWORDPassword for the certificate file (if encrypted).No
REDIRECT_URIRedirect URI for interactive authentication (default: http://localhost:3000).No
ACCESS_TOKENInitial access token for client-provided token mode.No
USE_GRAPH_BETASet 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

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

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

Client Credentials Authentication

json
{
  "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.)

Instalación

TypingMind
Requisitos:

Node.js 18+

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

Herramientas disponibles

  • Lokka-Microsoft

    A versatile tool to interact with Microsoft APIs including Microsoft Graph (Entra) and Azure Resource Management. IMPORTANT: For Graph API GET requests using advanced query parameters ($filter, $count, $search, $orderby), you are ADVISED to set 'consistencyLevel: "eventual"'. NOTE: Results are specific to Lokka's active tenant connection (named in each result). If the user switches connections/tenants, earlier results in this conversation are stale — re-run the query instead of reusing previous answers. If a call fails because the user is not signed in, IMMEDIATELY call 'open-lokka-connections' to show them the sign-in dialog instead of only telling them to sign in.

  • open-graph-explorer

    Open the interactive Lokka Graph explorer UI for the user. Call this whenever the user asks to open, show, or launch Lokka, the Lokka app, or the Graph explorer (e.g. 'open lokka', 'show me the graph explorer'), or wants to explore Microsoft Graph interactively without running a specific query first. Optionally pre-fills a request path for the user to start from.

  • open-lokka-connections

    Open the Lokka connections manager UI for the user. Call this whenever the user asks to sign in, log in, authenticate, connect, manage connections or tenants, switch tenants, or says things like 'lokka auth', 'lokka sign in', 'lokka connection'. Also call it when a Lokka query fails because the user is not signed in — in that case pass 'pendingRequest' so the request resumes automatically after sign-in. The UI lets the user sign into one or more Microsoft tenants (as a user or with a service principal), shows the currently active tenant, and switches between connections.

  • open-lokka-permissions

    Open the Lokka permissions manager UI for the user. Call this whenever the user asks about Lokka's Microsoft Graph permissions, wants to grant/consent to additional permissions, or says things like 'lokka permissions', 'consent to permissions', 'add graph permissions' — and CALL IT WITH the 'scopes' argument when a Graph call fails with 403 insufficient privileges and you know which permission is missing (e.g. scopes: ['Mail.Read']): the UI opens with those permissions pre-selected so the user only has to approve. The UI shows the currently consented permissions and lets the user search the Graph permission catalog and consent to new ones.

  • open-lokka-help

    Open the Lokka help tour UI for the user. Call this whenever the user says 'lokka help', asks what Lokka can do, how to use Lokka, what tools are available, or wants an overview/tour of Lokka's features. The UI is a visual walkthrough of Graph Explorer, Lokka Settings (connections and guardrails), Connections, Permissions, and chat usage, with one-click launchers and sample prompts.

  • open-lokka-settings

    Open the Lokka settings UI for the user. Call this whenever the user asks for Lokka settings, wants a single place to manage connections or guardrails, or says things like 'lokka settings'. The UI combines the connections manager and guardrails settings; permissions stay in the dedicated Permissions app and inside connection editing.

  • open-lokka-guardrails

    Open the Lokka Guardrails UI for the user. Call this whenever the user says 'lokka guardrails', 'lokka settings', wants to control/limit model tool calls, change which HTTP methods or APIs are allowed, restrict access to specific groups/users/sites, or when a model request was just blocked by a guardrail and the user needs to adjust it. After a block, the app opens to the relevant scope, explains every contributing rule, and offers focused user-controlled fixes. Guardrails can only be changed by the user here — never by the AI. Direct user runs from Graph Explorer are not blocked by guardrails.

  • lokka-get-guardrails

    Get the guardrails (user-set policy) currently in effect for model tool calls on the active connection: which HTTP methods are allowed, the API allow/deny rules, and any per-resource id allowlists. Read-only — guardrails can only be changed by the user in the Lokka Guardrails app (open-lokka-guardrails). Direct user runs from Graph Explorer are not blocked by guardrails.

  • lokka-get-guardrails-config

    Internal: full guardrails config plus the connected tenants and resource presets, for the Guardrails app editor.

  • lokka-set-guardrails-enabled

    Internal: enable or disable Guardrails enforcement. Used by the Guardrails app. When disabled, Lokka allows every request through without method, API path, or resource guardrail checks.

  • lokka-set-guardrails-scope

    Internal: replace the guardrails policy for a scope ('global' or a tenant id). Used by the Guardrails app.

  • lokka-remove-guardrails-tenant

    Internal: remove a tenant's guardrails rule so it reverts to Global only. Used by the Guardrails app.

  • lokka-search-directory

    Internal: search the active connection's directory for items in a collection (e.g. groups, users) by name, for the Guardrails resource picker. Read-only; not subject to guardrails.

  • lokka-list-connections

    List Lokka's signed-in Microsoft tenant connections and which one is active. Use this to see which tenants are available before switching, or when the user asks which tenant/account Lokka is using.

  • lokka-add-user-connection

    Internal: sign into a Microsoft tenant interactively (browser) and add it as a Lokka connection. Used by the Lokka connections app UI.

  • lokka-add-sp-connection

    Internal: add a service principal (client credentials) connection to a Microsoft tenant. Used by the Lokka connections app UI.

  • lokka-create-app

    Internal: create a new Entra app registration in the active user's tenant — adds a client secret or auto-generated certificate, grants the requested Graph application permissions, and stores the credential. Does NOT sign in (poll lokka-connect-created-app afterwards). Used by the Lokka connections app UI.

  • lokka-connect-created-app

    Internal: complete sign-in for an app created by lokka-create-app. Returns { connected:false } while the new app is still replicating through the directory — poll until connected. Used by the Lokka connections app UI.

  • lokka-add-cert-connection

    Internal: add an app-only connection that authenticates with a client certificate (PEM). Used by the Lokka connections app UI.

  • switch-lokka-connection

    Switch Lokka's active tenant connection. Use whenever the user asks to switch to a different tenant, account or connection (e.g. 'switch to my dev tenant', 'use the contoso tenant'). Pass any identifying fragment — tenant name, domain, tenant id, username or connection id; it is fuzzy-matched against the signed-in connections. IMPORTANT: after a successful switch, results from earlier in the conversation are from the previous tenant — re-run queries instead of reusing them. If the requested tenant is not in the list, open the connections app (open-lokka-connections) so the user can sign into it.

  • lokka-set-active-connection

    Internal: switch Lokka's active tenant connection. Used by the Lokka connections app UI.

  • lokka-reconnect-connection

    Internal: re-acquire a fresh token for a connection (user connections re-run interactive sign-in to pick up newly consented scopes; service principals rebuild from the stored secret/certificate to pick up newly granted app roles). Used by the Lokka connections app UI.

  • lokka-update-app-credential

    Internal: replace an app-only connection's credential with a new client secret or certificate, then reconnect. Used by the Lokka connections app UI.

  • lokka-remove-connection

    Internal: remove a Lokka tenant connection. Used by the Lokka connections app UI.

  • lokka-get-permissions

    Internal: get the Microsoft Graph permissions (scopes/roles) currently granted to Lokka's active connection. Used by the Lokka permissions app UI.

  • lokka-consent-permissions

    Internal: request or remove Microsoft Graph delegated permission scopes for the active connection. Used by the Lokka permissions app UI.

  • lokka-grant-app-permissions

    Internal: grant or remove Microsoft Graph application permissions on an app-only connection, using a signed-in user/admin connection in the same tenant. Used by the Lokka connections app UI.

  • lokka-set-connection-label

    Internal: set a friendly display label for a connection (empty clears it). Used by the Lokka connections app UI.

  • set-access-token

    Set or update the access token for Microsoft Graph authentication. Use this when the MCP Client has obtained a fresh token through interactive authentication.

  • get-auth-status

    Check the current authentication status and mode of the MCP Server and also returns the current graph permission scopes of the access token for the current session.

  • add-graph-permission

    Request additional Microsoft Graph permission scopes by performing a fresh interactive sign-in. This tool only works in interactive authentication mode and should be used if any Graph API call returns a permission denied error.

Usa el MCP de Lokka (Microsoft Graph) con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado Lokka (Microsoft Graph), puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade Lokka (Microsoft Graph) como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de Lokka (Microsoft Graph).
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "lokka-microsoft-graph": {
      "command": "npx",
      "args": [
        "-y",
        "@merill/lokka"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de Lokka (Microsoft Graph) y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de Lokka (Microsoft Graph).
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar Lokka (Microsoft Graph) para ayudarme con esta tarea?
Lokka (Microsoft Graph)
Claro. Lo he leído.
Esto he encontrado usando Lokka (Microsoft Graph).

Preguntas frecuentes

¿Para qué sirve el servidor MCP Lokka (Microsoft Graph)?

Lokka (Microsoft Graph) es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP Lokka (Microsoft Graph) con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar Lokka (Microsoft Graph) con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de Lokka (Microsoft Graph) con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con Lokka (Microsoft Graph) conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP Lokka (Microsoft Graph) a TypingMind?

Lokka (Microsoft Graph) funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP Lokka (Microsoft Graph) en TypingMind?

Lokka (Microsoft Graph) ofrece 31 herramientas MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP Lokka (Microsoft Graph)?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si Lokka (Microsoft Graph) requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

lokka-graph-explorer

Interactive Microsoft Graph explorer for viewing and re-running Lokka API queries with rich JSON and table views.

lokka-connections

Manage Lokka's Microsoft tenant connections: sign in as a user or service principal, view the current tenant, and switch between connections.

lokka-permissions

View the Microsoft Graph permissions currently granted to Lokka and consent to additional permissions.

lokka-help

Visual tour of everything Lokka can do: the Graph explorer, connections, permissions, and how to use them.

lokka-guardrails

Review and set the guardrails that limit model-originated Lokka calls: allowed HTTP methods, API allow/deny lists, and per-resource id allowlists, globally or per tenant.

lokka-settings

Manage Lokka's core user settings in one place: Microsoft connections and guardrails.

open-lokka

Open the interactive Lokka Graph explorer to browse Microsoft Graph

lokka-connections

Sign into Microsoft tenants and switch the active Lokka connection

lokka-permissions

Review and consent to Microsoft Graph permissions for Lokka

lokka-help

Visual tour of everything Lokka can do and how to use it

lokka-settings

Manage Lokka connections and guardrails in one place

lokka-guardrails

Control which HTTP methods, APIs and resources model tool calls may use

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇