Skip to main content

MCP server for OCR functionality using Tesseract

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_ocr-0.1.2.tar.gz (29.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_ocr-0.1.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file mcp_ocr-0.1.2.tar.gz.

File metadata

  • Download URL: mcp_ocr-0.1.2.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for mcp_ocr-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c3a34c40f7df0fa2fd1b183082e28d69021f31ae17cfc68b64d724b27a876b15
MD5 06578ccb8e21e3cfba85d5347bc802cf
BLAKE2b-256 879365ee0fe254721fa0fbe9d427813060e06ca12cfc2bc4d9d774397c57168f

See more details on using hashes here.

File details

Details for the file mcp_ocr-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mcp_ocr-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for mcp_ocr-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4ce7e10e7a1fbbf2178a834dd977c72e76528830da7a310ce509bf73ee138918
MD5 6f789a08ac1feeaea5d68b2f1d6b24ed
BLAKE2b-256 110b4318e58aca523ac6861bcdf87405c00edd42d1a269e8dd24651322682c19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page