UNPKG

@turbot/powerpipe-mcp

Version:

Powerpipe MCP server to run benchmarks, detections and controls using AI.

45 lines 1.96 kB
import { ConfigurationService } from "../services/config.js"; import { executeCommand, formatResult } from "../utils/command.js"; import { buildPowerpipeCommand, getPowerpipeEnv } from "../utils/powerpipe.js"; import { handlePowerpipeRunOutput } from "../utils/powerpipe_run.js"; function validateParams(args) { if (!args || typeof args !== 'object') { throw new Error('Arguments must be an object'); } const params = args; if (!params.qualified_name || typeof params.qualified_name !== 'string') { throw new Error('qualified_name is required and must be a string'); } return params; } export const tool = { name: "powerpipe_benchmark_run", description: "Executes all controls in a compliance benchmark to evaluate your infrastructure against the framework's requirements. Each control will run its associated queries and report compliance status. Use benchmark show first to understand what will be evaluated.", inputSchema: { type: "object", properties: { qualified_name: { type: "string", description: "The qualified name of the benchmark to run" } }, required: ["qualified_name"], additionalProperties: false }, handler: async (args) => { const params = validateParams(args); const config = ConfigurationService.getInstance(); const modDirectory = config.getModLocation(); const cmd = buildPowerpipeCommand(`benchmark run ${params.qualified_name}`, modDirectory, { output: 'json' }); const env = getPowerpipeEnv(modDirectory); try { const output = executeCommand(cmd, { env }); const result = JSON.parse(output); return formatResult({ result }, cmd); } catch (error) { return handlePowerpipeRunOutput(error, cmd); } } }; //# sourceMappingURL=powerpipe_benchmark_run.js.map