mcp.downloader.configΒΆ

Configuration models for MCP Downloader.

This module defines the configuration models used throughout the MCP downloader system, including templates, server configurations, and installation methods.

Example

Creating a server template:


template = ServerTemplate(

name=”npm_official”, installation_method=InstallationMethod.NPM, command_pattern=”@modelcontextprotocol/server-{service}”, capabilities=[β€œtools”], category=”official”

)

Creating a server configuration:

config = ServerConfig(
name="filesystem",
template="npm_official",
source="npm",
variables={"service": "filesystem"},
tags={"official", "file-operations"}

)

Classes:

InstallationMethod: Enum of supported installation methods ServerTemplate: Template for server installation patterns ServerConfig: Configuration for a specific server DownloaderConfig: Overall downloader configuration

ClassesΒΆ

DiscoveryConfig

Configuration for server discovery.

DownloaderConfig

Overall configuration for the MCP downloader.

InstallationMethod

Supported installation methods for MCP servers.

ServerConfig

Configuration for a specific MCP server.

ServerTemplate

Template for MCP server installation patterns.

FunctionsΒΆ

load_config(β†’ DownloaderConfig)

Load configuration from YAML file.

save_config(β†’ None)

Save configuration to YAML file.

Module ContentsΒΆ

class mcp.downloader.config.DiscoveryConfig(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Configuration for server discovery.

sourcesΒΆ

List of discovery source URLs

patternsΒΆ

Package naming patterns by registry

auto_discoverΒΆ

Enable automatic discovery

discovery_intervalΒΆ

Hours between discovery runs

max_serversΒΆ

Maximum servers to discover per source

auto_discover: bool = NoneΒΆ
discovery_interval: int = NoneΒΆ
max_servers: int = NoneΒΆ
patterns: dict[str, list[str]] = NoneΒΆ
sources: list[str] = NoneΒΆ
class mcp.downloader.config.DownloaderConfig(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Overall configuration for the MCP downloader.

install_dirΒΆ

Directory for server installations

config_dirΒΆ

Directory for configuration files

log_dirΒΆ

Directory for log files

max_concurrentΒΆ

Maximum concurrent downloads

retry_attemptsΒΆ

Number of retry attempts

retry_delayΒΆ

Delay between retries in seconds

health_check_enabledΒΆ

Enable health checks after install

health_check_timeoutΒΆ

Health check timeout in seconds

backup_enabledΒΆ

Enable configuration backups

backup_dirΒΆ

Directory for backups

templatesΒΆ

List of server templates

serversΒΆ

List of server configurations

discoveryΒΆ

Discovery configuration

Example

Full configuration:

backup_dir: pathlib.Path = NoneΒΆ
backup_enabled: bool = NoneΒΆ
config_dir: pathlib.Path = NoneΒΆ
discovery: DiscoveryConfig = NoneΒΆ
health_check_enabled: bool = NoneΒΆ
health_check_timeout: int = NoneΒΆ
install_dir: pathlib.Path = NoneΒΆ
log_dir: pathlib.Path = NoneΒΆ
max_concurrent: int = NoneΒΆ
retry_attempts: int = NoneΒΆ
retry_delay: int = NoneΒΆ
servers: list[ServerConfig] = NoneΒΆ
templates: list[ServerTemplate] = NoneΒΆ
class mcp.downloader.config.InstallationMethodΒΆ

Bases: str, enum.Enum

Supported installation methods for MCP servers.

NPMΒΆ

Node Package Manager installation

PIPΒΆ

Python Package Index installation

GITΒΆ

Git repository cloning

DOCKERΒΆ

Docker image pull

BINARYΒΆ

Binary executable download

CURLΒΆ

Direct HTTP download

MANUALΒΆ

Manual installation process

SCRIPTΒΆ

Custom script execution

BINARY = 'binary'ΒΆ
CURL = 'curl'ΒΆ
DOCKER = 'docker'ΒΆ
GIT = 'git'ΒΆ
MANUAL = 'manual'ΒΆ
NPM = 'npm'ΒΆ
PIP = 'pip'ΒΆ
SCRIPT = 'script'ΒΆ
class mcp.downloader.config.ServerConfig(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Configuration for a specific MCP server.

Server configurations define individual servers to be installed, referencing a template and providing server-specific variables.

nameΒΆ

Server name identifier

templateΒΆ

Template name to use

sourceΒΆ

Source location (npm, git URL, etc.)

variablesΒΆ

Variables to substitute in template patterns

enabledΒΆ

Whether the server is enabled for installation

priorityΒΆ

Installation priority (lower = higher priority)

tagsΒΆ

Set of tags for categorization

env_varsΒΆ

Additional environment variables

versionΒΆ

Specific version to install

Example

Filesystem server config:

enabled: bool = NoneΒΆ
env_vars: dict[str, str] = NoneΒΆ
model_configΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str = NoneΒΆ
priority: int = NoneΒΆ
source: str = NoneΒΆ
tags: set[str] = NoneΒΆ
template: str = NoneΒΆ
variables: dict[str, Any] = NoneΒΆ
version: str | None = NoneΒΆ
class mcp.downloader.config.ServerTemplate(/, **data: Any)ΒΆ

Bases: pydantic.BaseModel

Template for MCP server installation patterns.

Templates define reusable installation patterns that can be applied to multiple servers with similar installation requirements.

nameΒΆ

Unique template identifier

installation_methodΒΆ

Method to use for installation

command_patternΒΆ

Pattern for the command to run the server

args_patternΒΆ

Default arguments for the command

env_varsΒΆ

Environment variables to set

capabilitiesΒΆ

List of server capabilities

categoryΒΆ

Server category for organization

health_checkΒΆ

Command to verify server health

prerequisitesΒΆ

Required system dependencies

post_installΒΆ

Commands to run after installation

timeoutΒΆ

Installation timeout in seconds

Example

NPM template:

args_pattern: list[str] = NoneΒΆ
capabilities: list[str] = NoneΒΆ
category: str = NoneΒΆ
command_pattern: str = NoneΒΆ
env_vars: dict[str, str] = NoneΒΆ
health_check: str | None = NoneΒΆ
installation_method: InstallationMethod = NoneΒΆ
model_configΒΆ

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str = NoneΒΆ
post_install: list[str] = NoneΒΆ
prerequisites: list[str] = NoneΒΆ
timeout: int = NoneΒΆ
mcp.downloader.config.load_config(config_file: pathlib.Path) DownloaderConfigΒΆ

Load configuration from YAML file.

Parameters:

config_file – Path to YAML configuration file

Returns:

Loaded configuration

Return type:

DownloaderConfig

Raises:

Example

Loading config:

mcp.downloader.config.save_config(config: DownloaderConfig, config_file: pathlib.Path) NoneΒΆ

Save configuration to YAML file.

Parameters:
  • config – Configuration to save

  • config_file – Path to save file

Example

Saving config: