npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mcpcn/mcp-image-ocr-mcp

v1.0.1

Published

使用阿里云百炼 Qwen OCR 进行图片文字识别提取

Readme

图片文字识别 MCP

使用阿里云百炼 Qwen OCR 进行图片文字识别提取的 MCP 服务器。

功能特性

  • 基于阿里云百炼的 qwen-vl-ocr-2025-04-13 模型
  • 高精度文字提取和识别
  • 支持自定义识别提示词
  • 可配置像素阈值
  • 完善的错误处理和友好的中文提示
  • TypeScript 类型安全

环境变量

  • DASHSCOPE_API_KEY:阿里云百炼 API Key(必需)

安装与构建

npm install
npm run build

运行

# 直接运行已构建的入口
npm start
# 或作为可执行命令
image-ocr-mcp

在 MCP 客户端中配置

以 Claude Desktop 为例,在其 MCP 配置中添加:

{
  "mcpServers": {
    "image-ocr": {
      "command": "node",
      "args": ["/绝对路径/到/本项目/dist/index.js"],
      "env": {
        "DASHSCOPE_API_KEY": "your-dashscope-key"
      }
    }
  }
}

暴露的工具

ocr_extract_text

使用 OCR 识别提取图片中的文字。

参数

  • image_url (必需): 图片URL
  • custom_prompt (可选): 自定义识别提示词
  • min_pixels (可选): 最小像素阈值,默认 3136
  • max_pixels (可选): 最大像素阈值,默认 229376

示例

{
  "image_url": "https://example.com/image.jpg",
  "custom_prompt": "请识别图片中的所有文字,包括表格内容"
}

目录结构

src/
├── index.ts          # MCP 服务器主入口
├── config.ts         # 配置信息
├── types.ts          # 类型定义
└── tool.ts           # OCR 工具实现

技术细节

  • 使用 OpenAI SDK 通过兼容接口调用阿里云 DashScope API
  • 默认温度设置为 0.1,确保识别结果稳定
  • 最大 tokens 设置为 4000,适合大量文字提取
  • 自动处理常见 HTTP 错误(401、403、429、500等)

兼容性

  • Node.js >= 18
  • @modelcontextprotocol/sdk v1 接口