diff --git a/mcp_server/src/graphiti_mcp_server.py b/mcp_server/src/graphiti_mcp_server.py index 833bc5d93..bb802b06c 100644 --- a/mcp_server/src/graphiti_mcp_server.py +++ b/mcp_server/src/graphiti_mcp_server.py @@ -278,8 +278,18 @@ async def initialize(self) -> None: # Re-raise other errors raise - # Build indices - await self.client.build_indices_and_constraints() + # Build indices - wrap in try/except to handle Neo4j 5.x race condition + # with parallel IF NOT EXISTS index creation + try: + await self.client.build_indices_and_constraints() + except Exception as idx_error: + if 'EquivalentSchemaRuleAlreadyExists' in str(idx_error): + logger.warning( + 'Index creation race condition detected (Neo4j 5.x issue). ' + 'Indexes likely already exist. Continuing...' + ) + else: + raise logger.info('Successfully initialized Graphiti client')