RM

rjn32s/mcp-ocr

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

40 stars 10 forks 质量 76 趋势 4MIT

rjn32s/mcp-ocr 是从 https://github.com/rjn32s/mcp-ocr. 导入的 MCP 服务器候选

概览

rjn32s/mcp-ocr 是从 https://github.com/rjn32s/mcp-ocr. 导入的 MCP 服务器候选

概述(AI 翻译)

一台使用MCP(模型上下文协议)构建的生产级OCR服务器,通过简单界面提供OCR功能。

特色

  • 使用Tesseract OCR从图像中提取文本
  • 支持多种输入类型:
  • 本地图像文件
  • 图片网址
  • 原始图像字节
  • 自动安装四维超方方
  • 支持多种语言
  • 生产准备错误处理

安装

Tesseract将自动安装在支持的平台上:

  • macOS(通过自制软件)
  • Linux(通过apt、dnf或pacman)
  • Windows(提供手动安装说明)

用途

作为MCP服务器

  1. 启动服务器:

  2. 配置Claude桌面版: 加到~/Library/Application Support/Claude/claude_desktop_config.json:

可用工具

####perform_ocr 从图片中提取文本:

get_supported_languages

列出可用的OCR语言:

发展

  1. 克隆仓库:

  2. 建立开发环境:

  3. 进行测试:

贡献

  1. 分支仓库
  2. 创建你的特征分支(git checkout -b feature/amazing-feature)
  3. 提交你的更改(git commit -m 'Add amazing feature')

本页由 AI 翻译,技术细节请以原文为准。

README

MCP OCR Server

A production-grade OCR server built using MCP (Model Context Protocol) that provides OCR capabilities through a simple interface.

Features

  • Extract text from images using Tesseract OCR
  • Support for multiple input types:
    • Local image files
    • Image URLs
    • Raw image bytes
  • Automatic Tesseract installation
  • Support for multiple languages
  • Production-ready error handling

Installation

# Using pip
pip install mcp-ocr

# Using uv
uv pip install mcp-ocr

Tesseract will be installed automatically on supported platforms:

  • macOS (via Homebrew)
  • Linux (via apt, dnf, or pacman)
  • Windows (manual installation instructions provided)

Usage

As an MCP Server

  1. Start the server:
python -m mcp_ocr
  1. Configure Claude for Desktop: Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
    "mcpServers": {
        "ocr": {
            "command": "python",
            "args": ["-m", "mcp_ocr"]
        }
    }
}

Available Tools

perform_ocr

Extract text from images:

# From file
perform_ocr("/path/to/image.jpg")

# From URL
perform_ocr("https://example.com/image.jpg")

# From bytes
perform_ocr(image_bytes)

get_supported_languages

List available OCR languages:

get_supported_languages()

Development

  1. Clone the repository:
git clone https://github.com/rjn32s/mcp-ocr.git
cd mcp-ocr
  1. Set up development environment:
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv pip install -e .
  1. Run tests:
pytest

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Security

  • Never commit API tokens or sensitive credentials
  • Use environment variables or secure credential storage
  • Follow GitHub’s security best practices

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "ocr": { "command": "python", "args": ["-m", "mcp_ocr"] } } }