Skip to main content

hfm — multi-account Hugging Face manager

Manage multiple Hugging Face accounts, their repos and Spaces from one CLI, and expose the same operations to AI agents over MCP. Auth uses HF's native OAuth device flow (no tokens pasted into dotfiles), tokens are stored locally with 0600 permissions and auto-refreshed.

Install

pipx install hfm

That's it. hfm is now on your PATH, running in its own isolated environment.

Option 2: pip

pip install hfm

Option 3: from source

git clone https://github.com/wraithen0/hfm.git && cd hfm
pipx install .

Setup

  1. Create a public OAuth app (no client secret) at https://huggingface.co/settings/applications/new. It needs the device-code flow; no redirect URI is required for device flow. Copy the Client ID.

  2. Register it and link an account:

hfm account register-oauth <client-id>
hfm account add personal                 # opens browser, shows a device code
hfm account add work --default

Scopes default to openid profile email read-repos write-repos manage-repos read-memberships. Pass --scopes to request fewer (e.g. read-repos only). For agent-only credentials, prefer contribute-repos (agent can only touch repos it created).

  1. Use it:
hfm account list
hfm repos list -a work -t dataset
hfm repos create myorg/my-model -a work
hfm repos upload ./checkpoints myorg/my-model -a work
hfm repos download myorg/my-model -t dataset --local-dir ./ds
hfm repos secret myorg/my-space MY_KEY        # prompts for value
hfm repos move old-id new-id                  # rename / transfer

Agents (MCP)

Run the MCP server over stdio:

hfm mcp                    # full mode
hfm mcp --read-only        # only read tools exposed

Add to an MCP client (e.g. Claude Desktop / any stdio-capable client):

{
  "mcpServers": {
    "hfm": {
      "command": "hfm",
      "args": ["mcp", "--read-only"]
    }
  }
}

Tools exposed

list_accounts, whoami, list_repos, repo_info; in write mode also create_repo, upload_file, upload_folder, download_repo, set_space_secret.

Safety rails

  • --read-only / HFM_READ_ONLY=1 — write tools are not registered at all.
  • delete_repo is only exposed when HFM_ALLOW_DESTRUCTIVE=1 (or allow_destructive: true in the config file). The CLI's hfm repos delete requires the same.
  • Every agent-triggered call is appended to ~/.config/hfm/audit.log as a JSON line (tool, account, args, timestamp).

Config lives in ~/.config/hfm/ (override with HFM_CONFIG_DIR): config.json (default account, OAuth client id), tokens.json (0600), audit.log.

Notes

  • OAuth access tokens are short-lived (~8 h); hfm refreshes them automatically using the stored refresh token.
  • Deleting an account locally (hfm account remove) removes the local tokens; revoke the app authorization in your HF settings to kill server-side access.
  • Only 2 dependencies: typer and requests. No heavy SDKs.

Metadata

Release files for hfm 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hfm 0.1.2
File Size Uploaded Provenance Actions
hfm-0.1.2.tar.gz 13.7 kB Without provenance Details for hfm-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hfm 0.1.2
File Interpreter ABI Platform Actions
hfm-0.1.2-py3-none-any.whl Python 3 none any Details for hfm-0.1.2-py3-none-any.whl

Total release size: 28.7 kB

Release files / hfm-0.1.2.tar.gz

Download URL hfm-0.1.2.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8f9c3bf8b550f43f6aa76265843230b9b603238b5f2398aab7bd80105b4d42c3
BLAKE2b-256 checksum
How to use checksums
33203d0f4fd88c7d00227520fd4c8c05c0352e5a271209ccc430c73e84975c87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / hfm-0.1.2-py3-none-any.whl

Download URL hfm-0.1.2-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ca5e008380c721aa914df463bed1c2d64fbbc267f7998b3e401bf04776a89c5
BLAKE2b-256 checksum
How to use checksums
ae50ebb2705b417189103cc6182fe87b5a4ad3cdf8c6f1f24c74b073379f7de3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for hfm 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page