Open-source AI agent to safely terminate stray localhost processes and free blocked ports.
Works with Node.js, Python/Django/Flask, Java/Spring Boot, Ruby/Rails, Go, PHP and more.
π Click to watch the demo video
π₯ https://youtu.be/Fetdo7CfPIs
Every developer knows this pain:
Error: listen EADDRINUSE: address already in use :::3000
You forgot to stop a dev server. Now you're hunting PIDs manually. Not anymore.
/killservers
That's it. ServerSlayer finds and safely kills stray development servers, idle localhost processes, and zombie dev servers β instantly.
| Feature | Description |
|---|---|
| Kill Stray Servers | Terminate localhost processes blocking your ports |
| Safe Port Killer | Never kills databases, Docker, ngrok, or IDE processes |
| Idle Server Detection | Identifies unresponsive/zombie dev servers |
| Cross-Platform | Works on Windows, macOS, and Linux |
| Multi-Framework | Node.js, Python, Java, Ruby, Go, PHP support |
| Any Agentic IDE | Cursor, Antigravity, Continue.dev, Windsurf, VS Code + AI |
git clone https://github.com/supratikpm/ServerSlayer.gitWindows (PowerShell):
Copy-Item -Path "path\to\ServerSlayer\.agent" -Destination ".\" -Recurse -ForcemacOS / Linux:
cp -r /path/to/ServerSlayer/.agent ./Type /listports or /killservers in your AI chat. Done!
| Command | What it does |
|---|---|
/listports |
π List all running dev servers on localhost |
/killservers |
πͺ Kill stray servers (graceful termination) |
/nukeports |
β’οΈ Force kill all dev servers |
/killport 3000 |
π― Kill specific port |
ServerSlayer is IDE-agnostic. Tested and works with:
| IDE | Setup |
|---|---|
| Cursor | Add .cursorrules (see below) |
| Antigravity | Just copy .agent/ folder |
| Continue.dev | Copy .agent/ folder |
| Windsurf | Copy .agent/ folder |
| VS Code + AI | Use system prompt (see below) |
| Any AI Assistant | Use the Python script directly |
π Cursor IDE Setup (.cursorrules)
Create .cursorrules in your project root:
You have access to ServerSlayer workflows in .agent/workflows/.
When the user mentions ports, servers, or "port in use" errors, use:
- /listports - to see what's running
- /killservers - to safely kill dev servers
- /killport <port> - to kill a specific port
- /nukeports - for force kill
Run: python .agent/tools/server_slayer_tools.py [list|kill] [options]
π€ Claude / ChatGPT / Any AI Setup
Add to your system prompt:
You have ServerSlayer for port management.
Commands:
python .agent/tools/server_slayer_tools.py list
python .agent/tools/server_slayer_tools.py kill --scope=project
python .agent/tools/server_slayer_tools.py kill --force
python .agent/tools/server_slayer_tools.py kill --port 3000
SAFETY: Never kill ports 3306, 5432, 27017, 6379 (databases).
ServerSlayer automatically protects critical services:
| Category | Protected |
|---|---|
| Databases | MySQL (3306), PostgreSQL (5432), MongoDB (27017), Redis (6379) |
| Tunnels | ngrok, SSH (22) |
| IDE Processes | Cursor, VSCode, Antigravity, JetBrains |
| Containers | Docker daemon |
The core logic is in server_slayer_tools.py:
# Detection: Find all listening ports
def get_listening_ports():
if SYSTEM_OS == "Windows":
output = run_command(["netstat", "-ano"])
# Parse LISTENING ports...
else: # macOS / Linux
output = run_command(["lsof", "-iTCP", "-sTCP:LISTEN", "-n", "-P"])
# Parse listening ports...
# Safety: Never kill protected services
PROTECTED_PORTS = [3306, 5432, 27017, 6379, 1433, 22]
PROTECTED_PROCESSES = ["docker", "postgres", "mysql", "ngrok", "vscode", "cursor"]
# Kill: Graceful first, force if needed
def kill_process(pid, force=False):
if SYSTEM_OS == "Windows":
subprocess.run(["taskkill", "/PID", str(pid), "/F" if force else ""])
else:
subprocess.run(["kill", "-9" if force else "", str(pid)])Full source: server_slayer_tools.py
.agent/ # π Copy this folder to any project
βββ tools/
β βββ server_slayer_tools.py # Core detection & kill logic
βββ workflows/
βββ listports.md # /listports command
βββ killservers.md # /killservers command
βββ killport.md # /killport command
βββ nukeports.md # /nukeports command
| Framework | Default Ports |
|---|---|
| Node.js (Next.js, Vite, CRA) | 3000, 3001, 5173 |
| Python (Django, Flask, FastAPI) | 8000, 5000 |
| Java (Spring Boot, Tomcat) | 8080 |
| Ruby (Rails) | 3000 |
| Go | 8080 |
| PHP | 8000 |
PRs welcome! See CONTRIBUTING.md
Help needed:
- π macOS/Linux testing
- π§© More framework detection
- π¬ Better demo GIF
If ServerSlayer saved you from "port already in use" hell:
kill stray servers β’ port already in use β’ terminate localhost processes β’ safe port killer β’ idle server killer β’ free blocked ports β’ dev server cleanup β’ cursor rules β’ ai agent β’ antigravity ide
βοΈ Stray servers slain! Happy coding! π
Made with βοΈ by @supratikpm