Skip to main content
Glama
README.md
# local-server-hub

MCP server for local development ports. It lists listening dev servers and leases free ports so parallel agents and worktrees do not collide.

The server does not stop processes.

## Tools

| Tool | Purpose |
|---|---|
| `list_servers` | TCP listeners for the current user: port, pid, command, project directory, stack, URL, HTTP status |
| `get_port_info` | One port, including its reservation |
| `find_free_port` | A port that is not listening, not reserved, and can be bound |
| `suggest_port` | Framework default, or the next free port |
| `reserve_port` | Lease a port for a project or worktree (default 8 hours, maximum 7 days) |
| `release_port` | Drop a lease |
| `list_reservations` | Active leases |

Leases are stored in `~/.local-server-hub/reservations.json`. Override the directory with `LOCAL_SERVER_HUB_DIR`.

Recognized stacks: Vite, Next, Nuxt, Astro, Angular, webpack, Remix, Django, Flask, FastAPI, Rails, PHP, Go, Spring, .NET, Rust, Node, and Docker port mappings.

On macOS, ports 5000 and 7000 carry a warning because AirPlay Receiver often binds them.

If `lsof` (macOS), `ss` (Linux), or `netstat` (Windows) is missing, the server probes the framework default ports instead. A missing `docker` binary skips container mappings and returns a warning.

## Install

Requires Node.js 20 or newer.

Claude Code:

```bash
claude mcp add local-server-hub -- npx -y github:wieschollek/local-server-hub
```

Cursor `~/.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "local-server-hub": {
      "command": "npx",
      "args": ["-y", "github:wieschollek/local-server-hub"]
    }
  }
}
```

The published `dist/` is what `npx` runs. From a checkout:

```bash
npm ci
npm test
npm run build
node dist/index.js
```

## Development

```bash
npm test
npm run build
```

GitHub Actions runs the tests on Ubuntu, macOS, and Windows.

TDQS

A3.7/5.0

Scored across 7 tools

Disambiguation4/5

Most tools map to a distinct resource+action: list listeners, inspect one port, reserve, release, list reservations. The only real overlap is find_free_port vs suggest_port, which both return a usable free port; the descriptions differentiate them (strictly free vs framework-default-first), but an agent could still hesitate between the two.

Naming Consistency5/5

All seven tools follow a consistent snake_case verb_noun pattern (list_servers, get_port_info, find_free_port, reserve_port, release_port, list_reservations, suggest_port). The list_/get_/find_/reserve_/release_/suggest_ prefixes are used predictably across the set.

Tool Count5/5

Seven tools is well within the ideal 3-15 range and each one covers a distinct step in the port discovery/reservation workflow. No tool appears redundant or filler.

Completeness4/5

The surface covers discovery (list_servers, get_port_info), allocation (find_free_port, suggest_port), and the full reservation lifecycle (reserve_port, release_port, list_reservations). Minor gaps: no way to renew or extend an expiring lease, and no tool to stop/inspect the process holding a port beyond the read-only listing.