port-doctor-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@port-doctor-mcpwhat's using port 3000?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
port-doctor-mcp
A local stdio MCP server based on FastMCP that checks development port usage and terminates the corresponding process by port.
Features
check_port_status(port: int): checks whether a port is occupied, and returns the PID, name, RSS memory usage, protocol, and connection state of the occupying process.kill_process_by_port(port: int, force: bool = True): terminates the process occupying the port. Uses forceful termination by default; passforce=falseto use the gentler terminate. The server will not terminate itself.scan_common_dev_ports(): scans common development ports: 3000, 3001, 4173, 5000, 5173, 8000, 8001, 8080, 8081, 8888, 9000.
Related MCP server: runkeep-mcp
Installation
Requires Python 3.10 or higher.
python -m venv .venv
source .venv/bin/activate # Windows PowerShell: .venv\Scripts\Activate.ps1
python -m pip install -r requirements.txtVerify that the current interpreter actually has the dependencies installed:
python -c "import sys, psutil, fastmcp; print(sys.executable); print('psutil', psutil.__version__); print('fastmcp', fastmcp.__version__)"If ModuleNotFoundError still appears here, it means the Python used to install dependencies and the one used to run the server are not the same. Do not just run Invalidate Caches; instead, in PyCharm select this project's .venv/bin/python under Settings -> Project -> Python Interpreter, and use the same interpreter in the Run Configuration.
For example, the project interpreter path should be similar to:
/path/to/port-doctor-mcp/.venv/bin/pythonWindows example:
C:\path\to\port-doctor-mcp\.venv\Scripts\python.exeRunning
This is a stdio server. Once started, it waits for MCP clients to communicate via stdin/stdout and does not provide an HTTP port.
python server.pyYou can also use the FastMCP CLI:
fastmcp run server.pyFor development and debugging, you can use MCP Inspector (subject to the support of your installed FastMCP CLI):
fastmcp dev inspector server.pyAfter running python server.py directly, it is normal for the terminal to have no ordinary output and to keep waiting for input: the stdio MCP server waits for the client to send JSON-RPC messages via stdin/stdout. Do not treat "the process has not exited" as a startup failure.
Manual Testing Checklist
Run in the project root directory:
source .venv/bin/activate
python -m pip check
python -m py_compile server.py
git diff --check
fastmcp list server.py --input-schema --output-schema --jsonfastmcp list should show the following three tools:
check_port_status: requiredport, an integer.kill_process_by_port: requiredport, optionalforce, defaulttrue.scan_common_dev_ports: no parameters.
Testing with Inspector
Run:
fastmcp dev inspector server.pyIn the opened Inspector, test in order:
Call
check_port_status, passing5000or8000.Call
scan_common_dev_portsand confirm it returnsscanned_portsandoccupied_ports.Start a dedicated test service:
python -m http.server 8765 --bind 127.0.0.1Call
check_port_status(8765)and confirm you can see the Python process's PID, name, and memory.Call
kill_process_by_port(8765, force=false), confirm it returnssuccess: true, then close the test terminal.
Do not test kill_process_by_port directly against important processes such as databases, IDEs, or system services. This tool defaults to force=true and sends a forced termination signal.
Checking the schema with the FastMCP CLI
fastmcp inspect server.py --format mcpCheck whether the tool names, descriptions, parameter types, and default values in the output are correct.
MCP Client Configuration
Replace the path below with the absolute path of this project, then place it in the configuration of an MCP-capable client:
{
"mcpServers": {
"port-doctor-mcp": {
"command": "/absolute/path/to/port-doctor-mcp/.venv/bin/python",
"args": ["/absolute/path/to/port-doctor-mcp/server.py"]
}
}
}Windows example:
{
"mcpServers": {
"port-doctor-mcp": {
"command": "C:\\path\\to\\port-doctor-mcp\\.venv\\Scripts\\python.exe",
"args": ["C:\\path\\to\\port-doctor-mcp\\server.py"]
}
}
}MCP.so only handles GitHub repository directory information; it will not fix your local Python interpreter. After installation, other users still need to create a virtual environment and run pip install -r requirements.txt.
Publishing to MCP.so
MCP.so is an MCP server directory; it will not turn a local stdio process into a public HTTP service. Before publishing, commit this project to a public GitHub repository, then open:
https://mcp.so/submit?type=serverFill in:
Repository URL: your GitHub repository URL.Name:port-doctor-mcp.
The submission page may offer a paid expedited publishing option; whether you purchase it does not affect whether this project's code runs. After discovering the project in the directory, users still need to configure the local Python environment following the installation steps above.
Return Value Example
check_port_status(8000) returns a structure similar to:
{
"port": 8000,
"in_use": true,
"process_count": 1,
"processes": [
{
"pid": 12345,
"name": "python",
"memory_rss_bytes": 52428800,
"memory_rss_mb": 50.0,
"connections": [
{
"protocol": "tcp",
"local_address": "127.0.0.1:8000",
"status": "LISTEN"
}
]
}
]
}Safety Notes
kill_process_by_port is a tool with side effects. The default force=true sends a forced termination signal and may cause loss of unsaved data; it is recommended to call check_port_status first to confirm the PID, then decide whether to terminate. When reading other users' process information or terminating protected processes, the operating system may return permission errors.
License
See LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Scans remote MCP servers for protocol, security, and TLS issues; exposes scan tools via MCP.
49 developer tools via MCP: DNS, WHOIS, IP lookup, JWT, hashing, QR, and more.
238+ dev tools via MCP: JSON, QR, PDF, DNS, hash, UUID, code review, JWT, SSL, WHOIS, and more
A MCP server built for developers enabling Git based project management with project and personal…
Related MCP Servers
- AlicenseAqualityDmaintenanceInspect, manage, and kill local dev servers via MCP. Stop guessing what's on :3000. Five tools: list servers with framework detection, inspect ports, find zombies, diagnose conflicts, safe-kill with dry-run default. Local, no cloud, no telemetry.55 npm3MIT
- AlicenseNot gradedqualityBmaintenanceEnables management of long-running development processes (such as dev servers, compilers, and watchers) from MCP hosts. Provides tools to start, stop, restart, check status, view logs, and send input to managed processes.MIT
- AlicenseNot gradedqualityAmaintenanceMCP server for managing local dev ports on macOS. It enables AI agents to inspect listening ports, identify owning processes and parent chains, kill processes safely, wait for ports, and report LAN exposure.7 npm1MIT
- AlicenseNot gradedqualityBmaintenanceEnables an AI agent to manage local development environments over MCP by starting, stopping, and restarting applications and processes, reading logs with cursors, and inspecting or freeing listening ports. Exposes a fixed set of id- and port-based tools, so the agent can operate registered processes without running arbitrary commands.2 npmMIT