local_vision

local_vision

Enables a primary Codex agent to inspect images using a separate local vision-language model via an MCP tool, keeping image data off the main model.

Category
访问服务器

README

Codex Local Vision Router

Codex using DeepSeek V4 through DwarfStar while Qwen3.5 describes an image through the Local Vision Router

DeepSeek V4 runs the Codex session through DwarfStar while Qwen3.5 in LM Studio handles image inspection through the local MCP tool.

Use one model as the main Codex agent and a separate local vision-language model for image inspection.

This project exposes a read-only MCP tool that:

  1. reads an image from an absolute local path;
  2. sends it to an OpenAI-compatible vision endpoint such as LM Studio;
  3. returns only a bounded text observation to Codex.

It is intended for custom Codex providers that work well with text and tools but reject input_image content.

Architecture

user prompt with local path
        |
        v
primary Codex model (text + tools)
        |
        | MCP: local_vision.describe_image
        v
Local Vision Router
        |
        | image bytes over loopback HTTP
        v
LM Studio + local vision model
        |
        | plain-text observation
        v
primary Codex model

Privacy defaults

  • The default endpoint is http://127.0.0.1:1234/v1.
  • Non-loopback endpoints are rejected unless LOCAL_VISION_ALLOW_REMOTE=1 is explicitly set.
  • Image bytes, base64 payloads, prompts, and API responses are not logged.
  • The returned tool result does not include the local image path.
  • No credentials, local configuration, model files, source images, or session data are included. The documentation contains only the intentionally published demonstration screenshot above.

A configured remote endpoint can receive image contents. Read SECURITY.md before enabling one.

Requirements

  • Node.js 20 or newer
  • Codex CLI
  • LM Studio, or another compatible /v1/chat/completions server
  • A loaded vision model

The tested model is TracNetwork/Qwen3.5-4B-4bit-mlx, loaded through LM Studio. LM Studio exposes it to the local API as qwen3.5-4b-mlx in the tested setup; use the exact ID returned by /v1/models if yours differs. Other vision models can be selected with --model.

Quick start

1. Start the vision endpoint

In LM Studio:

  1. Load a vision-capable model.
  2. Open Developer.
  3. Start the local server on port 1234.

Confirm the model is visible:

curl http://127.0.0.1:1234/v1/models

2. Clone and check the router

git clone <repository-url>
cd codex-local-vision-router
node scripts/doctor.mjs

3. Register the MCP server

For normal Codex:

node scripts/register.mjs --model qwen3.5-4b-mlx

For an isolated custom-provider installation, set the same CODEX_HOME used by its launcher:

CODEX_HOME="$HOME/.codex-custom" \
  node scripts/register.mjs --model qwen3.5-4b-mlx

PowerShell:

$env:CODEX_HOME = "$HOME\.codex-custom"
node .\scripts\register.mjs --model qwen3.5-4b-mlx

The registration command refuses to replace an existing local_vision entry unless --replace is supplied.

4. Mark the primary model as text-only

Copy the root keys from templates/text-only-primary-config.toml into the active $CODEX_HOME/config.toml. Place them before the first TOML table.

This disables the built-in image tool and instructs Codex to use local_vision.describe_image.

5. Start a new Codex session

Do not resume a session that already contains an incompatible image block.

Run /mcp and confirm local_vision is connected. Then test:

Use local_vision.describe_image to inspect /absolute/path/to/image.jpg.
Describe the main subject, composition, visible text, and uncertainty.

Use a filesystem path rather than attaching or dragging the image into a text-only session.

End-to-end diagnostics

node scripts/doctor.mjs \
  --image /absolute/path/to/image.jpg \
  --prompt "Transcribe the largest visible heading."

Configuration

Variable Default Purpose
LOCAL_VISION_BASE_URL http://127.0.0.1:1234/v1 Compatible API base URL
LOCAL_VISION_MODEL qwen3.5-4b-mlx Vision model ID
LOCAL_VISION_TIMEOUT_MS 120000 Request timeout
LOCAL_VISION_MAX_IMAGE_BYTES 52428800 Maximum image size
LOCAL_VISION_MAX_OUTPUT_TOKENS 4096 Generation ceiling
LOCAL_VISION_MAX_ANSWER_CHARS 2000 Structured answer limit
LOCAL_VISION_ALLOW_REMOTE unset Set to 1 to permit remote endpoints
LOCAL_VISION_API_KEY unset Optional endpoint bearer token

Supported extensions: PNG, JPEG, WebP, GIF, and AVIF.

Remove

codex mcp remove local_vision

Remove the text-only routing block from config.toml only if the primary provider can safely receive images.

Development

npm run check
npm test

The MCP server has no runtime npm dependencies.

See docs/SETUP.md for the detailed provider workflow and docs/PUBLISHING.md for publishing this repository.

Codex plugin bundle

The repository is also a valid Codex plugin bundle. A marketplace can point to this repository, and codex plugin add will install both the routing skill and the bundled MCP server. The plugin defaults to the loopback LM Studio endpoint and qwen3.5-4b-mlx.

Use the clone-and-register flow above when a different endpoint, model ID, or CODEX_HOME needs to be selected at install time.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选