Skip to main content

Introduction

Build agentic graph queries that evolve step-by-step without rebuilding from scratch. HelixDBโ€™s MCP endpoints provide a stateful, incremental query session via a connection_id, so each call extends the same traversal. This allows agents to chain and build complex traversal and filter queries over time while being able to view intermediate results. Stream results with mcp/next or batch with mcp/collect. You can also dynamically pass lists created at runtime, toggle AND/OR property groups, and filter by temporary traversals. Run multiple traversals in concurrently and asynchronously using multiple connection IDs by initializing each traversal with its own connection_id to keep them separate and easy to manage.

MCP Tools

These tools are used to manage the MCP connection and interact with the MCP endpoints.

Initialization init

Endpoint "mcp/init"

Creates a new MCP connection, which is a blank traversal.
The request for this endpoint is empty ({}). Response Format

Iterate Results next

Endpoint "mcp/next"

Returns the next item in the MCP traversal results.
Request Format
string
required
Connection ID of the MCP connection
Response Format

Collect Results collect

Endpoint "mcp/collect"

Collects all the results from the MCP traversal.
Request Format
string
required
Connection ID of the MCP connection
json
Range of results to collect (default: {"start": 0, "end": -1})
boolean
Resets the traversal after collecting results (default: true)
Response Format

Reset Connection reset

Endpoint "mcp/reset"

Resets the MCP connection with the given connection ID to a blank traversal.
Request Format
string
required
Connection ID of the MCP connection
Response Format

Schema Context schema_resource

Endpoint "mcp/schema_resource"

Returns the schema and query information of the database for LLM context.
Request Format
string
required
Connection ID of the MCP connection
Response Format

MCP Traversals

These tools are used to dynamically traverse the graph and retrieve nodes and edges. However, they do not return the results of the traversal.

Retrieve Nodes n_from_type

Endpoint "mcp/n_from_type"

Retrieves all nodes of a given type.
Request Format
string
required
Connection ID of the MCP connection
string
required
The label of node to retrieve (name in schema)

Retrieve Edges e_from_type

Endpoint "mcp/e_from_type"

Retrieves all edges of a given type.
Request Format
string
required
Connection ID of the MCP connection
string
required
The label of edge to retrieve (name in schema)

Out out_step

Endpoint "mcp/out_step"

Traverses out from current nodes or vectors in the traversal with the given edge type to nodes or vectors. Assumes that the current state of the traversal is a collection of nodes or vectors that is the source of the given edge type and label.
Request Format
string
required
Connection ID of the MCP connection
string
required
The target entity (node or vec)
string
required
The label of edge to traverse out (name in schema)

OutE out_e_step

Endpoint "mcp/out_e_step"

Traverses out from current edges to their target nodes or vectors. Assumes that the current state of the traversal is a collection of edges with the target of the given edge label.
Request Format
string
required
Connection ID of the MCP connection
string
required
The label of edge to traverse out (name in schema)

In in_step

Endpoint "mcp/in_step"

Traverses into the current nodes or vectors in the traversal with the given edge type to nodes or vectors. Assumes that the current state of the traversal is a collection of nodes or vectors that is the target of the given edge type and label.
Request Format
string
required
Connection ID of the MCP connection
string
required
The source entity (node or vec)
string
required
The label of edge to traverse into (name in schema)

InE in_e_step

Endpoint "mcp/in_e_step"

Traverses into the current edges to their source nodes or vectors. Assumes that the current state of the traversal is a collection of edges with the source of the given edge label.
Request Format
string
required
Connection ID of the MCP connection
string
required
The label of edge to traverse into (name in schema)

MCP Filter Tool

Filter filter_items

Endpoint "mcp/filter_items"

Filters the current state of the traversal.
Request Format
Where filters is a list of filters to apply to the current state of the traversal. The format of the filters is as follows:

Property Filter

The property filter is used to filter the current state of the traversal by the properties of the entity. The outer list is the OR operation and the inner list is the AND operation.
string
required
The name of the property to filter on
string
required
The operator to use for the filter
string | [string]
required
The value to filter on

Operators

List to value and value to list comparisons will use the OR operator for each element in the list.
List to list comparisons will also use the OR operator for each element in each list.
This allows for using contains and not_contains operators by using the == and != operator with a list of values.

Traversal Filter

The traversal filter is used to filter the current state of the traversal by the results of a traversal. It doesnโ€™t actually change the state of the current traversal, it just temporarily traverses and checks the results of the traversal. You can have nested filters in the inner filter layer, which can include property and traversal filters with the same structure. The traversal filter only has an AND operation.

MCP Aggregation Tools

Group group_by

Endpoint "mcp/group_by"

Groups the current state of the traversal by the given properties. It returns a list of unique property combinations and their count.
Request Format
string
required
Connection ID of the MCP connection
[string]
required
The properties to group by
Response Format

Aggregate aggregate_by

Endpoint "mcp/aggregate_by"

Aggregates the current state of the traversal by the given properties. It returns a list of groups of jsons each with a count and data as a list of items in that group.
Request Format
string
required
Connection ID of the MCP connection
[string]
required
The properties to aggregate by
Response Format

Order order_by

Endpoint "mcp/order_by"

Orders the current state of the traversal by a given property in ascending or descending order.
Request Format
string
required
Connection ID of the MCP connection
string
required
The property to order by
string
required
The order to use for the property (asc or desc)
Response Format

MCP Search Tools

SearchV search_vector

Endpoint "mcp/search_vector"

Searches for vectors by their vector representation with the given vector. It returns the top k results with a minimum score of min_score. Additionally, you can continue the traversal from the search results by using the traversal tools.
Request Format
string
required
Connection ID of the MCP connection
[F64]
required
The vector to search for
I64
required
The number of results to return
F64
The minimum score to return (default: 0.0)
Response Format

SearchV Text search_vector_text

Endpoint "mcp/search_vector_text"

Searches for vectors by their vector representation with given text. It uses the embedding inside the database to embed the text and then does HNSW search for the vector. It returns the top 5 results of the vectors with the label.
Request Format
string
required
Connection ID of the MCP connection
string
required
The text to search for
string
required
The label of the vectors to search for (name in schema)
Response Format

Search BM25 search_keyword

Endpoint "mcp/search_keyword"

Searches for nodes of the given label by their keyword representation using BM25.
Request Format
string
required
Connection ID of the MCP connection
string
required
The text to search for
string
required
The label of the node, edge, or vector to search for (name in schema)
I64
required
The number of results to return
Response Format

Knowledge Graph Examples

In this example, we will be using the Python SDK to interact with the MCP endpoints on a local instance of HelixDB. We will use a knowledge graph with the schema below, which has a triplet node to represent a fact and an entity node to represent the subject and object of the triplet. We will also have an embedding of the tripletโ€™s summary defined as a vector node. Schema.hx
Python SDK
Click here for more information about the Python SDK.

1. Filter properties by a list of values.

We will filter the entities with the names โ€œJohnโ€ or โ€œJaneโ€.

2. Filter multiple properties by a list of values.

We will filter the entities with the names โ€œJohnโ€ or โ€œJaneโ€ and the created_at property between 2025-01-01 and 2025-01-31.

3. Filter properties by multiple lists of values.

We will filter by date range of the created_at property from January to March or June to September.

3. Filter by traversal result properties.

We will filter the triplets connected to the subject name โ€œJohnโ€.
This example has 2 answers:
OR

4. Filter by multiple traversal results.

We will filter the triplets connected to the subject name โ€œJohnโ€ and the object name โ€œJaneโ€.

5. Collecting intermediate results.

We will get all triplets and their embeddings in one MCP connection.

6. Search by vector.

We will search for the top 10 triplets that are most similar to an example embedding of [0.1, 0.2, 0.3, 0.4, 0.5] with a minimum score of 0.7.