RapidOCR MCP server

Extracts text from images using RapidOCR library through base64-encoded data or file paths for automated document processing workflows.
Back to servers
Setup instructions
Provider
z4none
Release date
Mar 21, 2025
Language
Python
Package
Stats
2.5K downloads
2 stars

The RapidOCR MCP Server provides optical character recognition (OCR) capabilities through an easy-to-use interface. It's based on the RapidOCR library and follows the Model Context Protocol (MCP) specification, allowing for straightforward integration with applications that need text extraction from images.

Installation

To install the RapidOCR MCP Server, you'll need to have Python installed on your system. Then run:

pip install rapidocr-mcp

This will install the server and its dependencies.

Running the Server

Once installed, you can start the server using the following command:

uvx run rapidocr-mcp

The server will start and listen for incoming OCR requests.

Available Methods

The RapidOCR MCP Server provides two main methods for text recognition:

OCR by Content

Extract text from an image provided as base64-encoded content:

# Example of calling the ocr_by_content method
import base64
import requests

# Load image and convert to base64
with open("image.jpg", "rb") as image_file:
    base64_data = base64.b64encode(image_file.read()).decode("utf-8")

# Send request to the server
response = requests.post(
    "http://localhost:8000/ocr_by_content",
    json={"base64_data": base64_data}
)

# Process results
results = response.json()
for text_content in results:
    print(f"Text: {text_content['text']}")
    print(f"Position: {text_content['position']}")

OCR by Path

Extract text from an image file located on the server's filesystem:

# Example of calling the ocr_by_path method
import requests

# Send request to the server with the path to the image
response = requests.post(
    "http://localhost:8000/ocr_by_path",
    json={"path": "/path/to/image.jpg"}
)

# Process results
results = response.json()
for text_content in results:
    print(f"Text: {text_content['text']}")
    print(f"Position: {text_content['position']}")

Response Format

Both methods return a list of recognized text items. Each item contains:

  • text: The recognized text string
  • position: The coordinates of the text in the image (typically in the format [[x1,y1], [x2,y2], [x3,y3], [x4,y4]])

Configuration

By default, the server runs on port 8000. To configure different server parameters, you can set environment variables before starting the server:

# Example of setting a custom port
export MCP_PORT=9000
uvx run rapidocr-mcp

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "rapidocr-mcp" '{"command":"uvx","args":["run","rapidocr-mcp"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "rapidocr-mcp": {
            "command": "uvx",
            "args": [
                "run",
                "rapidocr-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "rapidocr-mcp": {
            "command": "uvx",
            "args": [
                "run",
                "rapidocr-mcp"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later