MCP server for OCR text recognition service (RapidOCR + OpenVINO)
Project description
OCR MCP Server
MCP (Model Context Protocol) 服务器,让 Claude Code / Cursor / Windsurf 等 AI 编码工具通过 MCP 协议直接调用 OCR 文字识别服务。
功能
| Tool | 说明 |
|---|---|
ocr_recognize |
图片文字识别 - 从任意包含文字的图片中提取文本内容 |
ocr_table |
表格识别 - 从图片中提取表格的行列结构化数据 |
ocr_health |
服务健康检查 - 验证后端 OCR 服务是否正常运行 |
参数说明
ocr_recognize 和 ocr_table 支持以下参数(三选一,优先级从高到低):
| 参数 | 说明 |
|---|---|
image_path |
本地文件路径(推荐) - 支持 png, jpg, jpeg, gif, bmp, webp, tiff, tif, pdf |
image_base64 |
图片的 base64 编码 |
image_url |
图片 URL 地址 |
直接给文件路径即可,MCP Server 会自动读取文件并处理。
环境变量
| 变量 | 默认值 | 说明 |
|---|---|---|
OCR_SERVICE_URL |
http://127.0.0.1:8082/api |
OCR 后端 API 地址(含路径前缀) |
接入配置
Claude Code
项目根目录创建 .mcp.json:
{
"mcpServers": {
"ocr": {
"command": "uvx",
"args": ["wk-ocr-mcp"],
"env": {
"OCR_SERVICE_URL": "https://gogs.wxapp.info/ocr-api"
}
}
}
}
或 pip install 后:
{
"mcpServers": {
"ocr": {
"command": "python3",
"args": ["-m", "ocr_mcp_server"],
"env": {
"OCR_SERVICE_URL": "https://gogs.wxapp.info/ocr-api"
}
}
}
}
Cursor / Windsurf
分别放到项目根目录 .cursor/mcp.json 或 .codeium/windsurf/mcp_config.json,格式同上。
OCR_SERVICE_URL 配置说明
OCR_SERVICE_URL 必须指向 API 路径前缀:
| 场景 | 值 |
|---|---|
| 直接访问 | http://127.0.0.1:8082/api |
| Nginx 代理 | https://gogs.wxapp.info/ocr-api |
代码会在此基础拼接端点:{URL}/ocr、{URL}/table、{URL}/health
使用方式
配置好后重启工具,直接用自然语言:
帮我识别这张图片里的文字: /path/to/screenshot.png
这个截图里的表格数据提取出来: /path/to/table.png
AI 会自动调用 ocr_recognize 或 ocr_table,传入文件路径即可完成识别。
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wk_ocr_mcp-0.2.2.tar.gz.
File metadata
- Download URL: wk_ocr_mcp-0.2.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8792b32dc15444669dc80bb73c4794747213ff29d7f607e5ddb37e7d240cb973
|
|
| MD5 |
37af2b2d5d1999f7593e37ba13cf840d
|
|
| BLAKE2b-256 |
ee29ec50154e0a55fec6319c5e925956bf630c3bef8ad421118419e6259afb68
|
File details
Details for the file wk_ocr_mcp-0.2.2-py3-none-any.whl.
File metadata
- Download URL: wk_ocr_mcp-0.2.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8808d9656e9744d52fbd77eb34860f7ece3451b0b6a51251dc1f5263d1464912
|
|
| MD5 |
c01d7692024c117a3716cbccf6850d97
|
|
| BLAKE2b-256 |
777ffcff7afe247564996afb607631a8cdb7cf7a8753d8af93df9e05cbd7b5d3
|