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 <repo-url> && 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.0

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.0
File Size Uploaded Provenance Actions
hfm-0.1.0.tar.gz 13.0 kB Without provenance Details for hfm-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 27.2 kB

Release files / hfm-0.1.0.tar.gz

Download URL hfm-0.1.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
635386b8be558b72d7a0e7282a738239323860d1eada8dead6e281c5c7d749c1
BLAKE2b-256 checksum
How to use checksums
02e9e3de71f71ae80044e8acc3d24d888826fd74d69097de552ecf3c562a1e1b
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.0-py3-none-any.whl

Download URL hfm-0.1.0-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1ee6f1c868b3cc15df73e82f26cdc747419890fe7ba069d7097132a6c2fe865
BLAKE2b-256 checksum
How to use checksums
5f3231a9af6ac561e2192dc22eec7ccb8198621fdd41935b48c457abcd07df26
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.0

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