Skip to main content

MCP Vision Gateway (视觉AI网关)

一个连接MCP与视觉AI模型的网关服务,支持纯文本对话和图像分析(通过URL或Base64编码)。

安装

pip install mcp-vision-gateway

功能

工具 (Tools)

  • vision_query: 向AI模型发送查询,支持纯文本对话和图像分析

    • 支持通过URL引用图像
    • 支持通过image_ref引用图像(推荐方式)
    • 支持通过base64编码传递图像
    • 可自定义模型、温度等参数
  • upload_image_from_url: 从URL下载图像并获取引用ID

    • 返回一个图像引用ID而非base64字符串
    • 避免传输大量base64文本
  • upload_local_image: 从本地文件读取图像并获取引用ID

    • 返回一个图像引用ID而非base64字符串
    • 避免传输大量base64文本
  • list_available_models: 列出可用的AI模型

环境变量配置

设置以下环境变量来配置默认参数:

  • VISION_API_BASE: API基础URL (默认: https://api.ssopen.top)
  • VISION_API_KEY: API密钥 (必须设置)
  • VISION_DEFAULT_MODEL: 默认模型 (默认: gpt-4o)
  • VISION_DEBUG: 调试模式 (设置为"true"启用)

在阿里云百炼中使用

在阿里云百炼平台的MCP服务配置中,使用以下JSON:

{
  "mcpServers": {
    "vision-gateway": {
      "command": "uvx",
      "args": ["mcp-vision-gateway"],
      "env": {
        "VISION_API_KEY": "你的API密钥",
        "VISION_DEFAULT_MODEL": "gpt-4o"
      }
    }
  }
}

本地运行

安装后,在设置好环境变量的情况下,可以通过以下方式运行:

# 使用uvx
uvx mcp-vision-gateway

# 使用包提供的命令
mcp-vision-gateway

# 使用Python -m
python -m mcp_vision_gateway

使用示例

1. 纯文本对话

vision_query(
    prompt="你好,请问今天的天气如何?"
)

2. 使用URL传递图像

vision_query(
    prompt="描述这张图片",
    image_url="https://example.com/image.jpg"
)

3. 使用图像引用ID(推荐方式)

# 从本地文件获取图像引用ID
image_id = upload_local_image("C:/Users/YourName/Pictures/photo.jpg")

# 或从URL获取图像引用ID
# image_id = upload_image_from_url("https://example.com/image.jpg")

# 使用图像引用ID进行查询
vision_query(
    prompt="描述这张图片",
    image_ref=image_id
)

4. 指定自定义参数

vision_query(
    prompt="描述这张图片",
    image_ref=image_id,
    model="gpt-4o-mini",
    temperature=0.5,
    max_tokens=500,
    api_key="自定义API密钥"
)

许可证

MIT License

Metadata

Release files for mcp-vision-gateway 0.15

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-vision-gateway 0.15
File Size Uploaded Provenance
mcp_vision_gateway-0.15.tar.gz 7.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-vision-gateway 0.15
File Interpreter ABI Platform
mcp_vision_gateway-0.15-py3-none-any.whl Python 3 none any Details

Total release size: 15.5 kB

Release files / mcp_vision_gateway-0.15.tar.gz

Download URL mcp_vision_gateway-0.15.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e0da7b0ecb6fb51dec8b9b7fab6153373362b8c2f7d4808ee29e5ac251b19124
BLAKE2b-256 checksum
How to use checksums
ad5682e53eff60c370d6e2c9407290bae46b3ab7fdccc3b8957da8b1afa879c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release files / mcp_vision_gateway-0.15-py3-none-any.whl

Download URL mcp_vision_gateway-0.15-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04be88944d82940d052b1096181f418d39ffc88750932cee7e0823a6e18e6634
BLAKE2b-256 checksum
How to use checksums
9270ab33fc9176b802a6b115b8c27632d289b33227a0f0939b360dd4064415d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Security for mcp-vision-gateway 0.15

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.

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