Skip to main content
Glama
lemopian

Mistral OCR MCP Server

by lemopian

Mistral OCR MCP Server

A Model Context Protocol (MCP) server that provides OCR (Optical Character Recognition) functionality using Mistral's OCR API. This server allows you to extract text content from PDF files and images through MCP-compatible clients like Cursor and Claude Desktop.

šŸ“– For more context and practical usage examples, read the related article: How I Use Mistral Document AI to Consolidate My Notes

Usage example flowchart

flow

Related MCP server: Mistral OCR MCP Server

Features

  • Extract text from PDF files and images (JPG, JPEG, PNG, TIFF, BMP)

  • Returns structured content with page-by-page breakdown

  • Integrates seamlessly with MCP clients

  • Built with FastMCP for optimal performance

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/lemopian/mistral-ocr-mcp.git
    cd mistral-ocr-mcp
  2. Install dependencies using uv:

    uv sync
  3. Set up environment variables: Create a .env file in the project root:

    echo "MISTRAL_API_KEY=your_mistral_api_key_here" > .env

Configuration for MCP Clients

Add the following configuration to your MCP client config file:

{
  "mcpServers": {
    "mistral-ocr": {
      "command": "/Users/yourusername/.local/bin/uv",
      "args": [
        "--directory",
        "/path/to/mistral-ocr-mcp",
        "run",
        "main.py"
      ]
    }
  }
}

Important: Replace /path/to/mistral-ocr-mcp with the actual path to your cloned repository.

Usage

Once configured, the server provides the following tool:

extract_file_content

Extracts text content from PDF files and images.

Parameters:

  • file_path (string): Local path to the PDF or image file

Returns:

  • Extracted text content as a string

Supported formats:

  • PDF files (.pdf)

  • Image files (.jpg, .jpeg, .png, .tiff, .bmp)

Example usage :

Please extract the text from this document: /path/to/your/document.pdf

Development

Running the server directly

uv run main.py

Project structure

mistral-ocr-mcp/
ā”œā”€ā”€ mistral_ocr/          # Package directory
│   ā”œā”€ā”€ __init__.py       # Package initialization
│   └── extractor.py      # Mistral OCR functionality
ā”œā”€ā”€ docs/                 # Documentation
│   └── flowchart.png     # Architecture flowchart
ā”œā”€ā”€ main.py               # MCP server implementation
ā”œā”€ā”€ pyproject.toml        # Project dependencies and configuration
ā”œā”€ā”€ uv.lock              # Dependency lock file
ā”œā”€ā”€ .env                 # Environment variables (create this)
ā”œā”€ā”€ .gitignore           # Git ignore rules
└── README.md            # This file

Environment Variables

  • MISTRAL_API_KEY: Your Mistral API key (required)

Troubleshooting

  1. "MISTRAL_API_KEY must be set" error:

    • Ensure you've created a .env file with your Mistral API key

    • Verify the API key is valid

  2. "File not found" error:

    • Check that the file path is correct and accessible

    • Ensure the file format is supported

  3. MCP connection issues:

    • Verify the path to uv is correct in your MCP configuration

    • Ensure the repository path is absolute and correct

    • Check that all dependencies are installed with uv sync

Available Tools

1 tool
extract_file_contentB

Extract content from a PDF or image file using Mistral OCR.

Args:
    file_path: Local path to the file (PDF or image)

Returns:
    Dictionary containing the extraction results
ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathYes

TDQS

B3.2/5.0
Behavior2/5

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

No annotations; description only names the technology (Mistral OCR) but fails to disclose potential limitations, errors, or side effects (e.g., file size, network dependency).

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

Conciseness3/5

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

Short but includes redundant docstring sections (Args, Returns) that don't add value for an agent. Purpose is front-loaded.

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

Completeness2/5

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

No output schema; mentions 'Dictionary containing the extraction results' without details. Lacks error handling, format constraints, or beyond-basic behavior. Incomplete for a production tool.

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

Parameters4/5

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

Adds significant meaning to the file_path parameter: clarifies it's a local path and acceptable file types (PDF or image). Schema has 0% coverage, so this is valuable.

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?

Clearly states verb 'extract', resource 'content from file', and specifies file types PDF or image using Mistral OCR. Distinct and specific.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives or when not to use. No mention of prerequisites or context.

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. Dates show when Glama detected each change.

  1. 1 tool updatev0.1.0
    • First observedextract_file_content

TDQS

A3.6/5.0
Disambiguation5/5

Only one tool exists, so there is no chance of confusion between tools.

Naming Consistency5/5

With a single tool, naming consistency is inherently perfect.

Tool Count5/5

A single tool for OCR extraction is well-scoped for a focused server.

Completeness3/5

The server covers the core OCR task but lacks additional capabilities like batch processing or format listing, making it minimally complete.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lemopian/mistral-ocr-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server