mcp-mistral-ocr

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Supports containerized deployment using Docker, with configuration options for environment variables and volume mounting to access local files.

MCP Mistral OCR

一个使用 Mistral AI 的 OCR API 提供 OCR 功能的 MCP 服务器。该服务器可以处理本地文件和 URL,并支持图像和 PDF。

特征

  • 使用 Mistral 的 OCR 处理本地文件(图像和 PDF)
  • 处理来自具有明确文件类型规范的 URL 的文件
  • 支持多种文件格式(JPG、PNG、PDF等)
  • 结果保存为带有时间戳的 JSON 文件
  • Docker 容器化
  • UV包管理

环境变量

  • MISTRAL_API_KEY :您的 Mistral AI API 密钥
  • OCR_DIR :本地文件处理的目录路径。在容器内部,此目录始终映射到/data/ocr

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Mistral OCR:

npx -y @smithery/cli install @everaldo/mcp/mistral-crosswalk --client claude

使用 Docker

  1. 构建 Docker 镜像:
docker build -t mcp-mistral-ocr .
  1. 运行容器:
docker run -e MISTRAL_API_KEY=your_api_key -e OCR_DIR=/data/ocr -v /path/to/local/files:/data/ocr mcp-mistral-ocr

本地开发

  1. 安装 UV 包管理器:
pip install uv
  1. 创建并激活虚拟环境:
uv venv source .venv/bin/activate # On Unix # or .venv\Scripts\activate # On Windows
  1. 安装依赖项:
uv pip install .

Claude桌面配置

将此配置添加到您的 claude_desktop_config.json:

{ "mcpServers": { "mistral-ocr": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "MISTRAL_API_KEY", "-e", "OCR_DIR", "-v", "C:/path/to/your/files:/data/ocr", "mcp-mistral-ocr:latest" ], "env": { "MISTRAL_API_KEY": "<YOUR_MISTRAL_API_KEY>", "OCR_DIR": "C:/path/to/your/files" } } } }

可用工具

1. process_local_file

从配置的 OCR_DIR 目录中处理文件。

{ "name": "process_local_file", "arguments": { "filename": "document.pdf" } }

2. process_url_file

处理来自 URL 的文件。需要明确指定文件类型。

{ "name": "process_url_file", "arguments": { "url": "https://example.com/document", "file_type": "image" // or "pdf" } }

输出

OCR 结果以 JSON 格式保存在OCR_DIR output目录中。每个结果文件使用以下格式命名:

  • 对于本地文件: {original_filename}_{timestamp}.json
  • 对于 URL:如果在 URL 中未找到文件名,则为{url_filename}_{timestamp}.jsonurl_document_{timestamp}.json

时间戳格式为YYYYMMDD_HHMMSS

支持的文件类型

  • 图像:JPG、JPEG、PNG、GIF、WebP
  • 文档:PDF 和 Mistral OCR 支持的其他文档格式

限制

  • 最大文件大小:50MB(由 Mistral API 强制执行)
  • 最大文档页数:1000(由 Mistral API 强制执行)
-
security - not tested
F
license - not found
-
quality - not tested

使用 Mistral OCR API(付费)在本地或通过 URL 对图像或 PDF 进行 OCR

  1. Features
    1. Environment Variables
      1. Installation
        1. Installing via Smithery
        2. Using Docker
        3. Local Development
      2. Claude Desktop Configuration
        1. Available Tools
          1. 1. process_local_file
          2. 2. process_url_file
        2. Output
          1. Supported File Types
            1. Limitations
              ID: 798rkh8r8l