文档 / 视觉记忆
视

视觉记忆/vision-mcp/mcp

存图时同时生成两样东西:dHash 视觉指纹(64 位,抗缩放和压缩,实测同图缩放 50%、JPEG 压到 q40 后距离仍为 0)和语义向量(百炼 text-embedding-v3,1024 维)。两条路各管一件事——dHash 找「看起来一样」的图,向量找「说的是同一件事」的图。不用装 torch,不用 GPU,4 核 CPU 跑得动。

7 个工具7 天调用 —免费 100 次 / 天 / IP

MCP 客户端接入

一行命令,工具自动出现在 Agent 的工具列表里。

bashclaude mcp add
# Claude Code / Cursor / 任何 MCP 客户端
claude mcp add --transport http mycel-vision https://pianam.cn/vision-mcp/mcp

HTTP 直连

标准 JSON-RPC 2.0。initialize 握手不消耗额度,只有 tools/call 计数。

bash先看有哪些工具
curl -s https://pianam.cn/vision-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

工具清单

7 个工具,参数与返回结构均来自线上真实响应
01

vision_remember

7 个参数

存一张图进视觉记忆。必须提供 description(这张图是什么),它是后续语义检索的唯一依据。会自动生成 dHash 视觉指纹并建语义索引。

入参

参数类型必填默认说明
image_urlstring可选—图片 http(s) 地址,与 image_base64 二选一
image_base64string可选—图片 base64(可带 data:image/...;base64, 前缀)
descriptionstring必填—必填。这张图是什么,越具体越好检索,例如「后台登录页报错弹窗:账号或密码错误」
titlestring可选—短标题,可选
tagsarray<string>可选—标签,便于过滤
sourcestring可选—来源标记,如 screenshot / web / upload
ocr_textstring可选—图中文字(你自己 OCR 后传入,本服务不内置 OCR)
bash直接 curl 调(真实可跑)
curl -s https://pianam.cn/vision-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"vision_remember","arguments":{"image_url":"https://pianam.cn/favicon.ico","description":"网站 favicon:深色圆角方块里的叶子标志,Mycel 品牌图标","title":"Mycel favicon","tags":["brand","logo","ui"],"source":"docs-demo"}}}'
返回示例(线上真实结果) · 199 字符,点开看
jsonstructuredContent
{
  "id": 4,
  "dhash": "00023478c8c0a000",
  "size": [
    48,
    48
  ],
  "bytes": 304,
  "semantic_index": true,
  "duplicate_of": 3,
  "tenant_items": 2,
  "evicted": [],
  "note": "语义向量已建索引"
}

duplicate_of 不为 null 表示库内已有视觉上几乎相同的图(dHash 距离 ≤3),返回的是那条的 id。此时图仍会入库,由你决定要不要删。

02

vision_recall

5 个参数全部可选

按语义描述检索视觉记忆,可叠加时间范围与标签过滤。返回按相关度排序的条目。

入参

参数类型必填默认说明
querystring可选—要找什么,自然语言描述,例如「登录报错的弹窗」
sincestring可选—起始时间,格式 YYYY-MM-DD 或 YYYY-MM-DD HH:MM:SS
untilstring可选—结束时间
tagsstring可选—标签过滤,逗号分隔
limitinteger可选—返回条数,默认 10,最大 50
bash直接 curl 调(真实可跑)
curl -s https://pianam.cn/vision-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"vision_recall","arguments":{"query":"品牌标志 叶子","limit":3}}}'
返回示例(线上真实结果) · 647 字符,点开看
jsonstructuredContent
{
  "query": "品牌标志 叶子",
  "count": 3,
  "items": [
    {
      "id": 5,
      "description": "iOS 主屏图标,同一个叶子标志的 180x180 版本",
      "tags": [
        "brand",
        "ui"
      ],
      "dhash": "02294383367c58a0",
      "size": [
        180,
        180
      ],
      "created_at": "2026-11-26 17:25:19",
      "score": 0.7108
    },
    {
      "id": 4,
      "description": "网站 favicon:深色圆角方块里的叶子标志,Mycel 品牌图标",
      "tags": [
        "brand",
        "logo",
        "ui"
      ],
      "dhash": "00023478c8c0a000",
      "size": [
        48,
        48
      ],
      "created_at": "2026-11-26 17:25:18",
      "score": 0.6832
    }
  ]
}

score 是余弦相似度,1.0 为完全一致。query 留空则退化为按时间倒序列出。embedding 服务不可用时会自动降级成关键词 LIKE 匹配,score 固定 0。此处截断到 2 条,线上返回 3 条。

03

vision_similar

5 个参数全部可选

找视觉上相似的图。用 dHash 汉明距离,零成本。给 item_id 找库内相似项,或直接给图找库内匹配。

入参

参数类型必填默认说明
item_idinteger可选—以库内某条为基准
image_urlstring可选—以外部图片为基准
image_base64string可选—以 base64 图片为基准
thresholdinteger可选—汉明距离上限,默认 10。0-3 几乎相同,4-12 小改动
limitinteger可选—返回条数,默认 10
bash直接 curl 调(真实可跑)
curl -s https://pianam.cn/vision-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"vision_similar","arguments":{"item_id":4,"threshold":40,"limit":3}}}'
返回示例(线上真实结果) · 439 字符,点开看
jsonstructuredContent
{
  "dhash": "00023478c8c0a000",
  "threshold": 40,
  "count": 2,
  "items": [
    {
      "id": 3,
      "description": "站点 favicon 图标",
      "dhash": "00023478c8c0a000",
      "size": [
        48,
        48
      ],
      "distance": 0
    },
    {
      "id": 5,
      "description": "iOS 主屏图标,同一个叶子标志的 180x180 版本",
      "dhash": "02294383367c58a0",
      "size": [
        180,
        180
      ],
      "distance": 37
    }
  ]
}

distance 是汉明距离(0-64)。0-3 同一张图,4-12 局部改动,12 以上是不同画面。threshold 默认 10,这里放宽到 40 才把不同设计的图标也捞出来。

04

vision_compare

2 个参数

比较两张图,判断是否同一画面、有没有改动。适合页面视觉回归、UI 改动核对。

入参

参数类型必填默认说明
a任意必填—第一张:item id,或 {image_url|image_base64, description}
b任意必填—第二张:item id,或 {image_url|image_base64, description}
bash直接 curl 调(真实可跑)
curl -s https://pianam.cn/vision-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"vision_compare","arguments":{"a":4,"b":5}}}'
返回示例(线上真实结果) · 502 字符,点开看
jsonstructuredContent
{
  "a": {
    "id": 4,
    "dhash": "00023478c8c0a000",
    "size": [
      48,
      48
    ],
    "description": "网站 favicon:深色圆角方块里的叶子标志,Mycel 品牌图标",
    "created_at": "2026-11-26 17:25:18"
  },
  "b": {
    "id": 5,
    "dhash": "02294383367c58a0",
    "size": [
      180,
      180
    ],
    "description": "iOS 主屏图标,同一个叶子标志的 180x180 版本",
    "created_at": "2026-11-26 17:25:19"
  },
  "hamming_distance": 37,
  "verdict": "内容明显不同",
  "hint": "距离 0-3 视为同一张;4-12 通常是小改动(改字、换色、局部增删);12 以上是不同画面"
}

a / b 都可以传库内 id,也可以传 {image_url} 或 {image_base64} 的临时图,混着传也行。

05

vision_timeline

3 个参数全部可选

按时间倒序列出视觉记忆,用于回顾某段时间看过什么。

入参

参数类型必填默认说明
sincestring可选—起始时间
untilstring可选—结束时间
limitinteger可选—返回条数,默认 20,最大 100
bash直接 curl 调(真实可跑)
curl -s https://pianam.cn/vision-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"vision_timeline","arguments":{"limit":3}}}'
返回示例(线上真实结果) · 739 字符,点开看
jsonstructuredContent
{
  "count": 3,
  "items": [
    {
      "id": 5,
      "created_at": "2026-11-26 17:25:19",
      "source": "docs-demo",
      "title": "Mycel 主屏图标",
      "description": "iOS 主屏图标,同一个叶子标志的 180x180 版本",
      "tags": [
        "brand",
        "ui"
      ],
      "dhash": "02294383367c58a0",
      "size": [
        180,
        180
      ],
      "bytes": 2026
    },
    {
      "id": 4,
      "created_at": "2026-11-26 17:25:18",
      "source": "docs-demo",
      "title": "Mycel favicon",
      "description": "网站 favicon:深色圆角方块里的叶子标志,Mycel 品牌图标",
      "tags": [
        "brand",
        "logo",
        "ui"
      ],
      "dhash": "00023478c8c0a000",
      "size": [
        48,
        48
      ],
      "bytes": 304
    }
  ]
}

此处截断到 2 条,线上返回 3 条。时间格式统一为 YYYY-MM-DD HH:MM:SS,时区东八区。

06

vision_stats

无参数

查看当前租户的视觉记忆用量:条数、存储占用、近 14 天分布、可用能力。

入参

无参数。这个工具不需要任何入参,直接调。

bash直接 curl 调(真实可跑)
curl -s https://pianam.cn/vision-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"vision_stats","arguments":{}}}'
返回示例(线上真实结果) · 337 字符,点开看
jsonstructuredContent
{
  "tenant_items": 3,
  "tenant_bytes": 2634,
  "tenant_limit": 1000,
  "by_day": [
    {
      "date": "2026-11-26",
      "count": 3
    }
  ],
  "global_items": 3,
  "capabilities": {
    "visual_fingerprint": "dHash 64-bit(零成本,找近似图)",
    "semantic": "百炼 text-embedding-v3(找语义相关)",
    "ocr": "未内置,可通过 ocr_text 参数传入第三方 OCR 结果"
  }
}

tenant_items 是当前租户(API Key 或 IP)的条数,global_items 是全站条数。单租户满 1000 条后,新存的会自动淘汰最旧的一条。

07

vision_forget

1 个参数

删除指定条目,释放存储。只影响当前租户。

入参

参数类型必填默认说明
idsarray<integer>必填—要删除的 id 列表
bash直接 curl 调(真实可跑)
curl -s https://pianam.cn/vision-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"vision_forget","arguments":{"ids":[5]}}}'
返回示例(线上真实结果) · 42 字符,点开看
jsonstructuredContent
{
  "removed": [
    5
  ],
  "count": 1
}

只删当前租户自己的条目,跨租户删不动。文件同步删除,存储占用立即释放。

✓

免费额度:每 IP 每天 100 次

超额返回 -32002,带 X-API-Key 继续用。密钥在 pianam.cn 注册后于控制台创建。

接法 ①:MCP 客户端

Claude Code、Cursor、Cherry Studio 等支持 streamable HTTP 的客户端,一行命令把 7 个工具挂到 Agent 上。

bashclaude mcp add
# Claude Code / Cursor / 任何 MCP 客户端
claude mcp add --transport http mycel-vision https://pianam.cn/vision-mcp/mcp

接法 ②:直接打 HTTP

端点 https://pianam.cn/vision-mcp/mcp,POST 一个 JSON-RPC 就返回数据,响应是 SSE(data: 行内是 JSON)。

bash先看工具清单(不消耗额度)
curl -s https://pianam.cn/vision-mcp/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
← 回全部端点