Skip to main content
Glama
bsmi021

Node Omnibus MCP Server

by bsmi021

create_project

Generate a new Node.js project with preconfigured settings for React, Node, Next.js, Express, or Fastify, including optional TypeScript support, by specifying a name, type, and directory path.

Instructions

Create a new Node.js project with enhanced configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesProject name
pathYesProject directory path
typeYesProject type
typescriptNoEnable TypeScript support

Implementation Reference

  • The main handler function that implements the create_project tool. It creates the project directory, executes the appropriate creation command based on type, installs dependencies, sets up TypeScript config if needed, generates README, and stores docs.
    private async handleCreateProject(args: CreateProjectArgs) { try { // Create the project directory first const projectPath = path.join(args.path, args.name); await fs.mkdir(projectPath, { recursive: true }); const typescript = args.typescript !== false; const template = this.getProjectTemplate(args.type, args.name, typescript); // Execute project creation command in the project directory const { stdout: createOutput } = await execAsync(template.command, { cwd: projectPath }); // Install dependencies directly in the project directory if (template.dependencies.length > 0) { const installCmd = `npm install ${template.dependencies.join(' ')}`; await execAsync(installCmd, { cwd: projectPath }); } // Install dev dependencies if (template.devDependencies.length > 0) { const installDevCmd = `npm install --save-dev ${template.devDependencies.join(' ')}`; await execAsync(installDevCmd, { cwd: projectPath }); } // Setup TypeScript configuration if needed if (typescript) { const tsConfig = { compilerOptions: { target: "es2020", module: "commonjs", outDir: "./dist", rootDir: "./src", strict: true, esModuleInterop: true, skipLibCheck: true, forceConsistentCasingInFileNames: true, jsx: args.type === 'react' || args.type === 'next' ? "react-jsx" : undefined, }, include: ["src/**/*"], exclude: ["node_modules", "dist"] }; await fs.mkdir(path.join(projectPath, 'src'), { recursive: true }); await fs.writeFile( path.join(projectPath, 'tsconfig.json'), JSON.stringify(tsConfig, null, 2) ); } // Create initial documentation const readmeContent = this.generateReadme(args.name, args.type, typescript); await fs.writeFile( path.join(projectPath, 'README.md'), readmeContent ); // Store documentation in memory this.projectDocs.set(args.name, readmeContent); return { content: [ { type: 'text', text: `Project ${args.name} created successfully with ${typescript ? 'TypeScript' : 'JavaScript'} configuration`, }, ], }; } catch (error: unknown) { throw new McpError( ErrorCode.InternalError, `Failed to create project: ${error instanceof Error ? error.message : String(error)}` ); } }
  • src/index.ts:221-248 (registration)
    Registration of the 'create_project' tool in the ListToolsRequestSchema handler, including name, description, and JSON input schema.
    { name: 'create_project', description: 'Create a new Node.js project with enhanced configuration', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Project name', }, type: { type: 'string', enum: ['react', 'node', 'next', 'express', 'fastify'], description: 'Project type', }, path: { type: 'string', description: 'Project directory path', }, typescript: { type: 'boolean', description: 'Enable TypeScript support', default: true, }, }, required: ['name', 'type', 'path'], }, },
  • TypeScript interface defining the arguments for the create_project handler.
    interface CreateProjectArgs extends Record<string, unknown> { name: string; type: 'react' | 'node' | 'next' | 'express' | 'fastify'; path: string; typescript?: boolean; }
  • Helper function that returns project creation templates (commands and dependencies) based on project type and TypeScript preference.
    private getProjectTemplate(type: string, name: string, typescript: boolean): { command: string; dependencies: string[]; devDependencies: string[]; } { const templates: Record<string, { command: string; dependencies: string[]; devDependencies: string[]; }> = { react: { command: typescript ? `npx create-react-app ./ --template typescript` : `npx create-react-app ./`, dependencies: ['react', 'react-dom'], devDependencies: typescript ? ['@types/react', '@types/react-dom', '@types/node'] : [], }, next: { command: `npx create-next-app@latest ./ ${typescript ? '--typescript' : ''} --tailwind --eslint`, dependencies: ['next', 'react', 'react-dom'], devDependencies: typescript ? ['@types/node', '@types/react', '@types/react-dom'] : [], }, express: { command: `npm init -y`, dependencies: ['express', 'cors', 'dotenv'], devDependencies: typescript ? ['typescript', '@types/node', '@types/express', '@types/cors', 'ts-node', 'nodemon'] : ['nodemon'], }, fastify: { command: `npm init -y`, dependencies: ['fastify', '@fastify/cors', '@fastify/env'], devDependencies: typescript ? ['typescript', '@types/node', 'ts-node', 'nodemon'] : ['nodemon'], }, node: { command: `npm init -y`, dependencies: [], devDependencies: typescript ? ['typescript', '@types/node', 'ts-node', 'nodemon'] : ['nodemon'], }, }; const template = templates[type]; if (!template) { throw new McpError(ErrorCode.InvalidParams, `Unsupported project type: ${type}`); } return template; }
  • Helper function that generates the initial README.md content for the new project.
    private generateReadme(name: string, type: string, typescript: boolean): string { return `# ${name} ## Description A ${type} project using ${typescript ? 'TypeScript' : 'JavaScript'}. ## Setup \`\`\`bash npm install \`\`\` ## Development \`\`\`bash npm run dev \`\`\` ## Build \`\`\`bash npm run build \`\`\` ## Project Structure - \`src/\` - Source files ${typescript ? '- `dist/` - Compiled output\n' : ''} - \`public/\` - Static assets - \`package.json\` - Project configuration ${typescript ? '- `tsconfig.json` - TypeScript configuration\n' : ''} ## Scripts - \`npm run dev\` - Start development server - \`npm run build\` - Build for production - \`npm start\` - Start production 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/bsmi021/mcp-node-omnibus-server'

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