fix: resolve 6 test failures — timeouts and window_list syntax
Generic: Repo Health / Release configuration (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Universal: Cascade Main → Dev / Cascade main → branches (push) Has been cancelled
Universal: Changelog Validation / Validate CHANGELOG.md (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
MCP: Standards Compliance / Secret Scanning (push) Has been cancelled
MCP: Standards Compliance / License Header Validation (push) Has been cancelled
MCP: Build & Validate / build (20) (push) Has been cancelled
MCP: Build & Validate / build (22) (push) Has been cancelled
MCP: Standards Compliance / Repository Structure Validation (push) Has been cancelled
MCP: Standards Compliance / Coding Standards Check (push) Has been cancelled
Universal: Build & Release / Build & Release Pipeline (push) Has been cancelled
MCP: Standards Compliance / Workflow Configuration Check (push) Has been cancelled
MCP: Standards Compliance / Documentation Quality Check (push) Has been cancelled
MCP: Standards Compliance / README Completeness Check (push) Has been cancelled
MCP: Standards Compliance / Git Repository Hygiene (push) Has been cancelled
MCP: Standards Compliance / Line Length Check (push) Has been cancelled
MCP: Standards Compliance / File Naming Standards (push) Has been cancelled
MCP: Standards Compliance / Insecure Code Pattern Detection (push) Has been cancelled
MCP: Standards Compliance / Script Integrity Validation (push) Has been cancelled
MCP: Standards Compliance / Dead Code Detection (push) Has been cancelled
MCP: Standards Compliance / File Size Limits (push) Has been cancelled
MCP: Standards Compliance / Binary File Detection (push) Has been cancelled
MCP: Standards Compliance / TODO/FIXME Tracking (push) Has been cancelled
MCP: Build & Release / Build, Validate & Release (push) Has been cancelled
MCP: Standards Compliance / Broken Link Detection (push) Has been cancelled
MCP: Standards Compliance / API Documentation Coverage (push) Has been cancelled
MCP: Standards Compliance / Accessibility Check (push) Has been cancelled
MCP: Standards Compliance / Performance Metrics (push) Has been cancelled
MCP: Standards Compliance / Version Consistency Check (push) Has been cancelled
Universal: CodeQL Analysis / Analyze (actions) (push) Has been cancelled
MCP: Standards Compliance / Code Complexity Analysis (push) Has been cancelled
MCP: Standards Compliance / Code Duplication Detection (push) Has been cancelled
MCP: Standards Compliance / Unused Dependencies Check (push) Has been cancelled
MCP: Standards Compliance / Terraform Configuration Validation (push) Has been cancelled
MCP: Standards Compliance / Dependency Vulnerability Scanning (push) Has been cancelled
Universal: CodeQL Analysis / Analyze (javascript) (push) Has been cancelled
Universal: CodeQL Analysis / Security Scan Summary (push) Has been cancelled
MCP: Standards Compliance / Enterprise Readiness Check (push) Has been cancelled
MCP: Standards Compliance / Repository Health Check (push) Has been cancelled
MCP: Standards Compliance / Compliance Summary (push) Has been cancelled
Universal: Sync Version on Merge / Propagate README version (push) Has been cancelled
Generic: Repo Health / Release configuration (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Universal: Cascade Main → Dev / Cascade main → branches (push) Has been cancelled
Universal: Changelog Validation / Validate CHANGELOG.md (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
MCP: Standards Compliance / Secret Scanning (push) Has been cancelled
MCP: Standards Compliance / License Header Validation (push) Has been cancelled
MCP: Build & Validate / build (20) (push) Has been cancelled
MCP: Build & Validate / build (22) (push) Has been cancelled
MCP: Standards Compliance / Repository Structure Validation (push) Has been cancelled
MCP: Standards Compliance / Coding Standards Check (push) Has been cancelled
Universal: Build & Release / Build & Release Pipeline (push) Has been cancelled
MCP: Standards Compliance / Workflow Configuration Check (push) Has been cancelled
MCP: Standards Compliance / Documentation Quality Check (push) Has been cancelled
MCP: Standards Compliance / README Completeness Check (push) Has been cancelled
MCP: Standards Compliance / Git Repository Hygiene (push) Has been cancelled
MCP: Standards Compliance / Line Length Check (push) Has been cancelled
MCP: Standards Compliance / File Naming Standards (push) Has been cancelled
MCP: Standards Compliance / Insecure Code Pattern Detection (push) Has been cancelled
MCP: Standards Compliance / Script Integrity Validation (push) Has been cancelled
MCP: Standards Compliance / Dead Code Detection (push) Has been cancelled
MCP: Standards Compliance / File Size Limits (push) Has been cancelled
MCP: Standards Compliance / Binary File Detection (push) Has been cancelled
MCP: Standards Compliance / TODO/FIXME Tracking (push) Has been cancelled
MCP: Build & Release / Build, Validate & Release (push) Has been cancelled
MCP: Standards Compliance / Broken Link Detection (push) Has been cancelled
MCP: Standards Compliance / API Documentation Coverage (push) Has been cancelled
MCP: Standards Compliance / Accessibility Check (push) Has been cancelled
MCP: Standards Compliance / Performance Metrics (push) Has been cancelled
MCP: Standards Compliance / Version Consistency Check (push) Has been cancelled
Universal: CodeQL Analysis / Analyze (actions) (push) Has been cancelled
MCP: Standards Compliance / Code Complexity Analysis (push) Has been cancelled
MCP: Standards Compliance / Code Duplication Detection (push) Has been cancelled
MCP: Standards Compliance / Unused Dependencies Check (push) Has been cancelled
MCP: Standards Compliance / Terraform Configuration Validation (push) Has been cancelled
MCP: Standards Compliance / Dependency Vulnerability Scanning (push) Has been cancelled
Universal: CodeQL Analysis / Analyze (javascript) (push) Has been cancelled
Universal: CodeQL Analysis / Security Scan Summary (push) Has been cancelled
MCP: Standards Compliance / Enterprise Readiness Check (push) Has been cancelled
MCP: Standards Compliance / Repository Health Check (push) Has been cancelled
MCP: Standards Compliance / Compliance Summary (push) Has been cancelled
Universal: Sync Version on Merge / Propagate README version (push) Has been cancelled
- audio.ts: increase Add-Type C# compilation timeout to 60s - system.ts: increase WMI query timeout to 45s - service.ts: batch WMI lookups (single query instead of per-service), 45s timeout - power.ts: increase powercfg timeout to 30s - window.ts: fix .Where() syntax to pipe-based Where-Object - shell.ts: unref terminal session child processes so MCP server can exit cleanly Test results: 36/36 passed (12 skipped — destructive/interactive) Authored-by: Moko Consulting
This commit is contained in:
@@ -182,7 +182,13 @@ export function startSession(shell: 'pwsh' | 'cmd' | 'bash' | 'python' | 'node'
|
|||||||
const proc = spawn(executable, args, {
|
const proc = spawn(executable, args, {
|
||||||
stdio: ['pipe', 'pipe', 'pipe'],
|
stdio: ['pipe', 'pipe', 'pipe'],
|
||||||
windowsHide: true,
|
windowsHide: true,
|
||||||
|
detached: false,
|
||||||
});
|
});
|
||||||
|
// Don't let terminal sessions prevent the MCP server from exiting
|
||||||
|
proc.unref();
|
||||||
|
(proc.stdout as any)?.unref?.();
|
||||||
|
(proc.stderr as any)?.unref?.();
|
||||||
|
(proc.stdin as any)?.unref?.();
|
||||||
|
|
||||||
const session: TerminalSession = {
|
const session: TerminalSession = {
|
||||||
pid: proc.pid!,
|
pid: proc.pid!,
|
||||||
|
|||||||
+1
-1
@@ -100,7 +100,7 @@ $device = (Get-CimInstance Win32_SoundDevice | Where-Object { $_.Status -eq 'OK'
|
|||||||
device = $device
|
device = $device
|
||||||
} | ConvertTo-Json -Compress`;
|
} | ConvertTo-Json -Compress`;
|
||||||
|
|
||||||
const result = await runPowerShell(ps);
|
const result = await runPowerShell(ps, { timeout: 60000 });
|
||||||
if (result.exitCode !== 0) {
|
if (result.exitCode !== 0) {
|
||||||
return { content: [{ type: 'text', text: `Error: ${result.stderr}` }], isError: true };
|
return { content: [{ type: 'text', text: `Error: ${result.stderr}` }], isError: true };
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -38,7 +38,7 @@ $dcSleep = (powercfg /query SCHEME_CURRENT SUB_SLEEP STANDBYIDLE 2>$null | Selec
|
|||||||
SleepTimeout_DC = if ($dcSleep) { "$([math]::Floor($dcSleep / 60))m" } else { 'Never' }
|
SleepTimeout_DC = if ($dcSleep) { "$([math]::Floor($dcSleep / 60))m" } else { 'Never' }
|
||||||
} | ConvertTo-Json -Compress`;
|
} | ConvertTo-Json -Compress`;
|
||||||
|
|
||||||
const result = await runPowerShell(ps, { timeout: 10000 });
|
const result = await runPowerShell(ps, { timeout: 30000 });
|
||||||
if (result.exitCode !== 0) {
|
if (result.exitCode !== 0) {
|
||||||
return { content: [{ type: 'text', text: `Error: ${result.stderr}` }], isError: true };
|
return { content: [{ type: 'text', text: `Error: ${result.stderr}` }], isError: true };
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ $dcSleep = (powercfg /query SCHEME_CURRENT SUB_SLEEP STANDBYIDLE 2>$null | Selec
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await runPowerShell(ps, { timeout: 10000 });
|
const result = await runPowerShell(ps, { timeout: 30000 });
|
||||||
return {
|
return {
|
||||||
content: [{ type: 'text', text: result.stdout || result.stderr }],
|
content: [{ type: 'text', text: result.stdout || result.stderr }],
|
||||||
isError: result.exitCode !== 0,
|
isError: result.exitCode !== 0,
|
||||||
|
|||||||
@@ -27,18 +27,19 @@ export function registerServiceTools(server: McpServer): void {
|
|||||||
: '';
|
: '';
|
||||||
|
|
||||||
const ps = `
|
const ps = `
|
||||||
|
$wmiCache = @{}
|
||||||
|
Get-CimInstance Win32_Service -ErrorAction SilentlyContinue | ForEach-Object { $wmiCache[$_.Name] = $_.Description }
|
||||||
Get-Service ${filterClause} ${statusClause} | Sort-Object DisplayName | ForEach-Object {
|
Get-Service ${filterClause} ${statusClause} | Sort-Object DisplayName | ForEach-Object {
|
||||||
$wmi = Get-CimInstance Win32_Service -Filter "Name='$($_.Name)'" -ErrorAction SilentlyContinue
|
|
||||||
[PSCustomObject]@{
|
[PSCustomObject]@{
|
||||||
Name = $_.Name
|
Name = $_.Name
|
||||||
DisplayName = $_.DisplayName
|
DisplayName = $_.DisplayName
|
||||||
Status = $_.Status.ToString()
|
Status = $_.Status.ToString()
|
||||||
StartType = $_.StartType.ToString()
|
StartType = $_.StartType.ToString()
|
||||||
Description = if ($wmi) { $wmi.Description } else { '' }
|
Description = if ($wmiCache[$_.Name]) { $wmiCache[$_.Name] } else { '' }
|
||||||
}
|
}
|
||||||
} | ConvertTo-Json -Depth 3 -Compress`;
|
} | ConvertTo-Json -Depth 3 -Compress`;
|
||||||
|
|
||||||
const result = await runPowerShell(ps, { timeout: 20000 });
|
const result = await runPowerShell(ps, { timeout: 45000 });
|
||||||
if (result.exitCode !== 0) {
|
if (result.exitCode !== 0) {
|
||||||
return { content: [{ type: 'text', text: `Error: ${result.stderr}` }], isError: true };
|
return { content: [{ type: 'text', text: `Error: ${result.stderr}` }], isError: true };
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@ $uptime = (Get-Date) - $os.LastBootUpTime
|
|||||||
Uptime = "$($uptime.Days)d $($uptime.Hours)h $($uptime.Minutes)m"
|
Uptime = "$($uptime.Days)d $($uptime.Hours)h $($uptime.Minutes)m"
|
||||||
} | ConvertTo-Json -Depth 4 -Compress`;
|
} | ConvertTo-Json -Depth 4 -Compress`;
|
||||||
|
|
||||||
const result = await runPowerShell(ps, { timeout: 15000 });
|
const result = await runPowerShell(ps, { timeout: 45000 });
|
||||||
if (result.exitCode !== 0) {
|
if (result.exitCode !== 0) {
|
||||||
return { content: [{ type: 'text', text: `Error: ${result.stderr}` }], isError: true };
|
return { content: [{ type: 'text', text: `Error: ${result.stderr}` }], isError: true };
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ export function registerWindowTools(server: McpServer): void {
|
|||||||
},
|
},
|
||||||
async ({ filter }) => {
|
async ({ filter }) => {
|
||||||
const filterClause = filter
|
const filterClause = filter
|
||||||
? `.Where({ $_.Title -like '*${filter.replace(/'/g, "''")}*' })`
|
? `| Where-Object { $_.Title -like '*${filter.replace(/'/g, "''")}*' }`
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
const ps = `
|
const ps = `
|
||||||
|
|||||||
Reference in New Issue
Block a user