{
  "markdown": "# dbatools-mcp-server\n\n[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_MCP_Server-0098FF?style=for-the-badge&logo=visualstudiocode)](https://insiders.vscode.dev/redirect/mcp/install?name=dbatools&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22dbatools-mcp-server%40latest%22%5D%7D)\n[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_MCP_Server-24bfa5?style=for-the-badge&logo=visualstudiocode)](https://insiders.vscode.dev/redirect/mcp/install?name=dbatools&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22dbatools-mcp-server%40latest%22%5D%7D&quality=insiders)\n\nA [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for the [dbatools](https://dbatools.io) PowerShell module.\n\nExposes dbatools commands as MCP tools so AI assistants (GitHub Copilot, Claude, etc.) can discover, explain, and execute dbatools commands directly — with all metadata sourced from dbatools' own **comment-based help**.\n\n---\n\n## Features\n\n- **`list_dbatools_commands`** — search commands by verb, noun, keyword, or risk level\n- **`get_dbatools_command_help`** — full normalized help (synopsis, parameters, examples) from `Get-Help -Full`\n- **`invoke_dbatools_command`** — execute any dbatools command with safe parameter validation, risk gating, and structured JSON output\n- **`check_dbatools_environment`** — verify PowerShell + dbatools installation, index freshness, and version alignment\n- **Version mismatch detection** — warns when installed dbatools version differs from the indexed version\n- **Safe mode** — non-readonly commands require explicit `confirm: true` to execute\n- **SQL Authentication support** — pass `SqlCredential: { username, password }` for SQL auth instances\n\n---\n\n## Prerequisites\n\n- [Node.js](https://nodejs.org/) 20+\n- [PowerShell 7+](https://github.com/PowerShell/PowerShell/releases) (`pwsh`)\n- [dbatools](https://dbatools.io/download) PowerShell module\n\n```powershell\nInstall-Module dbatools -Scope CurrentUser\n```\n\n---\n\n## Quick Start\n\n```powershell\n# 1. Clone the repo\ngit clone https://github.com/Dataplat/dbatools-mcp-server.git\ncd dbatools-mcp-server\n\n# 2. Install Node dependencies\nnpm install\n\n# 3. Generate the help index from your local dbatools installation\nnpm run refresh-help\n\n# 4. Build\nnpm run build\n```\n\nThen open the folder in VS Code — the `.vscode/mcp.json` file automatically registers the MCP server.\n\n---\n\n## Connecting to VS Code\n\nThe included [`.vscode/mcp.json`](.vscode/mcp.json) registers the server as a local STDIO MCP server.\nOpen this folder in VS Code and the server will appear in the GitHub Copilot MCP panel.\n\n```json\n{\n  \"servers\": {\n    \"dbatools\": {\n      \"type\": \"stdio\",\n      \"command\": \"node\",\n      \"args\": [\"${workspaceFolder}/dist/server.js\"],\n      \"env\": {\n        \"DBATOOLS_SAFE_MODE\": \"true\",\n        \"MAX_OUTPUT_ROWS\": \"100\",\n        \"COMMAND_TIMEOUT_SECONDS\": \"60\"\n      }\n    }\n  }\n}\n```\n\n---\n\n## Configuration\n\nAll settings are controlled via environment variables (set in `.vscode/mcp.json` or your shell):\n\n| Variable | Default | Description |\n|---|---|---|\n| `PWSH_EXE` | `pwsh` | Path to PowerShell executable |\n| `DBATOOLS_SAFE_MODE` | `true` | When `true`, non-readonly commands require `confirm: true` |\n| `MAX_OUTPUT_ROWS` | `100` | Maximum rows returned per command execution |\n| `COMMAND_TIMEOUT_SECONDS` | `60` | Seconds before PowerShell process is killed |\n\n---\n\n## Refreshing the Help Index\n\nThe help index (`generated/dbatools-help.json`) is generated from your locally installed dbatools module.\nRe-run whenever dbatools is updated:\n\n```powershell\nUpdate-Module dbatools -Scope CurrentUser\nnpm run refresh-help\n```\n\nThe server detects version mismatches at runtime and warns you when the index is stale.\n\n---\n\n## Risk Levels\n\nCommands are automatically classified by verb:\n\n| Risk Level | Verbs | Behavior |\n|---|---|---|\n| `readonly` | Get, Test, Find, Compare, … | Always allowed |\n| `change` | Set, New, Add, Copy, Enable, … | Requires `confirm: true` in safe mode |\n| `destructive` | Remove, Drop, Disable, Reset, … | Requires `confirm: true` in safe mode |\n\n---\n\n## SQL Authentication\n\nFor SQL-auth-only instances (e.g. Docker), pass credentials via the `SqlCredential` parameter:\n\n```json\n{\n  \"SqlInstance\": \"localhost,1433\",\n  \"SqlCredential\": { \"username\": \"<SqlLogin>\", \"password\": \"YourPassword\" }\n}\n```\n\n---\n\n## Project Structure\n\n```\ndbatools-mcp-server/\n├── src/\n│   ├── server.ts          # MCP server entry point, tool definitions\n│   ├── powershell.ts      # PowerShell process runner, health checks, version detection\n│   ├── help-indexer.ts    # Help manifest loader and command search\n│   ├── tool-registry.ts   # Risk classification, safe argument builder\n│   └── types.ts           # Shared TypeScript interfaces\n├── scripts/\n│   └── refresh-help.ps1   # Generates generated/dbatools-help.json\n├── generated/             # Help index (gitignored, generated locally)\n├── .vscode/\n│   └── mcp.json           # VS Code MCP local server registration\n└── dist/                  # Compiled output (gitignored)\n```\n\n---\n\n## Contributing\n\nContributions are welcome! Please open an issue first for significant changes.\n\nThis project follows the same community spirit as [dbatools](https://github.com/dataplat/dbatools).\n\n---\n\n## License\n\n[MIT](LICENSE) — © 2026 DataPlat contributors\n",
  "bytes": 5390,
  "sha": "59dc4761fe02fad2a2781b7397f979625666a7b3768d6092c4241d1b8958ee41",
  "repo_slug": "dataplat/dbatools-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_dataplat_dbatools_mcp_server_17151c63/readme"
}