文档提取与语义搜索CLI工具

一款集成Vision AI的CLI工具,用于从发票、收据和银行对账单中提取结构化数据,支持本地和云端AI处理,并提供语义搜索功能。

  • by prosdevlab
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 prosdevlab/doc-agent

使用说明

文档代理

文档提取和语义搜索CLI与MCP集成。使用Vision AI从发票、收据和银行对账单中提取结构化数据。

特性

  • 🔍 文档提取:使用Vision AI从PDF和图像中提取结构化数据
  • 🦙 奥拉玛第一:隐私优先默认使用本地 llama3.2-vision 模型
  • 🔧 零设置:如果需要,自动通过Homebrew安装Olama,自动拉取型号
  • 📄 多格式:支持PDF和图像(PNG、JPEG、WebP)
  • 🔬 OCR增强:使用Tesseract.js从收据中准确提取文本
  • 💾 本地存储:所有数据都保存到本地SQLite数据库
  • 🔎 语义搜索:索引文档的自然语言搜索(即将推出)
  • 🤖 MCP集成:通过Claude Desktop或任何兼容MCP的助手使用
  • 🔒 隐私第一:数据保留在您的机器上(除非您选择云AI)

快速开始

安装

npm install -g doc-agent

用法

提取文档数据(默认使用Ollama):

doc extract invoice.pdf

💡 没有奥利玛?没问题!CLI将通过Homebrew为您安装它。

使用Gemini(云,精度更高):

export GEMINI_API_KEY=your_key_here
doc extract invoice.pdf --provider gemini

启动MCP服务器:

doc mcp

Claude桌面集成

添加到您的 claude_desktop_config.json:

{
  "mcpServers": {
    "doc-agent": {
      "command": "npx",
      "args": ["-y", "doc-agent", "mcp"],
      "env": {
        "GEMINI_API_KEY": "your_key_here"
      }
    }
  }
}

然后在Claude Desktop中:

“从~/Downloads/invoice.pdf中提取数据”

发展

# Clone and install dependencies
git clone https://github.com/prosdevlab/doc-agent
cd doc-agent
pnpm install

# Build the project
pnpm build

# Run CLI locally
pnpm dev extract examples/invoice.pdf

# Run tests
pnpm test

# Start MCP server
pnpm mcp

建筑

CLI是用 墨水 (React for CLIs)提供丰富的交互式输出:

packages/
├── cli/           # Ink-based CLI with services, hooks, and components
├── core/          # Shared types and interfaces
├── extract/       # Document extraction (Gemini, Ollama) + OCR
├── storage/       # SQLite persistence (Drizzle ORM)
└── vector-store/  # Vector database for semantic search

路线图

看 ROADMAP.md 对于项目计划。

许可证

麻省理工学院