Context-MCP Document Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Context-MCP Document Server Search my knowledge base for OAuth setup"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Context-MCP Document Server
A powerful local TypeScript MCP (Model Context Protocol) server that enables Claude Code to index, search, and retrieve documents from your local filesystem. Supports PDF, DOCX, Markdown, HTML, TXT, and JSON files with full-text search capabilities and automatic file watching.
⨠Features
š Multi-format Support: PDF, DOCX, Markdown, HTML, TXT, and JSON files
š Full-text Search: Fast search with relevance scoring using Lunr.js
š¾ Persistent Storage: Local document storage with metadata
š MCP Integration: Seamless integration with Claude Code
š Content Extraction: Intelligent content parsing for each file type
š Resource Access: Documents accessible via
doc://URIsš File Watching: Automatically index new files when added to watched directories
āļø Configurable: Environment-based configuration for data paths and watch directories
Related MCP server: Claude RAG MCP Pipeline
š Quick Start
Prerequisites
Node.js 18+
npm or yarn
Claude Code with MCP support
Installation
Clone the Repository
git clone https://github.com/lxgbrl/Context-MCP.git cd Context-MCPInstall Dependencies
npm installBuild the Server
npm run buildTest the Server (Optional)
# Test with MCP inspector npm run inspect
āļø Configuration
Environment Variables
Create a .env file or set these environment variables:
# Directory where documents and indices are stored (optional)
DATA_PATH="/path/to/your/document-storage"
# Comma-separated list of directories to watch for new files (optional)
WATCH_DIRECTORIES="/Users/you/Documents/knowledge-base,/Users/you/Projects/docs"Claude Code Integration
Add the server to your Claude Code MCP configuration:
macOS
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"document-index": {
"command": "node",
"args": ["/absolute/path/to/Context-MCP/dist/index.js"],
"env": {
"DATA_PATH": "/Users/you/Documents/Context-MCP/data",
"WATCH_DIRECTORIES": "/Users/you/Documents/knowledge-base,/Users/you/Projects/docs"
}
}
}
}Windows
Edit %APPDATA%/Claude/claude_desktop_config.json:
{
"mcpServers": {
"document-index": {
"command": "node",
"args": ["C:\\absolute\\path\\to\\Context-MCP\\dist\\index.js"],
"env": {
"DATA_PATH": "C:\\Users\\you\\Documents\\Context-MCP\\data",
"WATCH_DIRECTORIES": "C:\\Users\\you\\Documents\\knowledge-base,C:\\Users\\you\\Projects\\docs"
}
}
}
}Linux
Edit ~/.config/Claude/claude_desktop_config.json with the same format as macOS.
Important:
Replace paths with your actual installation directory
Use absolute paths only
Restart Claude Code after configuration changes
š Usage
Method 1: Automatic File Watching (Recommended)
The easiest way to use the document server is through automatic file watching:
Configure Watch Directories in your MCP configuration (see above)
Drop Files into your watched directories:
# Just copy files to watched folders cp ~/Downloads/api-documentation.pdf ~/Documents/knowledge-base/ cp ~/Downloads/user-manual.docx ~/Documents/knowledge-base/manuals/ # Files are automatically indexed within seconds!Use in Claude Code:
Search my knowledge base for "authentication implementation" Using @document-index, find documents about OAuth and explain the setup process
Method 2: Manual Document Management
Use these commands directly in Claude Code:
Add Documents
Add the file /Users/me/documents/research-paper.pdf to the document index with tags ["research", "ai"]Search Documents
Search for documents about "machine learning algorithms"List All Documents
Show me all indexed documentsGet Specific Document
Get the content of document with ID abc123Update Document Metadata
Update document abc123 with title "New Title" and tags ["updated", "important"]Delete Documents
Delete document with ID abc123Server Statistics
Show me document server statisticsUsing Documents as Resources
Access documents directly as MCP resources:
Using @document-index:doc://abc123 as reference, explain the implementation details
Summarize the key points from @document-index:doc://xyz789š ļø Available Tools
Tool | Description |
| Index a new document from file path |
| Full-text search with relevance scoring |
| Retrieve complete document content |
| List all indexed documents |
| Update document metadata (title, tags) |
| Remove document from index |
| View server statistics |
š Supported File Types
Format | Extensions | Features |
| Text extraction, metadata, page count | |
Word Documents |
| Plain text extraction |
Markdown |
| Frontmatter parsing, heading analysis |
HTML |
| Content extraction, metadata tags |
Text Files |
| Plain text content |
JSON |
| Structured data to searchable text |
šļø Development
Project Structure
Context-MCP/
āāā src/
ā āāā index.ts # Main MCP server
ā āāā lib/
ā ā āāā DocumentStore.ts # Document storage & metadata
ā ā āāā SearchIndex.ts # Search indexing with Lunr.js
ā ā āāā DocumentProcessor.ts # File content extraction
ā ā āāā FileWatcher.ts # Directory monitoring
ā āāā resources/ # MCP resource handlers
ā āāā tools/ # MCP tool implementations
ā āāā types/ # TypeScript type definitions
ā āāā utils/ # Utility functions
āāā data/ # Generated - document storage
āāā dist/ # Generated - compiled output
āāā docs/ # Project documentation
āāā tests/ # Test suitesDevelopment Commands
# Build the project
npm run build
# Development mode with auto-reload
npm run dev
# Test with MCP inspector
npm run inspect
# Clean build files
npm run cleanAdding New File Types
Update
DocumentProcessor.ts:Add extension to
supportedExtensionssetImplement processing method
Add to
processFile()switch statement
Update type definitions in
types/index.tsif neededTest with various file samples
š” Best Practices
Directory Organization
~/Documents/knowledge-base/
āāā projects/
ā āāā project-a/
ā ā āāā api-docs.md
ā ā āāā specifications.pdf
ā āāā project-b/
ā āāā user-manual.docx
āāā references/
ā āāā programming-guides/
ā āāā api-references/
āāā manuals/
āāā tools/
āāā frameworks/File Naming
Use descriptive filenames:
oauth-implementation-guide.mdvsguide.mdInclude version info:
api-v2-reference.pdfUse consistent naming patterns
Content Quality
Clear headings for better search results
Good structure with logical sections
Relevant keywords in content
Meaningful tags when adding documents
š§ Data Storage
Documents are stored locally in the configured data directory:
data/
āāā documents/ # Full document content (JSON files)
āāā metadata/ # Document metadata index
āāā index/ # Search index filesPrivacy: All data stays on your local machine
Persistence: Data survives server restarts
Backup: Simply backup the data directory
Migration: Move data directory to transfer documents
š Troubleshooting
Server Won't Start
Check Node.js Version
node --version # Should be 18+Verify Installation
npm install
npm run build
ls -la dist/index.js # Should exist and be executableCheck Permissions
# Ensure data directory is writable
mkdir -p data
chmod 755 dataClaude Code Can't Connect
Verify Configuration Path
Use absolute paths only
Check
dist/index.jsexistsEnsure paths match your system
Test Server Independently
npm run inspect # Should show server tools and resourcesCheck Environment Variables
# Test server startup with explicit paths DATA_PATH="/full/path/to/data" node dist/index.jsRestart Claude Code after configuration changes
File Processing Issues
PDF Files Not Processing
Ensure PDF files are not password-protected
Check file permissions are readable
Large PDFs may take time to process
File Watching Not Working
Verify
WATCH_DIRECTORIESpaths existCheck directory permissions
Restart server after changing watch directories
Search Not Finding Documents
# Check if documents are indexed
# Use list_documents tool in Claude Code
# Verify search index
# Use get_server_stats toolCommon Error Solutions
Error | Solution |
| Use absolute file paths |
| Already fixed in this version |
| Check DATA_PATH directory permissions |
| Ensure directories are readable/writable |
š Migration & Backup
Backup Your Documents
# Backup document data
tar -czf document-backup.tar.gz data/
# Restore from backup
tar -xzf document-backup.tar.gzMoving to New Machine
Copy the
data/directoryInstall Context-MCP on new machine
Configure Claude Code with new paths
Documents and search index will be preserved
š¤ Contributing
Fork the Repository
Create Feature Branch:
git checkout -b feature/amazing-featureCommit Changes:
git commit -m 'Add amazing feature'Push to Branch:
git push origin feature/amazing-featureOpen Pull Request
Development Setup
git clone https://github.com/lxgbrl/Context-MCP.git
cd Context-MCP
npm install
npm run dev # Start development serverš Documentation
Architecture Documentation - System design and components
API Documentation - MCP tools and resources reference
Usage Examples - Detailed usage scenarios
š License
MIT License - see LICENSE file for details.
š Acknowledgments
Model Context Protocol - MCP specification and SDK
Claude Code - MCP client integration
Lunr.js - Full-text search engine
Open Source Libraries - All the amazing libraries that make this possible
Made with ā¤ļø for the Claude Code community
Transform your local documents into an intelligent, searchable knowledge base accessible directly in Claude Code conversations.
Available Tools
7 toolsadd_documentB
Add a document to the index from a file path. Supports PDF, DOCX, Markdown, HTML, TXT, and JSON files.
Inputs: path (required), tags, title.
delete_documentB
Remove a document from the index permanently
Inputs: id (required).
get_documentA
Get the full content and metadata of a specific document by ID
Inputs: id (required).
get_server_statsA
Get statistics about the document server (total documents, types, index size)
Inputs: no named parameters.
list_documentsA
List all indexed documents with basic metadata (summaries without full content)
Inputs: no named parameters.
search_documentsC
Search for documents using full-text search with relevance scoring
Inputs: query (required), limit.
update_documentA
Update document metadata (title, tags) without changing content
Inputs: id (required), tags, title.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: add, search, get, list, update, delete, and stats target separate operations and resources. The descriptions also clarify the distinction between full-content retrieval (get_document) and metadata listing (list_documents).
All tool names follow a consistent snake_case verb_noun pattern (add_document, search_documents, get_document, etc.). No mixed conventions or ambiguous verbs are present.
Seven tools are well-scoped for a document indexing server. The set covers core operations without unnecessary bloat or missing basic utilities.
The surface covers create/read/list/search/update-metadata/delete plus stats, which is solid lifecycle coverage. A minor gap exists because document content cannot be updated directly or reindexed without deleting and re-adding, but this is workable.
Maintenance
Related MCP Connectors
Safe folder access for ChatGPT and Claude: read, write and search files, risky tools opt-in.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
Read and search folders on your own computer with explicit consent. Files are never uploaded.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables real-time indexing and semantic search of local documents (PDF, Word, text, Markdown, RTF) using vector embeddings and local LLMs. Monitors folders for changes and provides natural language search capabilities through Claude Desktop integration.22MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude Desktop to search and query personal document collections (PDF, Word, Markdown, text) using semantic search and conversational AI with full context preservation across exchanges.MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude Code to index and semantically search through PDFs, code, and documents with exact citations and zero hallucinations.MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to search and read the user's local document collection (PDF, Word, Excel, Markdown, plain text) during a conversation by subject, by file name/path, or by exact word, and to retrieve file contents page by page. It also supports finding folders relevant to a topic and checking indexing status, with everything running locally on the user's machine.MIT