convez.ai
MCP ServerIntegração & APIsIntermediário
grestrepojimenez

Caseware RAG MCP Server

grestrepojimenez/caseware-rag-mcp-server

RAG local para procurement: busca semântica + extração de documentos completos

Ver no GitHub
InicialPluginScore · de 0 a 100

Servidor MCP que expõe uma base de conhecimento local de compras e inventário através de busca semântica. Processa PDFs e imagens com OCR, armazena embeddings em ChromaDB e oferece ferramentas de retrieval para agentes de IA consultarem documentos de procurement de forma contextualizada.

Instalação

$npx convez-ai grestrepojimenez/caseware-rag-mcp-server

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
14%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Consultoria automatizada sobre pedidos de compra e faturas
  • Análise cross-matching entre POs e invoices para reconciliação
  • Processamento inteligente de documentos de procurement em lotes

Veredito

Implementação sólida de RAG local com boas práticas arquiteturais (separação pipeline/server, estratégia dual de retrieval). Ideal para equipes que precisam consultar bases de procurement offline, mas exige setup com Tesseract e gerenciamento manual de dados.

README

A tradução para o português deste README ainda está na fila.

Procurement MCP Server

This repository contains a lightweight, local data pipeline and an MCP (Model Context Protocol) server designed to let AI agents query a procurement and inventory knowledge base.

Architecture Overview

  • Data Pipeline (src/ingest.py): A local Python script that reads PDFs and images from the data/ directory, extracts text using PyPDFLoader and PyTesseract, chunks the data using LangChain, and stores the vector embeddings in a local ChromaDB instance (./chroma_db).
  • MCP Server (src/mcp_server.py): Built using the official mcp SDK (FastMCP). It connects to the local ChromaDB and exposes tools to search and retrieve full documents.
  • Data Modeling: Documents are categorized automatically by heuristic rules (Invoice, PO, etc.). Each text chunk stores its source filename and category in metadata, allowing the AI to ground its answers in specific files.
  • Retrieval Strategy: We employ a semantic vector search via search_knowledge_base, coupled with a full-document retrieval tool get_document_content. This allows the agent to first find relevant snippets, and if deep reasoning (e.g., cross-matching POs to Invoices) is needed, it can pull the full document text.

Prerequisites

  1. Python 3.12+
  2. Tesseract-OCR: Required for extracting text from images. (e.g., brew install tesseract on Mac or via installer on Windows).

Setup Instructions

  1. Environment Variables: Create a .env file in the root directory and add your OpenAI API key for embeddings:

    OPENAI_API_KEY=your-api-key-here
    
  2. Install Dependencies: You can install dependencies via pip:

    pip install -e .
    

    Or using uv:

    uv sync
    

Running the Data Pipeline

Place your documents (PDFs, PNGs, JPGs) into the data/ folder.

Run the ingestion script to process the documents and build the vector database:

python src/ingest.py

This will create a chroma_db folder in the root directory.

Running the MCP Server

The server runs over standard input/output (stdio), which is the standard method for MCP clients (like Claude Desktop) to communicate with local MCP servers.

To run the server manually or attach an inspector:

mcp dev src/mcp_server.py

Connecting to Claude Desktop

Add the following to your Claude Desktop configuration file (usually located at %APPDATA%\Claude\claude_desktop_config.json on Windows or ~/Library/Application Support/Claude/claude_desktop_config.json on Mac):

{
  "mcpServers": {
    "procurement": {
      "command": "python",
      "args": [
        "-m",
        "mcp",
        "run",
        "C:/absolute/path/to/src/mcp_server.py"
      ],
      "env": {
        "OPENAI_API_KEY": "your-api-key-here"
      }
    }
  }
}

(Replace C:/absolute/path/to/src/mcp_server.py with the actual absolute path to mcp_server.py and ensure the python executable used has the required dependencies installed.)

MCP Tools Exposed

  • search_knowledge_base(query, limit): Performs semantic vector search.
  • get_document_content(source_file): Retrieves the complete text of a specific document for deep reasoning.
  • list_documents(category): Lists all known files, optionally filtered by category.

Design Decisions

  • Why ChromaDB? Local, zero-setup, and directly integrates with LangChain.
  • Why FastMCP? It's the officially supported, most lightweight way to expose Python functions as MCP tools.
  • Why Vector Search + Full Doc Retrieval? Often, extracting structured data (like line items in an invoice) across multiple chunks is hard for an LLM to reason over. The agent can use semantic search to locate the right file, then pull the entire text to perform exact matching/comparison.
Ver o original no GitHub

Bom para

Relacionados