httpx.AsyncClient rejects requests whose body stream is a sync IteratorByteStream. That stream is what httpx builds whenever you pass data as a list of tuples, even when files are present. Convert data to a dict before delegating to httpx (duplicate keys collapse to a list value, which httpx still encodes correctly). The presigned S3 upload URL embeds its own signature in the query string and returns InvalidArgument: Unsupported Authorization Type if any extra Authorization header tags along. Build the request explicitly and drop the client-wide Basic auth header before sending whenever url_override is set. Tested end-to-end against BookFusion via the calibre-web-automated proxy. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| .env.example | ||
| docker-compose.yml | ||
| Dockerfile | ||
| README.md | ||
Deploy on /Volumes/docker/calibre-web-automated/
This folder contains everything needed to run the BookFusion-MCP HTTP service (and its CWA button) as a Docker container next to your existing Calibre-Web-Automated stack on macOS.
1. Get the files onto your Mac
Pick one:
a) git clone (recommended)
cd /Volumes/docker/calibre-web-automated/
git clone --branch claude/add-bookfusion-mcp-ocUTD \
https://github.com/Fguarien/FGU-bookfusion.git bookfusion-mcp
cd bookfusion-mcp
b) Download ZIP
Browse to
https://github.com/Fguarien/FGU-bookfusion/archive/refs/heads/claude/add-bookfusion-mcp-ocUTD.zip,
unzip it, rename the folder to bookfusion-mcp, and move it under
/Volumes/docker/calibre-web-automated/.
2. Configure
cp deploy/.env.example deploy/.env
# then edit deploy/.env and set:
# BOOKFUSION_API_KEY=<your key>
# CALIBRE_LIBRARY_HOST_PATH=/Volumes/docker/calibre-web-automated/library
# BOOKFUSION_MCP_TOKEN=<a random string> (optional but recommended)
# BOOKFUSION_CORS_ORIGINS=http://localhost:8083
3. Start
cd /Volumes/docker/calibre-web-automated/bookfusion-mcp/deploy
docker compose up -d --build
Check it's alive:
curl http://localhost:8765/healthz
You should see {"ok": true, "library_path": "/calibre-library", "book_count": N, ...}.
4. Install the CWA button
- Install Tampermonkey in your browser.
- Open http://localhost:8765/ and click Install userscript.
- Tampermonkey will prompt you to confirm the install.
- If you set a
BOOKFUSION_MCP_TOKEN, open the Tampermonkey menu on any CWA page → BookFusion: set auth token and paste the same token. - Open any book in CWA (URL
/book/<id>). A Sync to BookFusion button appears next to the title, along with the current sync status (on BookFusion / not yet / error).
5. Updating
cd /Volumes/docker/calibre-web-automated/bookfusion-mcp
git pull
cd deploy
docker compose up -d --build
FAQ
Do I have to modify CWA? No. The button is injected by a Tampermonkey userscript running in your browser, so CWA itself is never patched and survives every update.
Can I run this without exposing port 8765?
Yes — the default bind is 127.0.0.1:8765, so it's only reachable from your
Mac. The browser (on the same machine) can still call it.
Can I run the MCP server (for Claude Desktop) from the same image?
Yes: override the command to bookfusion-mcp to get a stdio MCP. Usually
you don't run that in Docker though — Claude Desktop spawns it directly; see
the top-level README for the Claude config snippet.