Skip to main content
Glama
darktable-mcp
by w1ne

Darktable MCP 服务器

一个模型上下文协议 (MCP) 服务器,使 Claude 和其他 AI 助手能够控制 darktable 进行照片管理和编辑。

功能特性

  • 照片库管理:浏览、评分、导入和整理照片

  • 基础照片编辑:调整曝光、应用预设、裁剪图像

  • 批量操作:高效处理多张照片

  • 安全集成:使用 darktable 官方 Lua API

  • 简易安装:一键安装

Related MCP server: darktable-mcp

安装

pip install darktable-mcp

配置

添加到您的 Claude Desktop 配置文件 (~/.claude_desktop_config.json) 中:

{
  "mcpServers": {
    "darktable": {
      "command": "python",
      "args": ["-m", "darktable_mcp"]
    }
  }
}

使用示例

为您的最佳照片评分:

"Claude,将我上周的风景照评为 4 星"

批量照片编辑:

"Claude,将所有曝光不足的日落照片的曝光度调高 +0.5"

智能整理:

"Claude,从我的相机导入照片并按日期整理"

要求

  • Python 3.8+

  • darktable 4.0+

  • Claude Desktop 或兼容的 MCP 客户端

可用工具

  • view_photos() - 使用过滤器浏览照片库

  • rate_photos() - 应用星级评分 (1-5)

  • import_batch() - 从目录导入

  • adjust_exposure() - 修改曝光设置

  • apply_preset() - 应用编辑预设

  • export_images() - 导出为各种格式

贡献

欢迎贡献!请阅读我们的贡献指南。

许可证

MIT 许可证 - 详情请参阅 LICENSE 文件。

关键词

darktable, MCP, 模型上下文协议, 照片编辑, RAW 处理, 批量处理, AI 照片管理, Claude, 摄影工作流

Available Tools

10 tools
apply_presetA

Apply a darktable style (preset) to one or more photos. The preset_name must exactly match a style name from list_styles. Returns counts of applied and missed photos. Requires darktable to be running with the darktable-mcp Lua plugin installed.

Inputs: photo_ids (required), preset_name (required).

apply_ratings_batchA

Write XMP sidecars (xmp:Rating) for a batch of {stem: rating} pairs. Each sidecar sits next to its raw file at .xmp and is picked up automatically by darktable on import. Rating range: -1 (reject), 0 (unrated), 1-5 (stars). Each rating is also appended to <source_dir>/ratings.jsonl for replay/audit. An existing sidecar is never replaced: only its rating value is rewritten, so darktable edit history survives. A sidecar with no recognisable rating is skipped with an error rather than overwritten.

Inputs: ratings (required), source_dir (required), log, force.

export_imagesA

Export photos to JPEG/PNG/TIFF via darktable-cli. Pass absolute file paths in photo_ids — the path field from view_photos drops in directly. Output names are de-collided: two sources sharing a stem (e.g. DSC_0001.NEF from two folders) get suffixed names rather than overwriting each other, so do not assume the written file is .. Read the real path from the output field of the .export_images.jsonl side file.

Inputs: format (required), photo_ids (required), output_path (required), quality, +2 more.

extract_previewsA

Extract auto-rotated JPEG previews from a directory of raw files (NEF/CR2/ARW/DNG/etc) for vision-based rating. Each preview is rotated upright via EXIF orientation and resized to max_dim (default 1024). A smaller thumb_dim (default 384) is also written for token-efficient first-pass culling. Returns a list of items with preview paths plus an EXIF summary (ISO, shutter, focal, aperture, datetime) per file. The scan is recursive, and the output tree mirrors the source tree, so raws with the same filename in different subdirectories get distinct previews. Read the preview path from each item rather than assuming <output_dir>/.jpg.

Inputs: source_dir (required), max_dim, overwrite, thumb_dim, +2 more.

import_batchA

Register a folder as a film roll in the user's darktable library. Useful when you've copied photos from a card or external drive and want darktable to know about them. Returns the count of newly-imported photos. Requires darktable to be running with the darktable-mcp Lua plugin installed.

Inputs: source_path (required), recursive.

import_from_cameraA

Use when a camera or memory card is physically connected. Detects the camera via libgphoto2 and copies all photos to a local directory, then returns the destination path. Copying alone does not put the photos in the library: follow up with import_batch on that destination path to register them as a film roll. Files are written one subdirectory per camera folder or card, prefixed with the camera's identity (e.g. /Nikon_D850_sn_30014567_store_00010001_DCIM_100NCD80/DSC_0001.NEF), because camera filenames repeat across folders, across the two cards of a dual-slot body, and across bodies importing into the same destination. Import the destination recursively. A file that would collide with a different photo already on disk is kept alongside it as -2., never overwritten. This holds for two bodies of the same model that report no serial number and therefore share a subdirectory: before skipping files a destination appears to already hold, such a camera is asked for a small sample of them and the bytes are compared, so a second body's photos are kept rather than dropped. Re-running is cheap: a body with a serial number transfers nothing it already delivered. Any file the card lists that does not reach the destination is reported by name. Cost: this tool runs to completion synchronously and does not return early. A full card can take many minutes, up to the 1 hour default timeout, which is longer than most MCP clients wait for a single request. Progress is observable while it runs by tailing the .import.log file in the destination directory.

Inputs: camera_port, destination, timeout_seconds.

list_stylesA

List all darktable styles (presets) installed on the user's system. Returns name and description for each. Required discovery step before calling apply_preset, since style names must match exactly. Requires darktable to be running with the darktable-mcp Lua plugin installed.

Inputs: no named parameters.

open_in_darktableA

Launch the darktable GUI on a folder. The folder is registered as a film roll on first launch and XMP sidecars are picked up automatically. The lighttable opens already filtered via the official darktable.gui.libs.collect.filter Lua API for any rating spec: exact rating=N, rating_min=N (>=), rating_max=N (<=), arbitrary rating_min..rating_max inner ranges, or no filter at all.

Inputs: source_dir (required), rating, rating_max, rating_min, +1 more.

rate_photosB

Apply a star rating to one or more photos in the user's darktable library. Requires darktable to be running with the darktable-mcp Lua plugin installed.

Inputs: rating (required), photo_ids (required).

view_photosA

Browse photos in the user's darktable library. Filter by filename substring, minimum star rating, or both. Returns id, filename, absolute file path, and rating per match — the path can be passed straight into export_images. Requires darktable to be running with the darktable-mcp Lua plugin installed (see darktable-mcp install-plugin).

Inputs: limit, filter, rating_min.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools map cleanly to a distinct resource+action (import, browse, rate, style, export, preview, GUI launch). The one genuine overlap is rate_photos vs apply_ratings_batch — both write star ratings, one via the running darktable library and one via XMP sidecars for pre-import files — and view_photos vs extract_previews both surface photos, though the rich descriptions clarify the library-browsing vs file-preview distinction.

    Naming Consistency4/5

    All tools are snake_case and verb-first, following a readable verb_noun convention (view_photos, list_styles, export_images, extract_previews). Minor deviations: import_from_camera and open_in_darktable use prepositional phrases, and the 'batch' suffix appears in both import_batch and apply_ratings_batch with slightly different grammatical roles, but the overall pattern stays predictable.

    Tool Count5/5

    Ten tools is well-scoped for the domain: two import paths, library browsing, two rating mechanisms, style discovery/application, preview extraction, export, and GUI launch. Each tool occupies a distinct step in the photo-management workflow and none feels like filler.

    Completeness4/5

    The end-to-end pipeline is covered: copy from camera → register film roll → browse → rate → apply style → export, plus an alternative XMP-sidecar rating path that darktable picks up on launch. Missing operations like metadata editing, style creation, photo deletion, and richer library search (tags, dates) are workable gaps rather than dead ends.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI agents to control Adobe Lightroom Classic on macOS for professional photo editing and catalog management. It allows users to inspect photos, apply develop settings, and automate workflows through a secure local bridge without direct catalog database manipulation.
      59
      5
      MIT
    • A
      license
      C
      quality
      C
      maintenance
      Enables AI agents to control Adobe Lightroom Classic develop settings, manage presets and catalogs, and perform round-trip handoffs with Adobe Photoshop for advanced retouching. Provides native socket bridging for exposure, color grading, search, ratings, keywords, collections, and export workflows.
      40
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to drive Adobe Lightroom Classic directly — searching and organizing catalogs, reading and writing the full set of develop parameters, building geometric and AI-generated masks (sky, subject, mountains, water, people), applying presets, and rendering previews, histograms, and exports. All capabilities are exposed as 167 MCP tools over a Lua plugin bridge, with write-confirmation sentinels so silently dropped edits surface as explicit errors.
      Apache 2.0