Skip to main content
Glama
0xnurrabby

mcp-omni-context

by 0xnurrabby
README.md
<div align="center">

<img src="https://raw.githubusercontent.com/0xnurrabby/mcp-omni-context/master/assets/logo.svg" alt="mcp-omni-context" width="110">

# mcp-omni-context

**Give any AI chat real vision.**

Read **images**, **files**, and **zip archives** in any language, for any AI model.
Works everywhere MCP works. No Python, no servers. OCR runs locally by default.

[![npm](https://img.shields.io/npm/v/mcp-omni-context?color=7c3aed&logo=npm)](https://www.npmjs.com/package/mcp-omni-context)
[![License](https://img.shields.io/badge/license-MIT-22c55e)](#license)
[![Node](https://img.shields.io/badge/node-%3E%3D20.17-339933)](https://nodejs.org)
[![stars](https://img.shields.io/github/stars/0xnurrabby/mcp-omni-context?color=f59e0b&logo=github)](https://github.com/0xnurrabby/mcp-omni-context)

</div>

---

## โœจ Features

| | Feature | What it does |
|---|---|---|
| ๐Ÿ–ผ๏ธ | Screenshot reading | Reads any screenshot, at any angle, in any language |
| ๐Ÿค– | Optional AI vision | Add a key in `.env` โ†’ images read by **GPT-4o-mini** or **Gemini** (โ‰ˆ $0.001/image) |
| ๐Ÿ” | Auto fallback | If the AI API fails (or no key set), it silently uses local OCR instead |
| ๐Ÿงฒ | Auto-detection | Pasted/dropped screenshots are found automatically in the temp/clipboard folders โ€” no copying files anywhere |
| ๐Ÿ“„ | File & log reader | Code files and error traces, line by line |
| ๐Ÿ“ฆ | Zip explorer | Visual file tree plus every code file inside |
| ๐ŸŒ | Any language | English, Bengali, Hindi, Arabic, Chinese and more |
| ๐Ÿช„ | Zero setup for users | One command installs it for any AI tool |
| ๐Ÿ”’ | Privacy first | With no API key, OCR runs 100% locally |

---

## ๐Ÿš€ Download & Run

Everything lives behind two tools: `read_context_data` and `find_images`.

**Step 1** ยท Check you have Node.js (20.17+)

```bash
node -v
```

**Step 2** ยท No command? Just ask your AI assistant

> "please setup mcp-omni-context"

**Step 3** ยท Or run it yourself

```bash
npx -y mcp-omni-context setup
```

Then **restart** your AI tool. Done. That's the whole setup.

It configures **opencode, Codex, Claude Desktop, Cursor, Windsurf, Cline, Roo,
and VS Code**, backs up your existing configs, and creates an uploads folder at
`~/.mcp-omni-context/uploads`.

> ๐Ÿ’ก **Pasting a screenshot?** Send it straight to your assistant. If the path is
> not obvious, the assistant calls `find_images` to locate the freshest images in
> your temp, clipboard, Downloads, Desktop, Pictures, and uploads folders. You
> never have to save or copy a file manually.

---

## โš™๏ธ Optional: better accuracy with AI vision (~$0.001 / image)

By default every image is read by **local OCR** (tesseract.js) โ€” free and private.

For noticeably better UI/error-screen reading, add **one** API key to a file named
`.env` in your project folder (the same folder you run the AI tool from).

<details>
<summary><b>Option A โ€” OpenAI (recommended)</b></summary>

1. Create an API key at https://platform.openai.com/api-keys
2. Create a `.env` file in your project and paste:

```env
OPENAI_API_KEY=sk-your-key-here
```

That's it. Images are resized to max **1024px** with sharp, compressed to JPEG,
and sent with `detail: "low"` โ€” keeping the cost at roughly **$0.001 per image**
with **GPT-4o-mini**.

</details>

<details>
<summary><b>Option B โ€” Google Gemini</b></summary>

1. Get a free key at https://aistudio.google.com/app/apikey
2. Create a `.env` file in your project and paste:

```env
GEMINI_API_KEY=your-gemini-key
```

</details>

<details>
<summary><b>Where else can the key live?</b></summary>

Keys are read from (first match wins):

1. Your environment variables (e.g. `set OPENAI_API_KEY=...` on Windows,
   `export OPENAI_API_KEY=...` on macOS/Linux), or
2. a `.env` file in the current project folder, or
3. a `.env` file at `~/.mcp-omni-context/.env`.

Existing environment variables are always respected over `.env` values.
New keys take effect immediately; you only need to **restart** the AI tool.
</details>

> ๐Ÿ›ก๏ธ **Fail-safe:** if the vision API is down, returns an error, or the key is
> missing, the tool automatically falls back to local OCR โ€” you always get a
> result, never a crash.

---

## ๐Ÿ› ๏ธ Tools

### read_context_data

Reads images, files, logs, and zip archives and returns a strictly-ordered,
LLM-ready text dump. Accepts:

- a path: `{"items": ["C:/Users/you/Desktop/shot.png"]}`
- many paths in one call: `{"items": ["a.png", "b.png", "error.log", "src/"]}`
- a bare file name (auto-resolved from the system temp/clipboard folders)
- an in-memory buffer: `{"items": [{"name": "a.png", "base64": "..."}]}`

Each image is processed sequentially and wrapped in a clear delimiter:

```
--- [Image Index 1] Visual Analysis ---
[Source: C:/Users/you/Desktop/shot.png]
[Vision AI ยท gpt-4o-mini ยท detail=low ยท jpeg 181.2 KB ยท raster 2560x1440]
<the analysis / transcribed text>

--- [Image Index 2] Visual Analysis ---
...
```

### find_images

Locates the freshest screenshots across your temp, clipboard, Downloads,
Desktop, Pictures, Telegram Desktop, and uploads folders โ€” newest first.

```
find_images                 โ†’ 10 newest images
find_images maxResults: 50  โ†’ up to 50
find_images query: "bug"    โ†’ only files whose name contains "bug"
find_images sinceMinutes: 10โ†’ only images from the last 10 minutes
```

---

## ๐Ÿ“ฆ Updating

Updates are **automatic**. Every client runs this via `npx -y`, so the newest
version loads on the next start. Zero clicks, zero reinstall.

<details>
<summary><b>Want to update right now?</b></summary>

Just tell your assistant:

> "update mcp-omni-context"

Or run the one-command update yourself:

```bash
npx -y mcp-omni-context update
```

It fetches the latest version and refreshes your configs and rules.

</details>

---

## โš™๏ธ Setup (manual)

The installer writes all of this for you. For the curious, here is how each
client is configured.

<details>
<summary><b>opencode</b> ยท <code>opencode.json</code></summary>

```json
{
  "mcp": {
    "omni-context": {
      "type": "local",
      "command": ["npx", "-y", "mcp-omni-context"],
      "enabled": true
    }
  }
}
```

</details>

<details>
<summary><b>Claude Desktop</b> ยท <code>claude_desktop_config.json</code></summary>

```json
{
  "mcpServers": {
    "omni-context": {
      "command": "npx",
      "args": ["-y", "mcp-omni-context"]
    }
  }
}
```

</details>

<details>
<summary><b>Cline / Cursor / Windsurf / Roo</b> ยท <code>mcpServers</code></summary>

```json
{
  "mcpServers": {
    "omni-context": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "mcp-omni-context"]
    }
  }
}
```

</details>

<details>
<summary><b>Codex CLI</b> ยท <code>~/.codex/config.toml</code></summary>

```toml
[mcp_servers.omni-context]
command = "npx"
args = ["-y", "mcp-omni-context"]
```

</details>

---

## โš™๏ธ Environment variables

All of these can go in a `.env` file or your real environment.

| Variable | Default | What it does |
|---|---|---|
| `OPENAI_API_KEY` | โ€” | Enables GPT-4o-mini vision (resized to 1024px, `detail: "low"`, ~$0.001/img) |
| `OPENAI_MODEL` | `gpt-4o-mini` | Override the OpenAI vision model |
| `OPENAI_BASE_URL` | `https://api.openai.com/v1` | Use any OpenAI-compatible endpoint |
| `GEMINI_API_KEY` | โ€” | Enables Google Gemini vision instead |
| `GEMINI_MODEL` | `gemini-2.0-flash` | Override the Gemini model |
| `MCP_OMNI_VISION` | `auto` | `auto` ยท `openai` ยท `gemini` ยท `tesseract` (force local OCR) |
| `MCP_OMNI_ENV_FILE` | โ€” | Path to a specific `.env` file to read |
| `MCP_OMNI_VERBOSE` | off | `1` to log OCR/vision progress to stderr |
| `MCP_OMNI_PSM` | `3` | tesseract page-segmentation mode (0โ€“13) |

---

## ๐Ÿ” How it reads

Your assistant reads context through `read_context_data`. It accepts any number
of images, files, logs, or zip archives in order, and returns a strictly ordered,
LLM-ready text dump.

<details>
<summary><b>Reading in any language</b></summary>

OCR defaults to **English + Bengali**. For other languages, just tell your
assistant the language (Hindi, Arabic, Chinese, Spanish, French, German, Russian,
Japanese, Korean, Urdu, and many more). The language data downloads itself, or
pre-download once:

```bash
npx -y mcp-omni-context --warmup eng,ben,hin,spa,fra,urd
```

</details>

<details>
<summary><b>Project structure</b></summary>

```
src/
โ””โ”€โ”€ index.ts          # the entire server (tool + vision + zip tree + setup + update)
dist/                 # compiled output (published)
README.md
package.json
```

</details>

---

## ๐Ÿ” Safety

| | Guard | What it means |
|---|---|---|
| ๐Ÿšซ | Sensitive files | `.env`, `id_rsa`, `*.pem`, `secrets.*`, tokens are skipped |
| ๐Ÿ“ฆ | Binary & heavy | ignore `node_modules`, media, and oversized blobs |
| ๐Ÿ›ก๏ธ | Zip-slip | blocks `..` and absolute paths inside archives |
| ๐Ÿงผ | Auto-cleanup | temp files are purged after every run |
| ๐Ÿ’ธ | Low cost | AI vision resizes to 1024px and sends `detail: "low"` (~$0.001/img) |

---

## ๐Ÿ› ๏ธ CLI reference

```
mcp-omni-context                      start the MCP server (stdio)
mcp-omni-context setup                configure all supported clients
mcp-omni-context update               fetch latest + refresh configs and rules
mcp-omni-context --check-update       check the latest published version
mcp-omni-context --warmup [langs]     pre-download OCR language data
mcp-omni-context --selftest           check OCR works on your machine
mcp-omni-context --help               show help
mcp-omni-context --version            show version
```

---

<div align="center">

**MIT License** ยท built by [@0xnurrabby](https://github.com/0xnurrabby)

</div>

TDQS

A4.7/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: read_context_data extracts content from files/images/archives, while find_images locates image paths. They complement each other without overlapping, so an agent can easily choose the right tool.

Naming Consistency5/5

Both tool names follow a consistent verb_noun snake_case pattern: read_context_data and find_images. This predictability makes the tool set easy to navigate.

Tool Count4/5

With only 2 tools, the count is slightly below the typical 3-15 range, but it is appropriate for the narrowly scoped purpose of context extraction. Each tool is essential and earns its place.

Completeness5/5

The tool surface covers the core workflow: reading content from images, files, and archives, plus finding images when no path is provided. There are no significant gaps for the stated domain; minor omissions like other archive formats are acceptable.

Maintenance

ActivitySlowing
ResponsivenessNo issues