agentic-ai-n8n-ocr

jbarn080/agentic-ai-n8n-ocr

3.2

If you are the rightful owner of agentic-ai-n8n-ocr 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.

The Model Context Protocol (MCP) server is a powerful tool designed to enhance AI capabilities by providing a structured environment for model interaction and context management.

Agentic AI Agent with n8n, OCR, and MCP Server

A powerful agentic AI system that combines n8n workflow automation, OCR capabilities, Model Context Protocol (MCP) server integration, and Airtable database with a modern frontend form interface.

🌟 Features

  • Agentic AI Workflows: Autonomous AI agent powered by n8n
  • OCR Processing: Extract text from images and documents using Tesseract OCR
  • MCP Server Integration: Connect to Model Context Protocol servers for enhanced AI capabilities
  • Airtable Database: Robust data storage and management
  • Frontend Form: User-friendly interface for document submission
  • Docker Support: Easy deployment with Docker Compose

🏗️ Architecture

┌─────────────────┐
│  Frontend Form  │
│   (React/HTML)  │
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│   n8n Workflow  │
│  (Orchestrator) │
└────┬───┬───┬────┘
     │   │   │
     ▼   ▼   ▼
┌────┴┐ ┌┴───┐ ┌┴─────────┐
│ OCR │ │MCP │ │ Airtable │
│Tool │ │Srv │ │    DB    │
└─────┘ └────┘ └──────────┘

📋 Prerequisites

  • Docker and Docker Compose
  • Node.js 18+ (for local development)
  • Airtable account and API key
  • Claude API key (for MCP server)

🚀 Quick Start

1. Clone the Repository

git clone https://github.com/yourusername/agentic-ai-n8n-ocr.git
cd agentic-ai-n8n-ocr

2. Configure Environment Variables

cp .env.example .env

Edit .env with your credentials:

# n8n Configuration
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=your_password

# Airtable Configuration
AIRTABLE_API_KEY=your_airtable_api_key
AIRTABLE_BASE_ID=your_base_id

# Claude API (for MCP)
ANTHROPIC_API_KEY=your_anthropic_api_key

# MCP Server
MCP_SERVER_PORT=3001

# Frontend
FRONTEND_PORT=3000

3. Start with Docker Compose

docker-compose up -d

This will start:

4. Import n8n Workflows

  1. Open n8n at http://localhost:5678
  2. Go to Workflows → Import
  3. Import the workflows from n8n-workflows/ directory

📁 Project Structure

agentic-ai-n8n-ocr/
├── README.md
├── docker-compose.yml
├── .env.example
├── n8n-workflows/
│   ├── ocr-processing-workflow.json
│   ├── agentic-ai-workflow.json
│   └── mcp-integration-workflow.json
├── mcp-server/
│   ├── package.json
│   ├── server.js
│   ├── tools/
│   └── prompts/
├── frontend/
│   ├── index.html
│   ├── app.js
│   ├── styles.css
│   └── package.json
├── docker/
│   ├── Dockerfile.mcp
│   ├── Dockerfile.ocr
│   └── Dockerfile.frontend
└── docs/
    ├── SETUP.md
    ├── WORKFLOWS.md
    └── API.md

🔧 Configuration

Airtable Setup

  1. Create a new Airtable base
  2. Create tables:
    • Documents: Store uploaded documents
      • Fields: Document ID, Filename, Upload Date, Status, OCR Text
    • OCR Results: Store OCR processing results
      • Fields: Result ID, Document ID, Extracted Text, Confidence, Timestamp
    • AI Responses: Store agent responses
      • Fields: Response ID, Document ID, Query, Response, Timestamp

n8n Workflow Configuration

The system includes three main workflows:

  1. OCR Processing Workflow: Handles document upload and OCR extraction
  2. Agentic AI Workflow: Processes requests with AI agent capabilities
  3. MCP Integration Workflow: Connects to MCP servers for enhanced AI features

🎯 Use Cases

  1. Document Processing: Upload documents, extract text via OCR, store in Airtable
  2. Intelligent Document Analysis: AI agent analyzes OCR results and provides insights
  3. Automated Data Entry: Extract information from forms and populate databases
  4. Content Summarization: Process large documents and generate summaries
  5. Multi-modal AI Queries: Combine text and image understanding

🔌 API Endpoints

Frontend Form Submission

POST /api/upload
Content-Type: multipart/form-data

MCP Server

POST /mcp/query
Content-Type: application/json
Body: { "prompt": "string", "context": {} }

n8n Webhook

POST /webhook/process-document
Content-Type: application/json
Body: { "documentId": "string", "action": "ocr|analyze|summarize" }

🛠️ Development

Running Locally

MCP Server
cd mcp-server
npm install
npm run dev
Frontend
cd frontend
npm install
npm start

Testing

# Test OCR processing
curl -X POST http://localhost:5678/webhook/process-document \
  -F "file=@test-image.png"

# Test MCP server
curl -X POST http://localhost:3001/mcp/query \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Analyze this document", "context": {}}'

📊 Monitoring

🔒 Security

  • All API keys should be stored in environment variables
  • Use HTTPS in production
  • Enable n8n basic authentication
  • Implement rate limiting on public endpoints
  • Validate and sanitize all inputs

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the file for details.

🙏 Acknowledgments

📞 Support

For issues and questions:

🗺️ Roadmap

  • Add support for multiple OCR engines
  • Implement real-time collaboration features
  • Add support for more document formats
  • Create mobile app
  • Add analytics dashboard
  • Implement webhook notifications
  • Add multi-language support

Made with ❤️ for the AI automation community