loading…
Search for a command to run...
loading…
A secure Model Context Protocol server that enables Claude AI to list, search, and read local documents in formats such as PDF, DOCX, and XLSX. It features read
A secure Model Context Protocol server that enables Claude AI to list, search, and read local documents in formats such as PDF, DOCX, and XLSX. It features read-only access with path traversal protection and supports deployment via Docker with SSE or STDIO transport options.
A secure Model Context Protocol (MCP) server that provides Claude AI with access to your local documents. Built for Aaron's work document integration needs.
Clone and setup:
cd mcp-document-server
cp .env.example .env
# Edit .env if needed
Create documents directory:
mkdir -p documents
# Add your work documents here
Start the server:
docker-compose up -d
Test it:
curl http://localhost:8000/health
Setup:
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Configure:
cp .env.example .env
export $(cat .env | xargs)
Run:
python server.py
| Variable | Default | Description |
|---|---|---|
MCP_TRANSPORT |
sse |
Transport type: sse (HTTP) or stdio |
MCP_HOST |
0.0.0.0 |
Server host (SSE only) |
MCP_PORT |
8000 |
Server port (SSE only) |
DOCUMENTS_PATH |
/documents |
Path to documents directory |
MAX_FILE_SIZE_MB |
10 |
Maximum file size in MB |
ALLOWED_EXTENSIONS |
.txt,.md,... |
Comma-separated allowed extensions |
Edit docker-compose.yml to mount your work documents:
volumes:
# Option 1: Local directory
- ./documents:/documents:ro
# Option 2: Specific path
- /path/to/work/documents:/documents:ro
~/.config/claude/mcp_servers.json on Linux):{
"document-server": {
"command": "docker",
"args": ["exec", "-i", "mcp-document-server", "python", "server.py"],
"env": {
"MCP_TRANSPORT": "stdio"
}
}
}
If running on your home server and accessing via Tailscale:
100.x.x.x)http://100.x.x.x:8000Configure Claude to use this URL in your MCP client settings.
list_documentsList all documents in a directory.
Parameters:
subdirectory (optional): Subdirectory to listrecursive (optional): List recursivelyExample:
{
"subdirectory": "projects/2024",
"recursive": true
}
read_documentRead the contents of a specific document.
Parameters:
file_path: Relative path to documentmax_chars (optional): Maximum characters to return (default: 50000)Example:
{
"file_path": "projects/2024/Q4-report.pdf",
"max_chars": 50000
}
search_documentsSearch for documents containing specific text.
Parameters:
query: Search queryfile_extension (optional): Filter by extensioncase_sensitive (optional): Case-sensitive searchExample:
{
"query": "quarterly review",
"file_extension": ".docx",
"case_sensitive": false
}
DOCUMENTS_PATHOn your home server, ensure Tailscale is running:
sudo tailscale status
Start MCP server:
docker-compose up -d
Get Tailscale IP:
tailscale ip -4
Access from anywhere:
http://<your-tailscale-ip>:8000
If using OPNsense with Tailscale:
pass in on tailscale0 proto tcp from any to any port 8000To add support for additional file types, modify server.py:
elif full_path.suffix == '.custom':
# Your custom parser here
content = parse_custom_file(full_path)
Add basic token authentication:
MCP_AUTH_TOKEN in .envRun multiple instances with different compose files:
# Work documents
docker-compose -f docker-compose.work.yml up -d
# Personal documents
docker-compose -f docker-compose.personal.yml up -d
# Check logs
docker-compose logs -f
# Verify documents directory exists
ls -la ./documents
# Check permissions
chmod 755 ./documents
# Verify file extensions are allowed
docker-compose exec mcp-document-server python -c \
"import os; print(os.getenv('ALLOWED_EXTENSIONS'))"
# Check file permissions
ls -la ./documents/
# Test server is running
curl http://localhost:8000/health
# Check Tailscale connectivity
ping <tailscale-ip>
# Verify firewall rules
# On OPNsense, check Firewall > Rules > Tailscale
# Install dev dependencies
pip install pytest pytest-asyncio
# Run tests
pytest tests/
# Enable debug logging
export LOG_LEVEL=DEBUG
python server.py
For development with auto-reload:
uvicorn server:mcp.app --reload --host 0.0.0.0 --port 8000
┌─────────────┐
│ Claude │
│ (claude.ai)│
└──────┬──────┘
│ MCP Protocol
│ (SSE/HTTP)
↓
┌─────────────────┐ ┌──────────────┐
│ MCP Document │─────→│ Documents │
│ Server │ │ Directory │
│ (Docker) │ │ (Read-Only) │
└─────────────────┘ └──────────────┘
│
│ Tailscale Network
│
┌─────────────────┐
│ Home Server │
│ (OPNsense) │
└─────────────────┘
This is a custom implementation for Aaron's needs, but feel free to adapt it for your own use.
MIT License - See LICENSE file for details
For issues or questions:
docker-compose logs -fBuilt for: Aaron Watson
Integration: Claude AI + Local Documents
Stack: Python, MCP SDK, Docker, FastAPI
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mcp-document-server": {
"command": "npx",
"args": []
}
}
}PRs, issues, code search, CI status
Database, auth and storage
Reference / test server with prompts, resources, and tools.
Secure file operations with configurable access controls.