Skip to main content

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

Metadata

Release files for wk-ocr-mcp 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wk-ocr-mcp 0.2.2
File Size Uploaded Provenance
wk_ocr_mcp-0.2.2.tar.gz 3.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for wk-ocr-mcp 0.2.2
File Interpreter ABI Platform
wk_ocr_mcp-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / wk_ocr_mcp-0.2.2.tar.gz

Download URL wk_ocr_mcp-0.2.2.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8792b32dc15444669dc80bb73c4794747213ff29d7f607e5ddb37e7d240cb973
BLAKE2b-256 checksum
How to use checksums
ee29ec50154e0a55fec6319c5e925956bf630c3bef8ad421118419e6259afb68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / wk_ocr_mcp-0.2.2-py3-none-any.whl

Download URL wk_ocr_mcp-0.2.2-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8808d9656e9744d52fbd77eb34860f7ece3451b0b6a51251dc1f5263d1464912
BLAKE2b-256 checksum
How to use checksums
777ffcff7afe247564996afb607631a8cdb7cf7a8753d8af93df9e05cbd7b5d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for wk-ocr-mcp 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page