2. Feature: Neo4j MCP Server (Single Gateway)2.1 Story: As a system, I need an MCP server as the sole interface to Neo4j. 2.1.1 Task: Implement get_schema tool that executes "CALL db.schema.visualization()" and returns JSON with node labels, relationship types, and property keys - no direct Cypher access allowed outside MCP 2.1.2 Task: Implement query_graph tool that accepts parameterized Cypher (e.g., "MATCH (w:Workflow {id: $id})" with params: {id: "123"}), validates against injection, executes via bolt driver, and returns JSON results 2.1.3 Task: Implement write_graph tool for CREATE/MERGE operations with transaction support, accepting structured input like {action: "create_node", label: "Instruction", properties: {...}} rather than raw Cypher 2.1.4 Task: Implement get_next_instruction tool that internally runs "MATCH (i:Instruction) WHERE i.status = 'pending' RETURN i ORDER BY i.sequence LIMIT 1" and returns the instruction or null 2.1.5 Task: Create API key authentication middleware that checks X-API-Key header against environment variable MCP_API_KEYS (comma-separated list) before allowing any tool execution 2.2 Story: As an agent, I need to log all operations in Neo4j for auditability. 2.2.1 Task: After each MCP operation, use write_graph to create Log node with properties: timestamp, operation_type, parameters, duration_ms, success, error_message 2.2.2 Task: Create relationships (Log)-[:OPERATED_ON]->(Node) linking logs to affected Workflow/Instruction nodes using their IDs 2.2.3 Task: Implement log retention by adding created_at timestamp and a cleanup tool that deletes logs older than 30 days (configurable)