Knowledge Graph Memory

by evangstav

10 stars
10.7k downloads
Not rated
GitHub

About

Provides a knowledge graph management system for storing, retrieving, and querying information to build and maintain long-term memory across conversations.

Details

Author
evangstav
Repository
evangstav/python-memory-mcp-server
GitHub stars
10
Downloads
10,724
License
MIT License
Categories
Developer Tools, Design, File Management, AI, Search, Infrastructure, Knowledge Base, Frontend
Tags
#visualization

- Strict validation rules for entity names, observations, and relations
- Eight supported entity types: person, concept, project, document, tool, organization, location, event
- Seven predefined relation types with no self-referential or circular dependencies allowed
- Natural language search with temporal queries and fuzzy matching
- Weighted search across entity names, types, and observations (80% similarity threshold)
- Typed responses with error types: NOT_FOUND, VALIDATION_ERROR, INTERNAL_ERROR, ALREADY_EXISTS, INVALID_RELATION

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Knowledge Graph Memory
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @highlight/mcp-server

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

The server provides tools for managing a knowledge graph:

get_entity

Retrieve an entity by its name. Parameters: entity_name (string)

get_graph

Fetch the entire knowledge graph. No parameters required.

create_entities

Create multiple entities. Parameters: entities (list of Entity objects)

add_observation

Add an observation to an entity. Parameters: entity (string), observation (string)

create_relation

Establish a relation between two entities. Parameters: from_entity (string), to_entity (string), relation_type (string)

search_memory

Search memory for specific queries using natural language. Parameters: query (string)

delete_entities

Delete multiple entities by their names. Parameters: names (list of strings)

delete_relation

Delete a relation between two entities. Parameters: from_entity (string), to_entity (string)

flush_memory

Clear all memory data. No parameters required.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "knowledge graph memory": {
            "env": {},
            "args": [
                "-y",
                "@highlight/mcp-server"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "cmd"
}

MseeP.ai Security Assessment Badge

Memory MCP Server

A Model Context Protocol (MCP) server that provides knowledge graph functionality for managing entities, relations, and observations in memory, with strict validation rules to maintain data consistency.

Installation

Install the server in Claude Desktop:

mcp install main.py -v MEMORY_FILE_PATH=/path/to/memory.jsonl

Data Validation Rules

Entity Names

- Must start with a lowercase letter - Can contain lowercase letters, numbers, and hyphens - Maximum length of 100 characters - Must be unique within the graph - Example valid names: python-project, meeting-notes-2024, user-john

Entity Types

The following entity types are supported: - person: Human entities - concept: Abstract ideas or principles - project: Work initiatives or tasks - document: Any form of documentation - tool: Software tools or utilities - organization: Companies or groups - location: Physical or virtual places - event: Time-bound occurrences

Observations

- Non-empty strings - Maximum length of 500 characters - Must be unique per entity - Should be factual and objective statements - Include timestamp when relevant

Relations

The following relation types are supported: - knows: Person to person connection - contains: Parent/child relationship - uses: Entity utilizing another entity - created: Authorship/creation relationship - belongs-to: Membership/ownership - depends-on: Dependency relationship - related-to: Generic relationship

Additional relation rules:
- Both source and target entities must exist
- Self-referential relations not allowed
- No circular dependencies allowed
- Must use predefined relation types

Usage

The server provides tools for managing a knowledge graph:

Get Entity

```python result = await session.call_tool("get_entity", { "entity_name": "example" }) if not result.success: if result.error_type == "NOT_FOUND": print(f"Entity not found: {result.error}") elif result.error_type == "VALIDATION_ERROR": print(f"Invalid input: {result.error}") else: print(f"Error: {result.error}")
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.