#!/usr/bin/env python3
"""
Kali MCP Server runner with environment configuration
"""
import os
import sys
from pathlib import Path
# Load environment variables from .env file if it exists
def load_env_file():
env_file = Path(__file__).parent / '.env'
if env_file.exists():
with open(env_file) as f:
for line in f:
line = line.strip()
if line and not line.startswith('#'):
key, _, value = line.partition('=')
os.environ[key.strip()] = value.strip()
def main():
"""Main entry point for the server"""
# Load environment variables
load_env_file()
# Check if we're running as root (not recommended)
if os.geteuid() == 0:
print("WARNING: Running as root is not recommended for security reasons.")
print("Consider setting up proper capabilities instead.")
response = input("Continue anyway? (y/N): ")
if response.lower() != 'y':
sys.exit(1)
# Import and run the server
try:
from kali_mcp_server.server import main as server_main
server_main()
except ImportError as e:
print(f"Error importing server module: {e}")
print("Make sure to install dependencies with: pip install -e .")
sys.exit(1)
except KeyboardInterrupt:
print("\nServer stopped by user")
sys.exit(0)
except Exception as e:
print(f"Error starting server: {e}")
sys.exit(1)
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/pellax/kaliMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server