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 分

    请在仓库或注册中心条目中声明许可证。