MCP server with FAISS local vector database for RAG
Project description
Local FAISS MCP Server
A Model Context Protocol (MCP) server that provides local vector database functionality using FAISS for Retrieval-Augmented Generation (RAG) applications.
Features
- 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
Quickstart
pip install local-faiss-mcp
Then configure your MCP client (see Configuration) and try your first query in Claude:
Use the query_rag_store tool 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.
Installation
From PyPI (Recommended)
pip install local-faiss-mcp
From Source
git clone https://github.com/nonatofabio/local_faiss_mcp.git
cd local_faiss_mcp
pip install -e .
Usage
Running the Server
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
2. As a Python module:
python -m local_faiss_mcp --index-dir /path/to/index/directory
3. For development/testing:
python local_faiss_mcp/server.py --index-dir /path/to/index/directory
Command-line Arguments:
--index-dir: Directory to store FAISS index and metadata files (default: current directory)
The server will:
- 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
Available Tools
1. ingest_document
Ingest a document into the vector store.
Parameters:
document(required): The text content to ingestsource(optional): Identifier for the document source (default: "unknown")
Example:
{
"document": "FAISS is a library for efficient similarity search...",
"source": "faiss_docs.txt"
}
2. query_rag_store
Query the vector store for relevant document chunks.
Parameters:
query(required): The search query texttop_k(optional): Number of results to return (default: 3)
Example:
{
"query": "How does FAISS perform similarity search?",
"top_k": 5
}
Configuration with MCP Clients
Claude Code
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"
}
}
}
With custom index directory:
{
"mcpServers": {
"local-faiss-mcp": {
"command": "local-faiss-mcp",
"args": [
"--index-dir",
"/home/user/vector_indexes/my_project"
]
}
}
}
Project-specific configuration (./.mcp.json in 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"]
}
}
}
Claude Desktop
Add this server to your Claude Desktop configuration:
{
"mcpServers": {
"local-faiss-mcp": {
"command": "local-faiss-mcp",
"args": ["--index-dir", "/path/to/index/directory"]
}
}
}
Architecture
- Embedding Model: Uses
all-MiniLM-L6-v2from sentence-transformers (384 dimensions) - Index Type: FAISS IndexFlatL2 for exact L2 distance search
- Chunking: Documents are split into ~500 word chunks with 50 word overlap
- Storage: Index saved as
faiss.index, metadata saved asmetadata.json
Development
Standalone Test
Test the FAISS vector store functionality without MCP infrastructure:
source venv/bin/activate
python test_standalone.py
This test:
- Initializes the vector store
- Ingests sample documents
- Performs semantic search queries
- Tests persistence and reload
- Cleans up test files
Unit Tests
Run unit tests:
pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file local_faiss_mcp-0.1.0.tar.gz.
File metadata
- Download URL: local_faiss_mcp-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea64f4cc6a1c56c9e4ce9dfcf46eda98e56bb72263d55f56c4f1d54d3123de08
|
|
| MD5 |
3d6b6767439b6922401c96cb2a8c9a5b
|
|
| BLAKE2b-256 |
0a127407c7cebc9b1f8451c0a59050889ae26f03d4e1de26c99354feff862f79
|
Provenance
The following attestation bundles were made for local_faiss_mcp-0.1.0.tar.gz:
Publisher:
publish.yml on nonatofabio/local_faiss_mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
local_faiss_mcp-0.1.0.tar.gz -
Subject digest:
ea64f4cc6a1c56c9e4ce9dfcf46eda98e56bb72263d55f56c4f1d54d3123de08 - Sigstore transparency entry: 735925158
- Sigstore integration time:
-
Permalink:
nonatofabio/local_faiss_mcp@45e544444ad31c705829d847c097b6525c6af83d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nonatofabio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@45e544444ad31c705829d847c097b6525c6af83d -
Trigger Event:
release
-
Statement type:
File details
Details for the file local_faiss_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: local_faiss_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
684ba9a1f1b4f81b039caa604eb635f90e064072624356247f26ba7ed930cdab
|
|
| MD5 |
1c4101939a69bd1da0bd7185fce79ca8
|
|
| BLAKE2b-256 |
78f104852ce2d2406ac203c26f6a5e4aba0f9e29d9d0b8ba7d8034994da9efa7
|
Provenance
The following attestation bundles were made for local_faiss_mcp-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on nonatofabio/local_faiss_mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
local_faiss_mcp-0.1.0-py3-none-any.whl -
Subject digest:
684ba9a1f1b4f81b039caa604eb635f90e064072624356247f26ba7ed930cdab - Sigstore transparency entry: 735925179
- Sigstore integration time:
-
Permalink:
nonatofabio/local_faiss_mcp@45e544444ad31c705829d847c097b6525c6af83d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nonatofabio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@45e544444ad31c705829d847c097b6525c6af83d -
Trigger Event:
release
-
Statement type: