Mcp Dharmamitra

io.github.alex-deus由 GitHub 帳號 alex-deus 發布v0.1.0更新於 Oct 25, 2026

Dharmamitra OCR for Tibetan / Sanskrit / Devanagari images; writes extracted text to a file.

已驗證STDIO僅桌面檔案與儲存媒體與設計

概覽

AI 產生的概覽

本機 MCP 伺服器,透過公開的 Dharmamitra 介面對藏文、梵文或天城文圖片執行 OCR,並將辨識文字寫入檔案。

可以做什麼
對本機圖片執行 OCR,把辨識出的 UTF-8 文字寫入指定的輸出檔案(自動建立上層目錄),並回傳包含任務 ID、頁數、處理時間與字元數的小型 JSON 摘要,而非文字本身。可選擇將天城文轉寫為 IAST、將藏文轉寫為 Wylie,傳入自訂模型指示,並設定 OCR 模型、輪詢間隔與逾時時間。
適用情境
適合處理藏文、梵文或天城文的掃描檔、照片、碑文或手稿,需要把文字擷取到本機檔案以便後續處理時使用。每次呼叫處理一張圖片,較適合零散數位化工作而非批次流程。
執行需求
以 Python 套件形式透過 uvx 在本機執行(也可用 uv 從原始碼執行,或使用 Docker 映像)。需要能連線到公開的 Dharmamitra OCR 端點。選用環境變數 DHARMAMITRA_COOKIE 存放 Cloudflare 的 cf_clearance 值,僅在請求開始回傳 403 時需要。
安裝前請注意
圖片會上傳到第三方公開 OCR 服務,請勿傳送敏感或機密資料。工具會寫入指定的輸出路徑並建立上層目錄,請指向你確實要修改的位置。DHARMAMITRA_COOKIE 是綁定 dharmamitra.org 的瀏覽器工作階段 Cookie,應視為機密並定期更新,不要寫死在設定中。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mcp Dharmamitra,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mcp-dharmamitra

MCP server that runs OCR on an image via the public Dharmamitra OCR endpoint and writes the extracted text to a local file. Optimised for Tibetan / Sanskrit / Devanagari input.

Tool

ocr_image

ArgumentTypeDefaultNotes
image_pathstr—Absolute path to a local image (png/jpg/…).
output_pathstr—File to write UTF-8 text into. Parent dirs are created.
transliterate_devanagari_to_iastboolfalsePassed to the API.
transliterate_tibetan_to_wylieboolfalsePassed to the API.
instructionstr""Optional model instruction.
modelstr"auto"OCR model id.
poll_interval_secondsfloat2.0Delay between status polls.
timeout_secondsfloat300.0Overall polling deadline.

Returns a small JSON summary — the extracted text is written to output_path, not returned to the client.

json
{  "job_id": "b8b26984b3ca49199c28303cad6a144d",  "output_path": "/abs/path/out.txt",  "pages": 1,  "processing_time_seconds": 3.957,  "chars": 1234}

Install from the MCP registry

Listed as io.github.alex-deus/mcp-dharmamitra on the official Model Context Protocol registry. The package ships to PyPI as mcp-dharmamitra and is meant to be run with uvx — no clone, no manual install.

~/Library/Application Support/Claude/claude_desktop_config.json (or the equivalent mcp block in Claude Code):

json
{  "mcpServers": {    "dharmamitra": {      "command": "uvx",      "args": ["mcp-dharmamitra"],      "env": {"DHARMAMITRA_COOKIE": ""}    }  }}

Or via the Claude Code CLI:

bash
claude mcp add dharmamitra -e DHARMAMITRA_COOKIE="" -- uvx mcp-dharmamitra

Pin a specific version with uvx [email protected].

Install from source

bash
uv sync                           # or: pip install -e '.[dev]'

Run locally with the MCP inspector:

bash
uv run mcp dev src/mcp_dharmamitra/server.py

Run tests:

bash
uv run pytest

For a source checkout the Claude Desktop entry uses the local path:

json
{  "mcpServers": {    "dharmamitra": {      "command": "uv",      "args": ["--directory", "/path/mcp-dharmamitra", "run", "mcp-dharmamitra"],      "env": {"DHARMAMITRA_COOKIE": ""}    }  }}

Docker

Build the image:

bash
docker build -t mcp-dharmamitra:latest .

MCP talks over stdio, so the container must be run with -i (no -t). Mount a host directory that holds the input images — the tool arguments (image_path, output_path) are paths inside the container.

Smoke-test the entrypoint:

bash
docker run --rm --entrypoint python mcp-dharmamitra:latest \  -c "from mcp_dharmamitra.server import mcp; print(mcp.name)"

Wire the container into Claude Desktop / Claude Code

Replace /path/mcp-dharmamitra with any host directory you want the tool to be able to read/write. Files inside it will be visible under /data in the container.

json
{  "mcpServers": {    "dharmamitra": {      "command": "docker",      "args": [        "run", "-i", "--rm",        "-v", "/path/mcp-dharmamitra/data:/data",        "-e", "DHARMAMITRA_COOKIE",        "mcp-dharmamitra:latest"      ],      "env": {        "DHARMAMITRA_COOKIE": ""      }    }  }}

Or the same via CLI:

bash
claude mcp add dharmamitra \  --scope project \  -e DHARMAMITRA_COOKIE="" \  -- docker run -i --rm \       -v /path/mcp-dharmamitra/data:/data \       -e DHARMAMITRA_COOKIE \       mcp-dharmamitra:latest

When calling the tool, pass container paths. Example — image at <host>/tmp/text.png → /data/text.png:

json
{  "image_path": "/data/text.png",  "output_path": "/data/text.txt"}

The resulting text.txt appears in the mounted host directory.

Cloudflare / cf_clearance

The endpoint sits behind Cloudflare. Most requests go through without any cookie. If you start getting 403, grab a fresh cf_clearance value from a logged-in browser session on dharmamitra.org and export it:

bash
export DHARMAMITRA_COOKIE='cf_clearance value here'

The server will attach it as a cookie on every request. Do not hardcode it — Cloudflare rotates the value.

來源:README.md,提交 9240b35

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.0最新Sep 16, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。