Neo4j & MCP Tools

MCP Tools

Let’s take a look at the knowledge graph that has been built. With Neo4j’s MCP tools, you can get an LLM to write Cypher queries for you.

What is the Model Context Protocol?

Model Context Protocol (MCP) is an open standard designed to connect AI applications with tools and data sources. It enables AI agents to access and interact with external resources as part of their reasoning process, allowing them to perform more complex tasks and collaborate effectively.

MCP follows a client-server architecture where:

  • MCP Servers provide capabilities through tools, resources, and prompt templates that clients can discover and use

  • MCP Clients manage connections to servers and execute tools on behalf of the host application

  • MCP Hosts are applications (like Claude Desktop, VS Code, or custom agents) that manage clients and determine which tools to use

mcp-neo4j-cypher

Purpose: Direct database interactions and Cypher query execution

What it does:

  • Enables AI agents to read database schemas

  • Generates Cypher queries from natural language

  • Executes both read and write operations safely

  • Provides three main tools: get-neo4j-schema, read-neo4j-cypher, and write-neo4j-cypher

Best for: Database exploration, query generation, and development assistance

mcp-neo4j-memory

Purpose: Building persistent knowledge graphs from conversations

What it does:

  • Automatically captures conversation context as graph structures

  • Stores knowledge incrementally from chat interactions

  • Creates relationships between discussed entities

  • Enables AI to remember and reference past conversations

Best for: Long-term knowledge accumulation and contextual AI assistants

mcp-neo4j-cloud-aura-api

Purpose: Cloud database management and infrastructure provisioning

What it does:

  • Manages Neo4j Aura instances programmatically

  • Handles cloud resource provisioning

  • Automates database deployment and configuration

  • Provides infrastructure management capabilities

Best for: DevOps workflows and cloud database automation

mcp-neo4j-data-modeling

Purpose: Interactive graph data modeling and visualization

What it does:

  • Assists with designing graph schemas

  • Provides data modeling recommendations

  • Helps refine relationship patterns

  • Offers visualization support for model design

Best for: Schema design and data architecture planning

Adding Neo4j Cypher MCP Server to VS Code

Create or update your .vscode/mcp.json file:

json
{
  "servers": {
    "neo4j-cypher": {
      "command": "uvx",
      "args": ["mcp-neo4j-cypher"],
      "env": {
        "NEO4J_URI": "{instance-scheme}://{instance-ip}:7687",
        "NEO4J_USERNAME": "{instance-username}",
        "NEO4J_PASSWORD": "{instance-password}",
        "NEO4J_DATABASE": "neo4j"
      }
    }
  }
}

Available Tools: get-neo4j-schema

Purpose: Discover database structure

Usage Examples:

  • "Describe the data model"

  • "What node labels and relationship types are available?"

  • "How are User and Movie nodes related?"

Returns: JSON schema showing labels, properties, and relationships

Available Tools: read-neo4j-cypher

Purpose: Execute read-only Cypher queries safely

Usage Examples:

  • "What are the top 10 movies by revenue?"

  • "Who directed the movie 'The Matrix'?"

  • "Show me all companies in the database"

Safety: Only allows read operations, preventing data modification

Available Tools: write-neo4j-cypher

Purpose: Execute write operations (requires approval)

Usage Examples:

  • "Create a new user named Sarah"

  • "Add a 5-star rating from John to The Godfather"

  • "Update the company revenue for Apple"

Safety: Requires explicit approval in most AI hosts

Try it out

When you add the MCP server, you will see a line of buttons appear above the configuration. If the server is not running, click Start Server.

Once the server is running, open up Chat, enable Agent mode, and prompt the LLM with questions about the knowledge graph:

  • What tools do you have available?

  • Describe my knowledge graph

  • How many documents are in the database?

  • Which asset manager has the highest exposure to $MCD?

Summary

In this lesson, you learned about the Model Context Protocol (MCP) and how Neo4j’s MCP servers can enhance your GraphRAG development workflow.

You discovered four specialized Neo4j MCP servers:

  • mcp-neo4j-cypher for database interactions

  • mcp-neo4j-memory for conversation knowledge graphs

  • mcp-neo4j-cloud-aura-api for cloud management

  • mcp-neo4j-data-modeling for schema design

You also learned how to set up the Neo4j Cypher MCP server in VS Code and Claude Desktop, and understand the three main tools it provides for schema discovery, read operations, and write operations.

MCP tools enable natural language database interactions, making GraphRAG development more efficient and accessible.

Chatbot

How can I help you today?