Loading...
Loading...
MCP server providing local-first document management with AI-powered semantic search, hybrid vector search, and intelligent chunking using Orama and Gemini
npx skill4agent add aradotso/mcp-skills mcp-documentation-serverSkill by ara.so — MCP Skills collection.
~/Library/Application Support/Claude/claude_desktop_config.json{
"mcpServers": {
"documentation": {
"command": "npx",
"args": ["-y", "@andrea9293/mcp-documentation-server"]
}
}
}{
"mcpServers": {
"documentation": {
"command": "npx",
"args": ["-y", "@andrea9293/mcp-documentation-server"],
"env": {
"MCP_BASE_DIR": "/path/to/workspace",
"GEMINI_API_KEY": "your-gemini-api-key",
"MCP_EMBEDDING_MODEL": "Xenova/paraphrase-multilingual-mpnet-base-v2",
"START_WEB_UI": "true",
"WEB_PORT": "3080"
}
}
}
}git clone https://github.com/andrea9293/mcp-documentation-server.git
cd mcp-documentation-server
npm install
npm run build| Variable | Default | Description |
|---|---|---|
| | Base directory for data storage |
| | Embedding model (384 dims) |
| — | Google Gemini API key for AI search |
| | Enable LRU embedding cache |
| | Start built-in web interface |
| | Web UI port |
| | Stream large files |
| | Streaming buffer (64KB) |
| | Streaming threshold (10MB) |
Xenova/all-MiniLM-L6-v2Xenova/paraphrase-multilingual-mpnet-base-v2~/.mcp-documentation-server/
├── data/
│ ├── orama-chunks.msp # Vector DB (child chunks + embeddings)
│ ├── orama-docs.msp # Document DB (full content + metadata)
│ ├── orama-parents.msp # Parent chunks DB (context sections)
│ ├── migration-complete.flag
│ └── *.md # Markdown document copies
└── uploads/ # Drop files here for processing// Tool call
{
"title": "API Reference",
"content": "# Authentication\nUse Bearer tokens...",
"metadata": {
"category": "api",
"version": "2.0",
"author": "team"
}
}// Tool call (no parameters required)
// Returns array of documents:
[
{
"id": "doc_abc123",
"title": "API Reference",
"preview": "# Authentication\nUse Bearer...",
"metadata": { "category": "api" },
"created": "2025-01-15T10:30:00Z",
"updated": "2025-01-15T10:30:00Z"
}
]// Tool call
{
"id": "doc_abc123"
}
// Returns complete document with metadata and full content// Tool call
{
"id": "doc_abc123"
}
// Deletes document, chunks, embeddings, and backup files// Tool call (no parameters)
// Processes .txt, .md, .pdf files from ~/.mcp-documentation-server/uploads/
// Returns:
{
"processed": 3,
"failed": 0,
"results": [
{
"filename": "guide.md",
"success": true,
"documentId": "doc_xyz789",
"chunks": 12
}
]
}// Tool call (no parameters)
// Returns: "/Users/username/.mcp-documentation-server/uploads"// Tool call (no parameters)
// Returns:
[
{
"name": "api-guide.md",
"size": 45678,
"sizeFormatted": "44.6 KB",
"extension": ".md"
}
]// Tool call (no parameters)
// Returns: "http://localhost:3080"// Tool call
{
"documentId": "doc_abc123",
"query": "authentication methods",
"limit": 5
}
// Returns:
{
"results": [
{
"content": "Bearer token authentication is used...",
"parentContent": "# Authentication\nBearer token authentication...",
"score": 0.92,
"documentId": "doc_abc123",
"documentTitle": "API Reference"
}
],
"total": 5
}// Tool call
{
"query": "rate limiting configuration",
"limit": 10
}
// Returns deduplicated results sorted by relevance
// Includes both exact text matches and semantic similarity// Tool call
{
"documentId": "doc_abc123",
"chunkIndex": 5,
"windowSize": 2
}
// Returns chunks [3, 4, 5, 6, 7] with the target chunk at index 5
// Useful for giving LLMs broader context around a search resultGEMINI_API_KEY// Tool call
{
"documentIds": ["doc_abc123", "doc_xyz789"],
"query": "How do I implement rate limiting with Redis?",
"conversationHistory": [
{
"role": "user",
"content": "What caching options are available?"
},
{
"role": "assistant",
"content": "Redis and Memcached are supported..."
}
]
}
// Returns AI-generated answer with context and sources// 1. Add documents programmatically
const apiDoc = await mcp.call("add_document", {
title: "REST API Guide",
content: "# REST API\n\n## Endpoints...",
metadata: { type: "api", version: "1.0" }
});
// 2. Or drop files in uploads folder
const uploadsPath = await mcp.call("get_uploads_path");
// Copy files to uploadsPath, then:
const result = await mcp.call("process_uploads");
// 3. Verify documents
const docs = await mcp.call("list_documents");
console.log(`${docs.length} documents indexed`);// Search across all documents
const results = await mcp.call("search_all_documents", {
query: "database connection pooling",
limit: 5
});
// Get more context for top result
if (results.results.length > 0) {
const topResult = results.results[0];
const context = await mcp.call("get_context_window", {
documentId: topResult.documentId,
chunkIndex: topResult.chunkIndex,
windowSize: 3
});
// context.chunks contains surrounding sections
}// Use Gemini for complex queries
const answer = await mcp.call("search_documents_with_ai", {
documentIds: ["doc_1", "doc_2"],
query: "Compare authentication approaches and recommend best practices",
conversationHistory: []
});
// answer contains:
// - AI-generated response
// - Source chunks with citations
// - Confidence scores// Process multiple files efficiently
const files = await mcp.call("list_uploads_files");
console.log(`Found ${files.length} files to process`);
const result = await mcp.call("process_uploads");
result.results.forEach(item => {
if (item.success) {
console.log(`✓ ${item.filename}: ${item.chunks} chunks`);
} else {
console.error(`✗ ${item.filename}: ${item.error}`);
}
});// List and filter documents
const allDocs = await mcp.call("list_documents");
const apiDocs = allDocs.filter(doc =>
doc.metadata?.category === "api"
);
// Update a document (delete + re-add)
await mcp.call("delete_document", { id: "doc_old" });
await mcp.call("add_document", {
title: "Updated API Docs",
content: updatedContent,
metadata: { category: "api", version: "2.0" }
});http://localhost:3080START_WEB_UI=falseWEB_PORT# Check if model is downloaded
ls ~/.cache/huggingface/
# Force re-download by clearing cache
rm -rf ~/.cache/huggingface/
# Restart server to re-downloadMCP_EMBEDDING_MODEL# Delete existing database
rm ~/.mcp-documentation-server/data/orama-*.msp
# Re-add all documents
# Server will recreate database with new model dimensions{
"env": {
"MCP_STREAMING_ENABLED": "true",
"MCP_STREAM_FILE_SIZE_LIMIT": "5242880"
}
}search_documents_with_aiGEMINI_API_KEYEADDRINUSE{
"env": {
"WEB_PORT": "3081"
}
}"START_WEB_UI": "false"MCP_STREAMING_ENABLED=trueXenova/all-MiniLM-L6-v2ls ~/.mcp-documentation-server/data/migration-complete.flagnpm run dev # MCP server with hot reload
npm run inspect # FastMCP web UI for testing tools
npm run web # Web UI only (development)npm run build
npm start