Skip to main content
Glama

devcontainer_up

Initialize and start a devcontainer environment in a specified workspace folder to prepare for development tasks. Ensures the container is running and ready.

Instructions

Start or initialize a devcontainer environment in the specified workspace folder.Use this to ensure the devcontainer is running and ready for development tasks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outputFilePathNo
workspaceFolderYes

Implementation Reference

  • Core handler function that runs the devcontainer 'up' command by calling the internal runCommand helper with appropriate arguments.
    export async function up(options: DevContainerUpOptions): Promise<number> {
      return runCommand(
        ['up', '--workspace-folder', options.workspaceFolder],
        createStdoutStream(options)
      );
    }
  • TypeScript interface defining the input parameters for the devcontainer up handler.
    interface DevContainerUpOptions extends DevcontainerOptions {
      workspaceFolder: string;
    }
  • src/server.ts:10-30 (registration)
    MCP tool registration for 'devcontainer_up', including tool description, Zod input schema validation, and thin wrapper handler that calls the core up implementation.
    server.tool(
      "devcontainer_up",
      "Start or initialize a devcontainer environment in the specified workspace folder." + 
      "Use this to ensure the devcontainer is running and ready for development tasks.",
      {
        workspaceFolder: z.string(),
        outputFilePath: z.string().optional(),
      },
      async ({ workspaceFolder, outputFilePath }) => {
        await devcontainers.up({ workspaceFolder, stdioFilePath: outputFilePath });
    
        return {
          content: [
            {
              type: "text",
              text: `Devcontainer started in ${workspaceFolder}`,
            }
          ]
        }
      }
    );
  • Internal helper that spawns the Node.js process for the devcontainer CLI binary, pipes stdout, and resolves/rejects based on exit code.
    async function runCommand(args: string[], stdout: fs.WriteStream): Promise<number> {
      return new Promise((resolve, reject) => {
        const proc = spawn('node', [devcontainerBinaryPath(), ...args], {
          stdio: ['ignore', 'pipe', 'inherit'],
        });
    
        proc.stdout.pipe(stdout);
    
        proc.on('close', (code) => {
          stdout.end();
    
          if (code === 0) {
            resolve(code);
          } else {
            reject(new Error(`devcontainer command ${args.join(' ')} exited with code ${code}`));
          }
        });
      });
    }
  • Helper function to create a write stream for stdout, either to a file or /dev/null.
    function createStdoutStream(options: DevcontainerOptions): fs.WriteStream {
      if (!options.stdioFilePath)
        return fs.createWriteStream('/dev/null', { flags: 'w' })
      
      return fs.createWriteStream(options.stdioFilePath, { flags: 'w' });
    }
Install Server

Other Tools

Related Tools

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/crunchloop/mcp-devcontainers'

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