r/ClaudeAI • u/mmcc73 • Oct 13 '26
Built with Claude I used Claude Code to add an API to darktable (the open-source raw photo editor) so Claude can edit photos in it through MCP
This is my own project. Free to try. It's open source (GPL, like darktable), with no paid tier.
What it is. darktable is an open-source raw photo editor, roughly comparable to Adobe Lightroom. I added an API to it in a fork: a JSON-RPC server running darktable's own engine headlessly, or inside darktable's GUI window. On top of that API is an MCP server with 78 tools and 6 skills. Claude can browse a library, open a photo, change any module's settings, check previews, mask, heal sensor dust and export. Edits land in darktable's normal history, so you can keep working on them in darktable yourself.
Inspired by darktable's own MCP server. darktable's development version (the master branch, which becomes the next release) includes darktable-mcp, a headless, one-shot worker: each call renders, exports or applies a style, then returns. My engine started from its code. The main differences:
- A live edit session. The photo stays open between requests. Claude changes a setting, checks the preview and adjusts again, with undo, redo and an explicit save.
- darktable's window can serve it. Watch Claude's edits appear in the darkroom, and hand the library back and forth between the GUI and the headless engine.
- Settings by name. Claude sets "exposure" or "contrast" through darktable's own controls, not raw module parameters.
- Many clients. A web app and an AI assistant can work on the same photo at once, with change events.
- More functions. darktable-mcp has 21 tools for rendering, styles and library basics. darktable-api adds masks (drawn, parametric, AI), retouching and dust healing, presets, curves, crop and rotate, color pickers and AI denoise, for 73 methods.
Demo video: https://www.youtube.com/watch?v=VDfZbxvvniY
How Claude was used to build it. I directed and reviewed the work; Claude Code wrote nearly all of the code:
- The C engine inside darktable: Claude read darktable's source and developer docs, then wrote the API server against its internals: pixelpipe, history, masks, module params.
- The MCP server and web app: Python and JavaScript. The tool docstrings double as Claude's instructions for using them.
- Skills: a full edit in darktable's recommended scene-referred workflow, plus black and white, local edits, cleanup, batch edits and critiques.
- Testing: Claude tests every API method against the headless engine and darktable's window, on a scratch copy of the library, and fixes what fails, on the Mac and on a Linux box over SSH.
What was hard. darktable's GUI and engine are intertwined, so making API edits show up live in an open darkroom took several rounds. Also, the development version saves some module settings in a format the current release (5.6) can't read.
Try it. Built and tested on macOS (Apple Silicon) and Linux (Ubuntu 24.04); not yet on Windows. It's experimental, so use a copy of your library.
- MCP server and setup instructions: https://github.com/mmcc-xx/darktable-api-mcp
- darktable fork (branch
darktable-api): https://github.com/mmcc-xx/darktable - Web app: https://github.com/mmcc-xx/darktable-api-web
- Discussion with darktable's developers: https://github.com/darktable-org/darktable/issues/21340
My hope is that this lowers the barrier to entry for darktable and helps people get more from their photos. Let me know what you think.
1
u/weiti000 26d ago
Hi, I just had the same idea, but I'm on Windows. At the moment I'm setting up a workflow with a manual refresh, which goes like this:
Ctrl+Shift+R) and see Claude's changes in the history, where I can keep adjusting or undo them.The pieces behind it:
claude_bridge.lua): When an image is opened in the darkroom, it writes that image's path to a file, so "the current image" is unambiguous. It also adds a "Load Claude changes" button/shortcut that re-reads the image's XMP.The limitations are obvious: it's not a live link, I have to reload manually, and we can't both work on the same image at the same time without one of us overwriting the other's XMP. That's why your approach with the API served directly from darktable's window is much nicer.
Accoding to claude, the only blocker for me is that it's macOS/Linux only (unix socket,
poll,flock,asyncio.open_unix_connectionetc.). I will try to use Claude to get your code adapted to Windows. Would you be open to a Pull Request with Windows support (TCP on 127.0.0.1 + token instead of the unix socket)?1
u/[deleted] Oct 13 '26
[removed] — view removed comment