JFrog Artifactory MCP Server
README.md
# JFrog Artifactory MCP Server
A Model Context Protocol (MCP) server that provides seamless integration with JFrog Artifactory, enabling AI assistants to manage artifacts, repositories, and perform cleanup operations through natural language interactions.
## ๐ Deployment Options
This MCP server can be deployed in two modes:
1. **Local Mode (stdio)** - Traditional installation where each developer runs the server locally
2. **Remote Mode (HTTP)** - **NEW!** Deploy once on a central server, and all developers connect remotely
**๐ Want to host this centrally?**
- **Quick Start (5 min):** [QUICK_SETUP.md](QUICK_SETUP.md)
- **Complete Guide:** [REMOTE_DEPLOYMENT.md](REMOTE_DEPLOYMENT.md)
Benefits of remote deployment:
- โ
No local installation required for developers
- โ
Single point of updates and maintenance
- โ
Centralized monitoring and logging
- โ
Consistent version across team
## ๐ Features
### Artifact Management
- **๐ List Artifacts** - Browse repository contents and folder structures
- **๐ฅ Download Artifacts** - Retrieve artifacts from repositories to local filesystem
- **๐ค Upload Artifacts** - Deploy artifacts to repositories
- **๐ Get Artifact Details** - Retrieve metadata, checksums, and properties
- **๐๏ธ Delete Artifacts** - Remove individual artifacts with safety confirmations
### Repository Operations
- **๐ List Repositories** - Browse available repositories with optional filtering
- **๐ง Repository Management** - Access repository configurations and details
### Cleanup & Maintenance
- **๐งน Smart Cleanup** - Remove artifacts older than specified days/weeks
- **๐ Search Old Artifacts** - Find artifacts by age with detailed size information
- **๐ Storage Analytics** - Calculate storage usage and cleanup impact
- **๐ก๏ธ Dry Run Mode** - Preview cleanup operations before execution
### Safety Features
- **โ ๏ธ Confirmation Required** - Explicit confirmation needed for deletions
- **๐ Input Validation** - Prevents accidental root deletions and invalid paths
- **โ
Existence Checks** - Verifies artifacts exist before operations
- **๐ Detailed Reporting** - Comprehensive operation logs and error handling
## ๐ Requirements
- Python 3.8 or higher
- JFrog Artifactory instance (Cloud or On-Premise)
- Valid JFrog authentication credentials
## ๐ ๏ธ Installation
### 1. Clone the Repository
```bash
git clone https://github.com/your-org/jfrog-mcp-server.git
cd jfrog-mcp-server
```
### 2. Install Dependencies
```bash
pip install -r requirements.txt
```
### 3. Install the Package
```bash
pip install -e .
```
## โ๏ธ Configuration
### Environment Variables
Create a `.env` file in the project root:
```bash
# JFrog Artifactory Configuration
JFROG_BASE_URL=https://your-instance.jfrog.io/artifactory
JFROG_ACCESS_TOKEN=your-access-token
# Alternative: Username/Password Authentication
# JFROG_USERNAME=your-username
# JFROG_PASSWORD=your-password
# Optional: Logging Configuration
LOG_LEVEL=INFO
```
### Authentication Options
#### Option 1: Access Token (Recommended)
```bash
JFROG_BASE_URL=https://your-instance.jfrog.io/artifactory
JFROG_ACCESS_TOKEN=your-access-token
```
#### Option 2: Username/Password
```bash
JFROG_BASE_URL=https://your-instance.jfrog.io/artifactory
JFROG_USERNAME=your-username
JFROG_PASSWORD=your-password
```
### MCP Client Configuration
Add to your MCP client configuration (e.g., Claude Desktop `config.json`):
```json
{
"mcpServers": {
"jfrog-artifactory": {
"command": "python",
"args": ["-m", "jfrog_mcp"],
"env": {
"JFROG_BASE_URL": "https://your-instance.jfrog.io/artifactory",
"JFROG_ACCESS_TOKEN": "your-access-token"
}
}
}
}
```
## ๐ Running as Remote HTTP Server
To deploy the MCP server as a centralized HTTP service:
### Quick Start with Docker
```bash
# Build and run
docker-compose up -d
# Check status
curl http://localhost:8000/health
```
### Run with Python
```bash
# Start HTTP server on port 8000
python -m jfrog_mcp --http
# Or specify custom host/port
python -m jfrog_mcp --http --host 0.0.0.0 --port 8000
```
**๐ For complete remote deployment guide, security setup, and client configuration, see [REMOTE_DEPLOYMENT.md](REMOTE_DEPLOYMENT.md)**
## ๐ง Usage Examples
### Repository Management
```python
# List all repositories
get_repositories()
# Filter repositories by type
get_repositories(package_type="maven")
```
### Artifact Operations
```python
# Browse repository contents
list_artifacts("my-repo-local")
list_artifacts("my-repo-local", "path/to/folder")
list_artifacts("my-repo-local", "", deep=True) # Recursive listing
# Get artifact details
get_artifact_details("libs-release-local", "com/example/app/1.0.0/app-1.0.0.jar")
# Download an artifact
download_artifact("libs-release-local", "path/to/artifact.jar", "/local/path/artifact.jar")
# Upload an artifact
push_artifact("libs-release-local", "com/example/app/1.0.0/app-1.0.0.jar", "/local/path/app-1.0.0.jar")
```
### Safe Deletion
```python
# This will show a warning and NOT delete
delete_artifact("my-repo", "path/to/artifact.jar")
# This will actually delete the artifact
delete_artifact("my-repo", "path/to/artifact.jar", confirm_deletion=True)
```
### Cleanup Operations
```python
# Search for old artifacts (safe preview)
search_old_artifacts("libs-snapshot-local", older_than_days=30)
# Preview cleanup (dry run - safe)
cleanup_old_artifacts("libs-snapshot-local", older_than_days=30, dry_run=True)
# Execute cleanup
cleanup_old_artifacts("libs-snapshot-local", older_than_days=30, dry_run=False)
# Target specific folders
cleanup_old_artifacts("docker-local", older_than_days=60, folder_path="old-images/", dry_run=False)
```
## ๐ ๏ธ Available Tools
| Tool | Description | Safety Level |
|------|-------------|--------------|
| `get_repositories` | List available repositories | โ
Safe |
| `list_artifacts` | Browse repository contents | โ
Safe |
| `get_artifact_details` | Get artifact metadata | โ
Safe |
| `download_artifact` | Download artifacts locally | โ
Safe |
| `push_artifact` | Upload artifacts to repository | โ ๏ธ Modifying |
| `delete_artifact` | Delete single artifact | ๐ Requires Confirmation |
| `search_old_artifacts` | Find artifacts by age | โ
Safe |
| `cleanup_old_artifacts` | Bulk cleanup by age | ๐ Supports Dry Run |
## ๐ก๏ธ Safety Features
### Deletion Protection
- All deletion operations require explicit `confirm_deletion=True` parameter
- Input validation prevents empty paths and repository root deletion
- Existence verification before attempting deletion
- Clear error messages for invalid operations
### Dry Run Mode
- Cleanup operations default to `dry_run=True`
- Preview exactly what would be deleted before execution
- Detailed reports showing affected artifacts and storage impact
### Error Handling
- Comprehensive error messages with actionable guidance
- Graceful handling of network issues and authentication failures
- Detailed logging for troubleshooting
## ๐ Troubleshooting
### Common Issues
#### Authentication Errors
```bash
Error: 401 Unauthorized
```
- Verify your access token or username/password
- Check token permissions in JFrog Artifactory
- Ensure base URL is correct
#### Connection Issues
```bash
Error: Connection timeout
```
- Verify JFrog Artifactory URL is accessible
- Check network connectivity and firewall settings
- Validate base URL format (should include `/artifactory`)
#### Permission Errors
```bash
Error: 403 Forbidden
```
- Verify your user has appropriate repository permissions
- Check if repository exists and is accessible
- Review JFrog permission model for your user/token
### Debug Mode
Enable debug logging:
```bash
export LOG_LEVEL=DEBUG
```
## ๐ค Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
### Development Setup
```bash
# Install development dependencies
pip install -e ".[dev]"
# Run tests
python -m pytest tests/
# Run linting
flake8 jfrog_mcp/
```
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Support
For support and questions:
- Open an issue on GitHub
- Check the [JFrog Artifactory REST API documentation](https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API)
- Review MCP protocol documentation
## ๐๏ธ Architecture
```
jfrog_mcp/
โโโ __init__.py # Package initialization
โโโ __main__.py # CLI entry point
โโโ config.py # Configuration management
โโโ server.py # MCP server and tool definitions
โโโ api/
โโโ __init__.py
โโโ artifactory.py # JFrog Artifactory API client
```
## ๐ฎ Future Features
- [ ] Build information management
- [ ] Repository creation and configuration
- [ ] Advanced search with AQL (Artifactory Query Language)
- [ ] Artifact properties management
- [ ] Replication status monitoring
- [ ] Docker registry specific operations
- [ ] Maven/Gradle metadata handling
- [ ] Bulk operations with progress tracking
---
**Made with โค๏ธ for the JFrog and MCP communities**This server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessSyncing