UNPKG

@pimzino/agentic-tools-mcp

Version:

A comprehensive MCP server for task management and agent memories with JSON file storage

45 lines (44 loc) 1.99 kB
import { homedir } from 'os'; import { join } from 'path'; /** * Parse command-line arguments to determine storage configuration */ export function parseCommandLineArgs() { const args = process.argv.slice(2); const useGlobalDirectory = args.includes('--claude'); return { useGlobalDirectory }; } /** * Get the global storage directory path * - Windows: C:\Users\{username}\.agentic-tools-mcp\ * - macOS/Linux: ~/.agentic-tools-mcp/ */ export function getGlobalStorageDirectory() { const userHome = homedir(); return join(userHome, '.agentic-tools-mcp'); } /** * Resolve the actual working directory based on configuration * * @param providedPath - The working directory path provided by the user * @param config - Storage configuration including global directory flag * @returns The actual working directory to use for storage */ export function resolveWorkingDirectory(providedPath, config) { if (config.useGlobalDirectory) { return getGlobalStorageDirectory(); } return providedPath; } /** * Get updated parameter description for workingDirectory that includes --claude flag behavior */ export function getWorkingDirectoryDescription(config) { const baseDescription = 'The full absolute path to the working directory where data is stored. MUST be an absolute path, never relative. Windows: "C:\\Users\\username\\project" or "D:\\projects\\my-app". Unix/Linux/macOS: "/home/username/project" or "/Users/username/project". Do NOT use: ".", "..", "~", "./folder", "../folder" or any relative paths. Ensure the path exists and is accessible before calling this tool.'; if (config.useGlobalDirectory) { return baseDescription + ' NOTE: Server started with --claude flag, so this parameter is ignored and a global user directory is used instead.'; } return baseDescription + ' NOTE: When server is started with --claude flag, this parameter is ignored and a global user directory is used instead.'; }