Local FAISS
About
About Local FAISS vector store as an MCP server – drop-in local RAG for Claude / Copilot / Agents.
Details
- Author
- nonatofabio
- Categories
- Database, Other, Knowledge Base
Jump to
Setup
Install Local FAISS in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/nonatofabio/local_faiss_mcp
Follow the installation instructions in the repository README, then restart your MCP client.
A Model Context Protocol (MCP) server that provides local vector database functionality using FAISS for Retrieval-Augmented Generation (RAG) applications.
- Local Vector Storage: Uses FAISS for efficient similarity search without external dependencies
- Document Ingestion: Automatically chunks and embeds documents for storage
- Semantic Search: Query documents using natural language with sentence embeddings
- Persistent Storage: Indexes and metadata are saved to disk
- MCP Compatible: Works with any MCP-compatible AI agent or client
- CLI Tool:local-faisscommand for standalone indexing and search
- Document Formats: Native PDF/TXT/MD support, DOCX/HTML/EPUB with pandoc
- Re-ranking: Two-stage retrieve and rerank for better results
- Custom Embeddings: Choose any Hugging Face embedding model
- MCP Prompts: Built-in prompts for answer extraction and summarization
# Install pip install local-faiss-mcp # Index documents local-faiss index document.pdf # Search local-faiss search "What is this document about?"
Or use with Claude Code - configure MCP client (seeConfiguration) and try:
Use the ingest_document tool with: ./path/to/document.pdf Then use query_rag_store to search for: "How does FAISS perform similarity search?"
Claude will retrieve relevant document chunks from your vector store and use them to answer your question.
⚡️Upgrading?Runpip install --upgrade local-faiss-mcp
For DOCX, HTML, EPUB, and 40+ additional formats, install pandoc:
# macOS brew install pandoc # Linux sudo apt install pandoc # Or download from: https://pandoc.org/installing.html
Note: PDF, TXT, and MD work without pandoc.
git clone https://github.com/nonatofabio/local_faiss_mcp.git cd local_faiss_mcp pip install -e .
After installation, you can run the server in three ways:
1. Using the installed command (easiest):
local-faiss-mcp --index-dir /path/to/index/directory
python -m local_faiss_mcp --index-dir /path/to/index/directory
python local_faiss_mcp/server.py --index-dir /path/to/index/directory
- --index-dir: Directory to store FAISS index and metadata files (default: current directory)
- --embed: Hugging Face embedding model name (default:all-MiniLM-L6-v2)
- --rerank: Enable re-ranking with specified cross-encoder model (default:BAAI/bge-reranker-base)
# Use a larger, more accurate model local-faiss-mcp --index-dir ./.vector_store --embed all-mpnet-base-v2 # Use a multilingual model local-faiss-mcp --index-dir ./.vector_store --embed paraphrase-multilingual-MiniLM-L12-v2 # Use any Hugging Face sentence-transformers model local-faiss-mcp --index-dir ./.vector_store --embed sentence-transformers/model-name
Re-ranking uses a cross-encoder model to reorder FAISS results for improved relevance. This two-stage "retrieve and rerank" approach is common in production search systems.
# Enable re-ranking with default model (BAAI/bge-reranker-base) local-faiss-mcp --index-dir ./.vector_store --rerank # Use a specific re-ranking model local-faiss-mcp --index-dir ./.vector_store --rerank cross-encoder/ms-marco-MiniLM-L-6-v2 # Combine custom embedding and re-ranking local-faiss-mcp --index-dir ./.vector_store --embed all-mpnet-base-v2 --rerank BAAI/bge-reranker-base
- FAISS retrieves top candidates (10x more than requested)
- Cross-encoder scores each candidate against the query
- Results are re-sorted by relevance score
- Top-k most relevant results are returned
- BAAI/bge-reranker-base- Good balance (default)
- cross-encoder/ms-marco-MiniLM-L-6-v2- Fast and efficient
- cross-encoder/ms-marco-TinyBERT-L-2-v2- Very fast, smaller model
- Create the index directory if it doesn't exist
- Load existing FAISS index from{index-dir}/faiss.index(or create a new one)
- Load document metadata from{index-dir}/metadata.json(or create new)
- Listen for MCP tool calls via stdin/stdout
The server provides two tools for document management:
Ingest a document into the vector store.
- document(required): Text content OR file path to ingest
- source(optional): Identifier for the document source (default: "unknown")
Auto-detection: Ifdocumentlooks like a file path, it will be automatically parsed.
- Native: TXT, MD, PDF
- With pandoc: DOCX, ODT, HTML, RTF, EPUB, and 40+ formats
{ "document": "FAISS is a library for efficient similarity search...", "source": "faiss_docs.txt" }
{ "document": "./documents/research_paper.pdf" }
Query the vector store for relevant document chunks.
- query(required): The search query text
- top_k(optional): Number of results to return (default: 3)
{ "query": "How does FAISS perform similarity search?", "top_k": 5 }
The server provides MCP prompts to help extract answers and summarize information from retrieved documents:
Extract the most relevant answer from retrieved document chunks with proper citations.
- query(required): The original user query or question
- chunks(required): Retrieved document chunks as JSON array with fields:text,source,distance
Use Case:After querying the RAG store, use this prompt to get a well-formatted answer that cites sources and explains relevance.
- Usequery_rag_storetool to retrieve relevant chunks
- Useextract-answerprompt with the query and results
- Get a comprehensive answer with citations
Create a focused summary from multiple document chunks.
- topic(required): The topic or theme to summarize
- chunks(required): Document chunks to summarize as JSON array
- max_length(optional): Maximum summary length in words (default: 200)
Use Case:Synthesize information from multiple retrieved documents into a concise summary.
In Claude Code, after retrieving documents withquery_rag_store, you can use the prompts like:
Use the extract-answer prompt with: - query: "What is FAISS?" - chunks: [the JSON results from query_rag_store]
The prompts will guide the LLM to provide structured, citation-backed answers based on your vector store data.
Thelocal-faissCLI provides standalone document indexing and search capabilities.
# Index single file local-faiss index document.pdf # Index multiple files local-faiss index doc1.pdf doc2.txt doc3.md # Index all files in folder local-faiss index documents/ # Index recursively local-faiss index -r documents/ # Index with glob pattern local-faiss index "docs//.pdf"
Configuration: The CLI automatically uses MCP configuration from:
- ./.mcp.json(local/project-specific)
- ~/.claude/.mcp.json(Claude Code config)
- ~/.mcp.json(fallback)
If no config exists, creates./.mcp.jsonwith default settings (./.vector_store).
- Native: TXT, MD, PDF (always available)
- With pandoc: DOCX, ODT, HTML, RTF, EPUB, etc.
- Install:brew install pandoc(macOS) orapt install pandoc(Linux)
# Basic search local-faiss search "What is FAISS?" # Get more results local-faiss search -k 5 "similarity search algorithms"
- Source file path
- FAISS distance score
- Re-rank score (if enabled in MCP config)
- Text preview (first 300 characters)
- ✅Incremental indexing: Adds to existing index, doesn't overwrite
- ✅Progress output: Shows indexing progress for each file
- ✅Shared config: Uses same settings as MCP server
- ✅Auto-detection: Supports glob patterns and recursive folders
- ✅Format support: Handles PDF, TXT, MD natively; DOCX+ with pandoc
Add this server to your Claude Code MCP configuration (.mcp.json):
User-wide configuration(~/.claude/.mcp.json):
{ "mcpServers": { "local-faiss-mcp": { "command": "local-faiss-mcp" } } }
{ "mcpServers": { "local-faiss-mcp": { "command": "local-faiss-mcp", "args": [ "--index-dir", "/home/user/vector_indexes/my_project" ] } } }
{ "mcpServers": { "local-faiss-mcp": { "command": "local-faiss-mcp", "args": [ "--index-dir", "./.vector_store", "--embed", "all-mpnet-base-v2" ] } } }
{ "mcpServers": { "local-faiss-mcp": { "command": "local-faiss-mcp", "args": [ "--index-dir", "./.vector_store", "--rerank" ] } } }
Full configuration with embedding and re-ranking:
{ "mcpServers": { "local-faiss-mcp": { "command": "local-faiss-mcp", "args": [ "--index-dir", "./.vector_store", "--embed", "all-mpnet-base-v2", "--rerank", "BAAI/bge-reranker-base" ] } } }
Project-specific configuration(./.mcp.jsonin your project):
{ "mcpServers": { "local-faiss-mcp": { "command": "local-faiss-mcp", "args": [ "--index-dir", "./.vector_store" ] } } }
Alternative: Using Python module(if the command isn't in PATH):
{ "mcpServers": { "local-faiss-mcp": { "command": "python", "args": ["-m", "local_faiss_mcp", "--index-dir", "./.vector_store"] } } }
Add this server to your Claude Desktop configuration:
{ "mcpServers": { "local-faiss-mcp": { "command": "local-faiss-mcp", "args": ["--index-dir", "/path/to/index/directory"] } } }
- Embedding Model: Configurable via--embedflag (default:all-MiniLM-L6-v2with 384 dimensions)
- Supports any Hugging Face sentence-transformers model
- Automatically detects embedding dimensions
- Model choice persisted with the index
Different models offer different trade-offs:
Important:Once you create an index with a specific model, you must use the same model for subsequent runs. The server will detect dimension mismatches and warn you.
Test the FAISS vector store functionality without MCP infrastructure:
source venv/bin/activate python test_standalone.py
- Initializes the vector store
- Ingests sample documents
- Performs semantic search queries
- Tests persistence and reload
- Cleans up test files
# Test embedding model functionality pytest tests/test_embedding_models.py -v # Run standalone integration test python tests/test_standalone.py
- test_embedding_models.py: Comprehensive tests for custom embedding models, dimension detection, and compatibility
- test_standalone.py*: End-to-end integration test without MCP infrastructure
Implement semantic memory layer on top of the Qdrant vector search engine
A vector database server powered by Chroma, enabling semantic document search, metadata filtering, and document management.
An MCP server for the Chroma embedding database, providing persistent, searchable working memory for AI-assisted development with features like automated context recall and codebase indexing.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





