mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-19 00:23:24 +02:00
feat(memory): add MEMORY_FILE_PATH environment variable support
- Add environment variable MEMORY_FILE_PATH to configure custom storage location - Support both absolute and relative paths - Update documentation with configuration examples - Bump version to 0.6.3
This commit is contained in:
@@ -10,10 +10,15 @@ import { promises as fs } from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
// Define memory file path using environment variable with fallback
|
||||
const defaultMemoryPath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'memory.json');
|
||||
|
||||
// Define the path to the JSONL file, you can change this to your desired local path
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const MEMORY_FILE_PATH = path.join(__dirname, 'memory.json');
|
||||
// If MEMORY_FILE_PATH is just a filename, put it in the same directory as the script
|
||||
const MEMORY_FILE_PATH = process.env.MEMORY_FILE_PATH
|
||||
? path.isAbsolute(process.env.MEMORY_FILE_PATH)
|
||||
? process.env.MEMORY_FILE_PATH
|
||||
: path.join(path.dirname(fileURLToPath(import.meta.url)), process.env.MEMORY_FILE_PATH)
|
||||
: defaultMemoryPath;
|
||||
|
||||
// We are storing our memory using entities, relations, and observations in a graph structure
|
||||
interface Entity {
|
||||
@@ -178,8 +183,7 @@ class KnowledgeGraphManager {
|
||||
}
|
||||
}
|
||||
|
||||
const knowledgeGraphManager = new KnowledgeGraphManager();
|
||||
|
||||
const knowledgeGraphManager = new KnowledgeGraphManager;
|
||||
|
||||
// The server instance and tools exposed to Claude
|
||||
const server = new Server({
|
||||
|
||||
Reference in New Issue
Block a user