Cross-platform FastMCP server for authenticated remote Linux/macOS host administration
Runs on your machine from its package; the steps are below.
At most: moves money, runs code or commands, deletes data, or sends messages for you.
Odel charges nothing per call. The publisher may charge for its own service.
Runs locally over stdio
This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).
Run
uvx universal-host-manager-mcp
MCP client config
{
"mcpServers": {
"universal-host-manager": {
"command": "uvx",
"args": [
"universal-host-manager-mcp"
]
}
}
}A cross-platform Model Context Protocol server for administering a Linux or macOS host through MCP clients such as ChatGPT and Claude.
It uses FastMCP Streamable HTTP transport, Auth0 OAuth, bounded file tools, output limits and command timeouts.
Caution
This project exposes arbitrary shell execution. Authentication decides who may use it; it does not make commands harmless. Read SECURITY.md before deploying it.
MCP_WORKSPACE_DIR| Tool | Parameters | Purpose |
|---|---|---|
run_command | command: str, timeout: int | Runs an arbitrary shell command with the workspace as its working directory |
read_file | path: str | Reads a text file inside the workspace |
write_file | path: str, content: str | Writes UTF-8 text inside the workspace |
list_dir | path: str = "." | Lists a directory inside the workspace |
system_metrics | none | Reports disk, memory and top-process information |
The workspace boundary applies to the file tools. It does not sandbox run_command; commands retain all permissions of the service's OS user.
pip install universal-host-manager-mcp
Next: run uhm-setup to generate your .env — see Configure below.
Without polluting a project environment:
uvx --from universal-host-manager-mcp uhm-setup
This installs into a throwaway environment, runs the setup wizard, and writes .env in the current directory. From then on, run the server itself the same way: uvx universal-host-manager-mcp.
git clone https://github.com/Abktya/universal-host-manager-mcp.git
cd universal-host-manager-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
Next: run uhm-setup to generate your .env — see Configure below.
The easiest way is the interactive setup wizard, installed alongside the server:
uhm-setup
Run it from the directory where you want to keep the configuration. The server must later be started from that same directory so it can find .env.
For a first test, choose 1 — Local-only test. Press Enter to accept the port 8765; the port prompt expects a number, not y or n. This mode:
workspace directory by default;127.0.0.1, so other computers cannot connect;The wizard also offers Cloudflare Tunnel, an ngrok static domain, and an existing HTTPS URL for remote use. Remote modes require Auth0 and will not write a misleading, unusable configuration if Auth0 is skipped. It validates domains and URLs, then writes .env with 600 permissions—backing up an existing file to .env.bak first.
If a virtual environment is active, install and run both commands through that environment:
python -m pip install universal-host-manager-mcp
uhm-setup
universal-host-manager-mcp
To verify that the command belongs to the active environment on macOS/Linux:
command -v uhm-setup
command -v universal-host-manager-mcp
python -m pip show universal-host-manager-mcp
The first two paths should normally point inside .venv/bin. If they point to /opt/homebrew/bin while a virtual environment is active, reinstall with python -m pip install universal-host-manager-mcp.
Prefer to do it by hand? Create a .env file (copy .env.example if you installed from source) with an explicitly restricted workspace:
HOST=127.0.0.1
PORT=8765
MCP_BASE_URL=https://mcp.example.com
MCP_WORKSPACE_DIR=/home/youruser/workspace
AUTH0_DOMAIN=your-tenant.eu.auth0.com
AUTH0_CLIENT_ID=replace_me
AUTH0_CLIENT_SECRET=replace_me
AUTH0_AUDIENCE=https://mcp.example.com/
Never commit .env.
This project uses FastMCP's Auth0Provider fixed-client OAuth integration.
Open auth0.com, create an account, and open the Auth0 Dashboard.
Go to Applications → APIs → Create API.
Use your public MCP URL as its Identifier (audience), for example https://mcp.example.com/. Keep RS256 as the signing algorithm.
Go to Applications → Applications → Create Application, enter a name, select Regular Web Application, and create it.
Set Application Ownership to First-party. Open Application > API Access, select the API you created, and enable User-delegated Access.
On Auth0's Integrate into your application page, click Copy above the .env block. The wizard can import AUTH0_DOMAIN, AUTH0_CLIENT_ID, and AUTH0_CLIENT_SECRET from your clipboard or from a pasted block. If Auth0 displays MASKED, reveal and copy the real Client Secret from the application's Settings tab; masked secrets are rejected.
Copy the API's Identifier into AUTH0_AUDIENCE when the wizard asks for it. It is intentionally separate because Auth0's application .env block does not contain the API audience.
In the Auth0 application's Settings, use the MCP server's public origin (without /mcp) as follows:
| Auth0 field | Value |
|---|---|
| Application Ownership | First-party |
| Application Type | Regular Web Application |
| Application Login URI | Leave blank |
| Allowed Callback URLs | https://mcp.example.com/auth/callback |
| Allowed Logout URLs | https://mcp.example.com |
| Allowed Web Origins | https://mcp.example.com |
| Allowed Origins (CORS) | https://mcp.example.com |
| Allow Cross-Origin Authentication | Off / disabled |
| Cross-Origin Verification Fallback URL | Leave blank |
| API Identifier / Audience | https://mcp.example.com/ |
| Signing Algorithm | RS256 |
| Application > API Access | User-delegated Access enabled for the created API |
| MCP endpoint (entered in the AI client, not Auth0) | https://mcp.example.com/mcp |
Save the Auth0 application settings, then run the wizard. Never share the Client Secret or commit .env to Git.
The callback above is FastMCP's fixed upstream callback. Do not put Claude, ChatGPT, or Grok callback URLs into Auth0: those products are downstream MCP clients and FastMCP validates their redirect URIs separately during MCP client registration. Connect each product to https://mcp.example.com/mcp.
Auth0's Python quickstart also shows AUTH0_SECRET, APP_BASE_URL, PORT, and sample Flask code. They belong to Auth0's standalone sample web application and are not used by this MCP server; the wizard safely ignores them when importing the copied block.
Client notes:
https://chatgpt.com/connector_platform_oauth_redirect; add the public /mcp endpoint in ChatGPT developer mode./mcp endpoint and start OAuth when you connect.FastMCP also supports an Auth0 MCP-native/DCR path through Auth0MCPProvider. This repository currently uses the manually managed, fixed-client Auth0Provider path.
universal-host-manager-mcp
(Running from a source checkout with the .venv activated works the same way — the console script is installed by pip install -e ..)
With the default port, the Streamable HTTP endpoint is:
http://127.0.0.1:8765/mcp
For an intentional local-only test without Auth0:
ALLOW_INSECURE_NO_AUTH=true universal-host-manager-mcp
Do not use insecure mode on a publicly reachable endpoint.
After starting the server (and the tunnel for remote mode), verify it:
curl -i https://mcp.example.com/mcp
# Expected without a token: HTTP 401
curl -i https://mcp.example.com/.well-known/oauth-authorization-server
# Expected: HTTP 200
The server and tunnel must remain running; closing either makes a tunneled endpoint unavailable.
Install cloudflared, authenticate it and create a named tunnel:
cloudflared tunnel login
cloudflared tunnel create universal-host-manager-mcp
cloudflared tunnel route dns universal-host-manager-mcp mcp.example.com
Create ~/.cloudflared/config.yml:
tunnel: YOUR_TUNNEL_ID
credentials-file: /home/youruser/.cloudflared/YOUR_TUNNEL_ID.json
ingress:
- hostname: mcp.example.com
service: http://127.0.0.1:8765
- service: http_status:404
Validate and run it:
cloudflared tunnel ingress validate
cloudflared tunnel run universal-host-manager-mcp
Keep both universal-host-manager-mcp and cloudflared running. Closing either process takes the public endpoint offline. The setup wizard can create an executable uhm-enable-autostart.sh installer. It writes Linux systemd-user services or macOS LaunchAgents for both processes and shows one command to run.
Your remote MCP URL will be:
https://mcp.example.com/mcp
Set MCP_BASE_URL=https://mcp.example.com; do not include /mcp in MCP_BASE_URL.
Auth0 OAuth needs a stable HTTPS URL, but you don't need to own a domain to get one. Unlike ngrok's old random URLs (which changed every restart) or Cloudflare's login-free quick tunnels (same problem), ngrok's free tier includes one static subdomain per account that never changes, at no cost.
Create a free account at ngrok.com. On macOS install it with brew install ngrok/ngrok/ngrok; on Ubuntu use sudo snap install ngrok. Other Linux distributions can use ngrok's official download instructions.
Open the ngrok authtoken page, copy your token, and run:
ngrok config add-authtoken YOUR_NGROK_TOKEN
Use the authtoken, not the domain ID. Never share it; reset it in the dashboard if it is exposed.
Claim your free static domain from the ngrok dashboard (Domains → New Domain). You'll get something like your-name.ngrok-free.dev.
Start universal-host-manager-mcp from the directory containing .env.
In a second terminal, start the tunnel:
ngrok http --url=your-name.ngrok-free.dev 8765
Both processes must remain running. Closing either one takes the public endpoint offline. The wizard can create uhm-enable-autostart.sh, which installs Linux systemd-user services or macOS LaunchAgents for both processes.
Set MCP_BASE_URL=https://your-name.ngrok-free.dev in .env (keep HOST=127.0.0.1; ngrok forwards to the local port while the server listens only on loopback).
In Auth0, set the application's callback URL to https://your-name.ngrok-free.dev/auth/callback; set web origins and logout URLs to https://your-name.ngrok-free.dev (see Auth0 setup).
Your remote MCP URL is:
https://your-name.ngrok-free.dev/mcp
This is a good fit for personal use or a small number of clients. For production traffic at scale, ngrok's free tier applies connection/bandwidth limits — check their pricing page if you outgrow it, or switch to the domain-based Cloudflare Tunnel setup above.
These steps deploy the server on an EC2 instance and expose it safely to remote MCP clients.
apt; on Amazon Linux 2023 use sudo dnf install -y python3-pip instead)t3.micro/t3.small is enough for typical management workloadsSSH into the instance, then install from PyPI:
sudo apt update && sudo apt install -y python3-pip python3-venv
python3 -m venv ~/uhm-venv
source ~/uhm-venv/bin/activate
pip install universal-host-manager-mcp
mkdir -p ~/workspace
cat > ~/.env << 'EOF'
HOST=127.0.0.1
PORT=8765
MCP_BASE_URL=https://mcp.example.com
MCP_WORKSPACE_DIR=/home/ubuntu/workspace
AUTH0_DOMAIN=your-tenant.eu.auth0.com
AUTH0_CLIENT_ID=replace_me
AUTH0_CLIENT_SECRET=replace_me
AUTH0_AUDIENCE=https://mcp.example.com/
EOF
chmod 600 ~/.env
Keep HOST=127.0.0.1. The server should never listen directly on the instance's public interface — internet exposure is handled entirely by the tunnel or load balancer described below, not by opening the instance's own port.
Auth0 OAuth requires HTTPS. Pick one option:
Option A — Cloudflare Tunnel (recommended, no inbound port needed)
Run the steps from the Cloudflare Tunnel section above, from the EC2 instance. Because the tunnel is an outbound-only connection, you don't need to open any inbound port beyond SSH, don't need an Elastic IP, and the instance can even sit in a private subnet behind a NAT gateway.
Don't own a domain? Run the steps from No domain? Use ngrok's free static domain above instead — same outbound-only, no-inbound-port setup, just from the EC2 instance.
Option B — Application Load Balancer with an ACM certificate
PORTPORT only from the ALB's security group, never from 0.0.0.0/0MCP_BASE_URL to that hostnameReuse the included unit (see Background service below):
sudo cp examples/mcp-manager.service /etc/systemd/system/
# edit User=, WorkingDirectory=, EnvironmentFile= and ExecStart= to point at
# ~/uhm-venv/bin/universal-host-manager-mcp and ~/.env
sudo systemctl daemon-reload
sudo systemctl enable --now mcp-manager
sudo systemctl status mcp-manager --no-pager
Not required for either networking option. The Cloudflare Tunnel connects outbound regardless of the instance's address, and an ALB registers targets by instance ID or private IP, so it doesn't need one either. Only add an Elastic IP if something else in your setup depends on a fixed public IP for this instance.
Add the public Streamable HTTP URL to the client's MCP/connector configuration:
https://mcp.example.com/mcp
Complete the Auth0 sign-in when the client opens the authorization flow. The exact settings screens and supported connector options can change, so follow the current client documentation rather than using legacy SSE instructions.
Multiple clients can connect to the same running HTTP server. Each client authenticates independently; no separate server process or port is required.
Copy and edit the included unit:
sudo cp examples/mcp-manager.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now mcp-manager
sudo systemctl status mcp-manager --no-pager
The example uses systemd hardening directives. Adjust ReadWritePaths, ProtectHome, the user, paths and permissions to match the resources the MCP server genuinely needs.
Edit paths in examples/com.user.mcpmanager.plist, then:
cp examples/com.user.mcpmanager.plist ~/Library/LaunchAgents/
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.user.mcpmanager.plist
launchctl kickstart -k gui/$(id -u)/com.user.mcpmanager
For a remote macOS installation, uhm-setup ends by asking:
Run macOS Remote Access Readiness Test now? [Y/n]
Run this while you are physically beside the Mac. Select only the capabilities you expect to use remotely. The wizard can test workspace read/write access, trigger a read-only Google Chrome Automation request, and open the exact macOS Privacy & Security panes for protected files, Accessibility, and Screen Recording. Opening an application or an ordinary URL does not itself require an extra privacy permission.
macOS deliberately requires the user to approve TCC privacy prompts. The wizard does not bypass or click them. It shows the exact server executable path, asks you to approve each selected permission, and prints a readiness report. If a permission is not prepared before unattended use, a later remote task can stop at a dialog that requires somebody at the Mac.
Full Disk Access, Automation, Accessibility, and similar grants may be tied to the executable or installation path involved. Recreating a virtual environment, switching Python versions, or reinstalling elsewhere can require approval again. After changing a privacy permission, restart the MCP LaunchAgent before relying on it remotely.
| Variable | Default | Description |
|---|---|---|
HOST | 127.0.0.1 | Listen address |
PORT | 8765 | Listen port |
MCP_BASE_URL | local URL | Public OAuth base URL, without /mcp |
MCP_WORKSPACE_DIR | user home | Boundary for file tools and command working directory |
MAX_OUTPUT_CHARS | 64000 | Maximum returned tool-output characters |
DEFAULT_CMD_TIMEOUT | 300 | Default command timeout in seconds |
MAX_CMD_TIMEOUT | 1800 | Maximum accepted command timeout |
MAX_READ_BYTES | 5000000 | Maximum file size read by read_file |
MAX_WRITE_BYTES | 5000000 | Maximum content size written by write_file |
LOG_LEVEL | INFO | Python log level |
LOG_COMMANDS | false | Log run_command's command text (may contain secrets) instead of just its timeout |
FASTMCP_CHECK_FOR_UPDATES | off (forced unless you set it) | FastMCP's own PyPI update-check on startup |
ALLOW_INSECURE_NO_AUTH | false | Explicit local-development authentication bypass |
pip install -e ".[dev]"
pytest tests/
CI runs the suite against fastmcp 2.13, 3.x and 4.x on every push (see the badge above), since @mcp.tool()'s return type changed between major versions and tests call tools through a small version-agnostic helper (tests/conftest.py::call_tool) to cover all three.
Clone with Git:
git clone https://github.com/Abktya/universal-host-manager-mcp.git
Or use Code → Download ZIP on GitHub.