Content
# Document Intelligence — MCP Workspace
AI-powered document analysis built on the [Model Context Protocol](https://modelcontextprotocol.io). Drop a PDF or image, run one or several analysis tools, get structured JSON — classification, entity extraction, summarization, validation, and comparison, all powered by Claude.
<div align="center">
[](https://mcp-document-front.vercel.app/)
</div>
<div align="center">
<a href="https://mcp-document-front.vercel.app/">
<img src="./assets/demo.gif" alt="Document Intelligence demo" width="800">
</a>
</div>
---
## Projects
This workspace contains two independent Next.js applications:
| Project | Description | Default URL |
|---------|-------------|-------------|
| [`mcp-document`](https://github.com/P4ST4S/mcp-document) | MCP server — exposes the 5 analysis tools via JSON-RPC | `http://localhost:3000` |
| [`mcp-document-front`](https://github.com/P4ST4S/mcp-document-front) | Web UI — drag & drop interface, proxies requests to the MCP server | `http://localhost:3001` |
---
## How it works
```
User (browser)
└── uploads a file → mcp-document-front (Next.js)
└── POST /api/analyze → mcp-document (MCP server)
└── Claude API (Haiku / Sonnet)
```
The frontend never calls the Claude API directly. Every request is proxied through the MCP server, with the user's API key forwarded via a secure `x-api-key` header (decrypted server-side from an `httpOnly` cookie).
---
## Authentication
There is no shared API key. Each user enters their own [Anthropic API key](https://console.anthropic.com/settings/keys) on first visit. The key is:
1. Validated against the Anthropic API before being saved
2. Encrypted with AES-GCM 256-bit using a server-side `SESSION_SECRET`
3. Stored in an `httpOnly; SameSite=Strict; Secure` cookie (7-day session)
4. Never exposed to the browser — not in JS, not in localStorage, not in response headers
The MCP server also accepts a fallback `ANTHROPIC_API_KEY` environment variable for Claude Desktop and direct MCP usage.
---
## Tools
| Tool | Model | Description |
|------|-------|-------------|
| `classify_document` | Haiku | Categorize: invoice, contract, identity document, bank statement, quote, other |
| `extract_entities` | Haiku | Named entities: dates, amounts, names, SIRET, IBAN, addresses, signatories |
| `summarize_document` | Sonnet | Structured summary + key points (French or English) |
| `validate_document` | Haiku | Completeness check against an expected document type |
| `compare_documents` | Sonnet | Diff two documents — differences, similarities, recommendation |
All tools accept PDF, PNG, JPEG, or plain text as base64-encoded input (max 4 MB).
---
## Quick Start
```bash
# 1. Start the MCP server
cd mcp-document
pnpm install
cp .env.local.example .env.local # ANTHROPIC_API_KEY is optional (Claude Desktop fallback)
pnpm dev # → http://localhost:3000
# 2. Start the frontend (new terminal)
cd mcp-document-front
pnpm install
cp .env.local.example .env.local
# Edit .env.local:
# SESSION_SECRET=$(openssl rand -hex 32)
# MCP_SERVER_URL=http://localhost:3000/api/mcp
pnpm dev # → http://localhost:3001
```
Open `http://localhost:3001`, enter your Anthropic API key, and drop a document.
---
## Deployment
Both projects deploy independently to Vercel. The frontend points to the deployed MCP server via `MCP_SERVER_URL`.
See each project's README for full deployment instructions:
- [mcp-document → Deploy to Vercel](https://github.com/P4ST4S/mcp-document/blob/main/README.md#deploy-to-vercel)
- [mcp-document-front → Deploy to Vercel](https://github.com/P4ST4S/mcp-document-front/blob/main/README.md#deploy-to-vercel)
---
## Tech Stack
- **Next.js 16** (App Router) — both projects
- **@anthropic-ai/sdk** `^0.97.1` — Claude API client
- **@modelcontextprotocol/sdk** + **mcp-handler** — MCP server infrastructure
- **React 19**, **TypeScript 5**, **Tailwind CSS 4**
- **Web Crypto API** — AES-GCM 256-bit encryption (no extra dependencies)
Connection Info
You Might Also Like
Train-in-Silence
The first Task-Aware MCP server and automated VRAM calculator for LLM...
stacklit
108,000 lines of code. 4,000 tokens of index. One command makes any repo...
AppClaw
AI-powered mobile automation agent — describe what you want in plain...
pdf-mcp
Production-ready MCP server for PDF processing with intelligent caching....
kotadb
Local-only code intelligence API for AI developer workflows (Bun +...
gemini-api-docs-mcp
A remote HTTP MCP server for searching Google Gemini API documentation.