Neo4j connector
Run Cypher queries and explore the schema of a Neo4j graph database from AgentRuntime workflow steps.
En esta página
The neo4j connector lets workflow steps query and update a Neo4j graph database over the Bolt protocol. It can run read-only or write Cypher queries, list the labels, relationship types, and property keys in your graph, and check connectivity. Use it to answer relationship questions (who reports to whom, which products are bought together), to keep a knowledge graph up to date from other tools, or to give an agent a way to explore your graph. To combine graph results with tabular data, see the Postgres connector or MySQL connector.
Prerequisites
- A Neo4j database that AgentRuntime can reach over the network (self-hosted, or Neo4j Aura).
- The Bolt connection URI, for example
neo4j+s://xxxx.databases.neo4j.iofor Aura orbolt://localhost:7687for a local server (a local address is only usable if AgentRuntime can reach it). Aura shows the connection URI for each instance in its console. - A database username and password. For Neo4j Aura the username is typically
neo4j, with the password shown when the instance is created. Use a user whose role matches what workflows do: reader roles forneo4j_query_read, a role with write access forneo4j_execute_write. - Optional: the database name, if your server hosts several databases. The default is
neo4j. - Permission in your workspace to create connections and MCP instances (MCP write permission).
Connect in AgentRuntime
- Create a connection
Open Connections in the Console and click New custom connection. Optionally set a Display name, then under Credentials add one row per setting (Key and Value):
neo4j_uri: the Bolt URI, for exampleneo4j+s://xxxx.databases.neo4j.ioneo4j_username: the database usernameneo4j_password: the database passwordneo4j_database: optional, defaults toneo4j
Click Save. The dialog also asks who can use the connection; choose the sharing option that fits your team.
- Add the neo4j MCP instance
Open MCP, click Add connectors, click the neo4j connector, then Add to workspace. Open Instance config, select your connection in the Connection picker, make sure the profile is active, and save.
- Smoke test with an MCP step
In Workflow Studio, create a workflow with a single
mcpstep usingtool_nameneo4j_ping(no arguments) and run it. A result of{"ok": true}means the connection works. - Look at the schema (optional)
Run
neo4j_schemato see the labels, relationship types, and property keys in your graph before you write queries.
See Authentication for how connections are bound to MCP instances.
What you can build
- Recommendations. Use
neo4j_query_readto follow product, category, and co-purchase relationships, then have an LLM step rank suggestions. - Org chart answers. Query reporting lines such as
(:Person)-[:REPORTS_TO*]->(:Person)to answer "who is Dana's manager chain?" in a workflow or agent. - Graph updates from events. When a webhook arrives, use
neo4j_execute_writewith aMERGEstatement to create or update nodes and relationships. - Schema-aware agents. Let an agent call
neo4j_schemafirst so the Cypher it writes uses labels and properties that exist.
Tools
| Tool | What it does |
|---|---|
neo4j_ping | Check connectivity by running RETURN 1. |
neo4j_schema | Return node labels, relationship types, and property keys. |
neo4j_query_read | Run a read-only Cypher query. |
neo4j_execute_write | Run a Cypher query that creates, changes, or deletes data. Writes data. |
neo4j_list_gds_procedures | List Graph Data Science procedures. Needs the GDS plugin on your server; returns an empty list when it is not installed. |
Parameters:
neo4j_query_readandneo4j_execute_write:cypher(required),parameters(an object for$nameplaceholders), andmax_records(default 500, maximum 10000). Both returnrecords,truncated(true when more rows existed thanmax_records), andapplied_limit.neo4j_ping,neo4j_schema, andneo4j_list_gds_procedurestake no arguments.
Example
Find collaborators up to two hops away from a user:
{
"id": "find-collaborators",
"type": "mcp",
"name": "Find nearby collaborators",
"instance_id": "REPLACE_NEO4J_INSTANCE",
"tool_name": "neo4j_query_read",
"tool_args": {
"cypher": "MATCH (u:User {id: $userId})-[:WORKED_WITH*1..2]-(other:User) RETURN DISTINCT other.name AS name, other.email AS email LIMIT 20",
"parameters": {
"userId": "{{input.user_id}}"
},
"max_records": 20
},
"timeout_s": 30
}Use the rows in a later step with {{steps.find-collaborators.result.records}}.
Configuration
Connection keys (the connection's Key names):
| Key | Required | Default | Description |
|---|---|---|---|
neo4j_uri | Yes | none | Bolt URI, for example bolt://localhost:7687 or neo4j+s://....databases.neo4j.io. |
neo4j_username | Yes | none | Database username for Bolt authentication. |
neo4j_password | Yes | none | Database password for Bolt authentication. |
neo4j_database | No | neo4j | Database name used for queries. |
Troubleshooting
| Issue | Fix |
|---|---|
missing neo4j configuration: uri, username, password are required | The connection lacks one of those keys, or the instance profile is not wired to it. |
| Connection failed | Check the URI scheme (use neo4j+s:// or bolt+s:// for TLS endpoints such as Aura), the host, and that your firewall allows the connection. |
| Authentication error | Check the username and password. |
Empty records | Run neo4j_schema to confirm label and property names, and check that the keys in parameters match the $name placeholders in the query. |
truncated is true | Raise max_records (up to 10000) or tighten the query with LIMIT or filters. |
| Write fails with a permission error | Use a database user whose role allows writes. |