Skip to content

Commit 7bf941b

Browse files
Fix write query detection to recognise INSERT. (#205)
* Fix write query detection to recognise `INSERT`. ```cypher INSERT (n:ThisIsValidCypher) RETURN n ``` obviously, this here too ```MATCH (n:Merge) RETURN n``` figuring out whether a query is read only or not with a regex will be kinda problematic in the long run. * Update CHANGELOG.md --------- Co-authored-by: alex <[email protected]>
1 parent b9c2eff commit 7bf941b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

servers/mcp-neo4j-cypher/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Changed
66

77
### Added
8+
* Update write query detection to include `INSERT` in regex check
89

910
## v0.4.1
1011

servers/mcp-neo4j-cypher/src/mcp_neo4j_cypher/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _format_namespace(namespace: str) -> str:
3232
def _is_write_query(query: str) -> bool:
3333
"""Check if the query is a write query."""
3434
return (
35-
re.search(r"\b(MERGE|CREATE|SET|DELETE|REMOVE|ADD)\b", query, re.IGNORECASE)
35+
re.search(r"\b(MERGE|CREATE|INSERT|SET|DELETE|REMOVE|ADD)\b", query, re.IGNORECASE)
3636
is not None
3737
)
3838

0 commit comments

Comments
 (0)