ocular
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ocular Analyze this screenshot and identify any layout problems"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ocular
Vision for coding agents.
ocular is an MCP server that lets text-first coding agents analyze screenshots, UI mockups, terminal errors, documents, tables, and charts through OpenAI-compatible vision models.
It is designed for both local stdio use and remote HTTP deployments. For remote agents, image bytes can travel through a binary upload side channel while MCP tool calls carry only a lightweight file_id, avoiding large inline base64 payloads.
Project status: early-stage and actively evolving. Feedback, bug reports, integrations, and real-world usage reports are welcome.
Why ocular?
Coding agents are good at reading source code but often lose context when the important evidence is visual: a broken layout, a terminal screenshot, an error dialog, a chart, or a design reference.
ocular turns those visual inputs into structured data an agent can reason about.
Agent-oriented output — tools return structured JSON instead of prose-only descriptions.
8 focused vision tools — general analysis, OCR, UI inspection, error diagnosis, UI comparison, table extraction, chart analysis, and upload orchestration.
OpenAI-compatible provider interface — point ocular at a compatible multimodal endpoint and model; reproducibly tested configurations are tracked in Provider compatibility.
Remote-friendly uploads — binary
PUT /uploadflow for large images with content-addressedfile_idreferences.Local or remote MCP — stdio for local clients, HTTP for hosted/private deployments.
Caching and persistence — deduplicated uploads plus result caching for repeated agent workflows.
Related MCP server: pic-id-mcp
How it works
flowchart LR
A[Coding agent] -->|MCP tool call| B[ocular]
C[Image / screenshot] -->|binary upload or base64| B
B -->|OpenAI-compatible request| D[Vision model]
D -->|multimodal response| B
B -->|structured JSON| AFor remote HTTP deployments, the recommended path is:
image bytes -> PUT /upload -> file_id -> MCP vision tool -> structured resultSee Architecture for the upload and caching model.
Demo
Want to see the full handoff from screenshot to coding-agent evidence? Read the end-to-end demo.
It walks through a remote image upload, a diagnose_error_screenshot call, the structured fields returned to the agent, and how that evidence is combined with repository context. Example model output is explicitly marked representative rather than presented as a benchmark.
Quick start
1. Install
The published npm package is ocular-mcp. It installs the CLI command ocular.
Global install:
npm install -g ocular-mcpOr run it without a global install:
npx -y ocular-mcpTo build from source instead:
git clone https://github.com/xyun1996/ocular.git
cd ocular
npm install
npm run build2. Configure a vision provider
ocular requires an OpenAI-compatible multimodal endpoint, API key, and model name:
OCULAR_BASE_URL=https://your-openai-compatible-endpoint.example/v1
OCULAR_API_KEY=your_api_key
OCULAR_MODEL=your_vision_modelFor a local compatible endpoint, use that server's base URL and vision-capable model name. Compatibility depends on the endpoint/model combination; see Provider compatibility for the reproducible smoke-test procedure and verified configurations.
3. Run in stdio mode
With a global install:
ocularOr:
npx -y ocular-mcpThe server communicates over stdio, so it may appear idle when started directly. In normal use an MCP client launches it and exchanges protocol messages over stdin/stdout.
4. Connect an MCP client
Claude Code example:
claude mcp add ocular \
-e OCULAR_BASE_URL=https://your-openai-compatible-endpoint.example/v1 \
-e OCULAR_MODEL=your_vision_model \
-e OCULAR_API_KEY=your_api_key \
-- npx -y ocular-mcpAvoid putting long-lived API keys directly in shell history on shared machines. Use your client's environment/secret-management mechanism when available.
For a generic MCP client:
{
"mcpServers": {
"ocular": {
"command": "npx",
"args": ["-y", "ocular-mcp"],
"env": {
"OCULAR_BASE_URL": "https://your-openai-compatible-endpoint.example/v1",
"OCULAR_MODEL": "your_vision_model",
"OCULAR_API_KEY": "your_api_key"
}
}
}
}See Claude Code setup for a fuller walkthrough.
Example workflows
Diagnose a screenshot
Ask your coding agent to inspect an error screenshot and extract the exact message, likely cause, and next checks.
{
"file_id": "e21ba723...",
"task": "Extract the exact error and suggest the next debugging checks",
"project_context": "Node.js TypeScript project"
}Review a UI implementation
Use analyze_ui_screenshot to turn a screenshot into implementation-oriented observations about hierarchy, alignment, spacing, typography, contrast, and likely visual defects.
Compare expected vs actual UI
Use compare_ui_screenshots with a reference screenshot and an implementation screenshot to identify regressions and layout differences.
See Screenshot debugging example.
Tools
Tool | Purpose |
| General structured image analysis |
| OCR with reading-order/layout awareness |
| UI hierarchy, spacing, typography and accessibility review |
| Extract and diagnose terminal/browser/build errors |
| Compare reference and implementation screenshots |
| Extract table data into structured output |
| Analyze chart labels, values, trends and uncertainty |
| Return upload endpoint and instructions for remote clients |
Every vision tool accepts file_id; local workflows can also use inline image_base64 where appropriate.
Remote deployment
Set HTTP transport and authentication:
MCP_TRANSPORT=http
MCP_HTTP_HOST=127.0.0.1
MCP_HTTP_PORT=3000
MCP_HTTP_PATH=/mcp
MCP_AUTH_TOKEN=replace_with_a_long_random_token
MCP_AUTH_HEADER=authorization
MCP_AUTH_SCHEME=BearerUpload raw bytes:
curl --request PUT \
--data-binary @/path/to/image.png \
"https://your.host/upload" \
-H "Content-Type: image/png" \
-H "Authorization: Bearer your_mcp_auth_token"The server returns a content-addressed file_id; pass that id to a vision tool instead of sending a large base64 string through MCP.
For reverse proxy and systemd examples, see Deployment.
Configuration
Common variables:
Variable | Purpose |
| OpenAI-compatible API base URL |
| Provider API key |
| Vision-capable model name |
| Optional custom provider headers as JSON |
| Generation temperature |
| Maximum generated tokens |
| Provider timeout |
| Maximum image size |
| Enable result cache |
| Cache directory |
| Persistent upload directory |
| Public base URL used in upload instructions |
See .env.example for the full configuration surface.
Verification and benchmarks
Provider compatibility claims are based on real endpoint/model smoke tests, not on API naming alone. See Provider compatibility.
The repository also includes synthetic, redistributable visual fixtures for repeatable project-level measurements. See Benchmark fixtures. The benchmark measures execution, structural JSON output, and timing; it is not presented as a broad model-quality ranking.
Development
npm install
npm run build
npm test
npm run check
npm run devThe repository includes tests for authentication, caching, image handling, MCP server behavior, provider payloads, tool execution, npm packaging, Registry metadata consistency, and release smoke checks.
Security and privacy
Do not commit provider API keys or MCP authentication tokens. Public HTTP deployments should sit behind HTTPS and a reverse proxy; the Node process should generally bind to a private interface.
See SECURITY.md for vulnerability reporting guidance.
Roadmap
Near-term areas where contributions are useful:
Real-world MCP client integration and usage reports
Provider/model compatibility verification
Published fixture-based benchmark results from real endpoints
Community-driven tool and prompt improvements
If you are using ocular in a real workflow, open a Usage report issue describing the client, provider/model, and use case. Public reports are useful even when nothing is broken and help keep compatibility/adoption claims grounded in real usage.
Contributing
Contributions are welcome. Start with CONTRIBUTING.md, run npm run check before opening a PR, and include reproduction details for behavior changes.
Release and registry
The npm package is ocular-mcp; the installed CLI is ocular. Release automation uses npm Trusted Publishing rather than a long-lived repository token. See Publishing.
ocular is published in the official MCP Registry as io.github.xyun1996/ocular. See MCP Registry for the live identity and release flow.
License
MIT — see LICENSE.
If ocular is useful in your agent workflow, a GitHub star helps other developers discover the project.
Available Tools
8 toolsanalyze_chart_imageB
Analyze a chart image and return labels, trends, approximate values, and limitations.
Inputs: task, file_id, mime_type, chart_hint, +1 more.
analyze_imageB
Analyze a general image and return structured JSON for a coding agent.
Inputs: task, file_id, mime_type, image_base64, +1 more.
analyze_ui_screenshotB
Analyze a webpage, app, UI, or design mockup screenshot for frontend implementation work.
Inputs: task, file_id, mime_type, page_hint, +2 more.
compare_ui_screenshotsB
Compare two UI screenshots and return implementation-useful visual differences.
Inputs: images (required), task, page_hint, framework_hint.
create_upload_sessionA
Returns upload instructions for the binary side channel (use this to analyze LOCAL image files without base64 corruption). Before uploading, verify the local file exists and is non-empty with Bash (e.g. ls -la <path> or test -f <path> && stat -c %s <path>). Then PUT the raw bytes to the returned upload_url with curl --data-binary (NOT base64); the response gives a file_id to pass to any vision tool. Stateless -- call once to learn the endpoint.
Inputs: mime_type.
diagnose_error_screenshotA
Analyze error, terminal, console, browser, or build failure screenshots.
Inputs: task, file_id, mime_type, image_base64, +1 more.
extract_table_from_imageC
Extract visible table data from an image as structured JSON, Markdown, or CSV-oriented output.
Inputs: task, file_id, mime_type, image_base64, +1 more.
extract_text_from_imageB
Extract OCR text from screenshots, documents, tables, terminal output, or code images.
Inputs: file_id, mime_type, image_base64, language_hint, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools have clear, distinct purposes (OCR, UI analysis, chart analysis, etc.), but analyze_image serves as a general fallback and could overlap with specialized tools like analyze_ui_screenshot or analyze_chart_image if an agent picks poorly. The descriptions are specific enough to guide selection in most cases.
All tool names follow a consistent verb_noun pattern using snake_case: analyze_image, extract_text_from_image, compare_ui_screenshots, etc. This consistency makes it easy to predict what a tool does based on its name.
With 8 tools, the set is well-scoped for an image analysis server. Each tool serves a distinct purpose, and the count is neither too sparse nor overwhelming.
The tool set covers a broad range of image analysis needs for coding agents: general analysis, OCR, UI analysis, error screenshots, table extraction, chart analysis, and image comparison. The inclusion of an upload session tool addresses local file handling, filling the only potential gap.
Maintenance
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
MCP server for Clipkit — gives AI agents a video toolbox via the Clipkit schema.
MCP server for building and testing AI agents with multi-model experimentation and insights.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server for vision AI — screenshots to code, OCR, error diagnosis, and image analysis via OpenAI-compatible APIs.82MIT
- AlicenseNot gradedqualityCmaintenanceLocal vision-capable MCP server that lets AI agents describe screenshots, UI, charts, and photos via vision and OCR tools, with support for multiple providers and automatic fallback.5MIT
- AlicenseAqualityDmaintenanceProvides vision understanding capabilities such as image analysis, OCR, object localization, and video frame analysis, plus optional image generation and editing, to coding agents via OpenAI-compatible multimodal models. Runs as a local MCP server with HTTP and stdio transports, configurable for clients like Codex, Claude Code, Kimi, and Cursor.323 npmMIT
- AlicenseNot gradedqualityDmaintenanceMCP server that gives Claude and other clients vision capabilities including screenshot-to-code, OCR, error diagnosis, diagram analysis, data-viz insights, UI diff checks, and video analysis via any OpenAI-compatible vision endpoint.Apache 2.0