mistral-ocr
MCP Server Showcasing How to Use mistral Document OCR functionality
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:
-
Clone the repository: git clone https://github.com/lemopian/mistral-ocr-mcp.git cd mistral-ocr-mcp
-
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
-
Configure environment variables: Create a .env file in the project root and add your API key: MISTRAL_API_KEY=your_mistral_api_key_here
-
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
-
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
web-eval-agent
An MCP server that autonomously evaluates web applications.
mcp-neo4j
Neo4j Labs Model Context Protocol servers
imagesorcery
An MCP server providing tools for image processing operations
Gitingest
mcp server for gitingest
fhir
FHIR MCP Server – helping you expose any FHIR Server or API as a MCP Server.
unitree-go2
The Unitree Go2 MCP Server is a server built on the MCP that enables users to control the Unitree Go2 robot using natural language commands interpreted by a LLM.