Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

MCP server that connects Claude Code to LDAP/Active Directory for user lookup, group management, authentication, and role mapping.

README.md

LDAP4Claude

An MCP (Model Context Protocol) server that connects Claude Code to LDAP / Active Directory.

Features

  • User lookup — search by name, email, username, or raw LDAP filter
  • Group management — list groups, get members, check membership (supports nested groups)
  • Authentication — verify user credentials via LDAP bind
  • Role mapping — map AD groups to application roles (admin, editor, reader, etc.)

Quick Start

npm install
npm run build

Configuration

Set environment variables (see .env.example):

| Variable | Required | Default | Description | |----------|----------|---------|-------------| | LDAP_HOST | Yes | — | Server hostname or IP | | LDAP_PORT | No | 389 | Service port | | LDAP_BASE_DN | Yes | — | Search base DN | | LDAP_BIND_DN | Yes | — | Service account bind DN | | LDAP_BIND_PASSWORD | Yes | — | Service account password | | LDAP_USE_TLS | No | false | Use ldaps:// | | LDAP_TLS_REJECT_UNAUTHORIZED | No | true | Reject self-signed certs | | LDAP_TIMEOUT | No | 5000 | Connection timeout (ms) | | ROLE_MAPPINGS_FILE | No | ./config/role-mappings.json | Role mapping file path |

Register with Claude Code

Add to ~/.claude.json:

{
  "mcpServers": {
    "ldap4claude": {
      "command": "node",
      "args": ["/path/to/LDAP4Claude/build/index.js"],
      "env": {
        "LDAP_HOST": "dc.company.com",
        "LDAP_BASE_DN": "dc=company,dc=com",
        "LDAP_BIND_DN": "cn=service-account,cn=users,dc=company,dc=com",
        "LDAP_BIND_PASSWORD": "password"
      }
    }
  }
}

Available Tools

User Tools

| Tool | Description | |------|-------------| | ldap_search_users | Search users by name, email, username, or custom LDAP filter | | ldap_get_user | Get detailed user info (title, department, groups, status) | | ldap_get_user_groups | List all groups a user belongs to (supports recursive) |

Group Tools

| Tool | Description | |------|-------------| | ldap_list_groups | List/search groups (security or distribution) | | ldap_get_group_members | Get members of a group (supports nested) | | ldap_check_group_membership | Check if a user is in a specific group |

Authentication

| Tool | Description | |------|-------------| | ldap_authenticate | Verify username + password against AD |

Role Management

| Tool | Description | |------|-------------| | ldap_role_mapping_set | Map AD groups to an application role | | ldap_role_mapping_get | View current role mappings | | ldap_role_mapping_delete | Delete a role mapping | | ldap_get_user_roles | Get a user's application roles based on group membership |

Role Mapping

Edit config/role-mappings.json or use the ldap_role_mapping_set tool:

{
  "admin": ["Domain Admins", "IT Admins"],
  "editor": ["Content Team"],
  "reader": ["Domain Users"]
}

Then query a user's roles with ldap_get_user_roles — it checks the user's AD groups against these mappings and returns which roles apply.

Architecture

!Architecture Diagram

graph TB
    subgraph Claude["Claude Code (Client)"]
        CC[Claude Code]
    end

    subgraph MCP["MCP Server (stdio transport)"]
        direction TB
        IDX[index.ts\nEntry Point]

        subgraph Tools["Tool Layer"]
            UT["user-tools.ts\nldap_search_users\nldap_get_user\nldap_get_user_groups"]
            GT["group-tools.ts\nldap_list_groups\nldap_get_group_members\nldap_check_group_membership"]
            AT["auth-tools.ts\nldap_authenticate"]
            RT["role-tools.ts\nldap_role_mapping_set/get/delete\nldap_get_user_roles"]
        end

        subgraph Core["Core Layer"]
            LC["ldap-client.ts\nLdapClient"]
            RM["role-manager.ts\nRoleManager"]
            CFG["config.ts\nZod validation"]
        end

        subgraph Utils["Utils"]
            ESC["ldap-escape.ts\nRFC 4515 filter escaping"]
        end
    end

    subgraph LDAP["Active Directory / LDAP Server"]
        SA["Service Account\nPersistent bind"]
        UA["User Auth\nTemporary bind"]
    end

    subgraph Storage["Local Storage"]
        JSON["role-mappings.json\nAtomic write"]
    end

    CC -- "JSON-RPC\n(stdin/stdout)" --> IDX
    IDX --> Tools
    IDX --> CFG
    IDX --> LC
    IDX --> RM

    UT --> LC
    GT --> LC
    AT --> LC
    RT --> LC
    RT --> RM

    LC --> ESC
    LC -- "ldap/ldaps bind\n(service account)" --> SA
    LC -- "separate Client\nper auth request" --> UA
    RM -- "read/write\n(tmp + rename)" --> JSON

License

MIT

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Developer Tools servers.