Skip to main content
Glama
AbdurRaahimm

MCP Terminal & Git Server

by AbdurRaahimm

install_next_project

Create a Next.js project with TypeScript support, install dependencies, and open it in VSCode for immediate development.

Instructions

Create a new Next.js project and open it in VSCode

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNameYesName of the Next.js project
destinationYesDirectory where to create the project (e.g., ~/Desktop)
typescriptNoUse TypeScript (default: true)
installDependenciesNoInstall dependencies after creating project (default: true)

Implementation Reference

  • The handler function for the 'install_next_project' tool. It creates a new Next.js project using 'npx create-next-app' with options for TypeScript, Tailwind, App Router, no Git init, optional dependency installation skip, ensures directory, resolves paths, executes the command, and opens the project in VSCode.
    case "install_next_project": {
      const { 
        projectName, 
        destination, 
        typescript = true,
        installDependencies = true 
      } = args as {
        projectName: string;
        destination: string;
        typescript?: boolean;
        installDependencies?: boolean;
      };
      
      const destPath = resolvePath(destination);
      await ensureDirectory(destPath);
      
      const tsFlag = typescript ? "--typescript" : "--javascript";
      const skipInstallFlag = installDependencies ? "" : "--skip-install";
      const command = `npx create-next-app@latest ${projectName} ${tsFlag} --tailwind --app --no-git ${skipInstallFlag}`;
      
      const { stdout, stderr } = await execa(command, {
        shell: true,
        cwd: destPath,
      });
      
      const projectPath = path.join(destPath, projectName);
      
      // Open in VSCode
      await openInVSCode(projectPath);
      
      return {
        content: [
          {
            type: "text",
            text: `Next.js project "${projectName}" created successfully at ${projectPath}\n\n` +
                  `TypeScript: ${typescript ? "Yes" : "No"}\n` +
                  `Dependencies: ${installDependencies ? "Installed" : "Not installed (run npm install manually)"}\n` +
                  `VSCode: Opened\n\n` +
                  `To start development:\n` +
                  `  cd ${projectPath}\n` +
                  `  ${installDependencies ? "" : "npm install\n  "}npm run dev`,
          },
        ],
      };
    }
  • src/index.ts:172-196 (registration)
    Registration of the 'install_next_project' tool in the list of available tools, including its name, description, and input schema definition.
      name: "install_next_project",
      description: "Create a new Next.js project and open it in VSCode",
      inputSchema: {
        type: "object",
        properties: {
          projectName: {
            type: "string",
            description: "Name of the Next.js project",
          },
          destination: {
            type: "string",
            description: "Directory where to create the project (e.g., ~/Desktop)",
          },
          typescript: {
            type: "boolean",
            description: "Use TypeScript (default: true)",
          },
          installDependencies: {
            type: "boolean",
            description: "Install dependencies after creating project (default: true)",
          },
        },
        required: ["projectName", "destination"],
      },
    },
  • Input schema for the 'install_next_project' tool, defining parameters like projectName (required), destination (required), typescript (boolean, default true), installDependencies (boolean, default true).
      name: "install_next_project",
      description: "Create a new Next.js project and open it in VSCode",
      inputSchema: {
        type: "object",
        properties: {
          projectName: {
            type: "string",
            description: "Name of the Next.js project",
          },
          destination: {
            type: "string",
            description: "Directory where to create the project (e.g., ~/Desktop)",
          },
          typescript: {
            type: "boolean",
            description: "Use TypeScript (default: true)",
          },
          installDependencies: {
            type: "boolean",
            description: "Install dependencies after creating project (default: true)",
          },
        },
        required: ["projectName", "destination"],
      },
    },
  • Helper function to open a project directory in VSCode, trying multiple possible 'code' command paths if the default fails.
    async function openInVSCode(projectPath: string): Promise<void> {
      try {
        await execa("code", [projectPath]);
      } catch (error) {
        // If 'code' command fails, try common VSCode executable paths
        const vscodePaths = [
          "code",
          "/usr/local/bin/code",
          "/usr/bin/code",
          "C:\\Program Files\\Microsoft VS Code\\Code.exe",
          "C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe",
        ];
    
        for (const codePath of vscodePaths) {
          try {
            await execa(codePath, [projectPath]);
            return;
          } catch {
            // Continue to next path
          }
        }
        
        throw new Error("VSCode not found. Please ensure VSCode is installed and 'code' command is available in PATH");
      }
  • Helper function to ensure a directory exists, creating it recursively if necessary.
    async function ensureDirectory(dirPath: string): Promise<void> {
      try {
        await fs.mkdir(dirPath, { recursive: true });
      } catch (error) {
        console.error(`Error creating directory ${dirPath}:`, error);
      }

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/AbdurRaahimm/mcp-git-terminal-server'

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