mcp -vector-search
MCP Server to improve LLM context through vector search.
claude mcp add --transport stdio miosomos-mcp-server-vector-search python main.py \ --env NEO4J_URI="bolt://localhost:7687" \ --env NEO4J_DATABASE="neo4j" \ --env NEO4J_PASSWORD="your_neo4j_password" \ --env NEO4J_USERNAME="neo4j" \ --env OPENAI_API_KEY="your_openai_api_key"
How to use
This MCP server provides a vector search capability over a Neo4j graph using OpenAI embeddings. It exposes a single tool, Vector Search, which converts natural language queries into a 1536-dimensional embedding, executes a cosine similarity search against the Neo4j vector index, and returns a ranked list of matching documents with similarity scores. You can invoke this tool from your MCP client or Claude Desktop integration by calling vector_search_neo4j with a natural language prompt such as: vector_search_neo4j(prompt="Find documents about machine learning and neural networks"). Ensure your Neo4j instance has the APOC plugin installed and a 1536-dimensional embedding property on nodes (embedding).
How to install
Prerequisites:
- Python 3.8+
- Neo4j 5.0+ with APOC installed
- OpenAI API key
- uv (Python package manager) for fast local setup (optional but recommended)
Install and run using uv (recommended):
-
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 the repository and install dependencies: git clone https://github.com/omarguzmanm/mcp-server-vector-search.git cd mcp-server-vector-search uv venv uv pip install fastmcp neo4j openai python-dotenv sentence-transformers pydantic
-
Configure environment variables (create .env or export variables): NEO4J_URI=bolt://localhost:7687 NEO4J_USERNAME=neo4j NEO4J_PASSWORD=your_neo4j_password NEO4J_DATABASE=neo4j OPENAI_API_KEY=your_openai_api_key
-
Launch the server:
Activate virtual environment (example for Linux/macOS)
source .venv/bin/activate
Or Windows: .venv\Scripts\activate
python main.py
If you prefer a direct Python run without uv, you can run:
python main.py
Additional notes
Notes and tips:
- Ensure your Neo4j vector index supports 1536 dimensions for OpenAI embeddings and that nodes have an embedding property containing the vector.
- If you encounter a missing vector index error, create or verify the index with: CREATE VECTOR INDEX embeddableIndex FOR (n:Document) ON (n.embedding) OPTIONS {indexConfig: {
vector.dimensions: 1536,vector.similarity_function: 'cosine'}} - The OpenAI API key is optional in some setups but recommended. If not provided, the default model might be used depending on your code; ensure OPENAI_API_KEY is configured if needed.
- uv provides faster dependency resolution; consider using it in development to accelerate installs and environment management.
- If you run into module-not-found errors, reinstall dependencies within the active environment: uv pip install --force-reinstall fastmcp neo4j openai
- For Claude Desktop integration, you can map the MCP server as shown in the README examples by configuring mcpServers with command and args that start the Python server and pass the needed with/neo4j/pydantic options.
Related MCP Servers
mcp-reddit
A Model Context Protocol (MCP) server that provides tools for fetching and analyzing Reddit content.
mcp-aktools
📈 提供股票、加密货币的数据查询和分析功能MCP服务器
edumcp
EDUMCP is a protocol that integrates the Model Context Protocol (MCP) with applications in the education field, dedicated to achieving seamless interconnection and interoperability among different AI models, educational applications, smart hardware, and teaching AGENTs.
TradingAgents mode
TradingAgents-MCPmode 是一个创新的多智能体交易分析系统,集成了 Model Context Protocol (MCP) 工具,实现了智能化的股票分析和交易决策流程。系统通过多个专业化智能体的协作,提供全面的市场分析、投资建议和风险管理。
lihil
2X faster ASGI web framework for python, offering high-level development, low-level performance.
zettelkasten
A Model Context Protocol (MCP) server that implements the Zettelkasten knowledge management methodology, allowing you to create, link, explore and synthesize atomic notes through Claude and other MCP-compatible clients.