Skip to main content

MCP Image Server

本地图床 MCP Server,通过 HTTP 服务将本地图片暴露为可访问的 URL,用于在 Cherry Studio 等支持 Markdown 渲染的 AI 客户端中内联显示图片。

工作原理

  1. 以 MCP Server 形式运行,由 Cherry Studio 自动管理进程生命周期
  2. 启动后在本地开启 HTTP 图片服务(默认端口 18090)
  3. AI 通过系统提示词知道 URL 格式,直接输出 Markdown 图片链接
  4. 客户端渲染 Markdown 时自动从本地 HTTP 服务加载图片
AI 输出: ![照片](http://localhost:18090/image?path=E%3A%5Cphotos%5Ctest.png&t=1713936000)
         ↓
Cherry Studio 渲染 Markdown
         ↓
浏览器请求 localhost:18090 → HTTP 服务读取本地文件 → 返回图片

安装

推荐使用 uv tool install,无需克隆仓库,任意电脑一行命令搞定:

uv tool install git+https://gitee.com/xiaoye12345/image-server.git

或用 pip(需要先激活你想要的虚拟环境):

pip install git+https://gitee.com/xiaoye12345/image-server.git

安装完成后会自动注册 mcp-image-server 命令,MCP 配置中直接引用命令名即可,无需填写任何路径。

配置

Cherry Studio MCP 服务器

通过 JSON 导入:

{
  "mcpServers": {
    "image-server": {
      "type": "stdio",
      "command": "mcp-image-server"
    }
  }
}

系统提示词

在 Cherry Studio 的系统提示词中添加:

当需要显示本地图片时,直接用 Markdown 图片格式输出:
![描述](http://localhost:18090/image?path=<URL编码的文件绝对路径>&t=<文件修改时间戳>)
路径中的中文、空格等特殊字符必须 URL 编码。
`t` 参数为文件修改时间戳,用于避免缓存导致图片更新后显示旧版本。
示例:![风景](http://localhost:18090/image?path=E%3A%5Cphotos%5Ctest.png&t=1713936000)

升级

uv tool install --upgrade git+https://gitee.com/xiaoye12345/image-server.git

环境变量

变量 默认值 说明
IMAGE_SERVER_PORT 18090 HTTP 服务监听端口

URL 格式

http://localhost:18090/image?path=<URL编码的文件路径>&t=<文件修改时间戳>
  • path:URL 编码的本地图片绝对路径
  • t:伪参数,值为文件修改时间戳(秒),用于打破缓存。图片更新后时间戳改变,URL 不同,浏览器不会使用缓存。服务端忽略此参数。

支持的图片格式:.png .jpg .jpeg .gif .svg .webp .bmp

License

MIT

Metadata

Release files for mcp-image-server 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-image-server 0.1.0
File Size Uploaded Provenance
mcp_image_server-0.1.0.tar.gz 45.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-image-server 0.1.0
File Interpreter ABI Platform
mcp_image_server-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.0 kB

Release files / mcp_image_server-0.1.0.tar.gz

Download URL mcp_image_server-0.1.0.tar.gz
Size 45.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f2da461c712e893c02e6e13ce9a33c6d317f2584a075de2e2435fa714d080750
BLAKE2b-256 checksum
How to use checksums
a77bf2ec70bab3017754e1b5f2952e58f3176baa156663f7a9fdb6817f47a57f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / mcp_image_server-0.1.0-py3-none-any.whl

Download URL mcp_image_server-0.1.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3427aaadbbba281320a547bae2e5123cad26b41dca7118fa5560120c1d276891
BLAKE2b-256 checksum
How to use checksums
7352818712cae2036d5f8fd9c7c25e6cfc90d2b60eb4f122e50f37b8053d231b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for mcp-image-server 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page