front-proxy

io.github.gutomezenciov0.8.2Updated Oct 8, 2026

Map local domains (and HTTPS) to apps on local ports, OS-wide, via /etc/hosts and a reverse proxy.

VerifiedSTDIODesktop onlyDeveloper ToolsCloud & Infrastructure

Overview

AI-generated overview

Lets an assistant map local domains to local app ports and manage an OS-wide HTTP/HTTPS reverse proxy.

What it does
The MCP server exposes tools to list, add, update and remove domain-to-port mappings, generate HTTPS certificates with mkcert, check proxy status, and apply saved configuration to a running proxy. The proxy itself writes the domains into /etc/hosts pointing at 127.0.0.1 and forwards requests by Host header to the mapped local port, so apps on ports like 3000 are reachable through real-looking domains in every browser and CLI tool.
When to use it
Useful when a local app must be reached through a real-looking domain rather than localhost, for example services that allowlist domains, APIs that block localhost with CORS, or headless browser tests that need a proper hostname. It suits developers who want that mapping to apply across the whole machine, not just one browser.
Requirements
Node.js 22.12 or newer; macOS or Linux, since it edits /etc/hosts and uses sudo. The proxy binds ports 80 and 443 and needs the user's password via sudo to start and stop; the password is not stored. HTTPS requires mkcert, with mkcert -install run once in a terminal. Configuration and certificates live in ~/.front-proxy, overridable with the FRONT_PROXY_HOME environment variable.
Before you install
The MCP server runs without sudo but writes domain mappings to the configuration file and can call the running proxy's local admin API to apply them; the admin page is enabled by default and can be turned off with --no-admin. Starting the proxy requires sudo and edits /etc/hosts, and with --persist-hosts entries remain after it stops. Certificates are created with mkcert, which installs a local CA that browsers trust. The admin page is protected by localhost-only access and a per-run token.

Installation

In SourceWeft

  1. Open front-proxy in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

[Image] front-proxy

[npm] [coverage] [audit] [OpenSSF Scorecard] [Socket Badge]

Reach apps on local ports, like localhost:3000, through real-looking domains, like local-dev.mylivedomain.com, over HTTP or HTTPS.

While it runs, front-proxy adds your domains to /etc/hosts, pointing them at 127.0.0.1, and runs a reverse proxy on ports 80 and 443. When it stops, it removes them. The proxy reads the Host header of each request and forwards it to the port you mapped to that domain. HTTPS uses locally trusted certificates from mkcert. Because the mapping lives in the OS, it works in every browser and tool on your machine, not just one.

  Browser, curl, Playwright...          │          │  https://local-dev.mylivedomain.com          ▼  ┌───────────────────────────────────────────────┐  │ /etc/hosts                                    │  │   127.0.0.1  local-dev.mylivedomain.com       │  └───────────────────────────────────────────────┘          │          │  127.0.0.1:443  (or :80 for http)          ▼  ┌───────────────────────────────────────────────┐  │ front-proxy                                   │  │   1. TLS with the domain's mkcert certificate │  │   2. Host header → port, from proxyHosts.json │  │        local-dev.mylivedomain.com → 3000      │  │      (unknown host → 502)                     │  └───────────────────────────────────────────────┘          │          │  http://127.0.0.1:3000          ▼  Your local app

Why

Some third-party services only accept requests from an allowlist of domains (Stripe and Google Tag Manager, for example), and some APIs block localhost with CORS. Browser extensions can fake a domain for one browser. front-proxy works for the whole OS, so it also covers other browsers, CLI tools and headless Playwright runs with no extra configuration.

Requirements

  • Node.js 22.12 or newer
  • macOS or Linux (it edits /etc/hosts and uses sudo)
  • mkcert, only for HTTPS (brew install mkcert on macOS)

Installation

bash
npm install -g front-proxy

The front-proxy command is now available in your terminal.

If npm install -g fails with EACCES, your npm global folder is owned by root. That's common with the system Node on Linux or the official macOS installer. Use a Node installed with nvm or Homebrew, or run sudo npm install -g front-proxy.

To update:

bash
npm update -g front-proxy

Your domains and certificates live in ~/.front-proxy (see Configuration), so updates and reinstalls keep them.

To run it from a clone instead, see Development.

Usage

bash
front-proxy add local-dev.livedomain.com:3000   # map a domain to a local portfront-proxy                                     # start the proxy

Then open http://local-dev.livedomain.com (or https:// once you've set up certificates).

CommandDescriptionNeeds sudo
front-proxyStart the proxy on ports 80 and 443, adding your domains to /etc/hosts until it stopsYes
front-proxy --persist-hostsSame, but keep the domains in /etc/hosts after the proxy stops (-p for short)Yes
front-proxy --no-adminStart without the admin pageYes
front-proxy add <host:port>Add a domain to the proxy configNo
front-proxy remove <host>Remove a domain from the proxy configNo
front-proxy listList the configured domainsNo
front-proxy generate-certs [host]Create HTTPS certificates with mkcert, for one domain or all of themNo
front-proxy mcpRun the MCP server for code assistants, on stdioNo
front-proxy --helpShow the helpNo

Only starting the proxy asks for your password through sudo, because it binds ports 80/443 and edits /etc/hosts. The password isn't stored.

The domains go into a single block in /etc/hosts:

# <FRONT-PROXY-HOSTS># > local-dev.livedomain.com < Host added by front-proxy127.0.0.1 local-dev.livedomain.com# </FRONT-PROXY-HOSTS>

Stopping the proxy (Ctrl+C) removes the block, unless you started it with --persist-hosts. If the proxy didn't stop cleanly (it crashed or was killed), the block stays until the next start. Each start replaces any block it finds with a fresh one. add and remove only change the config, so restart the proxy to apply them.

Requests for a domain that isn't configured get a 502 response.

Hosts must be valid hostnames (letters, digits, hyphens and dots, like myapp.local). IP addresses, localhost, front-proxy.localhost and ports 80/443 (the proxy's own) are rejected. Entries in proxyHosts.json that don't pass these checks are skipped with a warning.

Admin page

While the proxy runs, open http://front-proxy.localhost to manage your domains in the browser. The page:

  • lists the configured domains, with a dot showing whether something is listening on each port
  • adds and removes domains, and changes a domain's port
  • shows which certificate each domain uses, with the generate-certs command to copy when it has none
  • links to each active domain over HTTP (and HTTPS when it's on)

Changes are saved to proxyHosts.json right away, like the CLI commands. The page then shows a banner until they're active: click Apply now to reload the routes, certificates and /etc/hosts block without restarting, or restart front-proxy.

The proxy runs as root, so the page only accepts:

  • requests from this machine (127.0.0.1/::1), with the front-proxy.localhost host, which blocks LAN clients and DNS rebinding
  • changes sent from the page itself: its Origin, a JSON body and a random token generated each time the proxy starts

Its responses use a strict Content Security Policy and can't be framed. To turn the page off, start with front-proxy --no-admin.

For HTTPS on the admin page, the default certificate must include front-proxy.localhost. generate-certs adds it when it creates the default certificate. If yours was created by an older version, delete ~/.front-proxy/keys/_private-default-*.pem and run front-proxy generate-certs again.

MCP server

front-proxy mcp runs a Model Context Protocol server on stdio, so code assistants (Claude Code, Cursor, VS Code, Codex, Windsurf…) can manage your domains for you. For example, they can map the app they just started to a domain and check that it answers. It's listed in the MCP Registry as io.github.gutomezencio/front-proxy.

[Add to Cursor] [Install in VS Code] [Download for Claude Desktop]

Claude Code: install the plugin, which adds the MCP server and a skill that tells Claude when front-proxy helps (allowlisted domains, CORS, cookies, local HTTPS):

bash
claude plugin marketplace add gutomezencio/front-proxyclaude plugin install front-proxy@front-proxy

Or add only the MCP server: claude mcp add front-proxy -- npx -y front-proxy mcp.

Claude Desktop: download front-proxy.mcpb from the latest release and open it.

Codex: codex mcp add front-proxy -- npx -y front-proxy mcp.

Other clients take the same command in their MCP config:

json
{  "mcpServers": {    "front-proxy": { "command": "npx", "args": ["-y", "front-proxy", "mcp"] }  }}

If you installed front-proxy globally, front-proxy mcp works too. Both share the config in ~/.front-proxy, but the proxy itself still runs from the global install (see below).

ToolWhat it does
list_hostsList the configured domains, their ports and certificate status
add_hostMap a domain to a local port (same checks as front-proxy add)
update_hostPoint a domain to another port
remove_hostRemove a domain
generate_certsCreate HTTPS certificates with mkcert, for one domain or all of them
proxy_statusWhether the proxy runs, whether HTTPS is on, whether changes are waiting, and which apps are listening
apply_configLoad the saved config into the running proxy, like Apply now on the admin page

The MCP server runs as you, without sudo, like add and remove. Its changes are saved to proxyHosts.json. To apply them, it calls the running proxy's admin API from 127.0.0.1 with the same per-run token and Origin as the admin page. Some things are left to you:

  • Starting and stopping the proxy needs your password, so the assistant asks you to run front-proxy.
  • apply_config needs the admin page on (the default). With --no-admin, restart the proxy to apply changes.
  • generate_certs can't type your password, so run mkcert -install once in a terminal before using it.

HTTPS

HTTPS on port 443 needs locally trusted certificates, which front-proxy creates with mkcert:

bash
front-proxy generate-certs                            # every configured domainfront-proxy generate-certs local-dev.livedomain.com   # a single domain

The first run installs mkcert's local CA so browsers trust the certificates. It also creates a default certificate for localhost and front-proxy.localhost. Each domain then gets its own certificate, which the proxy serves through SNI. Domains without their own certificate fall back to the default one. If there's no default certificate, the proxy starts with HTTP only.

If Chrome still says "Not secure" for a domain after its certificate was created and applied, fully quit Chrome (Cmd+Q on macOS) and open it again. Chrome remembers a certificate error it saw before, or one you clicked through, until it restarts. Firefox only trusts mkcert's CA when nss is installed (brew install nss) before running generate-certs.

HTTPS responses include an HSTS header (includeSubDomains, preload), so browsers remember to use HTTPS for those domains.

Custom certificates

To use your own certificate (a wildcard, for example), save it in ~/.front-proxy/keys/ as _private-<name>-cert.pem and _private-<name>-key.pem, then set "cert": "<name>" on each domain that should use it:

bash
mkcert \  -cert-file ~/.front-proxy/keys/_private-mydomain-cert.pem \  -key-file  ~/.front-proxy/keys/_private-mydomain-key.pem \  "*.mydomain.com"

Configuration

Domains are stored in ~/.front-proxy/proxyHosts.json and certificates in ~/.front-proxy/keys/. The folder is created on the first run. To keep it somewhere else, set the FRONT_PROXY_HOME environment variable.

The commands above manage the config, but you can also edit it by hand:

json
{  "local-dev.livedomain.com": {    "port": 3000,    "cert": "local-dev.livedomain.com"  }}
KeyDescription
portLocal port the domain is proxied to, on 127.0.0.1
certOptional. Points to ~/.front-proxy/keys/_private-<cert>-{cert,key}.pem. Several domains can share one certificate

Keys starting with $ (like the $comment the CLI writes) are ignored.

Uninstalling

Stop the proxy first (Ctrl+C), so its block is removed from /etc/hosts. If you used --persist-hosts, or if an older version added your domains, start the proxy once without the flag and stop it to clean them up:

bash
front-proxy                        # then Ctrl+Cnpm uninstall -g front-proxyrm -rf ~/.front-proxy              # config and certificatesmkcert -uninstall                  # optional: remove mkcert's local CA

Development

To use front-proxy from a clone, or to work on it:

bash
git clone [email protected]:gutomezencio/front-proxy.gitcd front-proxynpm installnpm run build   # compile src/ (TypeScript) to dist/npm link        # point the global `front-proxy` command at this clone

If you installed the npm package before, run npm uninstall -g front-proxy first so the two don't clash. npm link links the global command to the clone's dist/, so keep the folder in place and run git pull and npm run build to update. npm unlink -g front-proxy removes the link. The clone uses the same ~/.front-proxy config as the npm package.

bash
npm run build                # compile src/ to dist/ and copy the admin page's static filesnpm start                    # build, then run the proxy from dist/, without the sudo wrappernpm run dev                  # same, rebuilding and restarting on file changesnpm run start:root -- list   # build, then run through the sudo wrapper, like the installed CLInpm run typecheck            # type-check src/ and test/npm test                     # run the tests (Jest with ts-jest, straight from src/)npm run test:coverage        # same, with coverage (fails below the thresholds in package.json)npm pack --dry-run           # list the files that get published to npmnpm run build:mcpb           # build front-proxy.mcpb, the Claude Desktop bundle

The code is TypeScript (strict, native ES modules) with zod schemas for everything it validates. tsc compiles it to dist/, and npm pack/npm publish build it first (the prepack script). Only dist/, README.md, LICENSE and package.json are published (the files field in package.json).

License

MIT

Source: README.md at commit 8d31f14

Tools

0
Tool metadata has not been indexed yet.

Version history

1
  1. v0.8.2LatestOct 8, 2026