π MCP Server - Vector Search
LocalAbout π MCP Server - Vector Search
A FastMCP server that performs semantic vector search over a Neo4j knowledge graph. It exposes a natural-language search tool that returns ranked nodes with similarity scores.
Key features
- 01Natural-language query embeddings
- 02Neo4j vector-index search
- 03Ranked results with similarity scores
Use cases
- 01Finding relevant graph documents by topic
- 02Retrieving contextual nodes for an LLM
- 03Searching a Neo4j knowledge graph semantically
MCP support
Exposes the `vector_search_neo4j` tool to MCP clients for searching a Neo4j vector index with natural-language queries.
Configuration
Local server config is the same for every client. Copy it into your clientβs MCP config file.
We havenβt collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEπ MCP Server - Vector Search
A blazing-fast Model Context Protocol (MCP) Server built with FastMCP that seamlessly combines Neo4j's graph database capabilities with advanced vector search using embeddings. This server enables intelligent semantic search across your knowledge graph, allowing you to discover contextually relevant information through natural language queries with lightning speed.
ποΈ Architecture
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β MCP Client βββββΊβ Vector Search βββββΊβ Neo4j β
β (Claude AI) β β Server β β Database β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β Embeddings β
ββββββββββββββββββββ
π Quick Start
Prerequisites
- Python 3.8+
- uv
- Neo4j Database (v5.0+) with APOC plugin
- OpenAI API Key
Installation with uv
-
Install uv (if not already installed)
# On macOS and Linux curl -LsSf https://astral.sh/uv/install.sh | sh # On Windows powershell -c "irm https://astral.sh/uv/install.ps1 | iex" -
Clone and setup the project
git clone https://github.com/omarguzmanm/mcp-server-vector-search.git cd mcp-server-vector-search # Create virtual environment and install dependencies uv venv uv pip install fastmcp neo4j openai python-dotenv sentence-transformers pydantic -
Environment Configuration
# Create .env file cp .env.example .envEdit
.envwith your configurations:NEO4J_URI=bolt://localhost:7687 NEO4J_USERNAME=neo4j NEO4J_PASSWORD=your_neo4j_password NEO4J_DATABASE=neo4j OPENAI_API_KEY=your_openai_api_key -
Neo4j Vector Index Setup
// Create vector index for 1536-dimensional OpenAI embeddings // If does not works CREATE VECTOR INDEX embeddableIndex FOR (n:Document) ON (n.embedding) OPTIONS {indexConfig: { `vector.dimensions`: 1536, `vector.similarity_function`: 'cosine' }} -
Launch the Server
# Activate virtual environment source .venv/bin/activate # On Linux/macOS # or .venv\Scripts\activate # On Windows # Start the FastMCP server python main.py
π οΈ Tool
The server exposes a single, powerful tool optimized for vector search:
π Vector Search
vector_search_neo4j(
prompt="Find documents about machine learning and neural networks"
)
What it does:
- Converts your natural language query into a 1536-dimensional vector using OpenAI
- Searches your Neo4j vector index for the most semantically similar nodes
- Returns ranked results with similarity scores
βοΈ Configuration
Environment Variables
| Variable | Description | Required | Default |
|---|---|---|---|
NEO4J_URI | Neo4j connection URI | β | bolt://localhost:7687 |
NEO4J_USERNAME | Neo4j username | β | neo4j |
NEO4J_PASSWORD | Neo4j password | β | password |
NEO4J_DATABASE | Neo4j database name | β | neo4j |
OPENAI_API_KEY | OpenAI API key | β | all-MiniLM-L6-v2 model |
Neo4j Requirements
- APOC Plugin: Essential for advanced graph operations
- Vector Index: Must support 1536 dimensions for OpenAI embeddings
- Node Structure: Nodes should have
embeddingproperties as vectors
Performance Optimization
- uv Benefits: 10-100x faster dependency resolution compared to pip
- FastMCP Advantages: Minimal overhead, optimized for MCP protocol
- Connection Pooling: Automatic Neo4j connection management
- Async Operations: Non-blocking I/O for maximum throughput
π€ Integration with Claude Desktop
MCP Configuration
Add to your Claude Desktop MCP settings:
{
"mcpServers": {
"mcp-neo4j-vector-search": {
"command": "python",
"args": [
"you\\server.py",
"--with",
"mcp[cli]",
"--with",
"neo4j",
"--with",
"pydantic"
],
"env": {
"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_USERNAME": "neo4j",
"NEO4J_PASSWORD": "your_password",
"NEO4J_DATABASE": "neo4j",
"OPENAI_API_KEY": "your_api_key"
}
}
}
}
π Troubleshooting
Common Issues
-
"Module not found" errors
# Reinstall dependencies with uv uv pip install --force-reinstall fastmcp neo4j openai -
"Vector index not found"
// Check existing indexes SHOW INDEXES // Create if missing CREATE VECTOR INDEX embeddableIndex FOR (n:Document) ON (n.embedding) OPTIONS {indexConfig: {`vector.dimensions`: 1536, `vector.similarity_function`: 'cosine'}} -
OpenAI API errors
# Verify API key uv run python -c " import os from openai import OpenAI client = OpenAI(api_key=os.getenv('OPENAI_API_KEY')) print('API key is valid!' if client.api_key else 'API key missing!') "
π€ Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Install development dependencies:
uv pip install -e ".[dev]" - Make your changes and add tests
- Commit:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- FastMCP - For the incredible MCP framework
- uv - For blazing-fast Python package management
- Neo4j - For powerful graph database capabilities
- OpenAI - For state-of-the-art embedding models
- Model Context Protocol - For the protocol specification
π Made with β€οΈ for the AI and Graph Database community
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.