Skip to main content
Glama

概要

Active Directory MCP は、オープンソースの Model Context Protocol サーバーであり、AI アシスタント(Claude、Gemini CLI、API 経由の ChatGPT など)が Active Directory 環境を安全に管理できるようにします。

主な機能

  • 47 のツール:ユーザー、グループ、コンピューター、OU、セキュリティ、監査、および 15 の MSP プロンプトプレイブックをカバー。

  • 3 つのトランスポート:stdio(server.py)、FastMCP 経由の Streamable HTTP(server_http.py)、FastAPI 経由の Streamable HTTP(server_fastapi.py)。

  • 設計上マルチテナント:各インスタンスは AD_MCP_CONFIG を介して独自の AD にバインドされます。同じコードベースで 1 台のホストから無制限のテナントにサービスを提供できます。

  • 書き込み操作のガードレール:すべての変更ツールは、AD に触れる前に、テナントごとのクライアント確認文字列または自動化 Bearer トークンのいずれかを必要とします。

  • すべての操作の監査ログ:各呼び出しは、操作名、ターゲット、モード(CONFIRMED / AUTOMATION / NO_CONFIRMATION_REQUIRED)、および結果を記録します。

命名規則

すべての MCP ツール名は、ad_* プレフィックスと説明的なサフィックスを使用します(例:ad_list_users_with_filtersad_create_user_accountad_disable_computer_account_trust)。これにより、この MCP が同じ AI クライアントに接続された他のサーバー(GLPI、Hudu など)と並行して実行される場合の衝突を回避します。


Related MCP server: Shell MCP

マルチテナントアーキテクチャ

この MCP は、テナントごとに 1 プロセスとして実行され、すべてが同じコードを共有するように設計されています:

.base-code/                    <- this repository (shared source of truth)
  src/active_directory_mcp/
  ad-config/
    ad-config.example.json     <- template only (real configs are .gitignored)

<deployment>/                  <- one directory per tenant, OUTSIDE this repo
  tenant-a/
    ad-config/ad-config.json   <- real credentials (NEVER committed)
    start.sh                   <- exports AD_MCP_CONFIG and launches the server
  tenant-b/
    ad-config/ad-config.json
    start.sh

start.sh は、そのテナントの設定を指す AD_MCP_CONFIG をエクスポートし、専用ポートで python -m active_directory_mcp.server_http を実行します。共有の .base-code/ を一度更新し、すべてのテナントを再起動します — 同じコード、分離された状態。


クイックスタート

前提条件

  • Python 3.11+

  • ホストから到達可能な LDAP/LDAPS

  • 公開予定の操作に必要な権限を持つ AD サービスアカウント

1. インストール

git clone https://github.com/DevSkillsIT/Skills-MCP-Active-Directory.git
cd Skills-MCP-Active-Directory

python -m venv .venv
source .venv/bin/activate          # Linux/macOS
# .venv\Scripts\activate           # Windows

pip install -e .                   # installs from pyproject.toml

2. 設定

mkdir -p /etc/ad-mcp
cp ad-config/ad-config.example.json /etc/ad-mcp/ad-config.json
$EDITOR /etc/ad-mcp/ad-config.json   # set server, bind_dn, password, base_dn, OUs
chmod 600 /etc/ad-mcp/ad-config.json

サンプルファイルは git に保持されている唯一のテンプレートです。実際の ad-config.json.gitignoread-config/*.json + !ad-config/*.example.json)によってブロックされます。

3. 実行

export AD_MCP_CONFIG=/etc/ad-mcp/ad-config.json

# stdio transport (for direct Claude Desktop / mcp-cli use):
python -m active_directory_mcp.server

# HTTP transport (for Claude Code, Gemini CLI, n8n, etc.):
python -m active_directory_mcp.server_http --host 0.0.0.0 --port 8813 --path /activedirectory-mcp

4. Claude Code から接続

claude mcp add --transport http ad http://localhost:8813/activedirectory-mcp \
  --headers "Authorization: Bearer YOUR_AUTOMATION_TOKEN"

5. Gemini CLI から接続

~/.gemini/settings.json

{
  "mcpServers": {
    "ad": {
      "httpUrl": "http://localhost:8813/activedirectory-mcp",
      "headers": { "Authorization": "Bearer YOUR_AUTOMATION_TOKEN" },
      "timeout": 30000
    }
  }
}

ツール

すべてのツールは ad_* プレフィックスを使用します。書き込みとマークされたツールは、確認文字列または自動化 Bearer トークンのいずれかを必要とします。

テナント識別(3)

ツール

操作

ad_get_client_tenant_info

このインスタンスのテナント情報を返す(最初に呼び出す)

ad_list_configured_clients

クライアントレジストリに登録されているすべてのクライアントを一覧表示

ad_check_client_configuration

指定されたクライアントスラッグに AD が設定されているか確認

ユーザー管理(9)

ツール

書き込み

操作

ad_list_users_with_filters

ユーザーを一覧表示(OU/条件でオプションでフィルタリング)

ad_get_user_details_by_username

sAMAccountName でユーザー属性を取得

ad_get_user_group_memberships

ユーザーがメンバーであるグループを一覧表示

ad_create_user_account

あり

新しいユーザーを作成

ad_modify_user_attributes

あり

ユーザー属性を変更

ad_delete_user_account_permanently

あり

ユーザーを削除

ad_enable_user_account_access

あり

ユーザーアカウントを有効化

ad_disable_user_account_access

あり

ユーザーアカウントを無効化

ad_reset_user_password_forced

あり

パスワードをリセット(次回ログイン時に変更を強制)

グループ管理(8)

ツール

書き込み

操作

ad_list_groups_with_filters

グループを一覧表示

ad_get_group_details_by_name

グループ属性を取得

ad_get_group_members_recursive

メンバーを一覧表示(オプションで再帰的)

ad_create_group_security_or_distribution

あり

セキュリティまたは配布グループを作成

ad_modify_group_attributes

あり

グループ属性を変更

ad_delete_group_permanently

あり

グループを削除

ad_add_member_to_group

あり

メンバーを追加

ad_remove_member_from_group

あり

メンバーを削除

コンピューター管理(8)

ツール

書き込み

操作

ad_list_computers_with_filters

コンピューターを一覧表示

ad_get_computer_details_by_name

コンピューター属性を取得

ad_get_inactive_computers_by_days

N 日以上アイドル状態のコンピューターを一覧表示

ad_create_computer_account

あり

コンピューターオブジェクトを作成

ad_modify_computer_attributes

あり

コンピューター属性を変更

ad_delete_computer_account_permanently

あり

コンピューターオブジェクトを削除

ad_enable_computer_account_trust

あり

コンピューターアカウントを有効化

ad_disable_computer_account_trust

あり

コンピューターアカウントを無効化

ad_reset_computer_password_trust

あり

コンピューターのセキュアチャネルパスワードをリセット

組織単位(OU)管理(7)

ツール

書き込み

操作

ad_list_organizational_units_hierarchy

OU を一覧表示(再帰オプション)

ad_get_organizational_unit_details

OU 属性を取得

ad_get_organizational_unit_objects

OU 内のオブジェクトを一覧表示

ad_create_organizational_unit

あり

OU を作成

ad_modify_organizational_unit_attributes

あり

OU を変更

ad_delete_organizational_unit_forced

あり

OU を削除(force=true で空でない OU も削除)

ad_move_organizational_unit_parent

あり

OU を新しい親に移動

セキュリティと監査(6)

ツール

操作

ad_get_domain_security_policy_info

ドメイン情報 + パスワード/ロックアウトポリシー

ad_get_privileged_security_groups

特権グループを一覧表示(Domain Admins、Enterprise Admins など)

ad_get_user_effective_permissions

ユーザーの実効権限を表示

ad_get_inactive_users_by_days

N 日以上ログオンしていないユーザー

ad_get_password_policy_violations

パスワードポリシーに違反しているアカウント

ad_audit_administrative_accounts

特権アカウントの衛生状態を監査

MSP プロンプト(2 ツール + 15 プロンプト)

ツール

操作

ad_list_msp_prompts

15 のプロフェッショナル MSP プレイブックを一覧表示(マネージャー&アナリスト)

ad_execute_msp_prompt

引数付きで指定されたプレイブックを実行

完全なプロンプトカタログ(セキュリティ監査、オンボーディング、オフボーディング、パスワードリセットプレイブックなど)については、PROMPTS.md を参照してください。

システム(4)

ツール

操作

ad_test_ldap_connection_status

LDAP 接続プローブ

ad_health_check_mcp_server

完全なヘルスチェック(サーバー + LDAP 検索テスト + 統計)

ad_get_mcp_schema_tools_info

登録済み全ツールの自己記述スキーマ


設定

ランタイム設定ファイルのパスは、AD_MCP_CONFIG 環境変数を介して提供されます。スキーマは ad-config/ad-config.example.json にあります。

主要フィールド

フィールド

必須

説明

active_directory.server

はい

プライマリLDAP URL(例: ldaps://dc.example.com:636

active_directory.server_pool

いいえ

フェイルオーバー用の追加LDAP URL

active_directory.bind_dn

はい

サービスアカウントの完全DN

active_directory.password

はい

サービスアカウントのパスワード(ファイルはchmod 600に保つ)

active_directory.base_dn

はい

ベースDN(例: DC=example,DC=com

organizational_units.*

はい

ユーザー/グループ/コンピューター/サービスアカウントのデフォルトOU

security.enable_tls

いいえ

StartTLS / LDAPSを強制

security.validate_certificate

いいえ

ca_cert_fileに対してサーバー証明書を検証

security.require_secure_connection

いいえ

平文でのバインドを拒否

automation.token

いいえ

無人書き込み操作用のベアラートークン

client.slug

いいえ

ad_get_client_tenant_infoによって報告されるテナント識別子

サービスアカウントの権限

公開する予定の操作に必要な最小限の委任権限をバインドアカウントに付与します:

  • 読み取り専用デプロイ: ドメインルートに対する「すべてのプロパティの読み取り」+「内容の一覧表示」で十分です。

  • ユーザー/グループ書き込み: 対象OUに「オブジェクトの作成/削除」+「すべてのプロパティの書き込み」を委任します。

  • パスワードリセット: 対象OUに「パスワードのリセット」拡張権限を委任します。

  • コンピューターの参加/離脱: コンピューターOUに「コンピューターオブジェクトの作成/削除」を委任します。

常に専用のサービスアカウントを使用し、本番環境ではLDAPSを使用し、パスワードを定期的にローテーションしてください。


セキュリティ

書き込み保護モデル

すべての変更ツール(ad_create_*ad_modify_*ad_delete_*ad_enable_*ad_disable_*ad_reset_*ad_add_*ad_remove_*ad_move_*)は、LDAPに到達する前にcheck_write_permission()を呼び出します。以下のいずれかが満たされた場合に書き込みを許可します:

  1. automation_tokenが設定ファイルのautomation.tokenと一致する — CI / スケジュールジョブ向け。

  2. client_confirmationがテナントスラッグと一致する — AIアシスタントは最初にad_get_client_tenant_infoを呼び出し、スラッグをユーザーに読み上げ、その正確な文字列を渡す必要があります。

  3. テナントがrequire_confirmation_for_writes: falseに設定されている(明示的なオプトアウト。推奨されません)。

上記のいずれも満たされない場合、呼び出しはpermitted: falseメッセージで短絡され、LDAP書き込みは試行されません。

監査ログ

すべての操作は、タイムスタンプ、ツール名、ターゲット、確認モード(AUTOMATION / CONFIRMED / WRONG_CONFIRMATION / NO_CONFIRMATION_REQUIRED)、成功/失敗を含む構造化ログ行を書き込みます。ログはlogging.fileが指す場所に出力されます。

シークレットの衛生管理

  • 実際のad-config.jsonファイルはgit-ignoreされます。追跡されるのは*.example.jsonのみです。

  • 実際のpasswordまたはautomation.tokenを含む設定を、ログ記録または第三者によって文字起こしされるチャットに貼り付けないでください。

  • automation.tokenを再生成するたびにローテーションしてください。特権資格情報として扱ってください。


テスト

# Unit + integration tests
pytest tests/ -v

# Coverage
pytest --cov=src --cov-report=term-missing

# Lint
ruff check .

同梱のdocker-compose-ad.ymlは、192.168.1.100にSamba ADコンテナとMCPコンテナを起動し、本番環境に触れることなく実際のLDAPバックエンドに対して統合テストを実行できるようにします。


トラブルシューティング

症状

考えられる原因

修正

LDAP bind failed

bind_dn / passwordが不正

ldapsearch -H <server> -D '<bind_dn>' -Wで確認

Insufficient permissions

サービスアカウントに委任権限がない

対象OUで再委任

Certificate verification failed

信頼されていない自己署名証明書

ca_cert_fileを設定するか、validate_certificate: false(テストのみ)

すべての書き込みでpermitted: false

確認/トークンが不足

最初にad_get_client_tenant_infoを呼び出すか、automation_tokenを渡す

Health degraded

ソケットは開いているがLDAP検索が失敗

サービスアカウントのロックアウト/レプリケーション/ネットワークACLを確認


コントリビューション

  1. リポジトリをフォークします。

  2. フィーチャーブランチを作成します: git checkout -b feat/your-feature

  3. テストを実行します: pytest

  4. 明確な説明と関連するIssueへのリンクを添えてPRを開きます。

コミットはConventional Commitsに従います。


ライセンス

MIT — LICENSEを参照してください。

謝辞

サポート

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    A comprehensive production-ready MCP server with AI integration, plugin management, and web-based administration. Features multi-database support, RAG capabilities, SSH/SFTP access, and a built-in plugin hub for managing the MCP ecosystem.
  • A
    license
    A
    quality
    D
    maintenance
    A production-ready MCP server that enables AI assistants to execute shell commands, manage files, monitor system resources, and automate complex workflows with advanced features like stock tracking and web automation.
    7
    32
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    MCP server that enables AI-powered assessment of Active Directory on-premises environments by exposing AD data as queryable tools for LLMs like Claude.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables AI assistants to manage, monitor, and diagnose Windows systems through 42 tools across 8 modules, including services, event viewer, task scheduler, processes, network, diagnostics, observability, and safety features.
    32
    8
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • MCP server for Gainium — manage trading bots, deals, and balances via AI assistants

  • Security-first WordPress MCP server. 129 tools for Claude, ChatGPT, Gemini. Free on wp.org.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DevSkillsIT/Skills-MCP-Active-Directory'

If you have feedback or need assistance with the MCP directory API, please join our Discord server