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ΒΆ
Configuration for server discovery. |
|
Overall configuration for the MCP downloader. |
|
Supported installation methods for MCP servers. |
|
Configuration for a specific MCP server. |
|
Template for MCP server installation patterns. |
FunctionsΒΆ
|
Load configuration from YAML file. |
|
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
- 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ΒΆ
- config_dir: pathlib.Path = NoneΒΆ
- discovery: DiscoveryConfig = NoneΒΆ
- install_dir: pathlib.Path = NoneΒΆ
- log_dir: pathlib.Path = NoneΒΆ
- servers: list[ServerConfig] = NoneΒΆ
- templates: list[ServerTemplate] = NoneΒΆ
- class mcp.downloader.config.InstallationMethodΒΆ
-
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:
- model_configΒΆ
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- 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:
- installation_method: InstallationMethod = NoneΒΆ
- model_configΒΆ
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- 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:
- Raises:
FileNotFoundError β If config file doesnβt exist
ValueError β If config file is invalid
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: