Skip to main content
Glama

install_dependencies

Install project dependencies using npm, yarn, or pnpm for MCP server development workflows. Specify the package manager and directory to streamline dependency management and ensure consistent builds.

Instructions

Install project dependencies

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryNoDirectory to install dependencies in (default: current directory)
managerNoPackage manager to usenpm

Implementation Reference

  • The handler function that installs project dependencies using the specified package manager (npm, yarn, or pnpm) via execSync in the given directory.
    private async installDependencies(args: any) { const manager = args?.manager || 'npm'; const directory = args?.directory || process.cwd(); const command = `${manager} install`; try { const output = execSync(command, { cwd: directory, encoding: 'utf8', timeout: 600000 // 10 minutes }); return { content: [ { type: 'text', text: `Dependencies installed successfully!\nCommand: ${command}\nDirectory: ${directory}\nOutput:\n${output}` } ] }; } catch (error: any) { throw new Error(`Dependency installation failed: ${error.message}\nStderr: ${error.stderr || 'N/A'}`); } }
  • Input schema defining parameters for the install_dependencies tool: package manager (enum) and directory.
    inputSchema: { type: 'object', properties: { manager: { type: 'string', description: 'Package manager to use', enum: ['npm', 'yarn', 'pnpm'], default: 'npm' }, directory: { type: 'string', description: 'Directory to install dependencies in (default: current directory)' } } }
  • src/index.ts:94-112 (registration)
    Registration of the install_dependencies tool in the ListTools handler response, including name, description, and schema.
    { name: 'install_dependencies', description: 'Install project dependencies', inputSchema: { type: 'object', properties: { manager: { type: 'string', description: 'Package manager to use', enum: ['npm', 'yarn', 'pnpm'], default: 'npm' }, directory: { type: 'string', description: 'Directory to install dependencies in (default: current directory)' } } } },
  • src/index.ts:145-146 (registration)
    Dispatcher case in the CallToolRequestSchema handler that routes to the installDependencies method.
    case 'install_dependencies': return await this.installDependencies(args);

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/TeodorTrotea/mcptest'

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