Skip to content

Cannot perform queries with with MATCH if the condition contains CREATE #56

@victorbonnet

Description

@victorbonnet

Expected Behavior (Mandatory)

MATCH (n {name: "Create a map"})
RETURN n

this query should be working with the MCP server

Actual Behavior (Mandatory)

The MCP server return and error:
Error executing tool read_neo4j_cypher: Only MATCH queries are allowed for read-query

How to Reproduce the Problem

Create a MATCH query with a condition that contains one of those words:

Code with the issue is here:
https://github.com/neo4j-contrib/mcp-neo4j/blob/main/servers/mcp-neo4j-cypher/src/mcp_neo4j_cypher/server.py#L36-L41

def _is_write_query(query: str) -> bool:
    """Check if the query is a write query."""
    return (
        re.search(r"\b(MERGE|CREATE|SET|DELETE|REMOVE|ADD)\b", query, re.IGNORECASE)
        is not None
    )

Simple Example

Datasets and Statements

Create a node:

CREATE (n {name: "Create a map"})

Ask an agent to perform this query

MATCH (n {name: "Create a map"}) 
RETURN n

It will return an error because of the Create in the text:

[{"type": "text", "text": "Error executing tool read_neo4j_cypher: Only MATCH queries are allowed for read-query", "uuid": "173a4b6e-b3f8-466f-be86-9f3344efe915"}]

Specifications (Mandatory)

Currently used versions: 0.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    cypher-mcpRelates to the Cypher MCP server

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions