MCP Documentation Server
A server for document management and semantic search using AI embeddings, with local JSON storage.
MCP Documentation Server
A TypeScript-based Model Context Protocol (MCP) server that provides local-first document management and semantic search. Documents are stored in an embedded Orama vector database with hybrid search (full-text + vector), intelligent chunking, and local AI embeddings ā no external database or cloud service required.
Core capabilities
š Web UI
- Built-in Web Interface: A full-featured web dashboard starts automatically alongside the MCP server ā no additional setup required
- Complete Tool Coverage: Every MCP tool is accessible from the browser: add/view/delete documents, semantic search, AI search, file uploads, and context window exploration
- Drag & Drop Uploads: Upload
.txt,.md, and.pdffiles directly from the browser - Configurable: Disable with
START_WEB_UI=falseor change the port withWEB_PORT
š Search & Intelligence
- Hybrid Search: Combined full-text and vector similarity powered by Orama, for both single-document and cross-document queries
- AI-Powered Search š¤: Advanced document analysis with Google Gemini AI for contextual understanding and intelligent insights (optional, requires API key)
- Context Window Retrieval: Fetch surrounding chunks to provide LLMs with richer context
ā” Performance & Architecture
- Orama Vector DB: Embedded search engine with zero native dependencies ā replaces manual JSON storage and cosine similarity
- LRU Embedding Cache: Avoids recomputing embeddings for repeated content and queries
- Parent-Child Chunking: Documents are split into large context-preserving parent chunks and small precise child chunks for vector search ā search results include both the matched fragment and the full surrounding context
- Streaming File Reader: Handles large files without high memory usage
- Automatic Migration: Legacy JSON documents are migrated to Orama on first startup ā no manual intervention needed
š File Management
- Upload processing: Drop
.txt,.md, or.pdffiles into the uploads folder and process them with a single tool call - Copy-based storage: Original files are backed up alongside the database
- Local-only storage: All data resides in
~/.mcp-documentation-server/
Quick Start
Configure an MCP client
Example configuration for an MCP client (e.g., Claude Desktop, VS Code):
Quick Start
{
"mcpServers": {
"documentation": {
"command": "npx",
"args": [
"-y",
"@andrea9293/mcp-documentation-server"
]
}
}
}
Advanced with env vars (all vars are optional)
{
"mcpServers": {
"documentation": {
"command": "npx",
"args": [
"-y",
"@andrea9293/mcp-documentation-server"
],
"env": {
"MCP_BASE_DIR": "/path/to/workspace",
"GEMINI_API_KEY": "your-api-key-here",
"MCP_EMBEDDING_MODEL": "Xenova/all-MiniLM-L6-v2",
"START_WEB_UI": "true",
"WEB_PORT": "3080",
}
}
}
}
All environment variables are optional. Without GEMINI_API_KEY, only the local embedding-based search tools are available.
Web UI
The web interface starts automatically on port 3080 when the MCP server launches. Open your browser at:
http://localhost:3080
From the web UI you can:
- š Dashboard ā overview of all documents and stats
- š Documents ā browse, view, and delete documents
- ā Add Document ā create documents with title, content, and metadata
- š Search All ā semantic search across all documents
- šÆ Search in Doc ā search within a specific document
- š¤ AI Search ā Gemini-powered analysis (if
GEMINI_API_KEYis set) - š Upload Files ā drag & drop files and process them into the knowledge base
- šŖ Context Window ā explore chunks around a specific index
To run the web UI standalone (without the MCP server):
npm run web # Development (tsx)
npm run web:build # Production (compiled)
Basic workflow
- Add documents using
add_documentor place.txt/.md/.pdffiles in the uploads folder and callprocess_uploads. - Search across everything with
search_all_documents, or within a single document withsearch_documents. - Use
get_context_windowto fetch neighboring chunks and give the LLM broader context.
MCP Tools
The server registers the following tools (all validated with Zod schemas):
š Document Management
| Tool | Description |
|---|---|
add_document | Add a document (title, content, optional metadata) |
list_documents | List all documents with metadata and content preview |
get_document | Retrieve the full content of a document by ID |
delete_document | Remove a document, its chunks, database entries, and associated files |
š File Processing
| Tool | Description |
|---|---|
process_uploads | Process all files in the uploads folder (chunking + embeddings) |
get_uploads_path | Returns the absolute path to the uploads folder |
list_uploads_files | Lists files in the uploads folder with size and format info |
get_ui_url | Returns the Web UI URL (e.g. http://localhost:3080) ā useful to open the dashboard or to locate the uploads folder from the browser |
š Search
| Tool | Description |
|---|---|
search_documents | Semantic vector search within a specific document |
search_all_documents | Hybrid (full-text + vector) cross-document search |
get_context_window | Returns a window of chunks around a given chunk index |
search_documents_with_ai | š¤ AI-powered search using Gemini (requires GEMINI_API_KEY) |
Configuration
Configure via environment variables or a .env file in the project root:
| Variable | Default | Description |
|---|---|---|
MCP_BASE_DIR | ~/.mcp-documentation-server | Base directory for data storage |
MCP_EMBEDDING_MODEL | Xenova/all-MiniLM-L6-v2 | Embedding model name |
GEMINI_API_KEY | ā | Google Gemini API key (enables search_documents_with_ai) |
MCP_CACHE_ENABLED | true | Enable/disable LRU embedding cache |
START_WEB_UI | true | Set to false to disable the built-in web interface |
WEB_PORT | 3080 | Port for the web UI |
MCP_STREAMING_ENABLED | true | Enable streaming reads for large files |
MCP_STREAM_CHUNK_SIZE | 65536 | Streaming buffer size in bytes (64KB) |
MCP_STREAM_FILE_SIZE_LIMIT | 10485760 | Threshold to switch to streaming (10MB) |
Storage layout
~/.mcp-documentation-server/ # Or custom path via MCP_BASE_DIR
āāā data/
ā āāā orama-chunks.msp # Orama vector DB (child chunks + embeddings)
ā āāā orama-docs.msp # Orama document DB (full content + metadata)
ā āāā orama-parents.msp # Orama parent chunks DB (context sections)
ā āāā migration-complete.flag # Written after legacy JSON migration
ā āāā *.md # Markdown copies of documents
āāā uploads/ # Drop .txt, .md, .pdf files here
Embedding Models
Set via MCP_EMBEDDING_MODEL:
| Model | Dimensions | Notes |
|---|---|---|
Xenova/all-MiniLM-L6-v2 | 384 | Default ā fast, good quality |
Xenova/paraphrase-multilingual-mpnet-base-v2 | 768 | Recommended ā best quality, multilingual |
Models are downloaded on first use (~80ā420 MB). The vector dimension is determined automatically from the provider.
ā ļø Important: Changing the embedding model requires re-adding all documents ā embeddings from different models are incompatible. The Orama database is recreated automatically when the dimension changes.
Architecture
Server (FastMCP, stdio)
āā Web UI (Express, port 3080)
ā āā REST API ā DocumentManager
āā MCP Tools
āā DocumentManager
āā OramaStore ā Orama vector DB (chunks DB + docs DB + parents DB), persistence, migration
āā IntelligentChunker ā Parent-child chunking (code, markdown, text, PDF)
āā EmbeddingProvider ā Local embeddings via @xenova/transformers
ā āā EmbeddingCache ā LRU in-memory cache
āā GeminiSearchService ā Optional AI search via Google Gemini
- OramaStore manages three Orama instances: one for document metadata/content, one for child chunks with vector embeddings, and one for parent chunks (context sections). All are persisted to binary files on disk and restored on startup.
- IntelligentChunker implements the Parent-Child Chunking pattern: documents are first split into large parent chunks that preserve full context (sections, paragraphs), then each parent is further split into small child chunks for precise vector search. At query time, results are deduplicated by parent so that the LLM receives both the matched fragment and the broader context.
- EmbeddingProvider lazily loads a Transformers.js model for local inference ā no API calls needed.
Development
git clone https://github.com/andrea9293/mcp-documentation-server.git
cd mcp-documentation-server
npm install
npm run dev # FastMCP dev mode with hot reload
npm run build # TypeScript compilation
npm run inspect # FastMCP web UI for interactive tool testing
npm start # Direct tsx execution (MCP server + web UI)
npm run web # Run only the web UI (development)
npm run web:build # Run only the web UI (compiled)
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/name - Follow Conventional Commits for messages
- Open a pull request
License
MIT ā see LICENSE
Support
- š Documentation
- š Report Issues
- š¬ MCP Community
- š¤ Google AI Studio ā get a Gemini API key
Star History
Related Servers
Travel Planner
A server for travel planning and interacting with Google Maps services.
SearchAPI Agent
An MCP agent that integrates various search tools using the SearchAPI service. Requires SearchAPI and Google API keys.
Open Brewery DB
Search and retrieve brewery data worldwide using the Open Brewery DB API.
LLM Jukebox
Enables LLMs to search, download, and extract information from YouTube music videos.
arXiv Search
A server for searching academic papers and preprints on arXiv.org.
Crypto News MCP Server
Provides real-time cryptocurrency news for AI agents using the NewsData.io API.
Google AI Search MCP
A server providing Google AI-powered search and documentation tools for developers.
NullBR MCP Server
A server for searching and retrieving movie and media resource information via the MCP protocol.
TripGo
Find transport-related locations, departures, and routes using the TripGo API.
PortOne Global MCP Server
Search and read PortOne documentation, including API schemas and product guides.

