Get the FREE Ultimate OpenClaw Setup Guide →

mistral-ocr

MCP Server Showcasing How to Use mistral Document OCR functionality

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio lemopian-mistral-ocr-mcp python main.py \
  --env MISTRAL_API_KEY="your_mistral_api_key_here"

How to use

This MCP server exposes an OCR capability powered by Mistral's OCR API. Once running, clients can call the extract_file_content tool to obtain text content from documents. The server accepts inputs in the form of a local file path to PDFs and common image formats (PDF, JPG/JPEG, PNG, TIFF, BMP) and returns a structured, page-by-page extracted text output. It’s designed to integrate with MCP clients like Cursor and Claude Desktop, enabling seamless incorporation of OCR results into downstream workflows. To use it, configure your MCP client to point at the server and invoke extract_file_content with the path to the file you want to OCR. The server handles authentication via your Mistral API key and returns text content suitable for further processing or storage.

How to install

Prerequisites:

  • Python 3.10.1 or higher
  • A Mistral API Key
  • uv (recommended via the project) or a Python environment to run the server

Installation steps:

  1. Clone the repository: git clone https://github.com/lemopian/mistral-ocr-mcp.git cd mistral-ocr-mcp

  2. Install dependencies (via uv if you have it, otherwise install into a Python environment):

    • If using uv: uv sync
    • If using a virtual environment manually: python -m venv venv source venv/bin/activate # on Windows use: venv\Scripts\activate pip install -r requirements.txt
  3. Configure environment variables: Create a .env file in the project root and add your API key: MISTRAL_API_KEY=your_mistral_api_key_here

  4. Run the MCP server: If following the project's guidance, you can start the server with: uv run main.py Note: If you prefer running directly with Python, you can start the server using: python main.py

  5. Verify the server is running and accessible to your MCP clients.

Additional notes

Tips and troubleshooting:

  • Ensure MISTRAL_API_KEY is set in a .env file or provided in the environment where the server runs.
  • If you encounter 'MISTRAL_API_KEY must be set', double-check the .env file path and environment loading in your runtime.
  • The server supports OCR for PDFs and image formats: .pdf, .jpg/.jpeg, .png, .tiff, .bmp. Large PDFs may take longer to process; consider batching if needed.
  • When configuring MCP clients, use the host and port where the server is exposed. Keep the uv or Python process running to maintain availability.
  • If you switch from uv to a direct Python run, ensure the working directory and file paths align with how main.py expects to locate resources.

Related MCP Servers

Sponsor this space

Reach thousands of developers