Neo4j GraphRAG MCP Server
The Neo4j GraphRAG MCP Server enables LLMs to interact with Neo4j databases through semantic search, fulltext search, graph traversal, and write operations for GraphRAG applications.
Schema Discovery (
get_neo4j_schema_and_indexes): Retrieve the graph schema, vector indexes, fulltext indexes, and property size warnings to guide efficient querying.Semantic Vector Search (
vector_search): Search Neo4j vector indexes using natural language queries embedded via LiteLLM (OpenAI, Azure, Bedrock, Cohere, Ollama, etc.), with support for pre-filtering by property values.Fulltext Keyword Search (
fulltext_search): Search fulltext indexes using Lucene query syntax, including boolean operators (AND/OR), wildcards, fuzzy matching, and exact phrases.Read-Only Cypher Queries (
read_neo4j_cypher): Execute arbitrary read-only Cypher queries with optional parameters.Search-Augmented Cypher Queries (
search_cypher_query): Combine vector and/or fulltext search with Cypher graph traversal using$vector_embeddingand$fulltext_textplaceholders for pattern matching, filtering, and aggregation.Write Cypher Queries (
write_neo4j_cypher): Execute write operations (CREATE, MERGE, SET, DELETE, etc.) with a summary of changes made.Multimodal Image Retrieval (
read_node_image): Retrieve base64-encoded images stored on Neo4j nodes as inline images, enabling visual analysis alongside node properties.
All responses include automatic sanitization and token-limit protection to ensure production-ready performance.
Supports Amazon Bedrock embedding models for performing search-augmented Cypher queries and vector searches.
Extends Neo4j databases with vector search, fulltext search, and the ability to execute read-only Cypher queries for GraphRAG applications.
Enables local semantic search capabilities by utilizing Ollama for embedding generation.
Integrates OpenAI embedding models to enable semantic similarity searches within Neo4j vector indexes.
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 GraphRAG MCP Server Find movies about space travel and list their directors and genres"
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 GraphRAG MCP Server
An MCP server that extends Neo4j with vector search, fulltext search, search-augmented Cypher queries, write operations, and multimodal image retrieval for GraphRAG applications.
Inspired by the Neo4j Labs
mcp-neo4j-cypherserver. This server adds vector search, fulltext search, and the innovativesearch_cypher_querytool for combining search with graph traversal.
Overview
This server enables LLMs to:
π Search Neo4j vector indexes using semantic similarity
π Search fulltext indexes with Lucene syntax
β‘ Combine search with Cypher queries via
search_cypher_queryπΈοΈ Execute read-only Cypher queries
βοΈ Execute write Cypher queries (CREATE, MERGE, SET, DELETE)
πΌοΈ Retrieve images stored in Neo4j nodes (multimodal β returns the image directly to the LLM)
Built on LiteLLM for multi-provider embedding support (OpenAI, Azure, Bedrock, Cohere, etc.).
Related: For the official Neo4j MCP Server, see neo4j/mcp. For Neo4j Labs MCP Servers (Cypher, Memory, Data Modeling), see neo4j-contrib/mcp-neo4j.
Related MCP server: Neo4j YASS MCP
Installation
# Using pip
pip install mcp-neo4j-graphrag
# Using uv (recommended)
uv pip install mcp-neo4j-graphragConfiguration
Claude Desktop
Edit the configuration file:
macOS/Linux:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"neo4j-graphrag": {
"command": "uvx",
"args": ["mcp-neo4j-graphrag"],
"env": {
"NEO4J_URI": "neo4j+s://demo.neo4jlabs.com",
"NEO4J_USERNAME": "recommendations",
"NEO4J_PASSWORD": "recommendations",
"NEO4J_DATABASE": "recommendations",
"OPENAI_API_KEY": "sk-...",
"EMBEDDING_MODEL": "text-embedding-ada-002"
}
}
}
}Note:
uvxautomatically downloads and runs the package from PyPI. No local installation needed!
Cursor
Edit ~/.cursor/mcp.json or .cursor/mcp.json in your project. Use the same configuration as above.
Reload Configuration
Claude Desktop: Quit and restart the application
Cursor: Reload the window (Cmd/Ctrl + Shift + P β "Reload Window")
Tools
The examples below use the Neo4j demo recommendations database (movies, actors, directors), which is the same database referenced in the Configuration section above.
get_neo4j_schema_and_indexes
Discover the graph schema, vector indexes, and fulltext indexes.
π‘ The agent should automatically call this tool first before using other tools to understand the schema and indexes of the database.
Example prompt:
"What is inside the database?"
vector_search
Semantic similarity search using embeddings.
Parameters: text_query, vector_index, top_k, return_properties, pre_filter
Use pre_filter to restrict results to nodes matching exact property values (e.g. {"genre": "Drama"}).
Example prompt:
"What movies are about artificial intelligence?"
fulltext_search
Keyword search with Lucene syntax (AND, OR, wildcards, fuzzy).
Parameters: text_query, fulltext_index, top_k, return_properties
Example prompt:
"Find movies with 'space' or 'galaxy' in the title or plot"
read_neo4j_cypher
Execute read-only Cypher queries.
Parameters: query, params
Example prompt:
"Show me all genres and how many movies are in each"
search_cypher_query
Combine vector/fulltext search with Cypher queries. Use $vector_embedding and $fulltext_text placeholders.
Parameters: cypher_query, vector_query, fulltext_query, params
Example prompt:
"In one query, what are the directors and genres of the movies about 'time travel adventure'?"
write_neo4j_cypher
Execute write Cypher queries (CREATE, MERGE, SET, DELETE, etc.). Returns a summary of counters (nodes created, properties set, etc.).
Parameters: query, params
Example prompt:
"Add a user rating of 4.5 for the movie 'Inception'"
read_node_image
Retrieve a base64-encoded image stored on a Neo4j node and return it as an inline image. Useful for graph databases that store page scans, diagrams, or photos directly on nodes. The LLM receives both the image and selected node properties, enabling visual analysis of graph-stored content.
Parameters: node_element_id, image_property, mime_type, return_properties
Note: This tool requires a database that stores images directly on nodes (as base64). The demo
recommendationsdatabase does not β it stores external poster URLs instead. See docs/ADVANCED.md for a full example using a document graph where page images are embedded on nodes.
Example prompt:
"Show me page 3 of the AbbVie pipeline document and describe what you see"
Environment Variables
Variable | Required | Default | Description |
| Yes |
| Neo4j connection URI |
| Yes |
| Neo4j username |
| Yes |
| Neo4j password |
| No |
| Database name |
| No |
| Embedding model (see below) |
Embedding Providers
Set EMBEDDING_MODEL and the corresponding API key:
Provider | Model Format | API Key Variable |
OpenAI |
|
|
Azure |
|
|
Bedrock |
|
|
Cohere |
|
|
Ollama |
| (none - local) |
Advanced Topics
See docs/ADVANCED.md for:
Comparison with Neo4j Labs
mcp-neo4j-cypherserverProduction features (output sanitization, token limits)
Detailed tool documentation including
write_neo4j_cypher,read_node_image, andvector_searchfiltering
License
MIT License
Available Tools
5 toolsfulltext_searchFulltext SearchARead-onlyIdempotent
Performs fulltext search on a Neo4j fulltext index using Lucene query syntax.
Lucene Syntax Supported:
Boolean: "legal AND compliance", "privacy OR security"
Wildcards: "compli*", "te?t"
Fuzzy: "complience~"
Phrases: ""exact phrase""
Automatic Sanitization (always applied):
Large lists (β₯128 items) β replaced with placeholders
Large strings (β₯10K chars) β truncated with suffix
Total response limited to 8000 tokens (results dropped if needed)
Property Selection:
Default (no return_properties): Returns ALL properties (sanitized)
With return_properties: Returns ONLY specified properties
Example: return_properties="pageNumber,id" β returns only these two
Check get_neo4j_schema_and_indexes for property warnings to avoid large fields
Returns node/relationship IDs, labels/types, properties (sanitized), and relevance scores.
Inputs: text_query (required), fulltext_index (required), top_k, return_properties.
get_neo4j_schema_and_indexesGet Neo4j Schema & IndexesARead-onlyIdempotent
Returns Neo4j graph schema with search indexes and property size warnings.
IMPORTANT: Call this tool BEFORE using any search tools (vector_search, fulltext_search, search_cypher_query).
This tool provides:
Vector & fulltext indexes (for search)
Node/relationship schemas with property types
Warnings for large properties (helps choose efficient return_properties)
Property size warnings help you avoid token limits when using search tools. For example, if a property has warning "avg ~100-200KB", avoid returning it unless necessary.
You should only provide a sample_size value if requested by the user, or tuning performance.
Inputs: sample_size.
read_neo4j_cypherRead Neo4j CypherBRead-onlyIdempotent
Execute a read Cypher query on the Neo4j database.
Inputs: query (required), params.
search_cypher_querySearch-Augmented Cypher QueryARead-onlyIdempotent
Execute a Cypher query that uses vector and/or fulltext search indexes.
This powerful tool allows you to:
Use vector search ($vector_embedding) and/or fulltext search ($fulltext_text) in Cypher
Post-filter large result sets (fetch 100-1000, filter with WHERE)
Combine search with graph traversal
Aggregate over search results
Example:
search_cypher_query(
cypher_query='''
CALL db.index.vector.queryNodes('chunk_embedding_vector', 500, $vector_embedding)
YIELD node, score
WHERE score > 0.75
MATCH (node)-[:BELONGS_TO]->(d:Document)
WHERE d.year >= 2020
RETURN node.chunkId, d.title, score
ORDER BY score DESC
LIMIT 20
''',
vector_query="student requirements"
)Placeholders:
$vector_embedding: Replaced with embedding vector$fulltext_text: Replaced with text string for fulltext
Inputs: cypher_query (required), vector_query, fulltext_query, params.
vector_searchVector Similarity SearchARead-onlyIdempotent
Performs vector similarity search on a Neo4j vector index.
This tool embeds your text query using OpenAI and searches the specified vector index. Returns node IDs, labels, node properties (automatically sanitized), and similarity scores.
Automatic Sanitization (always applied):
Embedding property used by the vector index β automatically excluded (vector_search only)
Large lists (β₯128 items) β replaced with placeholders
Large strings (β₯10K chars) β truncated with suffix
Total response limited to 8000 tokens (results dropped if needed)
Property Selection:
Default (no return_properties): Returns ALL properties (sanitized)
With return_properties: Returns ONLY specified properties
Example: return_properties="pageNumber,id" β returns only these two
Check get_neo4j_schema_and_indexes for property warnings to avoid large fields
Performance Optimization: Internally fetches max(top_k Γ 2, 100) results to avoid local maximum problems in kANN algorithms.
Inputs: text_query (required), vector_index (required), top_k, return_properties.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose with no overlap: fulltext_search uses Lucene queries, vector_search uses embeddings, search_cypher_query combines both with graph traversal, read_neo4j_cypher handles general read queries, and get_neo4j_schema_and_indexes provides metadata. The descriptions explicitly differentiate their use cases and when to apply each, preventing confusion.
All tool names follow a consistent snake_case pattern with clear verb_noun or noun_verb structures: fulltext_search, vector_search, search_cypher_query, read_neo4j_cypher, get_neo4j_schema_and_indexes. The naming is predictable and readable, making it easy for agents to infer functionality.
With 5 tools, this server is well-scoped for Neo4j GraphRAG operations. It covers essential search methods (fulltext, vector, hybrid), general querying, and schema inspection without being overly sparse or bloated. Each tool serves a unique and necessary function in the workflow.
The toolset provides strong coverage for search and querying in a Neo4j GraphRAG context, including schema inspection, multiple search types, and flexible Cypher execution. A minor gap is the lack of write operations (e.g., create/update nodes), but this aligns with a read-focused RAG server, and agents can work around this limitation.
Related MCP Connectors
The Grafbase MCP server sits in front of a GraphQL API and exposes an MCP protocol-compliant interface that allows AI agents and LLMs to explore and query GraphQL APIs using natural language. It provides tools to search schemas, introspect types and fields, and execute GraphQL queries while minimizing context bloat by returning only relevant schema subsets, with built-in support for authentication, authorization, and configurable access control.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Capability registry for the agentic economy. Semantic search over verified MCP server listings.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that enables graph database interactions with Neo4j, allowing users to access and manipulate graph data through natural language commands.-
- AlicenseNot gradedqualityDmaintenanceProduction-ready MCP server for Neo4j graph databases, enabling natural language to Cypher query translation with enterprise security and async performance.MIT
- FlicenseNot gradedqualityBmaintenanceMCP server for indexing source code from repositories into a Neo4j graph database and enabling Graph RAG-based search and traversal of functions via natural language queries.-
- AlicenseAqualityCmaintenanceMCP server for Neo4j that provides abstract graph operations for LLMs, enabling safe and consistent interaction with Neo4j databases through tools like search, insert, update, delete, and schema introspection.8MIT