Skip to main content

MCP server for OCR functionality using Tesseract

Project description

MCP OCR Server

PyPI Downloads

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.2.0.tar.gz (7.8 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.2.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcp_ocr-0.2.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mcp_ocr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 19d282ead353695454933bc0256bee89816bf49af9e5bd3435c56c5fb426015a
MD5 dd23131b64f80171d571dfc91e1435d5
BLAKE2b-256 44851f2c3f778d1a7618b7dda0faabe158dcf765ed429ee7e9f505b13d9164a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_ocr-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mcp_ocr-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b062b988c7f431dd564b94cd9528023926b0ac3f38b76509ddb8776b7df506d
MD5 473ce7425451bb2ff6edd9efad72fb26
BLAKE2b-256 eb850b77ff085acd2f57a8663f07ae7ff28fe66dec294315c1b8aa34b15af476

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