---
url: /operations/ldap.md
---

# LDAP integration

Assistants can be published to specific departments. MUCGPT reads the organization’s department tree from the configured LDAP directory, so published assistants are scoped according to that hierarchy. Configure LDAP in `assistant.config.yaml` under the `ldap` section:

```yaml
ldap:
    enabled: true
    host: "ldaps://ldap.example.org"
    port: 636
    use_ssl: true
    start_tls: false
    verify_ssl: true
    ca_cert_file: "/path/to/ca-bundle.pem"
    bind_dn: "cn=mucgpt,ou=service-accounts,dc=example,dc=org"
    # Provide bind_password via MUCGPT_ASSISTANT_LDAP__BIND_PASSWORD instead of storing it here.
    # bind_password: "<secret>"
    search_base: "dc=example,dc=org"
    search_filter: "(objectClass=organizationalUnit)"
    display_attribute: "ou"
    shortname_attribute: "departmentCode"
    parent_attribute: "parentDepartment" # optional
    additional_attributes: ["departmentName", "departmentCode"]
    required_attributes: ["departmentName", "departmentCode"]
    ignored_ou_prefixes: ["_"]
    ignored_ou_suffixes: ["-xxx"]
    ignored_ou_shortname_exceptions: ["DEPT-EXAMPLE"]
    page_size: 500
    connect_timeout: 5.0
    read_timeout: 10.0
```

Individual fields can be overridden via environment variables using the `MUCGPT_ASSISTANT_LDAP__` prefix:

```bash
export MUCGPT_ASSISTANT_LDAP__ENABLED=true
export MUCGPT_ASSISTANT_LDAP__BIND_PASSWORD='<secret>'
export MUCGPT_ASSISTANT_LDAP__IGNORED_OU_SHORTNAME_EXCEPTIONS='["DEPT-EXAMPLE"]'
```

* `search_base` defines the root of the organization tree.
* Toggle `use_ssl` / `start_tls` / `verify_ssl` depending on your directory security requirements; set `ca_cert_file` if your LDAP server uses a custom CA.
* `display_attribute` (default `ou`) controls the label shown for each organizational unit; `shortname_attribute` selects its stable identifier; `parent_attribute` can be set if your LDAP schema exposes a parent reference.
* `additional_attributes` fetches extra attributes for display; `required_attributes` are enforced during loading. Adapt all attribute names to your LDAP schema.
* `ignored_ou_prefixes` / `ignored_ou_suffixes` let you skip placeholder OUs (by default everything starting with `_` or ending with `-xxx`).
* `ignored_ou_shortname_exceptions` allows specific OUs to bypass ignore rules when their configured short-name attribute matches one of the listed values (case-insensitive).
* Typical use case: keep a business-relevant OU like `_Hidden` by adding its shortname (for example `DEPT-EXAMPLE`) to `ignored_ou_shortname_exceptions`.
* Pagination and robustness: `page_size` (default 500), `connect_timeout` (default 5s), and `read_timeout` (default 10s).
