mcp.downloader.installers

Installer plugins for different MCP server types.

This module provides installer implementations for various installation methods including NPM, pip, Git, Docker, binary downloads, and more.

Examples

Using installers directly:


installer = NPMInstaller() if await installer.can_handle(server_config, template):

result = await installer.install(server_config, template, install_dir)

Classes:

MCPInstaller: Abstract base class for installers NPMInstaller: Handles NPM package installations PipInstaller: Handles Python pip installations GitInstaller: Handles Git repository cloning DockerInstaller: Handles Docker image pulling BinaryInstaller: Handles binary executable downloads CurlInstaller: Handles direct HTTP downloads

Version: 1.0.0 Author: Haive MCP Team

Attributes

Classes

BinaryInstaller

Installer for binary executable MCP servers.

CurlInstaller

Installer for direct HTTP downloads.

DockerInstaller

Installer for Docker-based MCP servers.

GitInstaller

Installer for Git repository-based MCP servers.

MCPInstaller

Abstract base class for MCP installers.

NPMInstaller

Installer for NPM-based MCP servers.

PipInstaller

Installer for Python pip-based MCP servers.

Module Contents

class mcp.downloader.installers.BinaryInstaller

Bases: MCPInstaller

Installer for binary executable MCP servers.

Downloads and installs pre-compiled binary executables.

Examples

Binary installation:

async can_handle(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate) bool

Check if this is a binary installation.

async install(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) dict[str, Any]

Download and install binary executable.

Parameters:
  • server_config – Server configuration

  • template – Server template

  • install_dir – Installation directory

Returns:

Installation result dictionary

async verify(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) bool

Verify binary installation.

Checks if the binary exists and is executable.

Returns:

True if binary exists and is executable

class mcp.downloader.installers.CurlInstaller

Bases: MCPInstaller

Installer for direct HTTP downloads.

Downloads files directly via HTTP/HTTPS without package managers.

Examples

Curl installation:

async can_handle(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate) bool

Check if this is a curl/HTTP download.

async install(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) dict[str, Any]

Download files via HTTP.

Parameters:
  • server_config – Server configuration

  • template – Server template

  • install_dir – Installation directory

Returns:

Installation result dictionary

async verify(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) bool

Verify curl installation.

Checks if the expected files exist.

Returns:

True if installation directory exists with files

class mcp.downloader.installers.DockerInstaller

Bases: MCPInstaller

Installer for Docker-based MCP servers.

Handles pulling Docker images for containerized MCP servers.

Examples

Docker installation:

async can_handle(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate) bool

Check if this is a Docker installation.

async install(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) dict[str, Any]

Pull Docker image.

Parameters:
  • server_config – Server configuration

  • template – Server template

  • install_dir – Installation directory

Returns:

Installation result dictionary

async verify(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) bool

Verify Docker installation.

Checks if the Docker image exists locally.

Returns:

True if image is available

class mcp.downloader.installers.GitInstaller

Bases: MCPInstaller

Installer for Git repository-based MCP servers.

Handles cloning Git repositories and running post-install commands.

Examples

Git installation:

async can_handle(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate) bool

Check if this is a Git installation.

async install(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) dict[str, Any]

Clone Git repository and run post-install commands.

Parameters:
  • server_config – Server configuration

  • template – Server template

  • install_dir – Installation directory

Returns:

Installation result dictionary

async verify(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) bool

Verify Git installation.

Checks if the repository was cloned successfully.

Returns:

True if repository exists with .git directory

class mcp.downloader.installers.MCPInstaller

Bases: abc.ABC

Abstract base class for MCP installers.

All installer implementations must inherit from this class and implement the required methods.

Examples

Creating a custom installer:

abstractmethod can_handle(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate) bool
Async:

Check if this installer can handle the given configuration.

Parameters:
  • server_config – Server configuration

  • template – Server template

Returns:

True if this installer can handle the installation

abstractmethod install(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) dict[str, Any]
Async:

Install the MCP server.

Parameters:
  • server_config – Server configuration

  • template – Server template

  • install_dir – Installation directory

Returns:

Dict with installation results including success status

abstractmethod verify(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) bool
Async:

Verify the installation was successful.

Parameters:
  • server_config – Server configuration

  • template – Server template

  • install_dir – Installation directory

Returns:

True if installation is verified

class mcp.downloader.installers.NPMInstaller

Bases: MCPInstaller

Installer for NPM-based MCP servers.

Handles installation of MCP servers distributed as NPM packages. Supports both global and local installations.

Examples

NPM installation:

async can_handle(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate) bool

Check if this is an NPM installation.

Returns:

True if template uses NPM installation method

async install(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) dict[str, Any]

Install NPM package.

Attempts global installation first, falls back to local if that fails.

Parameters:
  • server_config – Server configuration

  • template – Server template

  • install_dir – Installation directory

Returns:

Installation result dictionary

async verify(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) bool

Verify NPM installation.

Checks if the package is accessible via npx.

Returns:

True if package is installed and accessible

class mcp.downloader.installers.PipInstaller

Bases: MCPInstaller

Installer for Python pip-based MCP servers.

Handles installation of MCP servers distributed as Python packages.

Examples

Pip installation:

async can_handle(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate) bool

Check if this is a pip installation.

async install(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) dict[str, Any]

Install Python package via pip.

Parameters:
  • server_config – Server configuration

  • template – Server template

  • install_dir – Installation directory

Returns:

Installation result dictionary

async verify(server_config: haive.mcp.downloader.config.ServerConfig, template: haive.mcp.downloader.config.ServerTemplate, install_dir: pathlib.Path) bool

Verify pip installation.

Checks if the module can be imported.

Returns:

True if module is installed and importable

mcp.downloader.installers.logger