MDS-MCP: Model Cache Server
A Model Control Protocol (MCP) server for efficiently downloading and caching machine learning models and datasets from various sources like Hugging Face.
Features
- 🚀 Fast Model & Dataset Downloads: Efficient downloading and caching of ML models and datasets
- 🔄 Smart Caching: Automatically manages local cache to avoid re-downloading
- 🔐 Authentication Support: Handles gated models and private repositories
- 🌐 Multiple Providers: Currently supports Hugging Face with extensible architecture
- 📊 Monitoring: Built-in Sentry integration for error tracking
- 🛠 MCP Compatible: Works seamlessly with MCP clients
Installation
From PyPI (Recommended)
pip install mds-mcp
From Source
git clone https://github.com/yourusername/mds-mcp.git
cd mds-mcp
pip install -e .
Quick Start
1. Environment Setup
Create a .env file in your project directory:
# Optional: Hugging Face token for gated/private models
HF_TOKEN=your_huggingface_token_here
# Optional: Sentry configuration
SENTRY_DSN=your_sentry_dsn_here
SENTRY_ENVIRONMENT=production
SENTRY_SAMPLE_RATE=0.1
# Server configuration
MCP_HOST=0.0.0.0
MCP_PORT=9004
LOG_LEVEL=INFO
2. Start the Server
mds-mcp
Or run with Python:
python -m mds_mcp.main
3. Using the MCP Tools
The server provides two main tools:
Download Model
{
"tool": "download_model",
"arguments": {
"provider": "huggingface",
"identifier": "microsoft/DialoGPT-medium",
"token": "optional_hf_token"
}
}
Download Dataset
{
"tool": "download_dataset",
"arguments": {
"provider": "huggingface",
"identifier": "imdb",
"name": "optional_config_name",
"token": "optional_hf_token"
}
}
Supported Providers
Hugging Face
- Models: All public and gated models from Hugging Face Hub
- Datasets: Complete dataset downloads with all splits
- Authentication: Supports access tokens for gated/private content
API Reference
Tools
download_model(provider, identifier, token=None)
Downloads a pretrained model to local cache.
Parameters:
provider(str): Model source (e.g., 'huggingface')identifier(str): Model repository IDtoken(str, optional): Access token for private/gated models
Returns:
- Success:
{'status': 'downloaded', 'path': '<cache_dir>'} - Cached:
{'status': 'cached', 'path': '<cache_dir>'} - Auth Required:
{'status': 'auth_required', 'access_url': '...', 'instructions': [...]} - Error:
{'status': 'error', 'message': '...'}
download_dataset(provider, identifier, name=None, token=None)
Downloads a dataset with all splits to local cache.
Parameters:
provider(str): Dataset source (e.g., 'huggingface')identifier(str): Dataset repository namename(str, optional): Dataset config or task nametoken(str, optional): Access token for private/gated datasets
Returns:
Same format as download_model.
Development
Setup Development Environment
git clone https://github.com/yourusername/mds-mcp.git
cd mds-mcp
pip install -e ".[dev]"
Running Tests
pytest
Code Formatting
black mds_mcp/
isort mds_mcp/
Type Checking
mypy mds_mcp/
Architecture
The server is built with a modular architecture:
- Core Server: FastMCP-based server handling MCP protocol
- Providers: Pluggable backends for different model sources
- Services: Business logic for caching, authentication, and downloads
- Logging: Structured logging with optional Sentry integration
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
Changelog
See CHANGELOG.md for details about version changes.
Metadata
Release files for mds-mcp 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mds_mcp-0.1.3.tar.gz | 10.3 kB | Without provenance | Details for mds_mcp-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mds_mcp-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for mds_mcp-0.1.3-py3-none-any.whl |
Total release size: 22.8 kB
Release files / mds_mcp-0.1.3.tar.gz
| Download URL | mds_mcp-0.1.3.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2cf6970f735a3b8e8faf3d17b8b0187c4b0c179bc5b90e0c612a832654355190
|
|
BLAKE2b-256 checksum How to use checksums |
526027e83ea5eaeaaabb40a757f2d947125663448bea97bd9c7ba6c69f9548e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.13
|
Release files / mds_mcp-0.1.3-py3-none-any.whl
| Download URL | mds_mcp-0.1.3-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d0c9b2e435115db803ec7f5c3d6f76e086385834f0a2dcaf4332471f8c944cc9
|
|
BLAKE2b-256 checksum How to use checksums |
619660aea0451f82862c0cc2dcbfc61bf9010a2e1a4c3dad2e39e2ceebb1739b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.13
|
Security for mds-mcp 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.