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
Option 1: pipx (recommended — standalone, no venv needed)
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
-
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.
-
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).
- 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_repois only exposed whenHFM_ALLOW_DESTRUCTIVE=1(orallow_destructive: truein the config file). The CLI'shfm repos deleterequires the same.- Every agent-triggered call is appended to
~/.config/hfm/audit.logas 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:
typerandrequests. No heavy SDKs.
Metadata
Release files for hfm 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hfm-0.1.1.tar.gz | 13.7 kB | Without provenance | Details for hfm-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hfm-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for hfm-0.1.1-py3-none-any.whl |
Total release size: 28.7 kB
Release files / hfm-0.1.1.tar.gz
| Download URL | hfm-0.1.1.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
422848970e1093c77098f0bf4566371913ee66d46c3756021d1224d9ed3ed90f
|
|
BLAKE2b-256 checksum How to use checksums |
fc363136346243b443ac7fc704b2ebaeeadfe8f354de04d61c450a6ffd50a20c
|
| 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.1-py3-none-any.whl
| Download URL | hfm-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2398c2552e15fd832d084eeb8e12ea3892f11373925dc7c6ea77e9e2aef4cdd5
|
|
BLAKE2b-256 checksum How to use checksums |
51edb13af00dc3e8662a4ba2dcc0ca77ab692bf2c7cc3a293ee69e104b8a99e5
|
| 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.1
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.