kali_mcp_wrapper.py•1.1 kB
#!/usr/bin/env python3
"""
Wrapper script to connect Claude Desktop to the containerized Kali MCP server
"""
import subprocess
import sys
import json
def main():
"""Connect to the containerized MCP server via docker exec"""
try:
# Execute the MCP server inside the running container
cmd = [
'docker', 'exec', '-i',
'kali-mcp-container',
'python3', '/app/kali_mcp_server/server.py'
]
# Run with stdio passthrough for MCP communication
process = subprocess.Popen(
cmd,
stdin=sys.stdin,
stdout=sys.stdout,
stderr=sys.stderr,
text=True
)
# Wait for the process to complete
process.wait()
except Exception as e:
error_response = {
"error": f"Failed to connect to containerized MCP server: {str(e)}",
"suggestion": "Make sure the container 'kali-mcp-container' is running"
}
print(json.dumps(error_response), file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()