open source · macOS menu bar app · 127.0.0.1:4747

Know every port. Hand out the next one without collisions.

Ports Manager watches host listeners, kind and minikube services and podman and docker containers, keeps the history, and reserves free ports for you, your scripts and your coding agents through one local API.

pmctl CLI11 SDKs, zero deps1 agent skill3 scanners

Eleven SDKs, standard library only

JavaScalaKotlinPythonRustGoSwiftC++ZigJavaScriptTypeScriptJavaScalaKotlinPythonRustGoSwiftC++ZigJavaScriptTypeScript
BunTypeScriptElectronSQLitePodmanDockerkind and minikubeBunTypeScriptElectronSQLitePodmanDockerkind and minikube
agents use it

Your coding agent asks for a port. It never guesses.

The bundled skill teaches coding agents to go through pmctl. The backend serializes reservations, so parallel agents spinning up services each get their own port.

  1. 1./scripts/install-skill.sh copies the skill for claude, codex, cursor, agy or all of them.
  2. 2The agent starts with pmctl health. Exit code 3 means the backend is down and it stops.
  3. 3A new service gets its port from pmctl next <app>, which prints only the port.
  4. 4kill, container-stop and image-rm need your explicit yes before the agent adds --yes.
agent session · pmctl
what it does

One catalog for everything listening

Three scanners feed one SQLite catalog. The UI, the CLI and the SDKs all read the same API.

lsof · 3s

Host listeners

TCP listeners on the host, rescanned every 3 seconds. node, java, python and bun processes are named after their project folder.

kubeconfig · 15s

kind and minikube

Clusters are read from your kubeconfig every 15 seconds, and their NodePort services show up next to host ports.

podman · docker · 5s

Containers

List containers, inspect one, stop it, or delete its image after a confirmation. Starts, stops and removals are kept as history.

POST /v1/ports/next

Next free port

Reserves and returns a port in 3000-9999 after checking the registry, live listeners and a real bind test.

event loop + mutex

No double booking

One single threaded event loop and a mutex around every catalog write, so two callers never get the same port.

SIGTERM · SIGKILL

Stop the app on a port

Asks first in the UI and the CLI, forces SIGKILL only when told to, and refuses to kill its own backend.

first · last seen

History

Every port ever seen with first and last seen, plus opened, closed, registered, reserved, released and killed events.

bun:sqlite

Local catalog

A SQLite catalog at ~/.ports-manager/catalog.db. The API binds 127.0.0.1 by default.

menu bar

Always in the tray

A macOS tray app. Click to open, panels expand to almost full screen or dock to the side, window position is remembered.

mode · discovery

Observe everything

  • Every listener, cluster service and container is tracked
  • History is kept for every port ever seen
  • Only ports you register or reserve are held
mode · auto-registry

Claim what you run

  • Every app found listening is registered to its port
  • Next free port never hands that port out
  • The claim stays after the app stops
sdks · zero third-party dependencies

Eleven languages, one small surface

Each SDK talks to the backend with ?format=tsv and reads PM_URL when the default address is not where your backend runs.

listPortsgetPortgetAppnextFreePortsetProductionPortresolvePort
sdks/javaStandard library only (java.net.http). Errors throw PortsManagerException.
PortsManagerClient client = new PortsManagerClient();
List<PortEntry> ports = client.listPorts();
Reservation r = client.nextFreePort("my-app");
sdks/scalaScala stdlib and java.net.http, built with scala-cli.
val client = PortsManagerClient()
val ports: List[PortEntry] = client.listPorts()
val r: Reservation = client.nextFreePort("my-app")
sdks/kotlinKotlin stdlib and java.net.http, no build tool needed.
val client = PortsManagerClient()
val ports: List<PortEntry> = client.listPorts()
val r: Reservation = client.nextFreePort("my-app")
sdks/pythonStandard library only. HTTP errors raise PortsManagerError.
from ports_manager import Client

client = Client()
for entry in client.list_ports():
    print(entry.port, entry.app, entry.source)
print(client.next_free_port("my-app").port)
sdks/rustEdition 2024, raw HTTP/1.1 over std::net::TcpStream.
let client = ports_manager::Client::new(None)?;
let ports = client.list_ports()?;
let reservation = client.next_free_port("my-app")?;
sdks/goStandard library only. Errors are *portsmanager.HTTPError.
client := portsmanager.NewClient("")
ports, err := client.ListPorts()
reservation, err := client.NextFreePort("my-app")
sdks/swiftSwift package PortsManager, Foundation only.
import PortsManager

let client = Client()
let ports = try await client.listPorts()
let reservation = try await client.nextFreePort("my-app")
sdks/cppStandard library and POSIX sockets, raw HTTP/1.1.
#include "client.hpp"

portsmanager::Client client;
auto ports = client.list_ports();
auto r = client.next_free_port("my-app");
sdks/zigZig 0.15 std only, raw HTTP/1.1 over std.net TCP.
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
var client = try pm.Client.fromEnv(arena.allocator());
const ports = try client.listPorts(arena.allocator());
const r = try client.nextFreePort(arena.allocator(), "my-app");
sdks/jsUses the global fetch. Errors throw PortsManagerError.
import { Client } from "ports-manager";

const client = new Client();
const ports = await client.listPorts();
const reservation = await client.nextFreePort("my-app");
sdks/tsTyped client on the global fetch, checked with tsc.
import { Client } from "ports-manager";

const client = new Client();
const ports = await client.listPorts();
const reservation = await client.nextFreePort("my-app");
pmctl

Everything the UI does, from a shell

Add --json to any command. Set PM_URL to point it at another backend.

CommandWhat it does
pmctl healthbackend status and mode
pmctl ports [--source host|kind|minikube]ports in use right now
pmctl port <port>who uses a port, registry entry and history
pmctl appsevery app in the catalog
pmctl app <name>ports and history of one app
pmctl next <app> [--from N] [--to N]reserve the next free port for an app
pmctl register <app> <port>register a port to an app
pmctl release <port>release a registered or reserved port
pmctl kill <port> [--force] [--yes]stop the process on a port, asks first
pmctl history [--limit N]open and close events, every port ever seen
pmctl registryregistered and reserved ports
pmctl clusterskind and minikube clusters
pmctl mode [discovery|auto-registry]show or change the catalog mode
pmctl scanrescan host and clusters now
pmctl containerspodman and docker containers
pmctl container <engine> <id|name>full inspect of one container
pmctl container-stop <engine> <id|name>stop a container, asks first
pmctl image-rm <engine> <image> [--force]delete an image, asks first
pmctl container-history [--limit N]container start, stop and removal events
0

okthe command did what it said

1

refusedthe backend said no, or you answered no

2

usagebad or missing arguments

3

backend downopen the tray app or run scripts/start-all.sh

rest · http://127.0.0.1:4747/v1

A plain local HTTP API

JSON by default, TSV with ?format=tsv for the SDKs.

MethodPathPurpose
GET/v1/healthstatus, mode, listener count, last scan
GET/v1/portsports in use, filter by source
GET/v1/ports/{port}who uses a port, registry entry, sightings
POST/v1/ports/nextreserve and return the next free port
POST/v1/ports/{port}/killSIGTERM, or SIGKILL with force
GET/v1/appsevery app in the catalog
GET/v1/apps/{name}ports and history of one app
GET/v1/apps/{name}/portnormal and production port of one app
GET/v1/historyevents and every port ever seen
GETPOST/v1/registrylist or register ports
PUT/v1/registry/{port}/productionset the production port
DELETE/v1/registry/{port}release a port
GET/v1/clusterskind and minikube clusters
GETPUT/v1/modediscovery or auto-registry
POST/v1/scanrescan host and clusters now
GET/v1/containerspodman and docker containers
GET/v1/containers/historystarted, stopped, removed, image deleted
GET/v1/containers/{engine}/{id}full inspect of one container
POST/v1/containers/{engine}/{id}/stopstop a container
POST/v1/images/{engine}/deletedelete an image

Reserve a port: POST /v1/ports/next {"app":"billing"} returns the port and holds it for billing.

BunTypeScriptElectronSQLitePodmanDockerkind and minikubelsofmacOS tray
install

Four commands to a tray icon

Installs Ports Manager.app in /Applications and puts pmctl on your PATH. One installed version, one running instance.

uninstall: ./scripts/uninstall-app.sh

zsh · ports-manager