Skip to main content
Glama
theburgerllc

AI Development Pipeline MCP

by theburgerllc

run_shell_command

Execute whitelisted shell commands for development tasks like npm, git, node, and code quality tools within the AI Development Pipeline workspace.

Instructions

Run a whitelisted shell command in the workspace (npm, yarn, git, node, npx, tsc, eslint, prettier)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes

Implementation Reference

  • Handler function that validates the command using validateCommand, executes the shell command with child_process.exec limited to workspace cwd, 30s timeout, 1MB buffer, sanitizes output by removing control characters, and returns the stdout or error as content.
    async ({ command }) => { return new Promise((resolve) => { try { validateCommand(command); exec(command, { cwd: WORKSPACE_ROOT, timeout: 30000, // 30 second timeout maxBuffer: 1024 * 1024 // 1MB max output }, (error, stdout, stderr) => { if (error) { resolve({ content: [{ type: 'text', text: `Error: ${stderr || error.message}` }] }); } else { // Sanitize output to prevent log injection const sanitizedOutput = stdout.replace(/[\x00-\x1f\x7f-\x9f]/g, ''); resolve({ content: [{ type: 'text', text: sanitizedOutput }] }); } }); } catch (err: any) { resolve({ content: [{ type: 'text', text: `Security error: ${err.message}` }] }); } }); }
  • Input schema defining the 'command' parameter as a Zod string.
    { command: z.string() },
  • MCP server tool registration for 'run_shell_command' with description, schema, and handler.
    server.tool( 'run_shell_command', 'Run a whitelisted shell command in the workspace (npm, yarn, git, node, npx, tsc, eslint, prettier)', { command: z.string() }, async ({ command }) => { return new Promise((resolve) => { try { validateCommand(command); exec(command, { cwd: WORKSPACE_ROOT, timeout: 30000, // 30 second timeout maxBuffer: 1024 * 1024 // 1MB max output }, (error, stdout, stderr) => { if (error) { resolve({ content: [{ type: 'text', text: `Error: ${stderr || error.message}` }] }); } else { // Sanitize output to prevent log injection const sanitizedOutput = stdout.replace(/[\x00-\x1f\x7f-\x9f]/g, ''); resolve({ content: [{ type: 'text', text: sanitizedOutput }] }); } }); } catch (err: any) { resolve({ content: [{ type: 'text', text: `Security error: ${err.message}` }] }); } }); } );
  • Helper to validate the base command is whitelisted by splitting on whitespace and checking against ALLOWED_COMMANDS.
    function validateCommand(command: string): void { const commandParts = command.trim().split(/\s+/); const baseCommand = commandParts[0]; if (!ALLOWED_COMMANDS.includes(baseCommand)) { throw new Error(`Command '${baseCommand}' is not allowed`); } }
  • Constant array defining allowed base commands for shell execution.
    const ALLOWED_COMMANDS = [ 'npm', 'yarn', 'git', 'node', 'npx', 'tsc', 'eslint', 'prettier' ];

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/theburgerllc/ai-development-pipeline-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server