MCP server/ai-tools

Document Q&A MCP Server

Document-based question answering using OpenAI's API.

SY-MR-CODER/MCPDocumentChat-main ↗by SY-MR-CODERupdated
Manual setup required. The maintainer's config contains paths only you know - edit the placeholders below before adding it to Claude Code.
1

Prepare the server locally

Run this once before adding it to Claude Code.

pip install -r requirements.txt
2

Register it in Claude Code

claude mcp add -e "OPENAI_API_KEY=${OPENAI_API_KEY}" document-qa -- python /path/to/web_server.py

Replace any placeholder paths in the command with the real path on your machine.

Required:OPENAI_API_KEY
3

Make your agent remember this setup

document-qa's config, env vars, and the gotchas you hit — recalled in every future Claude Code, Cursor, and Codex session.

npx conare@latest

Free · one command · indexes the sessions already on disk. Set up in the browser instead →

What it does

  • Web-based file upload for PDF, TXT, and Markdown files
  • GPT-4 powered question answering with strict document adherence
  • Semantic search using OpenAI embeddings and cosine similarity
  • Real-time dashboard with confidence scores and source attribution
  • Hallucination-free responses based strictly on provided content

Environment Variables

OPENAI_API_KEYrequiredAPI key for accessing OpenAI's GPT-4 and embedding services

Try it

Analyze the uploaded PDF document and summarize the key findings.
Based on the provided text files, what are the main arguments presented?
Find the section in the markdown documentation that explains the installation process.
Answer my question about the document content without using any outside information.
Original README from SY-MR-CODER/MCPDocumentChat-main

🚀 Document Q&A MCP Server

A Python-based Model Context Protocol (MCP) server that provides document-based question answering using OpenAI's API. Upload documents, ask questions, and get answers based strictly on document content with zero hallucinations.

🌟 Live Demo

Web Interface: Start the server and visit http://localhost:8000

Document Q&A Demo

⚡ Quick Start

# 1. Install dependencies
pip install -r requirements.txt

# 2. Set your OpenAI API key
export OPENAI_API_KEY="your-api-key-here"

# 3. Start the web server
python web_server.py

# 4. Open http://localhost:8000 in your browser
# 5. Upload a document and start asking questions!

🎯 Features

  • 📤 Web File Upload: Drag & drop PDF, TXT, Markdown files
  • 🤖 Smart Q&A: GPT-4 powered answers based strictly on your documents
  • 🔍 Semantic Search: OpenAI embeddings with cosine similarity
  • 🚫 Zero Hallucinations: Only answers from document content
  • 📊 Real-time Dashboard: Live status, confidence scores, source attribution
  • 🏗️ MCP Compliant: Standard protocol for AI integration
  • ⚡ Production Ready: Error handling, logging, async support

🏛️ Architecture

  • Multi-format Support: PDF, TXT, and Markdown files
  • Intelligent Chunking: Semantic document splitting with overlap
  • Vector Search: OpenAI embeddings with cosine similarity
  • Hallucination Prevention: Strict adherence to document content
  • MCP Compliant: Standard protocol endpoints
  • Production Ready: Clean architecture with error handling

Architecture

┌─────────────────┐    HTTP/Upload    ┌─────────────────┐    MCP Protocol    ┌─────────────────┐
│   Web Browser   │ ◄────────────────► │   Web Server    │ ◄─────────────────► │ Document Q&A    │
│                 │                    │                 │                    │   MCP Server    │
│  • File Upload  │                    │  • File Handling│                    │                 │
│  • Q&A Interface│                    │  • HTTP Endpoints│                    │  ┌───────────┐  │
│  • Results      │                    │  • JSON API     │                    │  │DocumentLoader│  │
└─────────────────┘                    └─────────────────┘                    │  └───────────┘  │
                                                                              │  ┌───────────┐  │
                                                                              │  │ Chunker   │  │
                                                                              │  └───────────┘  │
                                                                              │  ┌───────────┐  │
                                                                              │  │Embedding  │  │
                                                                              │  │  Store    │  │
                                                                              │  └───────────┘  │
                                                                              │  ┌───────────┐  │
                                                                              │  │  Query    │  │
                                                                              │  │ Handler   │  │
                                                                              │  └───────────┘  │
                                                                              └─────────────────┘

The server consists of five main components:

  1. DocumentLoader: Handles PDF, TXT, and Markdown file parsing
  2. DocumentChunker: Intelligently splits documents into semantic chunks
  3. EmbeddingStore: Manages vector embeddings for similarity search
  4. QueryHandler: Processes questions and generates context-aware answers
  5. MCPServer: Exposes MCP-compliant endpoints

🚀 Usage Options

Option 1: Web Interface (Recommended)

python web_server.py
# Visit http://localhost:8000

Option 2: Interactive CLI

python interactive_client.py

Option 3: Simple Version (No MCP)

python simple_document_qa.py  
# Visit http://localhost:8001

Option 4: Run Tests

python test_server.py

📱 Web Interface Features

  • 📤 File Upload: Click "Choose File" or drag & drop documents
  • ❓ Question Input: Type questions in the text area
  • 📊 Live Dashboard: Real-time status and document info
  • 🎯 Confidence Scores: See how confident the AI is in each answer
  • 📚 Source Attribution: Know exactly which document parts were used
  • ⚡ Real-time Processing: Instan

Frequently Asked Questions

What are the key features of Document Q&A MCP Server?

Web-based file upload for PDF, TXT, and Markdown files. GPT-4 powered question answering with strict document adherence. Semantic search using OpenAI embeddings and cosine similarity. Real-time dashboard with confidence scores and source attribution. Hallucination-free responses based strictly on provided content.

What can I use Document Q&A MCP Server for?

Extracting specific technical details from long PDF manuals. Summarizing multiple markdown project files for quick context. Verifying information against a set of provided text documents. Providing source-attributed answers for research or compliance tasks.

How do I install Document Q&A MCP Server?

Install Document Q&A MCP Server by running: pip install -r requirements.txt

What MCP clients work with Document Q&A MCP Server?

Document Q&A MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Conare · memory for coding agents

Turn this server into reusable context

Keep Document Q&A MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Set up free$npx conare@latest