About mcp-dharmamitra
mcp-dharmamitra is an MCP server for extracting text from images through the public Dharmamitra OCR endpoint. It is intended for Tibetan, Sanskrit, and Devanagari text, and writes results to a local file.
Key features
- 01OCR images through Dharmamitra
- 02Optimized for Tibetan, Sanskrit, and Devanagari
- 03Optional Devanagari and Tibetan transliteration
- 04Write extracted UTF-8 text to a file
Use cases
- 01Extract text from Tibetan manuscript images
- 02Convert Sanskrit or Devanagari image text into files
MCP support
It exposes an `ocr_image` tool that sends a local image to the Dharmamitra OCR endpoint and writes the extracted text to the specified output path.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
uvx mcp-dharmamitraDHARMAMITRA_COOKIESecretOptional cf_clearance cookie value. Only needed if requests start returning 403 from Cloudflare.Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.
Tools
1Saved tool list · updated 2w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | No | |
| image_path | string | Yes | |
| instruction | string | No | |
| output_path | string | Yes | |
| timeout_seconds | number | No | |
| poll_interval_seconds | number | No | |
| transliterate_tibetan_to_wylie | boolean | No | |
| transliterate_devanagari_to_iast | boolean | No |
Details
From the project READMEmcp-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
| Argument | Type | Default | Notes |
|---|---|---|---|
image_path | str | — | Absolute path to a local image (png/jpg/…). |
output_path | str | — | File to write UTF-8 text into. Parent dirs are created. |
transliterate_devanagari_to_iast | bool | false | Passed to the API. |
transliterate_tibetan_to_wylie | bool | false | Passed to the API. |
instruction | str | "" | Optional model instruction. |
model | str | "auto" | OCR model id. |
poll_interval_seconds | float | 2.0 | Delay between status polls. |
timeout_seconds | float | 300.0 | Overall polling deadline. |
Returns a small JSON summary — the extracted text is written to output_path,
not returned to the client.
{
"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):
{
"mcpServers": {
"dharmamitra": {
"command": "uvx",
"args": ["mcp-dharmamitra"],
"env": {"DHARMAMITRA_COOKIE": ""}
}
}
}
Or via the Claude Code CLI:
claude mcp add dharmamitra -e DHARMAMITRA_COOKIE="" -- uvx mcp-dharmamitra
Pin a specific version with uvx [email protected].
Install from source
uv sync # or: pip install -e '.[dev]'
Run locally with the MCP inspector:
uv run mcp dev src/mcp_dharmamitra/server.py
Run tests:
uv run pytest
For a source checkout the Claude Desktop entry uses the local path:
{
"mcpServers": {
"dharmamitra": {
"command": "uv",
"args": ["--directory", "/path/mcp-dharmamitra", "run", "mcp-dharmamitra"],
"env": {"DHARMAMITRA_COOKIE": ""}
}
}
}
Docker
Build the image:
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:
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.
{
"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:
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:
{
"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:
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.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.