Skip to main content

MCP server for Kanidm Identity Management using FastMCP

Project description

Kanidm MCP Server (mcp-kanidm)

A professional Model Context Protocol (MCP) server for managing an advanced Kanidm deployment. Built completely asynchronously leveraging httpx and FastMCP.

This server is designed to work via the Kanidm REST v1 API using Service Accounts to keep your intelligent agents sandboxed and robust (eliminating standard CLI shell constraints).

Features

Provides the following MCP tools for Identity and Access Management in Kanidm:

  • list_users: Queries validated user identities with simple search filters.
  • get_user_details: Extends deep query capabilities into PII attributes and precise access windows (requires an appropriate service account assigned).
  • reset_password_intent: Generates a credential update intent token for help-desking scenarios securely (the AI agent will never directly reset nor touch user passwords directly).
  • delete_user: Manages robust termination via a Human-in-the-Loop (HITL) prompt (ctx.elicit()) guaranteeing a person grants affirmative consent ahead of any destructive REST operation.

Installation and Usage

To install or run this server dynamically within any compatible framework (Claude Desktop, etc.), you can run it via uvx dynamically or install via Python global packages using uv.

Autenticación: Cómo obtener el KANIDM_TOKEN

Importante: Nunca debes configurar el agente MCP utilizando tu cuenta principal de admin. Para mantener la seguridad, aislar los privilegios y garantizar un rastro de auditoría claro, debes usar una Cuenta de Servicio (Service Account).

Sigue estos 3 pasos usando la CLI de Kanidm:

  1. Crear una cuenta de servicio para esta integración (por ejemplo, llamada mcp-agent):

    kanidm service-account create mcp-agent "MCP Server Agent"
    
  2. Asignarle los privilegios correctos. Añade esta cuenta al grupo adecuado, como idm_people_admins (para gestión completa de usuarios) o idm_service_desk (para tareas de soporte):

    kanidm group add-members idm_people_admins mcp-agent
    
  3. Generar un API Token:

    kanidm service-account api-token generate mcp-agent --name mcp-token
    

El comando te devolverá una larga cadena. Ese es tu KANIDM_TOKEN.

Execution Environment

To authenticate safely against Kanidm instances, configure your agent to inject these environmental variables securely:

  • KANIDM_URL: Base URI of the target Kanidm system (e.g. https://kanidm.mydomain.local)
  • KANIDM_TOKEN: The API Token generated for your Service Account in the previous step.

Configuring the Agent (e.g. Claude Desktop)

In your claude_desktop_config.json:

{
  "mcpServers": {
    "kanidm-server": {
      "command": "uvx",
      "args": [
        "mcp-kanidm"
      ],
      "env": {
        "KANIDM_URL": "https://idm.company.private",
        "KANIDM_TOKEN": "YOUR-SERVICE-ACCOUNT-TOKEN"
      }
    }
  }
}

Note: For testing inside enterprise proxies with strict self-signed cert blocks, run the uv instances with the necessary proxy fallback arguments (--allow-insecure-host=...).

Local Development

  1. Run uv sync --all-groups to install code, documentation tools, and dev dependencies fully.
  2. Initialize pre-commits to automatically check your code syntax before commits: uv run pre-commit install
  3. Run uv run mcp-kanidm to launch the STDIO pipeline manually.

Note: For testing inside enterprise proxies with strict self-signed cert blocks, run the uv instances with the necessary proxy fallback arguments (--allow-insecure-host=files.pythonhosted.org --allow-insecure-host=pypi.org).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_kanidm-0.1.0.tar.gz (101.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_kanidm-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file mcp_kanidm-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_kanidm-0.1.0.tar.gz
  • Upload date:
  • Size: 101.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcp_kanidm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ba26ccb07f7d405977f8c40af239aa2a078b859cf84fbef40b7bc21f0c2a035c
MD5 b3d57770635c8bdc0b23705bc9ce7dec
BLAKE2b-256 f08eaa4ddf51de417c9477fec66c4cf372908ccccf826c4a68908cf87ce3ceab

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_kanidm-0.1.0.tar.gz:

Publisher: publish.yml on anglisano/mcp-kanidm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_kanidm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_kanidm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcp_kanidm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c387de3a71c3d61b766cb3552f5e6638fa55748306d5ffe8e6682ff748c74ce4
MD5 792dc5eacc0d70a9693148824c74d23c
BLAKE2b-256 8c1af8bb1b770d30fbf6c69683920c0f0ae6992013204e1d7be0f15d6bc23bb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_kanidm-0.1.0-py3-none-any.whl:

Publisher: publish.yml on anglisano/mcp-kanidm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page