Open source · Apache-2.0 · Local MCP server

ActiveDirectoryMCP

Let your AI assistant search, explain and change on-premises Active Directory: users, groups, permissions, Group Policy, AD-integrated DNS and AD CS. Read-only by default, with every change recorded and reversible.

What you can ask

Once the server is connected, you talk to your assistant in plain language and it calls the tools.

  • Which enabled users have not signed in for 90 days, and are any of them in privileged groups?
  • Which GPOs set the LAN Manager authentication level, to what value, and where are they linked?
  • Which certificate templates let the requester supply the subject, and who may enroll in them?
  • Which records in our AD-integrated DNS zones point to 10.0.5.20, and which zones hold them?

Built to be safe to hand to an AI

Read-only by default

Every change is reversible

Your identity, your permissions

Runs on your machine

Built on Microsoft components

Data in, data out

What it covers

36 tools in read-only mode, 90 in ReadWrite mode. The full reference is in the repository.

AreaReadChange (ReadWrite mode)
Directory objectsLDAP search (also forest-wide), object details, nested membership, OU tree, deleted objects, password policies, attribute replication metadata, replication status, last logon, Windows LAPS passwordsCreate, modify, move, rename, delete and restore users, groups, computers, contacts, OUs, gMSAs, password settings objects and subnets; enable, disable, unlock; membership; password reset
PermissionsDACL with inheritance, owner, SACL (audit entries)Add and remove entries, owner, auditing, inheritance
Group PolicyGPOs, links, inheritance, reports, permissions, registry and security settings, Advanced Audit Policy, preferences, backupsCreate, link, enable, delete and restore GPOs; registry, security and audit settings and three kinds of preferences one by one; staging copies and imports for everything else
DNS (AD-integrated)Zones and records, also searched by name or dataAdd, change and remove records; create and delete zones
AD CSEnterprise CAs, NTAuth, certificate templates with flags and permissions, the CA’s settings, permissions and request databaseCopy, change and publish templates; approve, deny and revoke; publish CRLs; CA settings and permissions
ChangesThe change logRoll back one change or a selection, with a dry run

Use it with Forestall

Forestall finds the misconfigurations and attack paths in Active Directory and ranks them by how far they reach. ActiveDirectoryMCP helps you look into a finding and make the fix, with a dry run first and a rollback after. The two do not exchange data: you bring the finding to your assistant.

Close a certificate template that lets anyone pick the subject

Forestall flags a published template that allows domain authentication, lets the requester supply the subject, and is open to non-privileged or everyone-like principals: anyone who can enroll can ask for a certificate in a domain admin’s name.

Show me the settings and enrollment rights of the template Forestall flagged, and which CAs publish it. Then turn off “supply in the request” with a dry run first.

Forestall’s guidance is to clear “Supply in Request” when the template does not need it, and to consider removing the authentication EKUs. If one application really needs it, removing the Enroll right of broad groups is the narrower fix. Both are recorded and roll back.

Take a privileged account out of Kerberoasting reach

Forestall finds service principal names registered on privileged users. Any authenticated user can request a ticket for those services and crack the account’s password offline.

For each privileged account with an SPN, list the SPNs, the groups that make it privileged and when its password last changed. Create a gMSA for the SQL service on SRV-DB01.

Forestall recommends a dedicated least-privilege account, preferably a gMSA. Once the service runs under it (a change on the server, outside Active Directory), remove the SPN from the privileged account; that change rolls back if the service still needs it.

Investigate and remove a suspicious ACE on AdminSDHolder

Forestall reports an access control entry on AdminSDHolder that does not belong there. SDProp copies that ACL to every protected account and group within an hour, which makes it a favourite persistence spot.

Show the explicit entries on AdminSDHolder with trustee names, and when its security descriptor last changed and on which domain controller. Remove the GenericAll entry for that account, dry run first.

The replication metadata tells you when and where the ACL changed, which is where the investigation starts. If an attacker added the entry, Forestall’s guidance is to treat the whole domain as compromised and run a compromise assessment, not only to remove the entry.

Clear passwords left in Group Policy Preferences

Forestall finds GPOs whose preference files in SYSVOL still hold a cpassword. Any domain user can read SYSVOL, and the key that encrypts it is public.

List the local users in the preferences of the GPOs Forestall flagged, with the stored passwords as they are in the file. Remove the stored password from each item.

The tool edits local users and groups (Groups.xml); drive maps, scheduled tasks, data sources and printers are not edited one by one. Treat every password that was in SYSVOL as known: change it, and manage local administrator passwords with LAPS.

Raise the LAN Manager authentication level without breaking things

Forestall finds GPOs that set LmCompatibilityLevel below 5, which leaves LM or NTLMv1 accepted and authentication open to relay and cracking.

Which GPOs set LmCompatibilityLevel, to what, and where are they linked? Make a staging copy of the server baseline, set it to 5 there, and link the copy to the Test-Servers OU.

Audit who still uses NTLMv1 before you enforce: Forestall’s own guidance warns that legacy systems can break. When the test OU is clean, import the copy’s settings into the original; the import rolls back.

Disable stale accounts that still hold privileges

Forestall lists inactive users and shows which of them still sit on an attack path or in a privileged group. A forgotten account with rights is an easy target nobody watches.

For the inactive users Forestall listed, check the last logon on every domain controller and their group memberships. Disable the ones that have not signed in for 180 days.

lastLogonTimestamp can lag by up to two weeks, so the server reads lastLogon from every domain controller instead. If someone turns out to need an account, rolling back the change enables it again.

Forestall itself stays read-only: it never writes to your directory.

Install it

On a domain-joined Windows x64 machine (Windows 10/11 or Windows Server 2016 or later) with RSAT. The release is self-contained, so no .NET installation is needed. The README lists the RSAT features and the ports each tool needs.

1. Download

Get the zip from the latest release, then unblock and extract it:

Unblock-File .\ActiveDirectoryMCP-*-win-x64.zip Expand-Archive .\ActiveDirectoryMCP-*-win-x64.zip C:\

Each release lists SHA-256 sums and signed build provenance you can check first.

2. Connect Claude Code

claude mcp add activedirectory --scope user -- C:\ActiveDirectoryMCP\ActiveDirectoryMCP.exe

Add -e ADMCP__Mode=ReadWrite before -- when you want the edit tools. Then ask: “Using the activedirectory tools, show the domain info.”

Claude Desktop

Open the .mcpb file from the release, or drag it onto Settings › Extensions, to install it as an extension. Pick ReadOnly or ReadWrite in the extension's settings.

VS Code, Cursor and others

Any MCP client that starts a local stdio server works the same way: point it at ActiveDirectoryMCP.exe. The README has the configuration for each client and the one-command build from source.

Before you let an AI change your directory

  • Start read-only. Turn on ReadWrite only on the machine and for the session where you mean to change things.
  • Run it as an account with exactly the rights you want the AI to have, not as a Domain Admin by habit.
  • Leave your client’s tool approval prompts on and ask for a dry run before every change.
  • Text stored in the directory (descriptions, notes, display names) reaches the model as data. Anyone who can write those attributes can try to steer an AI that reads them: check what it proposes before it writes.
  • Tool results go to the model provider your MCP client uses, including any passwords or LAPS values you ask for.
  • The local change and audit logs are a convenience, not evidence. Active Directory’s own auditing remains the record.

Frequently asked questions

Is ActiveDirectoryMCP free?

Yes. It is open source under the Apache-2.0 license and published by Forestall on GitHub. Each release has a ready-to-run Windows zip and a Claude Desktop extension, built by GitHub Actions from the tagged source; you can also build it yourself with the .NET 10 SDK.

Does it send my directory data to Forestall?

No. It runs on your own machine over stdio, as your Windows user, with no Forestall service behind it. The only data that leaves the machine is what your MCP client sends to its model provider.

Do I need Forestall to use it?

No. It works on its own with any MCP client. Forestall is the analysis side: it finds the misconfigurations and attack paths and ranks them; ActiveDirectoryMCP helps you look into a finding and make the change. The two do not exchange data, so you bring the finding to your assistant.

Which AI clients does it work with?

Any MCP client that starts a local stdio server: Claude Code, Claude Desktop, VS Code and Cursor are documented in the README. Some clients pass only a limited number of tools to the model; in ReadWrite mode the server lists 90 tools.

Is it ready for production?

It is in early development (0.1.0). The tools are covered by unit tests and by end-to-end tests in a lab with a child domain, a trusted forest and an enterprise CA, but interfaces may still change. Try it in a lab or with a read-only account first.

What can it not undo?

Password resets and unlocks, deletions when the AD Recycle Bin is off, and on the CA everything except a certificate hold (revocations, approvals, CRL publications). The tools say so in their result. A change made by another tool between the read and the write is not detected.

Know what to fix first.

Forestall maps the misconfigurations and attack paths across Active Directory, Entra ID and cloud, and ranks the fixes that cut the most paths. See it on your own environment in one day.