Skip to main content
Glama
DeepSeek Vision MCP
by groxaxo

DeepSeek Vision MCP

CI Python License: MIT

一个安全、轻量级的 MCP v2 服务器,可为任何兼容 MCP 的代理提供 DeepSeek V4 Flash Vision:图像分析、忠实描述、OCR、 对比、UI/对象定位,以及可复用的 Files API 上传。

该服务器暴露精确模型 deepseek-v4-flash-vision-exp,而无需 在每个代理集成中嵌入特定于提供方的图像负载。

工具

工具

用途

vision_analyze

使用自定义提示进行通用单图/多图分析

vision_describe

忠实的场景/UI 描述

vision_ocr

截图/文档 OCR

vision_compare

比较两张或更多图像

vision_locate

尽力而为的 UI/对象定位,输出归一化坐标

vision_upload

将本地图像上传到 DeepSeek Files API

vision_files_list

列出可复用的已上传图像

vision_files_delete

删除已上传的图像

可接受的图像引用:

  • 本地服务器端路径

  • 公共 http:// 或 https:// URL

  • data:image/...;base64,...

  • DeepSeek file-api-... 文件 ID

Related MCP server: vision-mcp

为什么这个服务器很轻量

MCP 服务器不运行本地视觉模型。它仅验证/规范化 图像输入,并将推理委托给 DeepSeek。这使得 CPU/RAM 占用极小, 并让任何支持 MCP 的代理无需在代理自身中嵌入 DeepSeek 特定的 负载结构即可获得视觉能力。

使用 uv 安装

git clone https://github.com/groxaxo/deepseek-vision-mcp.git
cd deepseek-vision-mcp

uv sync --locked

cp .env.example .env
# Set DEEPSEEK_API_KEY and allowed roots in .env

对于本地 MCP 主机,stdio 是首选传输方式:

DEEPSEEK_API_KEY="..." \
DEEPSEEK_VISION_ALLOWED_ROOTS="/home/you/Pictures:/tmp/vision" \
uv run deepseek-vision-mcp

用于 MCP Inspector 开发:

DEEPSEEK_API_KEY="..." uv run mcp dev src/deepseek_vision_mcp/server.py

MCP 主机配置

典型的 stdio 配置:

{
  "mcpServers": {
    "deepseek-vision": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/deepseek-vision-mcp",
        "run",
        "deepseek-vision-mcp"
      ],
      "env": {
        "DEEPSEEK_API_KEY": "YOUR_KEY",
        "DEEPSEEK_VISION_ALLOWED_ROOTS": "/home/you/Pictures:/tmp/vision"
      }
    }
  }
}

不要提交 API 密钥。如果主机可以继承环境变量, 建议从你的密钥管理器或 shell 注入 DEEPSEEK_API_KEY。

安全的共享启动器

当多个本地代理共享一个安装时,run-mcp.py 很有用。它:

  • 仅从进程或环境文件中读取已批准的 DeepSeek 变量;

  • 在启动 MCP 前过滤掉不相关的继承机密;

  • 强制使用 stdio 传输;

  • 将本地图像限制在明确的根目录内。

默认情况下,它读取 ~/.hermes/.env,并允许当前主目录下 常见的图像工作目录以及 /tmp。无需编辑脚本即可覆盖这些选择:

export DEEPSEEK_VISION_ENV_FILE="$HOME/.config/deepseek-vision.env"
export DEEPSEEK_VISION_ALLOWED_ROOTS="$HOME/Pictures:/tmp/vision"
./run-mcp.py

Hermes 配置:

mcp_servers:
  deepseek-vision:
    command: "/absolute/path/to/deepseek-vision-mcp/run-mcp.py"
    args: []
    enabled: true

OpenCode 配置:

{
  "mcp": {
    "deepseek-vision": {
      "type": "local",
      "command": ["/absolute/path/to/deepseek-vision-mcp/run-mcp.py"],
      "enabled": true
    }
  }
}

OMP 和其他标准 MCP 主机可以使用上述 mcpServers 示例, 以 run-mcp.py 作为命令。

流式 HTTP

export DEEPSEEK_API_KEY="..."
export MCP_TRANSPORT=streamable-http
export MCP_HOST=127.0.0.1
export MCP_PORT=8000

uv run deepseek-vision-mcp

MCP 端点为:

http://127.0.0.1:8000/mcp

在将服务器暴露到可信机器/网络之外之前,请在其前面使用 TLS 和身份验证。

示例工具调用

分析截图

{
  "images": ["/home/you/Pictures/screen.png"],
  "prompt": "What application is open, what is the current state, and what should I click next?",
  "detail": "original"
}

快速粗略屏幕读取

{
  "images": ["/home/you/Pictures/screen.png"],
  "prompt": "Is a modal dialog visible? Answer briefly.",
  "detail": "low"
}

OCR

{
  "image": "/home/you/Pictures/error.png",
  "detail": "original"
}

尽力而为的 UI 定位

{
  "image": "/home/you/Pictures/screen.png",
  "target": "the blue Save button"
}

vision_locate 返回归一化到 0..1000 的坐标。它被有意描述为 尽力而为:生成式 VLM 不是确定性检测器。在 高影响点击之前验证其目标。

安全模型

此 MCP 分析的图像会发送到 DeepSeek 的外部 API。未经 用户明确同意,请勿发送私人或敏感图像。

本地路径限制在 DEEPSEEK_VISION_ALLOWED_ROOTS 内。如果未配置 根目录,服务器仅允许其当前工作目录下的图像。

这一点很重要:不受限制的 vision_analyze("/etc/...") 风格工具 会让 MCP 主机将图像分析变成任意的本地文件外泄。

服务器还会拒绝明显的 localhost/私有 IP 外部 URL。

共享启动器仅将基线进程变量、XDG_* 和 四个已批准的 DeepSeek 设置传递给子进程。它从不加载 整个凭据文件。

此服务器反映的 DeepSeek 图像行为

  • JPEG、PNG、GIF、WebP

  • 本地/base64 内联图像:每个最大 32 MiB

  • DeepSeek Files API 图像:最大 64 MiB

  • 每请求最多 600 张图像

  • 外部 URL 长度:最大 8192 个字符

  • 最大尺寸:每边 8192 像素,或 15 张以上图像时每边 4096 像素

  • detail=low:DeepSeek 降采样到 512x512

  • detail=original / high:保留原始细节

  • 图像仅在用户消息中发送

大/复用图像

上传一次:

{
  "local_path": "/home/you/Pictures/large.png",
  "expires_seconds": 86400
}

然后将返回的 file-api-... ID 传入 vision_analyze。仅当 你故意想要 DeepSeek 永久存储时,才将 expires_seconds 设为 null。

Docker

docker build -t deepseek-vision-mcp .
docker run --rm \
  -p 127.0.0.1:8000:8000 \
  -e DEEPSEEK_API_KEY="$DEEPSEEK_API_KEY" \
  deepseek-vision-mcp

对于 Docker 中的本地图像路径,仅挂载 MCP 需要的目录,并将 DEEPSEEK_VISION_ALLOWED_ROOTS 设置为容器侧路径。

架构

MCP host / agent
      |
      | MCP tool call
      v
DeepSeek Vision MCP
  - validates source
  - restricts local paths
  - encodes local files
  - shapes DeepSeek payload
      |
      | HTTPS
      v
api.deepseek.com
  deepseek-v4-flash-vision-exp
      |
      v
structured MCP result

开发

uv sync --locked --extra dev
uv run ruff check .
uv run pytest

CI 在 Python 3.11 和 3.13 上运行相同的门控。欢迎贡献和聚焦的 错误报告。

Available Tools

8 tools
vision_analyzeB

Analyze one or more images with a custom prompt.

Image sources may be:

  • local server-side paths under DEEPSEEK_VISION_ALLOWED_ROOTS

  • public http(s) URLs

  • base64 data:image/... URLs

  • DeepSeek Files API IDs beginning with file-api-

Use detail="low" for cheap/fast coarse inspection, or "original" for screenshots, OCR, charts, and other fine-detail tasks.

Inputs: images (required), prompt (required), detail, json_mode, +1 more.

vision_compareB

Compare 2+ images in the order provided.

Inputs: images (required), detail, question, max_tokens.

vision_describeC

Describe the visible content of an image faithfully and concisely.

Inputs: image (required), detail, max_tokens.

vision_files_deleteC

Delete an uploaded DeepSeek Files API image.

Inputs: file_id (required).

vision_files_listA

List uploaded DeepSeek user_data image files, newest first.

Inputs: limit.

vision_locateA

Best-effort semantic localization of a visible target.

Coordinates are model-estimated and MUST be validated before destructive or high-impact UI actions. This is useful for agent grounding but is not a deterministic object detector.

Inputs: image (required), target (required), detail.

vision_ocrA

Read visible text from a screenshot/document image.

Returns the transcription as model text. Prefer detail="original".

Inputs: image (required), detail, max_tokens.

vision_uploadA

Upload a local image to DeepSeek Files API and return its reusable file_id.

Local paths must be inside DEEPSEEK_VISION_ALLOWED_ROOTS. expires_seconds: 3600..2592000 (1h..30d), or null for permanent storage.

Inputs: local_path (required), expires_seconds.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct visual task: custom analysis, faithful description, OCR, comparison, semantic localization, upload, listing, and deletion. The overlaps between analyze and describe are minor and clearly differentiated by purpose and usage notes.

    Naming Consistency3/5

    Most tools follow a vision_<verb> pattern (analyze, describe, compare, locate, upload), but vision_files_list and vision_files_delete reverse the noun-verb order, and vision_ocr is an abbreviation noun. The shared prefix provides some consistency, but the mixed conventions prevent a higher score.

    Tool Count5/5

    Eight tools is a well-scoped number for a vision MCP server, covering both image analysis and file lifecycle management without unnecessary bloat. Each tool serves a clear purpose.

    Completeness5/5

    The tool surface covers the major vision tasks (analysis, description, OCR, comparison, localization) and includes full file management via upload, list, and delete. There are no obvious dead ends; images are immutable so update/delete semantics are appropriately handled.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers