Skip to main content
Glama
gpo-mcp-server

gpo-mcp-server

by hgursel

gpo-mcp-server

A read-only MCP (Model Context Protocol) server for querying and auditing Active Directory Group Policy Objects (GPOs) through natural language with Claude or any MCP-compatible AI client.

Runs on a domain-joined Windows machine. Executes PowerShell cmdlets via subprocess — no extra AD libraries required.


Features

  • 15 read-only MCP tools spanning GPO discovery, inspection, scope analysis, search, and audit

  • get_gpo_scope — answers "which users/computers will be affected?" by combining linked OUs, security filtering (GpoApply permissions), and WMI filter conditions

  • Strict read-only design — no GPO configuration is ever modified

  • Automatic PowerShell version detection (PS7 pwsh.exe preferred, PS5.1 fallback)

  • XML report parsing with full support for Admin Templates, Security Settings, Registry policies, and Scripts

  • All tests run on any OS (PowerShell calls are mocked)


Related MCP server: azure-compliance-mcp

Architecture

Claude (or any MCP client)
        │  stdio
        ▼
gpo-mcp-server (FastMCP, Python)
        │
        ▼
PowerShellRunner (subprocess.run)
        │
        ▼
powershell.exe / pwsh.exe
        │
        ▼
Active Directory (GroupPolicy module)

Prerequisites

Requirement

Notes

Windows (domain-joined)

Server must be a member of the AD domain

RSAT: Group Policy Management Tools

Get-WindowsCapability -Online -Name Rsat.GroupPolicy*

PowerShell 5.1+

Built into Windows; PS7 recommended

Python 3.10+

With pip

Install RSAT on Windows 10/11

Add-WindowsCapability -Online -Name Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0

Installation

# Clone the repository
git clone https://github.com/yourorg/gpo-mcp-server.git
cd gpo-mcp-server

# Install (in a virtual environment recommended)
pip install -e .

# Install with dev/test dependencies
pip install -e ".[dev]"

Configuration

All settings are controlled via environment variables:

Variable

Default

Description

GPO_POWERSHELL_PATH

auto-detect

Explicit path to pwsh.exe or powershell.exe

GPO_COMMAND_TIMEOUT

30

Timeout in seconds for PS commands

GPO_TARGET_DOMAIN

current domain

Target AD domain name

GPO_LOG_LEVEL

INFO

Python logging level (DEBUG, INFO, WARNING)

GPO_BACKUP_PATH

C:\GPOBackups

Default directory for get_gpo_backup


Running the Server

# Start with stdio transport (default — required for Claude Desktop)
python -m gpo_mcp.server

# or via the installed entry point
gpo-mcp-server

Available Tools

Read Tools

Tool

Description

list_gpos

List all GPOs in the domain with metadata

get_gpo_details

Full metadata for a GPO (name, GUID, status, versions, WMI filter)

get_gpo_report

Full GPO settings report in XML (parsed) or HTML format

get_gpo_settings

Structured policy settings extracted from a GPO's XML report

get_gpo_links

All OUs/sites/domains this GPO is linked to, with link status

get_gpo_scope

Who is affected — linked OUs + security filtering (GpoApply) + WMI filter

get_gpo_inheritance

GPO inheritance chain for an OU with precedence order

get_rsop

Resultant Set of Policy for a specific user and/or computer

test_connection

Verify PowerShell and GroupPolicy module availability

Search Tools

Tool

Description

find_gpo_by_setting

Search all GPOs for a setting keyword in names/categories/registry paths

find_gpo_by_permission

Find GPOs where a user/group has a specific permission level

Audit Tools

Tool

Description

compare_gpos

Side-by-side settings diff between two GPOs

find_unlinked_gpos

Identify GPOs with no OU/site/domain links

find_disabled_gpos

Find fully or partially disabled GPOs

get_gpo_backup

Export a GPO to a backup folder (read-only filesystem operation)


Usage Examples

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "gpo": {
      "command": "gpo-mcp-server",
      "env": {
        "GPO_TARGET_DOMAIN": "contoso.com",
        "GPO_LOG_LEVEL": "INFO"
      }
    }
  }
}

Claude Code

Add to .claude/mcp.json in your project:

{
  "mcpServers": {
    "gpo": {
      "command": "python",
      "args": ["-m", "gpo_mcp.server"],
      "env": {
        "GPO_TARGET_DOMAIN": "contoso.com"
      }
    }
  }
}

Example Prompts

"List all GPOs in the domain and show me which ones are disabled"

"Show me the scope of the 'Windows Firewall Policy' GPO —
 which users and computers will it apply to?"

"Compare the 'Default Domain Policy' with 'Workstation Baseline' GPO
 and highlight the differences"

"Find all GPOs that configure password length settings"

"Which GPOs does the 'IT Helpdesk' group have permission to edit?"

"Show the GPO inheritance for the Sales OU"

"What is the Resultant Set of Policy for user CONTOSO\jsmith
 on computer DESKTOP-001?"

Development

Run Tests

Tests work on any OS — all PowerShell calls are mocked:

pytest tests/ -v

# With coverage
pytest tests/ --cov=src/gpo_mcp --cov-report=term-missing

Project Structure

src/gpo_mcp/
├── server.py          FastMCP entry point
├── config.py          Environment-driven configuration
├── powershell/
│   └── runner.py      PowerShell subprocess wrapper
├── parsers/
│   └── gpo_xml.py     GPO XML report parser
└── tools/
    ├── gpo_read.py    9 read tools
    ├── gpo_search.py  2 search tools
    └── gpo_audit.py   4 audit tools

Security Considerations

  • Read-only by design: No PowerShell write cmdlets (Set-*, New-*, Remove-*) are ever called.

  • No credential storage: Uses the Windows identity of the process (domain machine account or interactive user).

  • No code injection: All user inputs are escaped before being interpolated into PowerShell commands (single-quote escaping applied).

  • Audit logging: Every PowerShell command executed is logged at INFO level, creating an implicit audit trail.

  • Least privilege: The server only needs "Read" + "Apply Group Policy" permissions on GPOs to function. No elevated rights required for read operations.


Roadmap

Phase

Status

Description

Phase 1

Complete

Read-only GPO inspection (15 tools)

Phase 2

Planned

RAG/vector search over GPO settings history

Phase 3

Planned

Write operations (create, link, modify settings)


License

MIT — see LICENSE

Available Tools

15 tools
compare_gposCompare GposA

Compare the settings between two Group Policy Objects.

Fetches XML reports for both GPOs, parses them into structured settings, then computes a detailed diff. Useful for identifying configuration drift between a baseline GPO and a deployed GPO, or between two environment-specific GPOs.

Inputs: gpo1_name (required), gpo2_name (required). Returns: object

find_disabled_gposFind Disabled GposA

Find GPOs that are fully or partially disabled.

Identifies GPOs where all settings, computer settings only, or user settings only are disabled. Partially disabled GPOs can indicate intentional configuration (e.g., a Computer-only GPO with User settings disabled) or abandoned/forgotten GPOs.

Inputs: status_filter. Returns: result

find_gpo_by_permissionFind Gpo By PermissionA

Find GPOs where a specific user or group has a defined permission.

Queries the security permissions on every GPO in the domain to find which GPOs a given user, group, or security principal has access to. Useful for auditing who can manage, apply, or read specific GPOs.

Inputs: trustee (required), permission_level. Returns: result

find_gpo_by_settingFind Gpo By SettingA

Search all GPOs for a specific policy setting by keyword.

Iterates through every GPO in the domain, fetches its XML report, and searches for the given keyword in setting names, categories, and registry key paths. This operation can be slow on domains with many GPOs because it must fetch and parse each GPO report.

Inputs: setting_keyword (required), section. Returns: result

find_unlinked_gposFind Unlinked GposA

Find all GPOs that are not linked to any OU, site, or domain.

Unlinked GPOs consume storage and processing resources but have no effect on any users or computers. They are often the result of deleted OUs, reorganized AD structure, or incomplete cleanup after GPO migration.

Note: This tool issues one PowerShell call per GPO to fetch XML reports. It may be slow on domains with many GPOs.

Inputs: no named parameters. Returns: result

get_gpo_backupGet Gpo BackupA

Create a backup of a Group Policy Object to a specified path.

Exports the GPO settings to a backup folder using Backup-GPO. The backup includes all policy settings, security settings, and WMI filters. It does NOT modify any GPO configuration — this is a read-only export operation.

The backup can later be used to restore the GPO with Restore-GPO (outside the scope of this read-only server).

Inputs: name, gpo_id, backup_path. Returns: object

get_gpo_detailsGet Gpo DetailsB

Get detailed metadata for a specific Group Policy Object.

Retrieves the full GPO object including version information, enabled status, WMI filter, owner, and timestamps.

Inputs: name, gpo_id. Returns: object

get_gpo_inheritanceGet Gpo InheritanceA

Show the GPO inheritance chain for an Organizational Unit.

Retrieves the ordered list of GPOs that apply to the specified OU, taking into account inheritance from parent OUs, block inheritance settings, and enforced (NoOverride) links.

Inputs: target_ou (required). Returns: object

get_gpo_reportGet Gpo ReportA

Get the full settings report for a GPO in XML or HTML format.

For XML reports, returns both the raw XML string and the parsed settings structure. For HTML reports, returns the raw HTML string suitable for display in a browser.

Inputs: name, gpo_id, report_type. Returns: object

get_gpo_scopeGet Gpo ScopeA

Show which users and computers are affected by a GPO.

Determines the effective applicability scope of a GPO by combining:

  • Linked OUs: Which Organizational Units/Sites/Domains this GPO is applied to (with link-enabled and enforcement status).

  • Security Filtering: Which users and groups have the "Apply Group Policy" permission (GpoApply) — only principals with this permission actually receive the GPO.

  • WMI Filter: If a WMI filter is attached, the filter name and WQL query condition that computers must satisfy.

Inputs: name, gpo_id. Returns: object

get_gpo_settingsGet Gpo SettingsB

Extract structured policy settings from a GPO.

Fetches the XML report for the GPO and returns parsed settings in a clean, nested dictionary format without the raw XML overhead.

Inputs: name, gpo_id, section. Returns: object

get_rsopGet RsopA

Get the Resultant Set of Policy (RSoP) for a user and/or computer.

Calculates which policies actually apply to a specific user, computer, or user+computer combination after inheritance, security filtering, and WMI filter evaluation are taken into account.

At least one of user or computer must be provided.

Inputs: user, computer. Returns: object

list_gposList GposA

List all Group Policy Objects in the domain.

Returns a summary of every GPO found, including name, GUID, status, creation/modification timestamps, owner, and description.

Inputs: domain. Returns: result

test_connectionTest ConnectionA

Verify that PowerShell and the GroupPolicy module are available.

Tests the connection to PowerShell and confirms the GroupPolicy RSAT module is installed. Use this tool to diagnose configuration issues before running other GPO operations.

Inputs: no named parameters. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 15 tools

    Disambiguation4/5

    Most tools have clearly distinct targets (links, inheritance, RSoP, comparison, searches), but a few overlap: get_gpo_scope explicitly re-includes link status and WMI filter info already exposed by get_gpo_links and get_gpo_details, and get_gpo_report vs get_gpo_settings differ mainly in output format. Descriptions do a good job of steering an agent to the right one in most cases.

    Naming Consistency4/5

    All names use snake_case with a leading verb (list_, get_, find_, compare_, test_), which is highly predictable. The one wrinkle is get_gpo_backup, whose 'get_' verb masks that it creates a backup folder — a create/export verb would be clearer.

    Tool Count5/5

    Fifteen tools is well within the sweet spot for a read-only GPO auditing domain, and each tool maps to a distinct diagnostic question (links, scope, inheritance, RSoP, drift, unlinked, disabled, backup). Nothing feels like filler.

    Completeness4/5

    The read-only lifecycle is well covered: enumerate, inspect, parse settings, resolve effective scope/RSoP, compare, and export. Remaining gaps are minor and mostly acknowledged out of scope — no restore/import path and no direct tool for discovering OUs/sites/domains as entry points for inheritance or link queries.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables managing Active Directory users, groups, and computers using natural language, with support for queries and updates.
      59
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides read-only tools for monitoring and investigating Active Directory Domain Services, including users, groups, OUs, computers, GPOs, and domain metadata via LDAPS.
      -
    • F
      license
      B
      quality
      D
      maintenance
      Enables users to query BloodHound Active Directory graph data using natural language, finding attack paths, Kerberoastable accounts, and other AD security insights.
      23
      -