neo4j-prefiltering-mcp
Automatically discovers vector indexes in a Neo4j database and exposes each one as a semantic search tool with metadata filtering capabilities.
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., "@neo4j-prefiltering-mcpfind news articles about climate change in English"
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.
Neo4j Prefiltering Vector Search MCP Server
An MCP (Model Context Protocol) server that automatically discovers vector indexes in a Neo4j database and exposes each one as a semantic search tool. Built with FastMCP and LangChain embeddings, so it works with any embedding provider out of the box.
How It Works
On startup the server:
Connects to Neo4j and runs
SHOW INDEXESto find everyVECTORindex.Samples one node per indexed property to detect its type (string, numeric, date, bool, or vector).
Identifies the embedding property and the remaining filterable metadata properties.
Registers an MCP tool
search_<index_name>for each discovered index, complete with a dynamically generated description listing the available filters.
If no vector indexes are found, the server exits with an error.
Related MCP server: AXYS MCP Lite
Prerequisites
Python 3.10+
A running Neo4j instance (5.x+ with vector index support)
At least one vector index already created in the database
An API key or credentials for your chosen embedding provider
Installation
First, clone the repository:
git clone https://github.com/tomasonjo/neo4j-prefiltering-mcp.git
cd neo4j-prefiltering-mcpUsing uvx (recommended)
No installation needed — just run it directly from the local folder:
uvx --from /path/to/neo4j-prefiltering-mcp neo4j-prefiltering-mcpUsing pip
pip install /path/to/neo4j-prefiltering-mcpThen run:
neo4j-prefiltering-mcpEmbedding providers
The base package does not include an embedding provider. Install the one you need as an extra:
# OpenAI
pip install "/path/to/neo4j-prefiltering-mcp[openai]"
# Cohere
pip install "/path/to/neo4j-prefiltering-mcp[cohere]"
# HuggingFace
pip install "/path/to/neo4j-prefiltering-mcp[huggingface]"Or with uvx:
uvx --from /path/to/neo4j-prefiltering-mcp --with langchain-openai neo4j-prefiltering-mcpConfiguration
All configuration is done through environment variables.
Variable | Default | Description |
|
| Neo4j connection URI |
|
| Neo4j username |
|
| Neo4j password |
|
| Neo4j database name |
|
| LangChain embedding model spec |
The EMBEDDING_MODEL value is passed directly to langchain.embeddings.init_embeddings(). Any provider string it supports will work:
# OpenAI
export EMBEDDING_MODEL="openai:text-embedding-3-small"
# Cohere
export EMBEDDING_MODEL="cohere:embed-english-v3.0"
# HuggingFace
export EMBEDDING_MODEL="huggingface:BAAI/bge-small-en-v1.5"Make sure the corresponding provider SDK and API key env var are set (e.g. OPENAI_API_KEY, COHERE_API_KEY).
Usage
Claude Desktop
Add the server to your claude_desktop_config.json:
{
"mcpServers": {
"neo4j-vector": {
"command": "uvx",
"args": ["--from", "/path/to/neo4j-prefiltering-mcp", "--with", "langchain-openai", "neo4j-prefiltering-mcp"],
"env": {
"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_USER": "neo4j",
"NEO4J_PASSWORD": "your-password",
"NEO4J_DATABASE": "neo4j",
"EMBEDDING_MODEL": "openai:text-embedding-3-small",
"OPENAI_API_KEY": "sk-..."
}
}
}
}Claude Code
claude mcp add neo4j-vector -- uvx --from /path/to/neo4j-prefiltering-mcp --with langchain-openai neo4j-prefiltering-mcpStandalone
neo4j-prefiltering-mcpThe server communicates over stdio by default, which is the standard transport for local MCP tool servers.
Cursor / Continue / Other MCP Clients
Point the client at the server as a stdio server. The exact config format varies by client — consult its docs and use the command + args pattern shown above.
Tool Interface
Each discovered index is exposed as a tool with the following parameters:
Parameter | Type | Required | Description |
|
| Yes | Natural-language search text (embedded at call time) |
|
| No | Number of results to return (default |
|
| No | Metadata filters (keys and accepted types are index-specific) |
Filter Types
The server infers filter types by sampling a node from each index:
Detected Type | Filter Format | Example |
|
|
|
|
|
|
|
|
|
|
|
|
Both min and max are optional within a range filter — you can supply either or both.
Example Tool Call
Given an index called news_articles on :Article nodes with metadata properties language (string) and sentiment (float):
{
"name": "search_news_articles",
"arguments": {
"query": "recent breakthroughs in fusion energy",
"top_k": 5,
"filters": {
"language": "en",
"sentiment": { "min": 0.6 }
}
}
}Response Format
The tool returns a JSON array of results, each containing the matched node's properties (minus the raw embedding vector) and a similarity score:
[
{
"doc": {
"title": "Fusion Milestone Reached at NIF",
"language": "en",
"sentiment": 0.92,
"published": "2025-01-15"
},
"score": 0.941
}
]Project Structure
.
├── pyproject.toml
├── src/
│ └── neo4j_prefiltering_mcp/
│ ├── __init__.py
│ └── server.py
└── README.mdLicense
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
A collaborative substrate over your data: vector, knowledge graph, SQL, geospatial, streaming.
Cloud or self-hosted knowledge for AI agents: hybrid search, reranking, GraphRAG, scoped MCP tools.
Disposable private vector search + semantic RAG for AI agents. x402 pay-per-call, no account.
Search your knowledge bases from any AI assistant using hybrid RAG.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables semantic search and document management using a local Qdrant vector database with OpenAI embeddings. Supports natural language queries, metadata filtering, and collection management for AI-powered document retrieval.35 npm37MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to search through structured databases and unstructured content (documents, videos, files) using natural language queries with semantic understanding.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Neo4j graph databases through natural language, supporting Cypher queries, schema management, data manipulation, and graph algorithms.MIT
- AlicenseBqualityAmaintenanceEnables building and querying vector-based knowledge graphs with node and edge management and semantic search.57 npm48 PyPIMIT