Skip to main content
Glama

Awesome Linux MCP Server

by aitesthaj
setup.pyโ€ข7.46 kB
#!/usr/bin/env python3 """ Setup script for Awesome Linux MCP Server Helps users configure the server for their environment. """ import os import sys import json import subprocess from pathlib import Path def check_python_version(): """Check if Python version is compatible.""" if sys.version_info < (3, 8): print("โŒ Python 3.8+ is required") sys.exit(1) print(f"โœ… Python {sys.version.split()[0]} detected") def check_dependencies(): """Check if required Python packages are installed.""" required_packages = [ 'mcp', 'paramiko', 'pyppeteer', 'psutil' ] missing_packages = [] for package in required_packages: try: __import__(package.replace('-', '_')) print(f"โœ… {package} is installed") except ImportError: missing_packages.append(package) print(f"โŒ {package} is missing") if missing_packages: print(f"\n๐Ÿ“ฆ Installing missing packages: {', '.join(missing_packages)}") try: subprocess.check_call([ sys.executable, '-m', 'pip', 'install', *missing_packages ]) print("โœ… Dependencies installed successfully") except subprocess.CalledProcessError: print("โŒ Failed to install dependencies. Please install manually:") print(f"pip install {' '.join(missing_packages)}") return False return True def check_chrome(): """Check if Chrome/Chromium is available for browser automation.""" try: result = subprocess.run( ['which', 'google-chrome'], capture_output=True, text=True ) if result.returncode == 0: print("โœ… Google Chrome found") return True except: pass try: result = subprocess.run( ['which', 'chromium-browser'], capture_output=True, text=True ) if result.returncode == 0: print("โœ… Chromium found") return True except: pass print("โš ๏ธ Chrome/Chromium not found. Browser automation may not work.") print(" Install Chrome/Chromium or set BROWSER_HEADLESS=false to see browser window.") return False def create_env_file(): """Create .env file from template.""" env_file = Path('.env') template_file = Path('config.example.env') if env_file.exists(): response = input("โš ๏ธ .env file already exists. Overwrite? (y/N): ") if response.lower() != 'y': print("โญ๏ธ Skipping .env creation") return if not template_file.exists(): print("โŒ config.example.env template not found") return try: env_file.write_text(template_file.read_text()) print("โœ… .env file created from template") print("๐Ÿ“ Please edit .env with your SSH configuration") except Exception as e: print(f"โŒ Failed to create .env file: {e}") def setup_claude_config(): """Help set up Claude Desktop configuration.""" print("\n๐Ÿค– Claude Desktop Configuration") print("-" * 40) # Detect OS and config path home = Path.home() if sys.platform == "darwin": # macOS config_path = home / "Library" / "Application Support" / "Claude" / "claude_desktop_config.json" elif sys.platform == "win32": # Windows config_path = home / "AppData" / "Roaming" / "Claude" / "claude_desktop_config.json" else: # Linux config_path = home / ".config" / "Claude" / "claude_desktop_config.json" print(f"๐Ÿ“ Config file location: {config_path}") if not config_path.exists(): print("โ„น๏ธ Claude Desktop config file doesn't exist yet") print(" It will be created when you first run Claude Desktop") return # Read existing config try: config = json.loads(config_path.read_text()) except: config = {"mcpServers": {}} # Check if our server is already configured if "linux-server" in config.get("mcpServers", {}): print("โœ… Linux MCP server already configured in Claude Desktop") return # Ask user if they want to add the configuration response = input("โ“ Add Linux MCP server to Claude Desktop config? (y/N): ") if response.lower() != 'y': print("โญ๏ธ Skipping Claude Desktop configuration") return # Get the absolute path to the server server_path = Path(__file__).parent / "linux_mcp_server.py" server_path_str = str(server_path.absolute()) # Create server configuration server_config = { "command": sys.executable, "args": [server_path_str], "env": { "SSH_HOST": os.environ.get("SSH_HOST", "your-server.com"), "SSH_USER": os.environ.get("SSH_USER", "your-username"), "SSH_KEY_PATH": os.environ.get("SSH_KEY_PATH", "/path/to/key"), "BROWSER_HEADLESS": "true" } } config.setdefault("mcpServers", {})["linux-server"] = server_config try: config_path.write_text(json.dumps(config, indent=2)) print("โœ… Linux MCP server added to Claude Desktop configuration") print("๐Ÿ”„ Restart Claude Desktop to load the new server") except Exception as e: print(f"โŒ Failed to update Claude Desktop config: {e}") print(f" Manual config:\n{json.dumps(server_config, indent=2)}") def test_server(): """Run basic tests.""" print("\n๐Ÿงช Running basic tests...") try: result = subprocess.run([ sys.executable, "test_server.py" ], capture_output=True, text=True, cwd=Path(__file__).parent) if result.returncode == 0: print("โœ… Basic tests passed") return True else: print("โŒ Basic tests failed") print("STDOUT:", result.stdout) print("STDERR:", result.stderr) return False except Exception as e: print(f"โŒ Test execution failed: {e}") return False def main(): """Main setup function.""" print("๐Ÿš€ Awesome Linux MCP Server Setup") print("=" * 40) steps = [ ("Checking Python version", check_python_version), ("Checking dependencies", check_dependencies), ("Checking Chrome/Chromium", check_chrome), ("Creating .env file", create_env_file), ("Setting up Claude Desktop", setup_claude_config), ("Running basic tests", test_server), ] completed = 0 total = len(steps) for step_name, step_func in steps: print(f"\n{step_name}...") try: if step_func(): completed += 1 except Exception as e: print(f"โŒ {step_name} failed: {e}") print(f"\n๐Ÿ“Š Setup Results: {completed}/{total} steps completed") if completed == total: print("๐ŸŽ‰ Setup completed successfully!") print("\n๐Ÿ“‹ Next steps:") print("1. Edit .env with your SSH server details") print("2. Test SSH connection manually: ssh user@host") print("3. Run the server: python linux_mcp_server.py") print("4. Restart Claude Desktop to use the server") else: print("โš ๏ธ Setup completed with some issues.") print(" Please address the failed steps before using the server.") if __name__ == "__main__": main()

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aitesthaj/AWESOME_LINUX_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server