modelscope·@pazuzu1w/ubuntu_mcp_server
暂无描述。
Security-First Model Context Protocol server for safe Ubuntu system operations
A hardened, production-ready Model Context Protocol (MCP) server that provides AI assistants with secure, controlled access to Ubuntu system operations. Built with comprehensive security controls, audit logging, and defense-in-depth principles.
# Clone the repository
git clone https://github.com/yourusername/secure-ubuntu-mcp.git
cd secure-ubuntu-mcp
# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Verify installation with built-in tests
python main.py --test
# Start with secure policy (recommended)
python main.py --policy secure
# Start with development policy (more permissive)
python main.py --policy dev
# Test security measures
python main.py --security-test
Official Support: Claude Desktop doesn't officially support Linux, but the community has created solutions!
Recommended Method: Use the community Debian package by @aaddrick:
# Download and install Claude Desktop for Linux
wget https://github.com/aaddrick/claude-desktop-debian/releases/latest/download/claude-desktop_latest_amd64.deb
sudo dpkg -i claude-desktop_latest_amd64.deb
sudo apt-get install -f # Fix any dependency issues
For other methods and troubleshooting, see: https://github.com/aaddrick/claude-desktop-debian
Once Claude Desktop is installed, add to your configuration (~/.config/claude-desktop/claude_desktop_config.json):
{
"mcpServers": {
"secure-ubuntu": {
"command": "/path/to/secure-ubuntu-mcp/.venv/bin/python3",
"args": ["/path/to/secure-ubuntu-mcp/main.py", "--policy", "secure"],
"env": {
"MCP_LOG_LEVEL": "INFO"
}
}
}
}
Important: Use absolute paths and the virtual environment Python interpreter
Verification: After restarting Claude Desktop, you should see "secure-ubuntu" listed as a connected server, and Claude will have access to system control tools.
The server implements the standard MCP protocol and works with any MCP-compatible client:
# Example with mcp Python client
import asyncio
from mcp.client import ClientSession
async def example():
# Connect to the server
# Implementation depends on your MCP client
pass
Recommended for production and untrusted environments:
~/, /tmp, /var/tmp/etc, /root, /boot, /sys, /proc, /dev, /usr, /bin, /sbinls, cat, echo, pwd, whoami, date, find, grep, apt (search only)More permissive for development environments:
/opt, /usr/localCreate your own security policy:
from main import SecurityPolicy
custom_policy = SecurityPolicy(
allowed_paths=["/your/custom/paths"],
forbidden_paths=["/sensitive/areas"],
allowed_commands=["safe", "commands"],
forbidden_commands=["dangerous", "commands"],
max_command_timeout=30,
allow_sudo=False, # Use with extreme caution
audit_actions=True
)
list_directory(path) - List directory contents with metadataread_file(file_path) - Read file contents with size validationwrite_file(file_path, content, create_dirs=False) - Write with atomic operationsexecute_command(command, working_dir=None) - Execute shell commands safelyget_system_info() - Get OS, m…