mcp.downloader.core¶

Core MCP Downloader implementation.

This module provides the main GeneralMCPDownloader class that orchestrates the downloading, installation, and configuration of MCP servers from various sources.

Example

Basic usage:


downloader = GeneralMCPDownloader() result = await downloader.download_servers([“filesystem”, “github”])

Auto-discovery:

result = await downloader.auto_discover_and_download(limit=10)

Custom configuration:

downloader = GeneralMCPDownloader(
config_file="my_config.yaml",
install_dir="/custom/path"

)

Classes:

GeneralMCPDownloader: Main downloader orchestrator DownloadResult: Result of download operations ServerStatus: Status tracking for servers

Version: 1.0.0 Author: Haive MCP Team

Attributes¶

Classes¶

DownloadResult

Result of a download operation.

GeneralMCPDownloader

General MCP Server Downloader with configurable patterns and installers.

ServerStatus

Status information for an MCP server.

Module Contents¶

class mcp.downloader.core.DownloadResult(/, **data: Any)¶

Bases: pydantic.BaseModel

Result of a download operation.

total¶

Total servers attempted

successful¶

Number of successful installations

failed¶

Number of failed installations

success_rate¶

Percentage success rate

successful_servers¶

List of successful server details

failed_servers¶

List of failed server details

config_file¶

Path to generated configuration

duration¶

Operation duration in seconds

Example

Checking results:

config_file: str | None = None¶
duration: float | None = None¶
failed: int = None¶
failed_servers: list[dict[str, Any]] = None¶
success_rate: float = None¶
successful: int = None¶
successful_servers: list[dict[str, Any]] = None¶
total: int = None¶
class mcp.downloader.core.GeneralMCPDownloader(config_file: str | None = None, install_dir: str | None = None)¶

General MCP Server Downloader with configurable patterns and installers.

This is the main orchestrator class that manages the downloading, installation, and configuration of MCP servers from various sources using a plugin-based architecture.

config¶

Downloader configuration

installers¶

List of available installers

discovery¶

Server discovery instance

status_tracker¶

Server status tracking

Example

Creating and using downloader:

Note

The downloader automatically creates necessary directories and default configuration if not provided.

add_custom_server(server: haive.mcp.downloader.config.ServerConfig) None¶

Add a custom server configuration.

Parameters:

server – ServerConfig to add

Example

Adding custom server:

add_custom_template(template: haive.mcp.downloader.config.ServerTemplate) None¶

Add a custom template.

Parameters:

template – ServerTemplate to add

Example

Adding custom template:

async auto_discover_and_download(limit: int | None = None, auto_install: bool = True) DownloadResult¶

Auto-discover servers from registries and optionally download them.

This method discovers MCP servers from configured sources and can automatically install them.

Parameters:
  • limit – Maximum number of servers to discover per source

  • auto_install – Whether to automatically install discovered servers

Returns:

DownloadResult with discovery and installation details

Example

Auto-discover and install:

async check_server_health(server_names: list[str] | None = None) dict[str, Any]¶

Check health status of installed servers.

Parameters:

server_names – Specific servers to check. If None, checks all installed.

Returns:

Dict with health check results

Example

Checking health:

async download_servers(server_names: list[str] | None = None, categories: list[str] | None = None, tags: set[str] | None = None, max_concurrent: int | None = None) DownloadResult¶

Download and install MCP servers.

This is the main method for downloading servers. It supports filtering by name, category, or tags, and handles concurrent downloads with retry logic.

Parameters:
  • server_names – Specific server names to download. If None, downloads all enabled servers.

  • categories – Filter servers by category (e.g., “official”, “community”)

  • tags – Filter servers by tags (e.g., {“database”, “file-operations”})

  • max_concurrent – Maximum concurrent downloads. Uses config default if None.

Returns:

DownloadResult with details of the operation

Example

Download specific servers:

Raises:

ValueError – If no servers match the criteria

get_all_status() dict[str, ServerStatus]¶

Get status for all servers.

Returns:

Dict mapping server names to ServerStatus objects

get_server_status(server_name: str) ServerStatus | None¶

Get status for a specific server.

Parameters:

server_name – Name of the server

Returns:

ServerStatus if found, None otherwise

Example

Checking status:

save_configuration(config_file: pathlib.Path) None¶

Save current configuration to file.

Parameters:

config_file – Path to save configuration

Example

Saving config:

discovery¶
installers¶
property servers: list[haive.mcp.downloader.config.ServerConfig]¶

Get list of server configurations.

Returns:

List of ServerConfig objects

Example

Listing servers:

status_tracker: dict[str, ServerStatus]¶
property templates: dict[str, haive.mcp.downloader.config.ServerTemplate]¶

Get templates as a dictionary.

Returns:

Dict mapping template names to ServerTemplate objects

Example

Accessing templates:

class mcp.downloader.core.ServerStatus(/, **data: Any)¶

Bases: pydantic.BaseModel

Status information for an MCP server.

name¶

Server name

status¶

Current status (installed, failed, pending)

last_check¶

Timestamp of last status check

last_success¶

Timestamp of last successful operation

install_result¶

Result of installation attempt

health_status¶

Health check status

error¶

Error message if failed

Example

Creating status:

error: str | None = None¶
health_status: str | None = None¶
install_result: dict[str, Any] | None = None¶
last_check: datetime.datetime | None = None¶
last_success: datetime.datetime | None = None¶
name: str = None¶
status: str = None¶
mcp.downloader.core.logger¶