MCP Port Manager
A Model Context Protocol (MCP) server for managing port registrations on your computer. Keep track of which applications are using which ports, find free ports, and maintain a central registry of port allocations.
README
MCP Port Manager
A Model Context Protocol (MCP) server for managing port registrations on your computer. Keep track of which applications are using which ports, find free ports, and maintain a central registry of port allocations.
Features
- Get Free Port: Find available ports with OS-level verification
- Lookup by Port: Get information about what's using a specific port
- Lookup by Application: Find all ports registered to an application
- Register Port: Register a port to an application with description
- Unregister Port: Remove port registrations
- JSON Persistence: All registrations saved to
~/.mcp_portman/registry.json - OS-Level Checking: Verifies actual port availability using socket binding
Installation
Quick Install (Claude Code)
One command to install directly from GitHub:
claude mcp add port-manager -- uvx --from git+https://github.com/sooth/mcp_portman mcp-portman
For global installation (available in all projects on your machine):
claude mcp add --scope user port-manager -- uvx --from git+https://github.com/sooth/mcp_portman mcp-portman
Verify installation:
claude mcp list
Installation Scopes
Choose the appropriate scope for your needs:
-
Local (default): Project/workspace-specific, not shared
claude mcp add port-manager -- uvx --from git+https://github.com/sooth/mcp_portman mcp-portman -
User (global): Available across all projects on your machine
claude mcp add --scope user port-manager -- uvx --from git+https://github.com/sooth/mcp_portman mcp-portman -
Project: Stored in
.mcp.jsonin project root (can be committed to git for team sharing)claude mcp add --scope project port-manager -- uvx --from git+https://github.com/sooth/mcp_portman mcp-portman
Alternative: Claude Desktop Manual Configuration
macOS
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"port-manager": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/sooth/mcp_portman",
"mcp-portman"
]
}
}
}
Windows
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"port-manager": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/sooth/mcp_portman",
"mcp-portman"
]
}
}
}
After editing, restart Claude Desktop.
Local Development Setup
For local development or contributing:
# Clone the repository
git clone https://github.com/sooth/mcp_portman.git
cd mcp_portman
# Install dependencies
uv sync
# Run the server
uv run mcp-portman
Available Tools
1. get_free_port
Find an available port in the range 1024-49151.
Parameters:
preferred_port(optional): Specific port to check
Example requests to Claude:
- "Find me a free port"
- "Is port 8080 available?"
- "Get me an available port for my web server"
Returns:
{
"port": 8080,
"message": "Port 8080 is available"
}
2. lookup_by_port
Get information about a specific port.
Parameters:
port: Port number to look up
Example requests to Claude:
- "What's using port 3000?"
- "Look up port 5432"
- "Is port 8080 registered?"
Returns:
{
"port": 3000,
"registered": true,
"app_name": "my-web-app",
"description": "Development web server",
"registered_at": "2025-01-15T10:30:00",
"os_available": false
}
3. lookup_by_application
Find all ports registered to an application (case-insensitive).
Parameters:
app_name: Application name to search for
Example requests to Claude:
- "Show me all ports for postgres"
- "What ports is my-app using?"
- "List ports registered to nginx"
Returns:
{
"app_name": "postgres",
"count": 2,
"ports": [
{
"port": 5432,
"app_name": "postgres",
"description": "Main database",
"registered_at": "2025-01-15T09:00:00",
"os_available": false
},
{
"port": 5433,
"app_name": "postgres",
"description": "Test database",
"registered_at": "2025-01-15T09:05:00",
"os_available": true
}
]
}
4. register_port
Register a port to an application.
Parameters:
port: Port number to registerapp_name: Application namedescription(optional): What the port is used for
Example requests to Claude:
- "Register port 3000 to my-web-app"
- "Register port 5432 for postgres with description 'Main database'"
- "Add port 8080 for nginx development server"
Returns:
{
"success": true,
"message": "Successfully registered port 3000 to \"my-web-app\"",
"port": 3000,
"app_name": "my-web-app",
"description": "Development server",
"os_available": true
}
5. unregister_port
Remove a port registration.
Parameters:
port: Port number to unregister
Example requests to Claude:
- "Unregister port 3000"
- "Remove port 8080 from the registry"
- "Delete the registration for port 5432"
Returns:
{
"success": true,
"message": "Successfully unregistered port 3000",
"removed_registration": {
"port": 3000,
"app_name": "my-web-app",
"description": "Development server",
"registered_at": "2025-01-15T10:30:00"
}
}
Port Range
The server manages ports in the user/registered port range: 1024-49151
- 0-1023: System/well-known ports (not managed)
- 1024-49151: User/registered ports (managed by this server)
- 49152-65535: Dynamic/private ports (not managed)
Data Storage
Port registrations are stored in: ~/.mcp_portman/registry.json
The directory and file are automatically created on first registration. Format:
{
"3000": {
"app_name": "my-web-app",
"description": "Development server",
"registered_at": "2025-01-15T10:30:00.123456"
},
"5432": {
"app_name": "postgres",
"description": "Main database",
"registered_at": "2025-01-15T09:00:00.654321"
}
}
Development
Built with modern Python tools:
- FastMCP: Modern framework for building MCP servers
- uv: Fast, reliable Python package manager
Project Structure
mcp_portman/
├── pyproject.toml # Project configuration
├── README.md # This file
├── .gitignore # Git ignore rules
└── src/
└── mcp_portman/
├── __init__.py # Package initialization
└── server.py # Main MCP server implementation
Running in Development
# Install dependencies
uv sync
# Run the server
uv run mcp-portman
# Or run directly with Python
uv run python -m mcp_portman.server
Troubleshooting
Server not appearing in Claude Code/Desktop
- Verify installation:
claude mcp listshould show "port-manager" - Check server status:
claude mcp get port-manager - Verify uv is installed:
uv --version - For Claude Desktop: Restart the application completely
- Check logs for errors
Port shows as unavailable but not registered
The port may be in use by another application. The server checks:
- Registry database (managed by MCP Port Manager)
- OS-level availability (actual socket binding)
A port must be free in BOTH to be considered available.
Cannot write to registry file
Ensure you have write permissions to your home directory. The registry file is created at ~/.mcp_portman/registry.json
License
MIT License - feel free to use and modify as needed.
Contributing
Contributions welcome! Feel free to submit issues or pull requests.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。