Immich Photo Library (via claw2immich)
Work with your Immich photo library via the claw2immich MCP server. Search by people, dates, locations, and albums. Download photos via shared links or inline base64. 249 tools available from the full Immich OpenAPI spec.
Prerequisites
- - Immich instance running (https://immich.app)
- claw2immich MCP server installed and running
- Repository: https://github.com/JoeRu/claw2immich
- Follow setup instructions in the repo README
- - MCP server configured in
config/mcporter.json:
CODEBLOCK0
Key Tools
| Tool | Description |
|---|
| INLINECODE1 | Metadata search (date, people, location, etc.) |
| INLINECODE2 |
CLIP-based natural language search |
|
immich_searchperson | Find person by name |
|
immich_getassetinfo | Get full asset details including
web_url |
|
immich_viewasset | Get thumbnail/preview as base64 (WebP) |
|
downloadAsset | Download asset via shared link (default) or inline base64 |
|
immich_getallpeople | List all people |
|
immich_getallalbums | List all albums |
|
immich_createsharedlink | Create shared link for album/assets |
|
tool_access_report | Check which tools are available |
Quick Start
Find people by name
CODEBLOCK1
Search photos with multiple people (AND logic)
CODEBLOCK2
CLIP smart search (natural language)
CODEBLOCK3
Get asset info (includes web_url)
CODEBLOCK4
Download a photo (shared link)
mcporter call immich downloadAsset asset_id=<asset-uuid>
Returns a short-lived shared link (30 min, no auth needed).
Get thumbnail for display
mcporter call immich immich_viewasset path_id=<asset-uuid> query_size=thumbnail
Returns
{encoding: "base64", content_type: "image/webp", size_bytes: ..., data: "..."}.
Web URLs
Tool responses for assets, albums, people, and places include a web_url field:
- - Assets: INLINECODE14
- Albums: INLINECODE15
- People: INLINECODE16
This requires IMMICH_EXTERNAL_DOMAIN to be configured on the server.
Common Workflows
"Show me recent photos of X and Y together"
- 1. Find person IDs:
CODEBLOCK7
- 2. Search photos (AND logic):
CODEBLOCK8
- 3. Display a photo:
mcporter call immich immich_viewasset path_id=<asset-id> query_size=thumbnail
Decode base64 data, save as .webp, send to user.
"Find vacation photos from summer 2024"
CODEBLOCK10
"Download a photo"
CODEBLOCK11
Response:
CODEBLOCK12
The shared link can be sent directly to users — no auth required.
Displaying photos in chat
- 1. Get thumbnail via
immich_viewasset (query_size=thumbnail, typically < 30KB) - Decode the base64
data field - Save as
.webp file - Send via messaging tool
Note: preview size may exceed the 64KB MCP transport limit. Use thumbnail for reliable delivery.
Key Parameters
immich_searchassets (POST /api/search/assets)
Filtering:
- -
body_personIds: ["uuid1", "uuid2"] — Photos with these people (AND) - INLINECODE24 — Filter by city
- INLINECODE25 — Filter by country
- INLINECODE26 — Minimum date
- INLINECODE27 — Maximum date
- INLINECODE28 — Only favorites
- INLINECODE29 — Filter by albums
Sorting & Pagination:
- -
body_order: "desc" — Newest first - INLINECODE31 — Oldest first
- INLINECODE32 — Limit results
- INLINECODE33 — Page number
immich_searchsmart (POST /api/search/smart)
- -
body_query: "string" — Natural language query (CLIP-based) - INLINECODE35 — Limit results
- Same filter parameters as searchassets
downloadAsset
- -
asset_id: "uuid" — Asset to download
Delivery mode is controlled server-side via IMMICH_DOWNLOAD_ASSET_DELIVERY:
- -
shared_link (default): Returns a tokenized shared link (30 min TTL, no auth) - INLINECODE39 : Returns base64-encoded file data (limited by 64KB transport)
- INLINECODE40 : Returns direct Immich URL (requires auth)
immich_viewasset (GET /api/assets/{id}/thumbnail)
- -
path_id: "uuid" — Asset ID - INLINECODE42 — Image size
Returns structured base64 response. Use thumbnail to stay under transport limits.
Important Patterns
Multi-Person Search (AND)
✅
Correct: Array in
body_personIds
{"body_personIds": ["person-1", "person-2"]}
❌
Wrong: Separate calls (that's OR, not AND)
Parameter Prefixes
All OpenAPI tool parameters use prefixes:
- -
path_<name> — Path parameters - INLINECODE46 — Query parameters
- INLINECODE47 — Body parameters (for POST endpoints)
Date Filtering
Always use ISO 8601: INLINECODE48
64KB Transport Limit
MCP responses are truncated at 64KB. This affects:
- -
downloadAsset with inline_base64 mode (use shared_link instead) - INLINECODE52 with
query_size=preview (use thumbnail instead) - Large search results (reduce
body_size)
Access Profiles
Set IMMICH_PROFILE on the server to restrict tools:
- -
read_only — Only GET endpoints (search, browse) - INLINECODE58 — Read + write (upload, update, delete)
- INLINECODE59 — Everything including admin
Use tool_access_report to check available tools.
Troubleshooting
No results with multiple people:
- - Verify person IDs (search each person first)
- Add
body_isArchived: false if photos might be archived
downloadAsset returns error:
- - Check
tool_access_report for permissions - Shared link creation requires write access to shared-links API
Thumbnail too large:
- - Use
query_size=thumbnail instead of INLINECODE64 - Thumbnails are typically 5-25 KB (WebP)
MCP call fails:
- - Verify server is running: INLINECODE65
- Check config: INLINECODE66
Reference
- - Immich: https://immich.app
- claw2immich: https://github.com/JoeRu/claw2immich
- Immich API docs: https://immich.app/docs/api/
Immich 照片库(通过 claw2immich)
通过 claw2immich MCP 服务器操作您的 Immich 照片库。按人物、日期、地点和相册进行搜索。通过共享链接或内联 base64 下载照片。完整 Immich OpenAPI 规范提供 249 个工具。
前提条件
- - Immich 实例 正在运行 (https://immich.app)
- claw2immich MCP 服务器 已安装并运行
- 仓库:https://github.com/JoeRu/claw2immich
- 按照仓库 README 中的设置说明操作
- - 在 config/mcporter.json 中配置 MCP 服务器:
json
{
mcpServers: {
immich: {
baseUrl: http://your-claw2immich-host:port/sse
}
}
}
关键工具
| 工具 | 描述 |
|---|
| immichsearchassets | 元数据搜索(日期、人物、地点等) |
| immichsearchsmart |
基于 CLIP 的自然语言搜索 |
| immich_searchperson | 按姓名查找人物 |
| immich
getassetinfo | 获取完整资产详情,包括 weburl |
| immich_viewasset | 获取缩略图/预览图(base64 编码,WebP 格式) |
| downloadAsset | 通过共享链接(默认)或内联 base64 下载资产 |
| immich_getallpeople | 列出所有人物 |
| immich_getallalbums | 列出所有相册 |
| immich_createsharedlink | 为相册/资产创建共享链接 |
| tool
accessreport | 检查哪些工具可用 |
快速入门
按姓名查找人物
mcporter call immich immichsearchperson queryname=Maria
搜索包含多人的照片(AND 逻辑)
mcporter call immich immich_searchassets \
body_personIds=[person-uuid-1,person-uuid-2] \
bodyorder=desc bodysize=10
CLIP 智能搜索(自然语言)
mcporter call immich immich_searchsmart \
bodyquery=sunset at the beach bodysize=5
获取资产信息(包含 web_url)
mcporter call immich immichgetassetinfo pathid=
下载照片(共享链接)
mcporter call immich downloadAsset asset_id=
返回一个短期有效的共享链接(30 分钟,无需认证)。
获取缩略图用于显示
mcporter call immich immichviewasset pathid= query_size=thumbnail
返回 {encoding: base64, contenttype: image/webp, sizebytes: ..., data: ...}。
Web URL
资产、相册、人物和地点的工具响应中包含 web_url 字段:
- - 资产:https:///photos/
- 相册:https:///albums/
- 人物:https:///people/
这需要在服务器上配置 IMMICHEXTERNALDOMAIN。
常见工作流程
显示我和 X 和 Y 最近在一起的照片
- 1. 查找人物 ID:
mcporter call immich immichsearchperson queryname=Alice
mcporter call immich immichsearchperson queryname=Bob
- 2. 搜索照片(AND 逻辑):
mcporter call immich immich_searchassets \
body_personIds=[alice-id,bob-id] \
bodyorder=desc bodysize=10
- 3. 显示照片:
mcporter call immich immichviewasset pathid= query_size=thumbnail
解码 base64 数据,保存为 .webp 文件,发送给用户。
查找 2024 年夏天的度假照片
mcporter call immich immich_searchassets \
body_createdAfter=2024-06-01T00:00:00Z \
body_createdBefore=2024-08-31T23:59:59Z \
bodycity=Barcelona bodyorder=desc
下载一张照片
mcporter call immich downloadAsset asset_id=
响应:
json
{
deliverymode: sharedlink,
download_url: https://immich.example.com/share/,
expiresinminutes: 30,
requires_auth: false
}
共享链接可以直接发送给用户——无需认证。
在聊天中显示照片
- 1. 通过 immichviewasset 获取缩略图(querysize=thumbnail,通常小于 30KB)
- 解码 base64 的 data 字段
- 保存为 .webp 文件
- 通过消息工具发送
注意: preview 大小可能超过 64KB 的 MCP 传输限制。请使用 thumbnail 以确保可靠传输。
关键参数
immich_searchassets (POST /api/search/assets)
过滤:
- - bodypersonIds: [uuid1, uuid2] — 包含这些人物的照片(AND)
- bodycity: string — 按城市过滤
- bodycountry: string — 按国家过滤
- bodycreatedAfter: ISO8601 — 最小日期
- bodycreatedBefore: ISO8601 — 最大日期
- bodyisFavorite: boolean — 仅收藏
- body_albumIds: [uuid] — 按相册过滤
排序与分页:
- - bodyorder: desc — 最新优先
- bodyorder: asc — 最旧优先
- bodysize: number — 限制结果数
- bodypage: number — 页码
immich_searchsmart (POST /api/search/smart)
- - bodyquery: string — 自然语言查询(基于 CLIP)
- bodysize: number — 限制结果数
- 与 searchassets 相同的过滤参数
downloadAsset
- - asset_id: uuid — 要下载的资产
传输模式由服务器端通过 IMMICHDOWNLOADASSET_DELIVERY 控制:
- - sharedlink(默认):返回带令牌的共享链接(30 分钟 TTL,无需认证)
- inlinebase64:返回 base64 编码的文件数据(受 64KB 传输限制)
- immich_link:返回直接的 Immich URL(需要认证)
immich_viewasset (GET /api/assets/{id}/thumbnail)
- - pathid: uuid — 资产 ID
- querysize: thumbnail|preview — 图片大小
返回结构化的 base64 响应。使用 thumbnail 以保持在传输限制内。
重要模式
多人搜索(AND)
✅
正确: 在 body_personIds 中使用数组
json
{body_personIds: [person-1, person-2]}
❌ 错误: 分开调用(那是 OR,不是 AND)
参数前缀
所有 OpenAPI 工具参数使用前缀:
- - path — 路径参数
- query — 查询参数
- body_ — 主体参数(用于 POST 端点)
日期过滤
始终使用 ISO 8601:2024-01-15T00:00:00Z
64KB 传输限制
MCP 响应在 64KB 处截断。这会影响:
- - 使用 inlinebase64 模式的 downloadAsset(改用 sharedlink)
- 使用 querysize=preview 的 immichviewasset(改用 thumbnail)
- 大型搜索结果(减少 body_size)
访问配置文件
在服务器上设置 IMMICH_PROFILE 以限制工具:
- - readonly — 仅 GET 端点(搜索、浏览)
- readwrite — 读取 + 写入(上传、更新、删除)
- full_scope — 包括管理员在内的所有功能
使用 toolaccessreport 检查可用工具。
故障排除
多人搜索无结果:
- - 验证人物 ID(先单独搜索每个人)
- 如果照片可能被归档,添加 body_isArchived: false
downloadAsset 返回错误:
- - 检查 toolaccessreport 的权限
- 创建共享链接需要对共享链接 API 具有写入权限
缩