Skip to main content
Glama

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

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
}

Related MCP server: Tesseract OCR MCP Server

Install

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

Wire into Claude Desktop / Claude Code

~/Library/Application Support/Claude/claude_desktop_config.json:

{
    "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 /Users/aleksei/projects/ai/mcp-dharmamitra/tmp 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", "/Users/aleksei/projects/ai/mcp-dharmamitra/tmp:/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 /Users/aleksei/projects/ai/mcp-dharmamitra/tmp:/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.

Available Tools

1 tool
ocr_imageA

Run Dharmamitra OCR on an image and save extracted text to a file.

Args: image_path: Absolute path to a local image file (png/jpg/…). output_path: File path where the extracted text will be written (UTF-8). transliterate_devanagari_to_iast: Pass-through flag for the API. transliterate_tibetan_to_wylie: Pass-through flag for the API. instruction: Optional instruction string for the OCR model. model: OCR model id ("auto" by default). poll_interval_seconds: Delay between status polls. timeout_seconds: Overall polling timeout.

Returns a summary with job_id, output_path, pages, processing time and char count.

ParametersJSON Schema
NameRequiredDescriptionDefault
modelNoauto
image_pathYes
instructionNo
output_pathYes
timeout_secondsNo
poll_interval_secondsNo
transliterate_tibetan_to_wylieNo
transliterate_devanagari_to_iastNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description carries the full burden. It adds real behavioral context beyond the schema: the operation is an async job (poll_interval_seconds, timeout_seconds, job_id in the return), and it names the returned summary fields. It stops short of stating auth requirements, error behavior, or whether output_path is overwritten.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action, then a clean args list and a return summary. It is longer than a single sentence but every line adds parameter or return semantics, so little is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given eight parameters, a write side effect, and no annotations, the description covers inputs and the return shape well. Remaining gaps—overwrite semantics for output_path, permissions/auth, and failure modes—are minor for an OCR utility whose output schema is provided.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does for all eight parameters: path formats (absolute, png/jpg), UTF-8 output, the meaning of the two transliteration flags, the optional instruction, the 'auto' model default, and what the polling/timeout knobs control.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Run Dharmamitra OCR on an image and save extracted text to a file.' The input and the side effect (writing extracted text to a file) are both named, so an agent knows exactly what the tool accomplishes without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The purpose implies the usage context (OCR of a local image), but there is no explicit when-to-use, when-not, or alternative-tool guidance. With no siblings this is less costly, but the description still leaves selection and prerequisites to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.1.0
    • First observedocr_image

TDQS

A4.1/5.0

Scored across 1 tool

Disambiguation5/5

There is only one tool, so there is no possibility of selecting the wrong one; its purpose (OCR an image and write text to a file) is unambiguous. An agent cannot confuse it with anything else in this server.

Naming Consistency5/5

The single tool uses a clean, predictable verb_noun-style name (ocr_image) with snake_case arguments that match the naming convention. No competing conventions exist to create inconsistency.

Tool Count3/5

One tool is thin for a named service like Dharmamitra, which suggests an OCR/document-processing domain that could span submission, status, and result retrieval. The tool does bundle the full submit-and-poll workflow, so it is self-contained, but the surface is minimal.

Completeness3/5

The core OCR operation, polling, and file output are covered, but there is no batch processing, no job status/list/cancel operation, and no way to discover supported models or endpoints. These are workable gaps but leave the lifecycle incomplete.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers