agentleFS
MicrosoftKnown publishermicrosoft/purview-dlm-mcp/.github/copilot-instructions.md

purview-dlm-mcp

Copilot instructions9 starsChanged 9 months agoMITView on GitHub

When using the dlm-diagnostics MCP server tools: MCP server enabling AI assistants to diagnose Microsoft Purview Data Lifecycle Management (DLM) issues in Exchange Online. Provides run_powershell (read-only command execution) and get_execution_log (audit trail) tools. Environment variables: DLM_UPN, DLM_ORGANIZATION (required), DLM_COMMAND_TIMEOUT_MS (optional, default 180000). Diagnostic skills live in .github/skills/: - dlm-diagnostics/ — 11 troubleshooting guides for DLM issues - asklearn/ — Fallback skill for Microsoft Learn documentation lookup - skill-creator/ — Meta-skill for authoring new skills Each skill has a SKILL.md…

  • Installs packages

The file

We split this copilot-instructions.md into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When using the dlm-diagnostics MCP server tools:

    line 5
  2. Very specific:

    Follow diagnostic guides in .github/skills/dlm-diagnostics/ when investigating

    line 15
  3. Very specific:

    Read-only only: Only Get-*, Test-*, Export-* cmdlets are allowed.

    line 34
  4. Very specific:

    Validation: Every command is checked against allowlist.ts before execution.

    line 36

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions — Purview DLM Diagnostics MCP Server

MCP Tool Selection (Runtime Diagnostics)

When using the dlm-diagnostics MCP server tools:

User IntentToolExamples
Reports a problem or errorrun_powershell"retention policy not applying", "items not archiving", "policy stuck in Error"
Asks how-to or conceptual questionask_learn"how do I create a retention policy", "what is eDiscovery"
Asks to review commands runget_execution_log"show me what we ran", "summarize the investigation"
  • Default to run_powershell for anything that sounds like troubleshooting
  • Never use ask_learn for active issues — it returns docs, not diagnostics
  • Follow diagnostic guides in .github/skills/dlm-diagnostics/ when investigating

Project Overview

MCP server enabling AI assistants to diagnose Microsoft Purview Data Lifecycle Management (DLM) issues in Exchange Online. Provides run_powershell (read-only command execution) and get_execution_log (audit trail) tools.

Key Files

FilePurpose
src/index.tsMCP server entry point, tool registration
src/powershell/executor.tsLong-lived pwsh process manager with MSAL auth
src/powershell/allowlist.tsCmdlet allowlist and command validation
src/asklearn.tsPurview topic lookup — Learn URLs and guidance
src/tsg-diagnostics.tsPure diagnostic evaluation engine (10 TSGs)
src/logger.tsAppend-only execution log with Markdown export

Security Constraints

  • Read-only only: Only Get-*, Test-*, Export-* cmdlets are allowed.
  • Blocked verbs: Set-*, New-*, Remove-*, Enable-*, Start-*, Invoke-*, Disable-*, Stop-*, Add-*, Clear-*, Update-*, Register-*, Revoke-*, Grant-*.
  • Validation: Every command is checked against allowlist.ts before execution. New cmdlets must be added to ALLOWED_CMDLETS explicitly.
  • No stored credentials: MSAL interactive browser auth only; tokens in-memory.

Code Style

  • TypeScript ESM — "type": "module", use .js extensions in imports
  • Strict mode — explicit return types on exported functions
  • Zod — for MCP tool input schemas
  • Pure evaluators — diagnostic functions in tsg-diagnostics.ts take parsed data, return structured results (no I/O)
  • Copyright header on every .ts file:
    // Copyright (c) Microsoft Corporation.
    // Licensed under the MIT License.
  • Naming: kebab-case files, camelCase variables/functions, PascalCase types/classes

Build & Test

npm install          # Install dependencies
npm run build        # Compile TypeScript (tsc)
npm test             # Run tests (vitest run)
npm start            # Start MCP server

Environment variables: DLM_UPN, DLM_ORGANIZATION (required), DLM_COMMAND_TIMEOUT_MS (optional, default 180000).

Skills

Diagnostic skills live in .github/skills/:

  • dlm-diagnostics/ — 11 troubleshooting guides for DLM issues
  • asklearn/ — Fallback skill for Microsoft Learn documentation lookup
  • skill-creator/ — Meta-skill for authoring new skills

Each skill has a SKILL.md and a references/ directory with per-symptom troubleshooting guides.

Guidelines for Code Suggestions

  1. Match existing patterns — follow the structure in allowlist.ts for new cmdlets, tsg-diagnostics.ts for new evaluators.
  2. Read-only cmdlets only — never suggest mutating PowerShell commands in diagnostic steps.
  3. Add copyright headers — include the Microsoft copyright header on new .ts files.
  4. Keep evaluators pure — diagnostic evaluation functions must not perform I/O or side effects.
  5. Update the allowlist — if a new Get-*/Test-*/Export-* cmdlet is needed, add it to ALLOWED_CMDLETS in src/powershell/allowlist.ts.
  6. Mirror skills — new skills must be placed in both .github/skills/ and .claude/skills/.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.