UNPKG

@mseep/atlas-mcp-server

Version:

A Model Context Protocol (MCP) server for ATLAS, a Neo4j-powered task management system for LLM Agents - implementing a three-tier architecture (Projects, Tasks, Knowledge) to manage complex workflows.

76 lines (75 loc) 3.59 kB
import { NodeLabels, PaginatedResult, PaginationOptions, RelationshipTypes } from './types.js'; import { Record as Neo4jRecord } from 'neo4j-driver'; /** * Database utility functions for Neo4j */ export declare class Neo4jUtils { /** * Initialize the Neo4j database schema with constraints and indexes * Should be called at application startup */ static initializeSchema(): Promise<void>; /** * Clear all data from the database and reinitialize the schema * WARNING: This permanently deletes all data */ static clearDatabase(): Promise<void>; /** * Apply pagination to query results * @param data Array of data to paginate * @param options Pagination options * @returns Paginated result object */ static paginateResults<T>(data: T[], options?: PaginationOptions): PaginatedResult<T>; /** * Generate a Cypher fragment for array parameters (e.g., for IN checks) * @param nodeAlias Alias of the node in the query (e.g., 't' for task) * @param propertyName Name of the property on the node (e.g., 'tags') * @param paramName Name for the Cypher parameter (e.g., 'tagsList') * @param arrayParam Array parameter value * @param matchAll If true, use ALL items must be in the node's list. If false (default), use ANY item must be in the node's list. * @returns Object with cypher fragment and params */ static generateArrayInListQuery(nodeAlias: string, propertyName: string, paramName: string, arrayParam?: string[] | string, matchAll?: boolean): { cypher: string; params: Record<string, any>; }; /** * Validate that a node exists in the database * @param label Node label * @param property Property to check * @param value Value to check * @returns True if the node exists, false otherwise */ static nodeExists(label: NodeLabels, property: string, value: string | number): Promise<boolean>; /** * Validate relationships between nodes * @param startLabel Label of the start node * @param startProperty Property of the start node to check * @param startValue Value of the start node property * @param endLabel Label of the end node * @param endProperty Property of the end node to check * @param endValue Value of the end node property * @param relationshipType Type of relationship to check * @returns True if the relationship exists, false otherwise */ static relationshipExists(startLabel: NodeLabels, startProperty: string, startValue: string | number, endLabel: NodeLabels, endProperty: string, endValue: string | number, relationshipType: RelationshipTypes): Promise<boolean>; /** * Generate a timestamp string in ISO format for database operations * @returns Current timestamp as ISO string */ static getCurrentTimestamp(): string; /** * Process Neo4j result records into plain JavaScript objects. * Assumes the record contains the node or properties under the specified key. * @param records Neo4j result records array (RecordShape from neo4j-driver). * @param primaryKey The key in the record containing the node or properties map (default: 'n'). * @returns Processed records as an array of plain objects. */ static processRecords<T>(records: Neo4jRecord[], primaryKey?: string): T[]; /** * Check if the database is empty (no nodes exist) * @returns Promise<boolean> - true if database is empty, false otherwise */ static isDatabaseEmpty(): Promise<boolean>; }