mcp-server-port-cleaner
Use this MCP Server when you encounter 'EADDRINUSE' (Address already in use).
Documentation
MCP Port Cleaner Server
Node.js server implementing Model Context Protocol (MCP) for port cleanup operations in development environments.
Features
- Finds and terminates processes occupying specified ports
- Scans and lists all processes occupying specified ports (cross-platform support)
- Safe input parameter validation using Zod schema
- Detailed error handling and response formatting
- Standard MCP protocol compliance for tool registration and request processing
Tools
port_scan
Description: Scans and lists all processes occupying a specified port (cross-platform support).
Input Parameters:
{
"port": {
"type": "integer",
"description": "scan process by specify port",
"minimum": 1,
"maximum": 65535
}
}Response:
- Success: Returns list of processes with details (PID, name, user, protocol)
- Failure: Returns error information
- Port not occupied: Returns appropriate notification
port_clean
Description: Finds and terminates processes occupying a specified port to resolve development environment port conflicts.
Input Parameters:
{
"port": {
"type": "integer",
"description": "clean process by specify port",
"minimum": 1,
"maximum": 65535
}
}Response:
- Success: Returns list of terminated process IDs
- Failure: Returns error information
- Port not occupied: Returns appropriate notification
Usage Examples
With Claude Desktop or Trae.cn
Docker Configuration
TODO
NPX Configuration
{
"mcpServers": {
"port-cleaner": {
"command": "npx",
"args": [
"-y",
"mcp-server-port-cleaner"
]
}
}
}or install globally:
npm install -g mcp-server-port-cleanerand then:
{
"mcpServers": {
"port-cleaner": {
"command": "mcp-server-port-cleaner"
}
}
}Implementation Details
The server implements the following components:
1. PortCleanerService: Core business logic for port cleanup operations
2. PortScannerService: Cross-platform port scanning functionality
3. MCP Server Integration: Standard MCP protocol implementation with:
4. Error Handling: Comprehensive error handling at both service and server levels
Error Handling
The server provides detailed error responses in all failure scenarios:
- Invalid input parameters
- Process termination failures
- Unexpected runtime errors
Development Notes
- The service uses platform-specific commands:
- Linux/Unix: `lsof`, `kill`, `netstat`
- Windows: `netstat`, `tasklist`, `taskkill`
- Cross-platform compatibility implemented with process detection
- The cleanup implementation terminates processes with SIGKILL (-9)
License
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Frequently asked questions
What is mcp-server-port-cleaner?
mcp-server-port-cleaner is Use this MCP Server when you encounter 'EADDRINUSE' (Address already in use).
How do I install mcp-server-port-cleaner?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcp-server-port-cleaner open source?
Yes — it is hosted on GitHub at https://github.com/BrightLin/mcp-server-port-cleaner.
Related MCP tools
An MCP server that installs other MCP servers for you JavaScript-based implementation. Trusted by 1400+ developers. Trusted by 1400+ developers.
MCP server for interacting with the iOS simulator JavaScript-based implementation. Trusted by 1200+ developers. Trusted by 1200+ developers.
A Model Context Protocol server that provides read-only access to MySQL databases. This server enables LLMs to inspect database schemas and execute read-only...
This is an MCP server that allows you to directly download transcripts of YouTube videos. JavaScript-based implementation.
The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.
An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others. Built for the Model Context Protocol to enhance AI capabiliti
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP