Skip to content

Commit 81b787c

Browse files
authored
Neo4j connection (#170)
1 parent d5d16cf commit 81b787c

17 files changed

+297
-2
lines changed

agents/available-connections.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,19 @@ agent card for the full list.
150150
<span className="text-lg font-semibold">Neo4j AuraDB</span>
151151
</div>
152152
Fully managed graph database.
153+
<div className="mt-4 flex items-center justify-between">
154+
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
155+
3 tools
156+
</span>
157+
158+
<a
159+
href="/agents/connections/neo4j"
160+
className="px-3 py-1 bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 dark:text-gray-200 rounded"
161+
>
162+
Details
163+
</a>
164+
</div>
165+
153166
</Card>
154167
<Card>
155168
<div className="flex items-center gap-2">

agents/connections/neo4j.mdx

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
---
2+
title: Using Neo4j with Hypermode
3+
sidebarTitle: Neo4j
4+
description: Connect your Hypermode agent to Neo4j for graph database operations
5+
---
6+
7+
<div className="flex items-center gap-3 mb-6">
8+
<img
9+
src="/images/agents/connections/icons/neo4j-auradb.png"
10+
alt="Neo4j"
11+
width={48}
12+
height={48}
13+
/>
14+
<div>
15+
<h2 className="text-2xl font-bold m-0">Neo4j</h2>
16+
<p className="text-gray-600 m-0">
17+
Graph database platform for connected data
18+
</p>
19+
</div>
20+
</div>
21+
22+
## Overview
23+
24+
Neo4j is a powerful graph database that excels at managing highly connected data
25+
and complex relationships. This guide will walk you through connecting your
26+
Hypermode agent to Neo4j.
27+
28+
## Prerequisites
29+
30+
Before connecting Neo4j to Hypermode, you'll need:
31+
32+
1. A [Neo4j account](https://neo4j.com/)
33+
2. A Neo4j instance (we'll use Neo4j Sandbox for this guide)
34+
3. A [Hypermode workspace](https://hypermode.com/)
35+
36+
## Setting up Neo4j
37+
38+
### Step 1: Create a Neo4j Sandbox
39+
40+
First, you need to go to https://sandbox.neo4j.com/ and create an account. When
41+
you get to making a database, select a blank sandbox.
42+
43+
![Create blank sandbox](/images/connections/neo4j/blank-sandbox.png)
44+
45+
<Note>
46+
Neo4j Sandbox provides free temporary instances perfect for testing. For
47+
production use, consider Neo4j Aura or a self-hosted instance.
48+
</Note>
49+
50+
### Step 2: Get your connection details
51+
52+
Once created (it may take a moment), you can navigate to the HTTP tab and grab
53+
the URL. Note you will have to modify this to use the Neo4j HTTP v2 endpoint:
54+
55+
- Remove `/db/neo4j/tx/commit`
56+
- Replace it with `/db/neo4j/query/v2`
57+
58+
For example:
59+
60+
- Original: `http://52.54.53.148:7474/db/neo4j/tx/commit`
61+
- Modified: `http://52.54.53.148:7474/db/neo4j/query/v2`
62+
63+
![http tab](/images/connections/neo4j/neo4j-http-connection.png)
64+
65+
### Step 3: Get authentication credentials
66+
67+
Save this URL and then move to the connection details to grab the username and
68+
password.
69+
70+
![Connection details](/images/connections/neo4j/neo4j-user-password.png)
71+
72+
Now we've got the URL, username, and password we can create a new agent in
73+
Hypermode.
74+
75+
## Creating your Neo4j agent
76+
77+
### Step 1: Create a new agent
78+
79+
From the Hypermode interface, create a new agent:
80+
81+
1. Click the agent dropdown menu
82+
2. Select "Create new Agent"
83+
84+
![Navigate to create agent](/images/connections/neo4j/navigate-create-agent.png)
85+
86+
### Step 2: Configure agent settings
87+
88+
Use these recommended settings for your Neo4j agent:
89+
90+
- **Agent Name**: GraphExplorer
91+
- **Agent Title**: Neo4j Graph Analysis Agent
92+
- **Description**: Analyzes graph relationships and patterns in Neo4j
93+
- **Instructions**: You have a connection to a Neo4j graph database. You can
94+
create nodes with any labels and properties, create relationships of any type,
95+
and run Cypher queries. Neo4j is schemaless, so you can dynamically add data
96+
without predefined structures.
97+
- **Model**: GPT-4.1
98+
99+
![Create agent modal](/images/connections/neo4j/create-agent-modal.png)
100+
101+
### Step 3: View your agent profile
102+
103+
Once created, navigate to your agent's settings page:
104+
105+
![Agent profile](/images/connections/neo4j/agent-profile.png)
106+
107+
## Connecting to Neo4j
108+
109+
### Step 1: Add the Neo4j connection
110+
111+
Navigate to the **Connections** tab and add Neo4j:
112+
113+
1. Click "Add connection"
114+
2. Search for "Neo4j" in the available connections
115+
116+
![Add Neo4j connection](/images/connections/neo4j/add-neo4j-connection.png)
117+
118+
### Step 2: Configure credentials
119+
120+
Enter your Neo4j credentials:
121+
122+
- **URL**: Your modified HTTP v2 endpoint
123+
(`http://52.54.53.148:7474/db/neo4j/query/v2`)
124+
- **Username**: Your Neo4j username (usually `neo4j`)
125+
- **Password**: Your Neo4j password
126+
127+
![Neo4j connection modal](/images/connections/neo4j/neo4j-connection-modal.png)
128+
129+
<Warning>
130+
Ensure you're using the HTTP v2 endpoint format. The connection will fail with
131+
the default transaction endpoint.
132+
</Warning>
133+
134+
## Understanding Neo4j's schemaless nature
135+
136+
Unlike traditional databases, Neo4j doesn't require you to define schemas
137+
upfront. This means:
138+
139+
- **Flexible node creation**: Add nodes with any labels and properties on the
140+
fly
141+
- **Dynamic relationships**: Create relationships of any type between nodes
142+
- **Evolving data models**: Your graph structure can grow and change organically
143+
- **No migrations needed**: Add new node types or properties without schema
144+
updates
145+
146+
This flexibility makes Neo4j perfect for:
147+
148+
- Exploratory data analysis
149+
- Rapidly evolving data models
150+
- Complex, heterogeneous datasets
151+
- Real-world relationship modeling
152+
153+
## Example graph model
154+
155+
Here's a simple example of how nodes and relationships work in Neo4j:
156+
157+
![Neo4j Graph Model](/images/connections/neo4j/model.png)
158+
159+
This model shows:
160+
161+
- **Nodes**: Person, Company, and Product (represented as circles)
162+
- **Relationships**: WORKS_AT, MAKER_OF, BY_COMPANY (represented as arrows)
163+
- Each node can have properties (like name, age, price)
164+
- Relationships can also have properties (like since, role)
165+
166+
## Testing the connection
167+
168+
### Test 1: Create your first nodes
169+
170+
Start a new thread with your agent and create some nodes dynamically:
171+
172+
```text
173+
Create nodes for this scenario:
174+
- A Person named "Alice" who is 28 years old
175+
- A Company named "TechCorp" founded in 2020
176+
- A Product named "GraphApp" with a price of $99
177+
```
178+
179+
![Create nodes result](/images/connections/neo4j/create-nodes-result.png)
180+
181+
### Test 2: Create relationships
182+
183+
Now connect your nodes based on our model:
184+
185+
```text
186+
Create these relationships:
187+
- Alice WORKS_AT TechCorp (since 2021)
188+
- Alice is MAKER_OF GraphApp
189+
- GraphApp is BY_COMPANY TechCorp
190+
```
191+
192+
![Create relationships result](/images/connections/neo4j/create-relationships-result.png)
193+
194+
### Test 3: Visualize in Neo4j Browser
195+
196+
After your agent creates the data, switch to Neo4j Browser to see the results:
197+
198+
1. **Click the "Open" button** in your Neo4j Sandbox
199+
2. **Run the visualization query**:
200+
201+
```cypher
202+
MATCH (n) RETURN n
203+
```
204+
205+
![graph in browser](/images/connections/neo4j/neo4j-browser-graph-view.png)
206+
207+
### Test 4: Query your graph
208+
209+
Back in your agent thread, use Cypher to explore your data:
210+
211+
```text
212+
Run a Cypher query to find all products made by people who work at TechCorp, showing the full relationship path.
213+
```
214+
215+
![Query result](/images/connections/neo4j/cypher-query-result.png)
216+
217+
## Example: Building a dynamic knowledge graph
218+
219+
Here's how to leverage Neo4j's schemaless nature to build a flexible knowledge
220+
graph:
221+
222+
```text
223+
Let's expand our graph with more data:
224+
1. Add another Person "Bob" who also works at TechCorp
225+
2. Add a new Company "StartupInc"
226+
3. Add Products "DataTool" and "AIAssistant"
227+
4. Create relationships showing Bob made DataTool, and StartupInc made AIAssistant
228+
5. Add a COMPETES_WITH relationship between the two companies
229+
```
230+
231+
Your agent can dynamically add:
232+
233+
- New node types as you discover them
234+
- Properties specific to each entity
235+
- Relationships that make sense in context
236+
- No need to predefine any structure!
237+
238+
## What you can do
239+
240+
With your Neo4j connection and its three core tools, your agent can:
241+
242+
- **Create Node**: Dynamically add entities with any labels and properties
243+
- **Create Relationship**: Connect nodes with typed relationships and properties
244+
- **Run Cypher Query**: Perform complex graph operations including:
245+
- Pattern matching and traversal
246+
- Aggregations and analytics
247+
- Graph algorithms
248+
- Data updates and deletions
249+
- Schema-free exploration
250+
251+
## Troubleshooting
252+
253+
### Common issues
254+
255+
#### Connection refused error
256+
257+
- Verify you're using the HTTP v2 endpoint format
258+
- Check if your sandbox is still active (they expire after 3 days)
259+
- Ensure the URL includes the correct port (usually 7474)
260+
261+
#### Authentication failed
262+
263+
- Confirm username and password are correct
264+
- Sandbox passwords are auto-generated - copy carefully
265+
- Try resetting the password in the sandbox console
266+
267+
#### Tool execution errors
268+
269+
- Check the
270+
[MCP Neo4j documentation](https://mcp.pipedream.com/app/neo4j_auradb) for
271+
correct parameter formats
272+
- Ensure node IDs exist before creating relationships
273+
- Verify Cypher syntax in your queries
274+
275+
## Learn more
276+
277+
- [Neo4j Documentation](https://neo4j.com/docs/)
278+
- [Cypher Query Language](https://neo4j.com/docs/cypher-manual/current/)
279+
- [MCP Neo4j AuraDB Server](https://mcp.pipedream.com/app/neo4j_auradb)
280+
- [Graph Data Science Library](https://neo4j.com/docs/graph-data-science/current/)

docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
"group": "Available Connections",
7070
"pages": [
7171
"agents/available-connections",
72-
"agents/connections/supabase"
72+
"agents/connections/supabase",
73+
"agents/connections/neo4j"
7374
]
7475
}
7576
]
267 KB
Loading
256 KB
Loading
155 KB
Loading
346 KB
Loading
213 KB
Loading
245 KB
Loading
252 KB
Loading

0 commit comments

Comments
 (0)