Skip to main content
Glama
bsmi021

Node Omnibus MCP Server

by bsmi021

install_packages

Install npm packages with version management in Node.js projects to manage dependencies and development tools.

Instructions

Install npm packages with version management

Input Schema

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

Implementation Reference

  • The main handler function that executes the installation of npm packages in the specified project directory. It validates the path, checks for package.json, runs 'npm install' with optional --save-dev flag, and returns success message with output.
    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: array of packages, project path, and optional dev flag.
    interface InstallPackageArgs extends Record<string, unknown> { packages: string[]; path: string; dev?: boolean; }
  • src/index.ts:249-272 (registration)
    Tool registration in the ListTools response, including name, description, and detailed inputSchema for MCP protocol compliance.
    { 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 the CallToolRequest handler that routes 'install_packages' calls to the specific handler function.
    case 'install_packages': return await this.handleInstallPackages(args as InstallPackageArgs);

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