Skip to main content
Glama
bsmi021

Node Omnibus MCP Server

by bsmi021

install_packages

Install and manage npm packages with version control in specified project directories. Supports dev dependencies for streamlined Node.js development workflows.

Instructions

Install npm packages with version management

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
devNoInstall as dev dependency
packagesYesPackage names to install
pathYesProject directory path

Implementation Reference

  • The main handler function that validates the project path, checks for package.json, executes npm install command with optional dev flag, and returns success message with output or throws error.
    private async handleInstallPackages(args: InstallPackageArgs) { await this.validatePath(args.path); try { // Verify package.json exists const packageJsonPath = path.join(args.path, 'package.json'); await fs.access(packageJsonPath); // Install packages const installCmd = `npm install ${args.dev ? '--save-dev' : ''} ${args.packages.join(' ')}`; const { stdout, stderr } = await execAsync(installCmd, { cwd: args.path }); return { content: [ { type: 'text', text: `Packages installed successfully:\n${stdout}\n${stderr}`, }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to install packages: ${error instanceof Error ? error.message : String(error)}` ); } }
  • TypeScript interface defining the input arguments for the install_packages tool.
    interface InstallPackageArgs extends Record<string, unknown> { packages: string[]; path: string; dev?: boolean; }
  • src/index.ts:249-272 (registration)
    Tool registration in ListToolsRequestSchema handler, including name, description, and JSON input schema.
    { name: 'install_packages', description: 'Install npm packages with version management', inputSchema: { type: 'object', properties: { packages: { type: 'array', items: { type: 'string' }, description: 'Package names to install', }, path: { type: 'string', description: 'Project directory path', }, dev: { type: 'boolean', description: 'Install as dev dependency', default: false, }, }, required: ['packages', 'path'], }, },
  • src/index.ts:397-398 (registration)
    Dispatch case in CallToolRequestSchema handler that routes to the install_packages handler function.
    case 'install_packages': return await this.handleInstallPackages(args as InstallPackageArgs);

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