Esta página no está disponible en español. Se muestra la versión en inglés.

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.io for Aura or bolt://localhost:7687 for 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 for neo4j_query_read, a role with write access for neo4j_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

  1. 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 example neo4j+s://xxxx.databases.neo4j.io
    • neo4j_username: the database username
    • neo4j_password: the database password
    • neo4j_database: optional, defaults to neo4j

    Click Save. The dialog also asks who can use the connection; choose the sharing option that fits your team.

  2. 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.

  3. Smoke test with an MCP step

    In Workflow Studio, create a workflow with a single mcp step using tool_name neo4j_ping (no arguments) and run it. A result of {"ok": true} means the connection works.

  4. Look at the schema (optional)

    Run neo4j_schema to 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_read to 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_write with a MERGE statement to create or update nodes and relationships.
  • Schema-aware agents. Let an agent call neo4j_schema first so the Cypher it writes uses labels and properties that exist.

Tools

ToolWhat it does
neo4j_pingCheck connectivity by running RETURN 1.
neo4j_schemaReturn node labels, relationship types, and property keys.
neo4j_query_readRun a read-only Cypher query.
neo4j_execute_writeRun a Cypher query that creates, changes, or deletes data. Writes data.
neo4j_list_gds_proceduresList Graph Data Science procedures. Needs the GDS plugin on your server; returns an empty list when it is not installed.

Parameters:

  • neo4j_query_read and neo4j_execute_write: cypher (required), parameters (an object for $name placeholders), and max_records (default 500, maximum 10000). Both return records, truncated (true when more rows existed than max_records), and applied_limit.
  • neo4j_ping, neo4j_schema, and neo4j_list_gds_procedures take 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):

KeyRequiredDefaultDescription
neo4j_uriYesnoneBolt URI, for example bolt://localhost:7687 or neo4j+s://....databases.neo4j.io.
neo4j_usernameYesnoneDatabase username for Bolt authentication.
neo4j_passwordYesnoneDatabase password for Bolt authentication.
neo4j_databaseNoneo4jDatabase name used for queries.

Troubleshooting

IssueFix
missing neo4j configuration: uri, username, password are requiredThe connection lacks one of those keys, or the instance profile is not wired to it.
Connection failedCheck 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 errorCheck the username and password.
Empty recordsRun neo4j_schema to confirm label and property names, and check that the keys in parameters match the $name placeholders in the query.
truncated is trueRaise max_records (up to 10000) or tighten the query with LIMIT or filters.
Write fails with a permission errorUse a database user whose role allows writes.
Editar esta páginaagentruntime-io/agentruntime-docs