Skip to content

Commit 04998ce

Browse files
Merge pull request #12 from dataplat/development
Bump dependencies and enhance security measures
2 parents 1054855 + 9d7142c commit 04998ce

5 files changed

Lines changed: 28 additions & 23 deletions

File tree

package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "dbatools-mcp-server",
33
"mcpName": "io.github.dataplat/dbatools-mcp-server",
4-
"version": "0.3.0",
4+
"version": "0.4.0",
55
"description": "MCP server for dbatools — exposes SQL Server management commands as MCP tools",
66
"keywords": [
77
"dbatools",
@@ -32,7 +32,7 @@
3232
"test": "node --experimental-vm-modules node_modules/.bin/jest --passWithNoTests"
3333
},
3434
"dependencies": {
35-
"@modelcontextprotocol/sdk": "^1.10.0",
35+
"@modelcontextprotocol/sdk": "^1.29.0",
3636
"zod": "^3.24.0"
3737
},
3838
"devDependencies": {

server.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"url": "https://github.com/dataplat/dbatools-mcp-server",
77
"source": "github"
88
},
9-
"version": "0.3.0",
9+
"version": "0.4.0",
1010
"icons": [
1111
{
1212
"src": "https://dbatools.io/thor.png",
@@ -17,7 +17,7 @@
1717
{
1818
"registryType": "npm",
1919
"identifier": "dbatools-mcp-server",
20-
"version": "0.3.0",
20+
"version": "0.4.0",
2121
"transport": {
2222
"type": "stdio"
2323
},

src/powershell.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ export function runPowerShell(
4444
config: ServerConfig
4545
): Promise<PowerShellResult> {
4646
return new Promise((resolve, reject) => {
47+
// Encode the script as Base64 UTF-16LE and use -EncodedCommand so that
48+
// no part of the script (including any user-supplied parameter values
49+
// embedded in it) is ever parsed as a command-line argument by PowerShell.
50+
// This eliminates the command-injection risk present with -Command.
51+
const encodedCommand = Buffer.from(script, "utf16le").toString("base64");
4752
const pwsh = spawn(
4853
config.powershellExe,
4954
[
@@ -52,8 +57,8 @@ export function runPowerShell(
5257
"-NoLogo",
5358
"-ExecutionPolicy",
5459
"Bypass",
55-
"-Command",
56-
script,
60+
"-EncodedCommand",
61+
encodedCommand,
5762
],
5863
{ shell: false }
5964
);

src/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async function getVersionState(): Promise<VersionMismatchResult> {
3333

3434
const server = new McpServer({
3535
name: "dbatools-mcp-server",
36-
version: "0.1.0",
36+
version: "0.4.0",
3737
});
3838

3939
// ---------------------------------------------------------------------------
@@ -208,7 +208,7 @@ server.tool(
208208
// ---------------------------------------------------------------------------
209209
server.tool(
210210
"invoke_dbatools_command",
211-
"Execute a dbatools command via PowerShell and return structured JSON output. Non-readonly commands require confirm:true when safe mode is enabled.",
211+
"Execute a dbatools command via PowerShell and return structured JSON output.\n\nSAFETY: For any destructive or change command (Remove, Drop, Disable, Reset, etc.), always explain the consequences to the user and ask for explicit confirmation before running. Only proceed with confirm:true if the user has clearly confirmed their intent. Respect DBATOOLS_SAFE_MODE: never bypass safety checks. For any command that modifies or deletes data, double-check with the user before proceeding. Show the exact command and output for transparency. Non-readonly commands require confirm:true when safe mode is enabled.",
212212
{
213213
commandName: z
214214
.string()

0 commit comments

Comments
 (0)