Enhanced Knowledge Graph Memory Server

Enhanced Knowledge Graph Memory Server

An enhanced fork of the official MCP memory server that enables persistent knowledge graph storage with automatic timestamps, tags, importance levels, date range search, comprehensive statistics, and multi-format export (JSON, CSV, GraphML).

Category
访问服务器

README

Memory MCP Server

Version NPM License MCP TypeScript

An enhanced fork of the official Model Context Protocol memory server with advanced features for timestamps, search, categorization, and export capabilities.

Knowledge graph-based persistent memory that lets Claude remember information across conversations with powerful organization and analysis tools.

Table of Contents

Features

Core Memory Capabilities

  • Knowledge Graph Storage: Entity-Relation-Observation model
  • Persistent Memory: Remember information across chat sessions
  • Full CRUD Operations: Create, read, update, delete entities and relations
  • Flexible Search: Text-based search across entities and observations

Enhanced Features (Phases 1-4)

  • 🆕 Automatic Timestamps: createdAt and lastModified fields with smart updates
  • 🆕 Date Range Search: Filter entities/relations by creation or modification date
  • 🆕 Graph Statistics: Comprehensive analytics with counts, types, and temporal data
  • 🆕 Tags System: Categorize entities with case-insensitive tags
  • 🆕 Importance Levels: 0-10 scale for entity prioritization
  • 🆕 Advanced Filtering: Combine text, tags, importance, and date ranges
  • 🆕 Multi-Format Export: JSON, CSV, and GraphML for visualization tools (Gephi, Cytoscape, yEd)

Comparison with Official Memory Server

Feature Official Enhanced (This Fork)
Entity Management
Relation Management
Observation Tracking
Basic Search
Timestamps ✅ createdAt + lastModified
Date Range Search
Graph Statistics
Tags
Importance Levels ✅ 0-10 scale
Export Formats ✅ JSON/CSV/GraphML
Total Tools 11 15 (+4 enhancements)

What's New

Version 0.7.0 (Latest)

Phase 1 & 2: Timestamps & Analytics

  • Automatic createdAt timestamp on entity/relation creation
  • Smart lastModified updates (only on actual changes)
  • Date range filtering with ISO 8601 format
  • Comprehensive graph statistics

Phase 3: Categorization

  • Tags system with lowercase normalization
  • Importance levels (0-10) for entity prioritization
  • Enhanced filtering combining multiple criteria

Phase 4: Export & Visualization

  • JSON export (pretty-printed)
  • CSV export (entities + relations with proper escaping)
  • GraphML export (for Gephi, Cytoscape, yEd)
  • All exports support filtering

See CHANGELOG.md for detailed version history.

Quick Start

1. Install from NPM (Recommended)

npm install -g @danielsimonjr/memory-mcp

Or use with npx (no installation required):

npx @danielsimonjr/memory-mcp

2. Configure Claude Desktop

Add to claude_desktop_config.json:

Using NPM Global Install:

{
  "mcpServers": {
    "memory": {
      "command": "mcp-server-memory"
    }
  }
}

Using NPX:

{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "@danielsimonjr/memory-mcp"]
    }
  }
}

3. Restart Claude Desktop

Restart Claude Desktop to load the enhanced memory server.

4. Start Using

Tell Claude:

Please remember that I prefer TypeScript over JavaScript.
Tag this as "preferences" with importance 8.

Claude will automatically use the enhanced tools!

Installation

Local Build (Recommended)

# Clone repository
git clone https://github.com/danielsimonjr/memory-mcp.git
cd memory-mcp/src/memory

# Install and build
npm install
npm run build

# Test
npm test

Claude Desktop Configuration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (Mac) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "memory": {
      "command": "node",
      "args": ["<PATH_TO>/memory-mcp/src/memory/dist/index.js"],
      "env": {
        "MEMORY_FILE_PATH": "<PATH_TO>/memory.jsonl"
      }
    }
  }
}

Replace <PATH_TO> with your actual paths.

VS Code

Add to .vscode/mcp.json:

{
  "servers": {
    "memory": {
      "command": "node",
      "args": ["c:/mcp-servers/memory-mcp/src/memory/dist/index.js"]
    }
  }
}

Core Concepts

Entities

Primary nodes in the knowledge graph.

Fields:

  • name (string): Unique identifier
  • entityType (string): Classification
  • observations (string[]): Facts
  • createdAt (string, optional): ISO 8601 timestamp
  • lastModified (string, optional): ISO 8601 timestamp
  • tags (string[], optional): Lowercase tags
  • importance (number, optional): 0-10 scale

Example:

{
  "name": "John_Smith",
  "entityType": "person",
  "observations": ["Speaks fluent Spanish"],
  "createdAt": "2025-01-15T10:30:00.000Z",
  "tags": ["colleague"],
  "importance": 7
}

Relations

Directed connections between entities.

Fields:

  • from (string): Source entity
  • to (string): Target entity
  • relationType (string): Relationship type
  • createdAt (string, optional): ISO 8601 timestamp
  • lastModified (string, optional): ISO 8601 timestamp

Example:

{
  "from": "John_Smith",
  "to": "Anthropic",
  "relationType": "works_at",
  "createdAt": "2025-01-15T10:30:00.000Z"
}

Observations

Discrete facts about entities.

Principles:

  • One fact per observation
  • Atomic information
  • Independently manageable

API Reference

Core Tools (11)

<details> <summary><b>create_entities</b></summary>

Create multiple new entities in the knowledge graph.

{
  entities: Array<{
    name: string;
    entityType: string;
    observations: string[];
  }>
}

</details>

<details> <summary><b>create_relations</b></summary>

Create multiple new relations between entities.

{
  relations: Array<{
    from: string;
    to: string;
    relationType: string;
  }>
}

</details>

<details> <summary><b>add_observations</b></summary>

Add new observations to existing entities.

{
  observations: Array<{
    entityName: string;
    contents: string[];
  }>
}

</details>

<details> <summary><b>delete_entities</b></summary>

Remove entities and their relations.

{
  entityNames: string[]
}

</details>

<details> <summary><b>delete_observations</b></summary>

Remove specific observations from entities.

{
  deletions: Array<{
    entityName: string;
    observations: string[];
  }>
}

</details>

<details> <summary><b>delete_relations</b></summary>

Remove specific relations from the graph.

{
  relations: Array<{
    from: string;
    to: string;
    relationType: string;
  }>
}

</details>

<details> <summary><b>read_graph</b></summary>

Read the entire knowledge graph.

No input required. </details>

<details> <summary><b>search_nodes</b></summary>

Search for nodes based on query.

{
  query: string;
}

</details>

<details> <summary><b>open_nodes</b></summary>

Retrieve specific nodes by name.

{
  names: string[];
}

</details>

Enhancement Tools (4)

<details> <summary><b>search_by_date_range</b> - Phase 2</summary>

Filter entities and relations within a date range.

{
  startDate?: string;      // ISO 8601
  endDate?: string;        // ISO 8601
  entityType?: string;
  tags?: string[];
}

Example:

{
  "startDate": "2025-01-01T00:00:00.000Z",
  "endDate": "2025-01-31T23:59:59.999Z",
  "tags": ["project"]
}

</details>

<details> <summary><b>get_graph_stats</b> - Phase 2</summary>

Get comprehensive statistics about the knowledge graph.

No input required.

Returns: Entity counts, relation counts, type breakdowns, oldest/newest items, date ranges. </details>

<details> <summary><b>add_tags / remove_tags</b> - Phase 3</summary>

Add or remove tags from an entity.

{
  entityName: string;
  tags: string[];
}

Tags are normalized to lowercase. </details>

<details> <summary><b>set_importance</b> - Phase 3</summary>

Set the importance level for an entity (0-10).

{
  entityName: string;
  importance: number;  // 0-10
}

</details>

<details> <summary><b>export_graph</b> - Phase 4</summary>

Export the knowledge graph in JSON, CSV, or GraphML format.

{
  format: "json" | "csv" | "graphml";
  filter?: {
    startDate?: string;
    endDate?: string;
    entityType?: string;
    tags?: string[];
  }
}

Formats:

  • JSON: Pretty-printed
  • CSV: Entities + relations with escaping
  • GraphML: For Gephi, Cytoscape, yEd </details>

Data Model

Entity Schema

interface Entity {
  name: string;
  entityType: string;
  observations: string[];
  createdAt?: string;       // ISO 8601
  lastModified?: string;    // ISO 8601
  tags?: string[];          // Lowercase
  importance?: number;      // 0-10
}

Relation Schema

interface Relation {
  from: string;
  to: string;
  relationType: string;
  createdAt?: string;       // ISO 8601
  lastModified?: string;    // ISO 8601
}

Storage

  • Format: JSONL (JSON Lines)
  • Default: memory.jsonl in server directory
  • Custom: Set MEMORY_FILE_PATH environment variable

Usage Examples

Example 1: Create Entity with Tags

{
  "entities": [{
    "name": "Alice_Johnson",
    "entityType": "person",
    "observations": ["Lead developer", "TypeScript specialist"]
  }]
}

// Then add tags
{
  "entityName": "Alice_Johnson",
  "tags": ["colleague", "tech-lead"]
}

// Set importance
{
  "entityName": "Alice_Johnson",
  "importance": 9
}

Example 2: Date Range Search

{
  "startDate": "2025-01-01T00:00:00.000Z",
  "endDate": "2025-01-31T23:59:59.999Z",
  "tags": ["project"]
}

Example 3: Export to GraphML

{
  "format": "graphml",
  "filter": {
    "entityType": "person",
    "tags": ["colleague"]
  }
}

Configuration

Environment Variables

  • MEMORY_FILE_PATH: Path to memory storage file (default: memory.jsonl)

Example Configuration

{
  "mcpServers": {
    "memory": {
      "command": "node",
      "args": ["c:/mcp-servers/memory-mcp/src/memory/dist/index.js"],
      "env": {
        "MEMORY_FILE_PATH": "c:/data/memory.jsonl"
      }
    }
  }
}

Development

Prerequisites

  • Node.js 18+
  • npm 9+
  • TypeScript 5.6+

Build

cd src/memory
npm install
npm run build      # Production
npm run watch      # Development

Test

npm test

Structure

memory-mcp/
├── src/memory/
│   ├── src/index.ts      # Main implementation
│   ├── dist/             # Compiled output
│   └── package.json
├── CHANGELOG.md
├── CONTRIBUTING.md
├── WORKFLOW.md
└── README.md

See WORKFLOW.md for detailed development guide.

Contributing

We welcome contributions!

See:

Ways to Help:

  • 🐛 Report bugs
  • ✨ Request features
  • 🔧 Submit fixes
  • 📚 Improve docs
  • 🧪 Add tests

License

MIT License - see LICENSE

You are free to use, modify, and distribute this software.

Acknowledgments

Original Project

Enhanced fork of Model Context Protocol memory server by Anthropic.

Original License: MIT

Enhancements

Developer: Daniel Simon Jr.

Features Added:

  • Automatic timestamps (createdAt, lastModified)
  • Date range search and filtering
  • Graph statistics and analytics
  • Tags and importance categorization
  • Multi-format export (JSON, CSV, GraphML)

Community

Thanks to:


Repository: https://github.com/danielsimonjr/memory-mcp Issues: https://github.com/danielsimonjr/memory-mcp/issues

Made with ❤️ for the MCP community

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选