ai-document-mcp-server

adi01012002/ai-document-mcp-server

3.2

If you are the rightful owner of ai-document-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

AI-powered Model Context Protocol server for intelligent document processing and chat with Google Gemini AI integration.

Tools
4
Resources
0
Prompts
0

AI Agent MCP Server

AI-powered Model Context Protocol server for intelligent document processing and chat with Google Gemini AI integration.

Features

  • Extract text from PDFs and images (OCR)
  • Auto-detect document types (Aadhaar, PAN, Bank Statements, etc.)
  • AI chat with context retention
  • Session management with file storage
  • RESTful API endpoints

Prerequisites

  • Node.js (v16+)
  • Google Gemini API key

🚀 Setup Guide

Follow the steps below to run the Express Client and MCP Server.

1️⃣ Clone the Repository

git clone <your-repo-url>

2️⃣ Setup Express Client

cd Express-client

Install Dependencies

npm install cors express multer

Start Express Client

node client.js

3️⃣ Setup MCP Server

cd ../mcp

Install Dependencies

npm install @google/generative-ai @modelcontextprotocol/sdk dotenv express pdf-parse sharp tesseract.js zod

Start MCP Server

node index.js

Environment Setup

GEMINI_API_KEY=your_gemini_api_key_here

API Endpoints

Upload Document

POST http://localhost:4000/upload
# multipart/form-data with 'file' field

Chat

POST http://localhost:4000/chat
# JSON: {"message": "your question", "sessionId": "optional"}

Usage Examples

# Upload document
curl -X POST http://localhost:4000/upload -F "file=@document.pdf"

# Ask about uploaded document  
curl -X POST http://localhost:4000/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "check my pdf file for predefined rule"}'

Project Structure

├──Express-client/
│   ├── client.js  # MCP client + Express API 
|   └── Routes/
|         └── routes.js      # API endpoint
|   
├──mcp/
│    ├── server.js
|    ├── index.js        # Entry  point
|    ├── utils/
|    │   ├── extractText.js    # PDF/OCR text extraction  
|    │   └── openAiExtractor.js 
|    └── .env               
|                            
└──frontend/

Available Tools

  • extractTextFromFile - Extract text from PDFs/images
  • askAboutUploadedText - Query uploaded documents
  • runPredefinedChecks - Automated document validation
  • chat - Main conversation interface

Document Types

Auto-detects: Aadhaar, PAN, Bank Statements, Salary Slips, Loan Applications