flowmusic-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. flowmusic_cli-0.1.0/.claude-plugin/marketplace.json +12 -0
  2. flowmusic_cli-0.1.0/.claude-plugin/plugin.json +10 -0
  3. flowmusic_cli-0.1.0/.github/workflows/ci.yml +61 -0
  4. flowmusic_cli-0.1.0/.gitignore +12 -0
  5. flowmusic_cli-0.1.0/.mcp.json +8 -0
  6. flowmusic_cli-0.1.0/AGENTS.md +51 -0
  7. flowmusic_cli-0.1.0/LICENSE +21 -0
  8. flowmusic_cli-0.1.0/PKG-INFO +227 -0
  9. flowmusic_cli-0.1.0/README.md +197 -0
  10. flowmusic_cli-0.1.0/docs/commands.md +224 -0
  11. flowmusic_cli-0.1.0/docs/how-it-works.md +84 -0
  12. flowmusic_cli-0.1.0/docs/mcp.md +106 -0
  13. flowmusic_cli-0.1.0/docs/troubleshooting.md +70 -0
  14. flowmusic_cli-0.1.0/llms.txt +19 -0
  15. flowmusic_cli-0.1.0/pyproject.toml +56 -0
  16. flowmusic_cli-0.1.0/server.json +20 -0
  17. flowmusic_cli-0.1.0/skills/fmusic/SKILL.md +48 -0
  18. flowmusic_cli-0.1.0/src/flowmusic_cli/__init__.py +3 -0
  19. flowmusic_cli-0.1.0/src/flowmusic_cli/__main__.py +4 -0
  20. flowmusic_cli-0.1.0/src/flowmusic_cli/api/__init__.py +0 -0
  21. flowmusic_cli-0.1.0/src/flowmusic_cli/api/client.py +328 -0
  22. flowmusic_cli-0.1.0/src/flowmusic_cli/api/download.py +136 -0
  23. flowmusic_cli-0.1.0/src/flowmusic_cli/api/generate.py +387 -0
  24. flowmusic_cli-0.1.0/src/flowmusic_cli/api/sse.py +49 -0
  25. flowmusic_cli-0.1.0/src/flowmusic_cli/auth/__init__.py +0 -0
  26. flowmusic_cli-0.1.0/src/flowmusic_cli/auth/browser_login.py +118 -0
  27. flowmusic_cli-0.1.0/src/flowmusic_cli/auth/session.py +161 -0
  28. flowmusic_cli-0.1.0/src/flowmusic_cli/auth/supabase.py +74 -0
  29. flowmusic_cli-0.1.0/src/flowmusic_cli/cli.py +665 -0
  30. flowmusic_cli-0.1.0/src/flowmusic_cli/config.py +64 -0
  31. flowmusic_cli-0.1.0/src/flowmusic_cli/errors.py +100 -0
  32. flowmusic_cli-0.1.0/src/flowmusic_cli/mcp_server.py +168 -0
  33. flowmusic_cli-0.1.0/src/flowmusic_cli/output.py +46 -0
  34. flowmusic_cli-0.1.0/tests/conftest.py +48 -0
  35. flowmusic_cli-0.1.0/tests/fixtures/stream_create_song.sse +54 -0
  36. flowmusic_cli-0.1.0/tests/test_api.py +186 -0
  37. flowmusic_cli-0.1.0/tests/test_session.py +57 -0
  38. flowmusic_cli-0.1.0/uv.lock +1560 -0
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "flowmusic-cli",
3
+ "owner": { "name": "JvanLeeuwen4", "url": "https://github.com/JvanLeeuwen4" },
4
+ "plugins": [
5
+ {
6
+ "name": "fmusic",
7
+ "source": "./",
8
+ "description": "Generate, remix and download music with Google Flow Music (Lyria): skill + MCP server.",
9
+ "category": "media"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "fmusic",
3
+ "version": "0.1.0",
4
+ "description": "Generate, remix and download music with Google Flow Music (Lyria) via the unofficial fmusic CLI + MCP server.",
5
+ "author": { "name": "JvanLeeuwen4", "url": "https://github.com/JvanLeeuwen4" },
6
+ "homepage": "https://github.com/JvanLeeuwen4/flowmusic-cli",
7
+ "repository": "https://github.com/JvanLeeuwen4/flowmusic-cli",
8
+ "license": "MIT",
9
+ "keywords": ["music", "lyria", "flow music", "audio", "mcp"]
10
+ }
@@ -0,0 +1,61 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: ["v*"]
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ os: [ubuntu-latest, windows-latest, macos-latest]
16
+ python: ["3.10", "3.13"]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: astral-sh/setup-uv@v6
20
+ with:
21
+ python-version: ${{ matrix.python }}
22
+ - run: uv run --extra dev ruff check src tests
23
+ - run: uv run --extra dev pytest -q
24
+
25
+ pypi:
26
+ # Requires a "trusted publisher" on pypi.org for this repo + workflow `ci.yml` + environment `pypi`.
27
+ if: startsWith(github.ref, 'refs/tags/v')
28
+ needs: test
29
+ runs-on: ubuntu-latest
30
+ environment: pypi
31
+ permissions:
32
+ id-token: write
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+ - uses: astral-sh/setup-uv@v6
36
+ - run: uv build
37
+ - uses: pypa/gh-action-pypi-publish@release/v1
38
+
39
+ mcp-registry:
40
+ # Publishes server.json to https://registry.modelcontextprotocol.io (auth via GitHub OIDC,
41
+ # allowed because the server name is io.github.JvanLeeuwen4/...).
42
+ if: startsWith(github.ref, 'refs/tags/v')
43
+ needs: pypi
44
+ runs-on: ubuntu-latest
45
+ permissions:
46
+ id-token: write
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+ - name: Install mcp-publisher
50
+ run: |
51
+ curl -fsSL "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" | tar xz mcp-publisher
52
+ - name: Wait for PyPI to serve the new version
53
+ run: |
54
+ v="${GITHUB_REF_NAME#v}"
55
+ for i in $(seq 1 30); do
56
+ curl -fs "https://pypi.org/pypi/flowmusic-cli/$v/json" >/dev/null && exit 0
57
+ sleep 10
58
+ done
59
+ echo "version $v not on PyPI yet" && exit 1
60
+ - run: ./mcp-publisher login github-oidc
61
+ - run: ./mcp-publisher publish
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ out/
10
+ session.json
11
+ *.wav
12
+ *.m4a
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "fmusic": {
4
+ "command": "uvx",
5
+ "args": ["--from", "git+https://github.com/JvanLeeuwen4/flowmusic-cli", "fmusic", "mcp", "run"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,51 @@
1
+ # AGENTS.md
2
+
3
+ This file is a guide for AI coding agents and contributors working **on** this repository.
4
+
5
+ To **use** the tool, read [README.md](README.md), [docs/commands.md](docs/commands.md) and [docs/mcp.md](docs/mcp.md). Agents using it through Claude Code should also read the skill in [skills/fmusic/SKILL.md](skills/fmusic/SKILL.md).
6
+
7
+ ## What this is
8
+
9
+ `flowmusic-cli` is an unofficial Python CLI and MCP server for Google Flow Music (flowmusic.app). It signs in once with a browser, then makes plain HTTP calls to the site's `/__api` backend. [docs/how-it-works.md](docs/how-it-works.md) describes every endpoint and payload.
10
+
11
+ ## Setup and checks
12
+
13
+ ```bash
14
+ uv venv && uv pip install -e ".[dev]"
15
+ uv run --extra dev pytest -q # unit tests (no network, respx mocks)
16
+ uv run --extra dev ruff check src tests
17
+ ```
18
+
19
+ ## Rules
20
+
21
+ - **Tests never touch the network.** Mock HTTP with `respx`. Fixtures in `tests/fixtures/` are scrubbed captures of real responses; keep them free of real user ids, emails and tokens.
22
+ - **Never commit secrets.** That includes `session.json`, cookie values, `ya29.` tokens and anything under `out/`.
23
+ - **Errors are typed.** Raise a subclass from `errors.py`; each one maps to a stable exit code, so don't renumber them. User-facing advice goes in `hint`.
24
+ - **Output channels.** Results go to stdout through `emit_json` / `out`. Progress and chatter go to stderr through `err` / `ctx.say`. `--json` output must stay one JSON object.
25
+ - **Keep the CLI and MCP tools in sync.** A new capability belongs in `cli.py` and in `mcp_server.py`, plus `docs/commands.md` and `docs/mcp.md`.
26
+ - **The API is reverse-engineered.** When a response shape changes, update `docs/how-it-works.md` along with the code, and add a fixture or test for the new shape.
27
+ - **Be careful with live testing.** It spends real credits on the developer's account, and `clips delete` is permanent. Only delete clips you created during the test.
28
+
29
+ ## Layout
30
+
31
+ ```text
32
+ src/flowmusic_cli/
33
+ cli.py Click commands (entry point: fmusic / flowmusic)
34
+ mcp_server.py MCP tools + `mcp setup`
35
+ config.py constants + FMUSIC_* env settings
36
+ errors.py typed errors → exit codes
37
+ output.py stdout/stderr helpers
38
+ auth/ session.py, supabase.py (refresh), browser_login.py
39
+ api/ client.py, sse.py, generate.py, download.py
40
+ tests/ pytest + respx
41
+ docs/ user + contributor docs
42
+ skills/fmusic/ Claude Code skill
43
+ .claude-plugin/ Claude Code plugin + marketplace manifest
44
+ .mcp.json MCP server config used by the plugin
45
+ server.json MCP Registry metadata
46
+ ```
47
+
48
+ ## Releasing
49
+
50
+ 1. Bump `version` in `pyproject.toml`, `src/flowmusic_cli/__init__.py`, `server.json` (twice) and `.claude-plugin/plugin.json`.
51
+ 2. `git tag vX.Y.Z && git push --tags`. CI runs the tests, publishes to PyPI (trusted publishing), then publishes `server.json` to the MCP Registry.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Joost
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,227 @@
1
+ Metadata-Version: 2.5
2
+ Name: flowmusic-cli
3
+ Version: 0.1.0
4
+ Summary: Unofficial command-line client for Google Flow Music (flowmusic.app, Lyria) — generate, download and manage songs from your terminal.
5
+ Project-URL: Homepage, https://github.com/JvanLeeuwen4/flowmusic-cli
6
+ Project-URL: Issues, https://github.com/JvanLeeuwen4/flowmusic-cli/issues
7
+ Author: Joost
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: cli,flow music,google,lyria,mcp,music generation
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Multimedia :: Sound/Audio
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: click>=8.1
19
+ Requires-Dist: filelock>=3.13
20
+ Requires-Dist: httpx>=0.27
21
+ Requires-Dist: mcp>=1.2
22
+ Requires-Dist: platformdirs>=4.2
23
+ Requires-Dist: playwright>=1.45
24
+ Requires-Dist: rich>=13.7
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=8; extra == 'dev'
27
+ Requires-Dist: respx>=0.21; extra == 'dev'
28
+ Requires-Dist: ruff>=0.6; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # flowmusic-cli
32
+
33
+ **Make music with Google Flow Music (Lyria) from your terminal, your scripts, or your AI agent.**
34
+
35
+ `fmusic` is a command-line client and MCP server for [flowmusic.app](https://www.flowmusic.app). You sign in once with your own Google account. After that it works without a browser: you describe a song, and a few minutes later you have a WAV file plus a JSON file with its details.
36
+
37
+ <!-- MCP registry ownership verification: do not remove -->
38
+ mcp-name: io.github.JvanLeeuwen4/flowmusic-cli
39
+
40
+ > [!IMPORTANT]
41
+ > **Unofficial project.** It is not affiliated with, endorsed by, or supported by Google. It uses the same endpoints as the flowmusic.app website, so it can break when the site changes. You use your own account and credits. Follow the Flow Music [terms](https://policies.google.com/terms) and the [generative AI use policy](https://policies.google.com/terms/generative-ai/use-policy), and don't use it for spam or mass generation.
42
+
43
+ ---
44
+
45
+ ## Quick start
46
+
47
+ ```bash
48
+ uv tool install flowmusic-cli # 1. install (or: pipx install flowmusic-cli)
49
+ fmusic auth login # 2. a browser opens once: sign in with Google
50
+ fmusic generate "dreamy synthwave, airy female vocals, 100 bpm" # 3. make a song
51
+ ```
52
+
53
+ Example output:
54
+
55
+ ```text
56
+ ♪ take 1 (audio__create_song) Dreamy synthwave, airy female vocals, lush pads, 100 bpm
57
+ queued "Neon Drift" 3e2b2139-… (~35s)
58
+ ✓ rendered "Neon Drift"
59
+ ⬇ ~/Music/flowmusic-cli/2026-11-04/neon-drift_3e2b2139.wav
60
+ Neon Drift 1:44 3e2b2139-2783-4171-a2b4-a51d03bc4504
61
+ continue with: fmusic chat 13001945-… "…"
62
+ ```
63
+
64
+ **What you need:**
65
+ - Python 3.10+, via [uv](https://docs.astral.sh/uv/) or pipx.
66
+ - Google Chrome or Edge, for the one-time sign-in.
67
+ - A Google account with Flow Music access. A Google AI subscription gives the most credits.
68
+
69
+ ---
70
+
71
+ ## What you can do
72
+
73
+ | I want to… | Command |
74
+ |---|---|
75
+ | Make a song from a description | `fmusic generate "folk ballad about the sea, male vocals"` |
76
+ | Use my own lyrics | `fmusic generate "upbeat k-pop" --lyrics lyrics.txt` |
77
+ | Make an instrumental | `fmusic generate "lofi beat, 80 bpm" --instrumental` |
78
+ | Change a song I just made | `fmusic chat <conversation_id> "make it faster, add a bridge"` |
79
+ | Restyle my own audio | `fmusic generate "turn this into a jazz trio" --audio demo.mp3` |
80
+ | Split a song into stems | `fmusic stems <clip_id>` (vocals, drums, bass, other) |
81
+ | See my songs | `fmusic clips list` |
82
+ | Download, rename or delete songs | `fmusic clips download/rename/delete <clip_id>` |
83
+ | Check my credits | `fmusic credits` |
84
+
85
+ The full reference for every command and flag is in **[docs/commands.md](docs/commands.md)**.
86
+
87
+ ### How generation works
88
+
89
+ Flow Music has an AI **co-producer**. Your prompt goes to it, and it decides what to make: often one or two *takes*. It rewrites your prompt into a detailed "sound prompt" and may suggest next steps. Each generation belongs to a **conversation**, and `fmusic chat <conversation_id> "…"` continues that conversation, for example to tweak, extend or remix a take.
90
+
91
+ If you want exact control without the co-producer, use the **experimental** `--direct` mode. Your prompt goes to the song model as-is, and `-n` sets the number of takes:
92
+
93
+ ```bash
94
+ fmusic generate "minimal techno, 126 bpm, hypnotic" --direct -n 2 --title "Night Drive"
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Install
100
+
101
+ | Method | Command |
102
+ |---|---|
103
+ | uv (recommended) | `uv tool install flowmusic-cli` |
104
+ | pipx | `pipx install flowmusic-cli` |
105
+ | Latest from GitHub | `uv tool install git+https://github.com/JvanLeeuwen4/flowmusic-cli` |
106
+ | Update | `uv tool upgrade flowmusic-cli` |
107
+
108
+ The package installs two equivalent commands, `fmusic` and `flowmusic`.
109
+
110
+ ## Sign in
111
+
112
+ ```bash
113
+ fmusic auth login # opens Chrome/Edge: sign in with Google; the window closes by itself
114
+ fmusic auth status # shows email, subscription tier, credits (exit code 0 = OK)
115
+ fmusic auth logout
116
+ ```
117
+
118
+ - You sign in once. Tokens refresh automatically, so you won't need to sign in again unless you log out or the session is revoked.
119
+ - To use several accounts, add `--profile work` (or set `FMUSIC_PROFILE=work`) to any command.
120
+ - **Can't open a browser** (for example on a server)? Sign in on flowmusic.app on another machine. In the browser's DevTools, open the Network tab and copy the `Cookie` header of any `__api` request. Then run:
121
+ ```bash
122
+ fmusic auth import "sb-sb-auth-token.0=base64-…; sb-sb-auth-token.1=…"
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Use it from AI agents
128
+
129
+ `fmusic` is built to be driven by agents. There are three ways:
130
+
131
+ ### 1. Claude Code plugin (skill + MCP server)
132
+
133
+ ```text
134
+ /plugin marketplace add JvanLeeuwen4/flowmusic-cli
135
+ /plugin install fmusic@flowmusic-cli
136
+ ```
137
+
138
+ Then run `fmusic auth login` once in a terminal. The plugin starts the MCP server through `uvx`, so you don't need to install anything else.
139
+
140
+ ### 2. Any MCP client (Claude Desktop, Cursor, VS Code, Codex, …)
141
+
142
+ Add this to the client's MCP configuration. It only needs [uv](https://docs.astral.sh/uv/):
143
+
144
+ ```json
145
+ {
146
+ "mcpServers": {
147
+ "fmusic": { "command": "uvx", "args": ["--from", "flowmusic-cli", "fmusic", "mcp", "run"] }
148
+ }
149
+ }
150
+ ```
151
+
152
+ If `fmusic` is already installed, this command writes the config for you:
153
+
154
+ ```bash
155
+ fmusic mcp setup --target claude-code # or: claude-desktop, print
156
+ ```
157
+
158
+ The tools and their parameters are listed in **[docs/mcp.md](docs/mcp.md)**.
159
+
160
+ ### 3. The CLI with `--json`
161
+
162
+ Every command accepts `--json`:
163
+ - **Results** go to stdout as one JSON object: `{"status":"ok","data":…}` or `{"status":"fail","error":{…}}`.
164
+ - **Progress messages** go to stderr.
165
+ - **Exit codes** are stable. See [docs/troubleshooting.md](docs/troubleshooting.md#exit-codes).
166
+
167
+ ```bash
168
+ fmusic --json generate "calm piano, 70 bpm" --instrumental | jq '.data.clips[].files'
169
+ ```
170
+
171
+ Agents working *on* this repository should read [AGENTS.md](AGENTS.md).
172
+
173
+ ---
174
+
175
+ ## Where files go
176
+
177
+ By default, songs are saved to `~/Music/flowmusic-cli/<date>/`. Use `-o DIR` to choose a folder; the files then go directly in it. Each clip produces:
178
+
179
+ ```text
180
+ neon-drift_3e2b2139.wav # audio (or .m4a with --format m4a; both with --format both)
181
+ neon-drift_3e2b2139.json # title, duration, sound prompt, lyrics, ids, URLs
182
+ neon-drift_3e2b2139.jpg # cover art (only with --cover)
183
+ ```
184
+
185
+ ## Configuration
186
+
187
+ All settings are optional environment variables.
188
+
189
+ | Variable | Default | Purpose |
190
+ |---|---|---|
191
+ | `FMUSIC_PROFILE` | `default` | Which saved account to use |
192
+ | `FMUSIC_OUTPUT_DIR` | `~/Music/flowmusic-cli` | Where downloads go |
193
+ | `FMUSIC_HOME` | OS user-data dir | Where sessions are stored |
194
+ | `FMUSIC_TIMEOUT` | `60` | HTTP timeout in seconds |
195
+
196
+ ## Troubleshooting
197
+
198
+ The most common issues:
199
+
200
+ - **Uploads with vocals fail with "not available in your region".** In some regions, including the EU, Flow Music doesn't allow uploading tracks with vocals or removing vocals from them. Upload instrumentals instead.
201
+ - **`Session expired` (exit code 3).** Run `fmusic auth login` again.
202
+ - **Google won't let you sign in.** Make sure Chrome or Edge is installed. You can also use `fmusic auth import` instead.
203
+
204
+ Everything else is in **[docs/troubleshooting.md](docs/troubleshooting.md)**.
205
+
206
+ ---
207
+
208
+ ## Documentation
209
+
210
+ | Doc | For |
211
+ |---|---|
212
+ | [docs/commands.md](docs/commands.md) | Every command, flag and JSON shape |
213
+ | [docs/mcp.md](docs/mcp.md) | MCP tools and client setup |
214
+ | [docs/troubleshooting.md](docs/troubleshooting.md) | Errors, exit codes, fixes |
215
+ | [docs/how-it-works.md](docs/how-it-works.md) | Architecture and the flowmusic.app API |
216
+ | [AGENTS.md](AGENTS.md) | Contributors and coding agents |
217
+ | [llms.txt](llms.txt) | A compact summary for LLMs |
218
+
219
+ ## Contributing
220
+
221
+ Issues and pull requests are welcome. See [AGENTS.md](AGENTS.md) for the layout and test commands:
222
+
223
+ ```bash
224
+ uv run --extra dev pytest
225
+ ```
226
+
227
+ The sign-in approach is inspired by [gflow-cli](https://github.com/ffroliva/gflow-cli). MIT licensed.
@@ -0,0 +1,197 @@
1
+ # flowmusic-cli
2
+
3
+ **Make music with Google Flow Music (Lyria) from your terminal, your scripts, or your AI agent.**
4
+
5
+ `fmusic` is a command-line client and MCP server for [flowmusic.app](https://www.flowmusic.app). You sign in once with your own Google account. After that it works without a browser: you describe a song, and a few minutes later you have a WAV file plus a JSON file with its details.
6
+
7
+ <!-- MCP registry ownership verification: do not remove -->
8
+ mcp-name: io.github.JvanLeeuwen4/flowmusic-cli
9
+
10
+ > [!IMPORTANT]
11
+ > **Unofficial project.** It is not affiliated with, endorsed by, or supported by Google. It uses the same endpoints as the flowmusic.app website, so it can break when the site changes. You use your own account and credits. Follow the Flow Music [terms](https://policies.google.com/terms) and the [generative AI use policy](https://policies.google.com/terms/generative-ai/use-policy), and don't use it for spam or mass generation.
12
+
13
+ ---
14
+
15
+ ## Quick start
16
+
17
+ ```bash
18
+ uv tool install flowmusic-cli # 1. install (or: pipx install flowmusic-cli)
19
+ fmusic auth login # 2. a browser opens once: sign in with Google
20
+ fmusic generate "dreamy synthwave, airy female vocals, 100 bpm" # 3. make a song
21
+ ```
22
+
23
+ Example output:
24
+
25
+ ```text
26
+ ♪ take 1 (audio__create_song) Dreamy synthwave, airy female vocals, lush pads, 100 bpm
27
+ queued "Neon Drift" 3e2b2139-… (~35s)
28
+ ✓ rendered "Neon Drift"
29
+ ⬇ ~/Music/flowmusic-cli/2026-11-04/neon-drift_3e2b2139.wav
30
+ Neon Drift 1:44 3e2b2139-2783-4171-a2b4-a51d03bc4504
31
+ continue with: fmusic chat 13001945-… "…"
32
+ ```
33
+
34
+ **What you need:**
35
+ - Python 3.10+, via [uv](https://docs.astral.sh/uv/) or pipx.
36
+ - Google Chrome or Edge, for the one-time sign-in.
37
+ - A Google account with Flow Music access. A Google AI subscription gives the most credits.
38
+
39
+ ---
40
+
41
+ ## What you can do
42
+
43
+ | I want to… | Command |
44
+ |---|---|
45
+ | Make a song from a description | `fmusic generate "folk ballad about the sea, male vocals"` |
46
+ | Use my own lyrics | `fmusic generate "upbeat k-pop" --lyrics lyrics.txt` |
47
+ | Make an instrumental | `fmusic generate "lofi beat, 80 bpm" --instrumental` |
48
+ | Change a song I just made | `fmusic chat <conversation_id> "make it faster, add a bridge"` |
49
+ | Restyle my own audio | `fmusic generate "turn this into a jazz trio" --audio demo.mp3` |
50
+ | Split a song into stems | `fmusic stems <clip_id>` (vocals, drums, bass, other) |
51
+ | See my songs | `fmusic clips list` |
52
+ | Download, rename or delete songs | `fmusic clips download/rename/delete <clip_id>` |
53
+ | Check my credits | `fmusic credits` |
54
+
55
+ The full reference for every command and flag is in **[docs/commands.md](docs/commands.md)**.
56
+
57
+ ### How generation works
58
+
59
+ Flow Music has an AI **co-producer**. Your prompt goes to it, and it decides what to make: often one or two *takes*. It rewrites your prompt into a detailed "sound prompt" and may suggest next steps. Each generation belongs to a **conversation**, and `fmusic chat <conversation_id> "…"` continues that conversation, for example to tweak, extend or remix a take.
60
+
61
+ If you want exact control without the co-producer, use the **experimental** `--direct` mode. Your prompt goes to the song model as-is, and `-n` sets the number of takes:
62
+
63
+ ```bash
64
+ fmusic generate "minimal techno, 126 bpm, hypnotic" --direct -n 2 --title "Night Drive"
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Install
70
+
71
+ | Method | Command |
72
+ |---|---|
73
+ | uv (recommended) | `uv tool install flowmusic-cli` |
74
+ | pipx | `pipx install flowmusic-cli` |
75
+ | Latest from GitHub | `uv tool install git+https://github.com/JvanLeeuwen4/flowmusic-cli` |
76
+ | Update | `uv tool upgrade flowmusic-cli` |
77
+
78
+ The package installs two equivalent commands, `fmusic` and `flowmusic`.
79
+
80
+ ## Sign in
81
+
82
+ ```bash
83
+ fmusic auth login # opens Chrome/Edge: sign in with Google; the window closes by itself
84
+ fmusic auth status # shows email, subscription tier, credits (exit code 0 = OK)
85
+ fmusic auth logout
86
+ ```
87
+
88
+ - You sign in once. Tokens refresh automatically, so you won't need to sign in again unless you log out or the session is revoked.
89
+ - To use several accounts, add `--profile work` (or set `FMUSIC_PROFILE=work`) to any command.
90
+ - **Can't open a browser** (for example on a server)? Sign in on flowmusic.app on another machine. In the browser's DevTools, open the Network tab and copy the `Cookie` header of any `__api` request. Then run:
91
+ ```bash
92
+ fmusic auth import "sb-sb-auth-token.0=base64-…; sb-sb-auth-token.1=…"
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Use it from AI agents
98
+
99
+ `fmusic` is built to be driven by agents. There are three ways:
100
+
101
+ ### 1. Claude Code plugin (skill + MCP server)
102
+
103
+ ```text
104
+ /plugin marketplace add JvanLeeuwen4/flowmusic-cli
105
+ /plugin install fmusic@flowmusic-cli
106
+ ```
107
+
108
+ Then run `fmusic auth login` once in a terminal. The plugin starts the MCP server through `uvx`, so you don't need to install anything else.
109
+
110
+ ### 2. Any MCP client (Claude Desktop, Cursor, VS Code, Codex, …)
111
+
112
+ Add this to the client's MCP configuration. It only needs [uv](https://docs.astral.sh/uv/):
113
+
114
+ ```json
115
+ {
116
+ "mcpServers": {
117
+ "fmusic": { "command": "uvx", "args": ["--from", "flowmusic-cli", "fmusic", "mcp", "run"] }
118
+ }
119
+ }
120
+ ```
121
+
122
+ If `fmusic` is already installed, this command writes the config for you:
123
+
124
+ ```bash
125
+ fmusic mcp setup --target claude-code # or: claude-desktop, print
126
+ ```
127
+
128
+ The tools and their parameters are listed in **[docs/mcp.md](docs/mcp.md)**.
129
+
130
+ ### 3. The CLI with `--json`
131
+
132
+ Every command accepts `--json`:
133
+ - **Results** go to stdout as one JSON object: `{"status":"ok","data":…}` or `{"status":"fail","error":{…}}`.
134
+ - **Progress messages** go to stderr.
135
+ - **Exit codes** are stable. See [docs/troubleshooting.md](docs/troubleshooting.md#exit-codes).
136
+
137
+ ```bash
138
+ fmusic --json generate "calm piano, 70 bpm" --instrumental | jq '.data.clips[].files'
139
+ ```
140
+
141
+ Agents working *on* this repository should read [AGENTS.md](AGENTS.md).
142
+
143
+ ---
144
+
145
+ ## Where files go
146
+
147
+ By default, songs are saved to `~/Music/flowmusic-cli/<date>/`. Use `-o DIR` to choose a folder; the files then go directly in it. Each clip produces:
148
+
149
+ ```text
150
+ neon-drift_3e2b2139.wav # audio (or .m4a with --format m4a; both with --format both)
151
+ neon-drift_3e2b2139.json # title, duration, sound prompt, lyrics, ids, URLs
152
+ neon-drift_3e2b2139.jpg # cover art (only with --cover)
153
+ ```
154
+
155
+ ## Configuration
156
+
157
+ All settings are optional environment variables.
158
+
159
+ | Variable | Default | Purpose |
160
+ |---|---|---|
161
+ | `FMUSIC_PROFILE` | `default` | Which saved account to use |
162
+ | `FMUSIC_OUTPUT_DIR` | `~/Music/flowmusic-cli` | Where downloads go |
163
+ | `FMUSIC_HOME` | OS user-data dir | Where sessions are stored |
164
+ | `FMUSIC_TIMEOUT` | `60` | HTTP timeout in seconds |
165
+
166
+ ## Troubleshooting
167
+
168
+ The most common issues:
169
+
170
+ - **Uploads with vocals fail with "not available in your region".** In some regions, including the EU, Flow Music doesn't allow uploading tracks with vocals or removing vocals from them. Upload instrumentals instead.
171
+ - **`Session expired` (exit code 3).** Run `fmusic auth login` again.
172
+ - **Google won't let you sign in.** Make sure Chrome or Edge is installed. You can also use `fmusic auth import` instead.
173
+
174
+ Everything else is in **[docs/troubleshooting.md](docs/troubleshooting.md)**.
175
+
176
+ ---
177
+
178
+ ## Documentation
179
+
180
+ | Doc | For |
181
+ |---|---|
182
+ | [docs/commands.md](docs/commands.md) | Every command, flag and JSON shape |
183
+ | [docs/mcp.md](docs/mcp.md) | MCP tools and client setup |
184
+ | [docs/troubleshooting.md](docs/troubleshooting.md) | Errors, exit codes, fixes |
185
+ | [docs/how-it-works.md](docs/how-it-works.md) | Architecture and the flowmusic.app API |
186
+ | [AGENTS.md](AGENTS.md) | Contributors and coding agents |
187
+ | [llms.txt](llms.txt) | A compact summary for LLMs |
188
+
189
+ ## Contributing
190
+
191
+ Issues and pull requests are welcome. See [AGENTS.md](AGENTS.md) for the layout and test commands:
192
+
193
+ ```bash
194
+ uv run --extra dev pytest
195
+ ```
196
+
197
+ The sign-in approach is inspired by [gflow-cli](https://github.com/ffroliva/gflow-cli). MIT licensed.