A Model Context Protocol (MCP) server that provides AI agents control over OS package managers.
This MCP server enables AI agents to interact with Linux distributions by providing tools to manage packages through the OS package manager. It offers a secure, controlled interface for package operations including installation, searching, listing, and repository management.
- Package Installation: Install Linux distributions packages with optional custom repository support
- Package Search: Search for available packages in configured repositories
- Package Listing: List all currently installed packages
- Repository Management: Refresh package repository indexes
- Error Handling: Comprehensive error reporting with detailed feedback
- Security: Controlled execution environment with proper privilege handling
Install Linux distribution packages using the system package manager.
- Parameters:
package_name(required): Exact name of the package to installrepository(optional): Custom repository URL for package installation
- Example: Install curl from default repositories or a specific repository
Search for packages by name or keyword.
- Parameters:
query(required): Search term for package names or descriptions
- Example: Search for all packages containing "python"
List all currently installed packages on the system.
- Parameters: None
- Returns: Complete list of installed packages with versions
Update package repository indexes to get latest package information.
- Parameters: None
- Example: Refresh all configured repositories before installing packages
- Rust (2024 edition)
- Appropriate permissions to run package manager
# Clone the repository
git clone <repository-url>
cd package-manager-mcp
# Build the project
make build
# Or build for specific target
make TARGET=x86_64-unknown-linux-musl build# Run with default settings (host: 0.0.0.0, port: 8090)
./target/debug/package-manager-mcp
# Or specify custom host and port
./target/debug/package-manager-mcp --host 127.0.0.1 --port 3000The server accepts the following command-line arguments:
--host: Host address to bind to (default: 0.0.0.0)--port: Port number to listen on (default: 8090)
The project includes Docker support for testing in containerized environments:
# Run in Alpine container
make run-alpine
# Run with MCP inspector for testing
make inspector-alpinemake fmt # Format Rust code
make nix-fmt # Format Nix filesmake lint # Run cargo clippymake test # Run cargo testsThis server implements the Model Context Protocol (MCP) v2025-03-26 and can be integrated with any MCP-compatible AI client. The server provides:
- Protocol Version: 2025-03-26
- Capabilities: Tools enabled
- Transport: HTTP streaming with session management
- Authentication: Configurable (supports development mode)
{
"mcpServers": {
"package-manager": {
"command": "./package-manager-mcp",
"args": ["--host", "127.0.0.1", "--port", "8090"]
}
}
}- The server executes package manager commands with the privileges of the running user
- Ensure proper user permissions and system security when deploying
- Package installations may require elevated privileges depending on system configuration
- Repository URLs are validated but should be from trusted sources
The server provides comprehensive error handling with:
- Detailed error messages for failed operations
- Exit code reporting for debugging
- Stdout/stderr capture for troubleshooting
- Suggestions for common issues
Licensed under the Apache License, Version 2.0. See LICENSE for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting:
make test lint - Submit a pull request