# ClicheFactory Document Intelligence [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/ClicheFactory/clichefactory-mcp  
**GitHub Stars:** 0  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/clichefactory-document-intelligence

## Description
Extract JSON from documents, emails with attachments, and custom DSPy-trained pipelines.

## Tools
Capabilities this server exposes over MCP:

- **extract** — Extract structured data from a document using a JSON schema.

    Takes a document file (PDF, image, DOCX, XLSX, CSV, EML, etc.) and a JSON
    schema describing the fields to extract. Returns the extracted data as JSON.

    If extraction fails or returns a validation error, try:
    1. Calling doctor to verify the ClicheFactory API key is configured.
    2. Using to_markdown first to inspect the document, then adjusting the schema.
    3. Using extraction_mode="fast" for simpler documents.

    Args:
        file: Absolute path to the document file.
        schema: Either an absolute file path to a JSON schema, or an inline
            JSON schema object. Example inline schema:
            {"type": "object", "properties": {"invoice_number": {"type": "string"}, "total": {"type": "number"}}}
        mode: Execution mode — "service" (ClicheFactory cloud, default) or
            "local" (BYOK, runs on user's machine). Auto-detected from credentials
            when omitted.
        extraction_mode: Extraction strategy. Options:
            - omit for standard OCR + LLM extraction (most reliable).
            - "fast" — send raw bytes to a multimodal LLM, skipping OCR (faster).
            - "trained" — use a trained pipeline artifact (service only, needs artifact_id).
            - "robust" — two-stage extract + verify (service only).
            - "robust-trained" — trained extract + verify (service only, needs artifact_id).
        artifact_id: Trained pipeline artifact ID from ClicheFactory / Emio.
            Required when extraction_mode is "trained" or "robust-trained".
        model: LLM model override (e.g. "gemini/gemini-3-flash-preview", "openai/gpt-4o").
        model_api_key: API key for the model override.
        ocr_model: Separate model for OCR/VLM tasks (optional, defaults to main model).
        ocr_api_key: API key for the OCR model.

    Returns:
        JSON string with the extracted data matching the provided schema.
    
- **to_markdown** — Convert a document to markdown text.

    Takes any supported document (PDF, image, DOCX, XLSX, CSV, EML, etc.) and
    returns its content as readable markdown. Use this to inspect a document
    before extraction, or when extract fails and you need to see the content
    to build a better schema.

    Args:
        file: Absolute path to the document file.
        mode: Client mode — "service" (default) or "local". Auto-detected from
            credentials when omitted.
        conversion_mode: Conversion mode (service mode only). Options:
            - omit for standard OCR + LLM conversion (most reliable).
            - "fast" — send raw bytes to a multimodal LLM, skipping OCR (faster).
        model: LLM model override (e.g. "gemini/gemini-3-flash-preview").
        model_api_key: API key for the model override.
        ocr_model: Separate model for OCR/VLM tasks.
        ocr_api_key: API key for the OCR model.

    Returns:
        The document content as markdown text.
    
- **doctor** — Check ClicheFactory configuration, dependencies, and system binaries.

    Returns a diagnostic report showing:
    - Config file status and API key / model settings
    - Installed Python dependencies (core + local mode)
    - System binaries (tesseract, pandoc, LibreOffice)

    Call this tool first when extraction fails, or to verify the setup is correct.
    

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "clichefactory-document-intelligence": {
    "command": "uvx",
    "args": ["clichefactory-mcp"],
    "env": {
      "CLICHEFACTORY_API_KEY": "",
      "CLICHEFACTORY_API_URL": "",
      "LLM_MODEL_NAME": "",
      "LLM_API_KEY": "",
      "OCR_MODEL_NAME": "",
      "OCR_API_KEY": ""
    }
  }
}
```

**Requires environment variables:** `CLICHEFACTORY_API_KEY`, `CLICHEFACTORY_API_URL`, `LLM_MODEL_NAME`, `LLM_API_KEY`, `OCR_MODEL_NAME`, `OCR_API_KEY` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What ClicheFactory Document Intelligence does

ClicheFactory Document Intelligence exposes document understanding operations through MCP. Its primary workflow accepts a file path and a JSON schema, then returns structured data matching that schema. Schemas can be supplied inline or loaded from an absolute JSON file path.

The server handles PDF, PNG, JPG, JPEG, WebP, GIF, BMP, DOCX, DOC, ODT, XLSX, CSV, EML, TXT, and Markdown files. It can also convert those documents into markdown, which is useful for reviewing source content before designing an extraction schema or troubleshooting a failed extraction.

## How it works

The default execution mode uses the ClicheFactory cloud service and requires a ClicheFactory API key. Local mode runs processing on the user's machine and uses the user's own LLM credentials. If no mode is supplied, the server can determine the mode from the available credentials.

Standard extraction combines OCR and LLM processing. A fast option sends document bytes to a multimodal model without the OCR stage. Service mode also supports trained pipeline artifacts and a two-stage extract-and-verify workflow; trained variants require an artifact ID from ClicheFactory or Emio.

Model and OCR model settings can be supplied independently. The main model may be overridden for extraction, while a separate OCR or vision model can be configured for document reading tasks.

## Setup and configuration

Install the package from PyPI with Python 3.12 or newer:

```bash
pip install clichefactory-mcp
```

For local processing, install the local extras:

```bash
pip install "clichefactory-mcp[local]"
```

Service mode uses `CLICHEFACTORY_API_KEY`. Credentials can be placed in the MCP client's environment or saved through `clichefactory configure` to `~/.clichefactory/config.toml`. Configuration-file values are overridden by environment variables. Local mode uses `LLM_MODEL_NAME` and `LLM_API_KEY`; `OCR_MODEL_NAME` and `OCR_API_KEY` can define separate OCR credentials. The service endpoint can be changed with `CLICHEFACTORY_API_URL`.

The server runs over stdio and can be registered with clients such as Cursor and Claude Desktop using a command such as `uvx clichefactory-mcp`.

## Tools and capabilities

- `extract` returns JSON generated from a document and a requested schema. It accepts inline schemas or schema file paths, execution modes, extraction strategies, model overrides, OCR settings, and trained artifact IDs.
- `to_markdown` converts supported files into markdown. Standard and fast conversion modes are available in service mode.
- `doctor` reports configuration, API-key and model settings, installed Python dependencies, and relevant system binaries.

## Limitations and notes

Local mode requires additional parsing and OCR dependencies, including system binaries such as Tesseract and LibreOffice. Processing quality in that mode depends on the selected local models and setup.

MCP operations return results directly to the calling assistant rather than writing output files. Batch CLI operations, interactive configuration, the CLI output flag, partial-result handling, and OCR engine selection are not exposed as MCP tool parameters. Extraction calls process documents one at a time.

The `trained` and `robust-trained` strategies require an `artifact_id`, and trained strategies are available only in service mode. Fast processing trades the OCR stage for speed and is intended for simpler documents; the standard path is the default extraction approach.

_Full upstream README: https://allmcps.com/mcp/clichefactory-document-intelligence/readme_

