Knowledge Graph Memory Server

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Implements persistent memory storage using a local knowledge graph to maintain information across different chat sessions, with capabilities for creating, retrieving, and manipulating structured memory data.

포크된 https://github.com/modelcontextprotocol/servers/tree/main

지식 그래프 메모리 서버

로컬 지식 그래프를 활용한 지속형 메모리의 기본 구현. 이를 통해 Claude는 여러 채팅에서 사용자 정보를 기억할 수 있습니다.

핵심 개념

엔티티

엔티티는 지식 그래프의 주요 노드입니다. 각 엔티티는 다음을 갖습니다.

  • 고유한 이름(식별자)
  • 엔터티 유형(예: "사람", "조직", "이벤트")
  • 관찰 목록

예:

지엑스피1

처지

관계는 엔티티 간의 방향성 있는 연결을 정의합니다. 관계는 항상 능동태로 저장되며 엔티티가 서로 어떻게 상호 작용하거나 관계를 맺는지 설명합니다.

예:

{ "from": "John_Smith", "to": "Anthropic", "relationType": "works_at" }

관찰

관찰은 개체에 대한 개별적인 정보입니다. 관찰은 다음과 같습니다.

  • 문자열로 저장됨
  • 특정 엔터티에 첨부됨
  • 독립적으로 추가하거나 제거할 수 있습니다
  • 원자적이어야 함(관찰당 하나의 사실)

예:

{ "entityName": "John_Smith", "observations": [ "Speaks fluent Spanish", "Graduated in 2019", "Prefers morning meetings" ] }

API

도구

  • 엔티티 생성
    • 지식 그래프에 여러 개의 새 엔터티 만들기
    • 입력: entities (객체 배열)
      • 각 객체에는 다음이 포함됩니다.
        • name (문자열): 엔터티 식별자
        • entityType (문자열): 유형 분류
        • observations (문자열[]): 연관된 관찰
    • 기존 이름이 있는 엔터티를 무시합니다.
  • 관계 생성
    • 엔터티 간에 여러 개의 새로운 관계를 생성합니다.
    • 입력: relations (객체 배열)
      • 각 객체에는 다음이 포함됩니다.
        • from (문자열): 소스 엔터티 이름
        • to (문자열): 대상 엔터티 이름
        • relationType (문자열): 활성태의 관계 유형
    • 중복된 관계를 건너뜁니다.
  • 관찰 추가
    • 기존 엔터티에 새로운 관찰 추가
    • 입력: observations (객체 배열)
      • 각 객체에는 다음이 포함됩니다.
        • entityName (문자열): 대상 엔티티
        • contents (문자열[]): 추가할 새로운 관찰
    • 엔터티당 추가된 관찰 결과를 반환합니다.
    • 엔터티가 존재하지 않으면 실패합니다.
  • 엔티티 삭제
    • 엔터티와 해당 관계 제거
    • 입력: entityNames (string[])
    • 연관된 관계의 계단식 삭제
    • 엔터티가 존재하지 않으면 자동 작업
  • 관찰 삭제
    • 엔터티에서 특정 관찰을 제거합니다.
    • 입력: deletions (객체 배열)
      • 각 객체에는 다음이 포함됩니다.
        • entityName (문자열): 대상 엔티티
        • observations (string[]): 제거할 관찰
    • 관찰이 존재하지 않으면 조용한 작동
  • 관계 삭제
    • 그래프에서 특정 관계 제거
    • 입력: relations (객체 배열)
      • 각 객체에는 다음이 포함됩니다.
        • from (문자열): 소스 엔터티 이름
        • to (문자열): 대상 엔터티 이름
        • relationType (문자열): 관계 유형
    • 관계가 존재하지 않으면 자동 작업
  • 읽기_그래프
    • 지식 그래프 전체를 읽어보세요
    • 입력이 필요하지 않습니다
    • 모든 엔터티와 관계가 포함된 완전한 그래프 구조를 반환합니다.
  • 검색_노드
    • 하나 이상의 키워드를 기반으로 노드 검색
    • 입력: query (문자열)
      • 공백으로 구분된 키워드(예: "예산 유틸리티")
      • 여러 키워드는 OR 조건으로 처리됩니다.
    • 검색 범위:
      • 엔터티 이름
      • 엔터티 유형
      • 하위 도메인
      • 관찰 내용
    • 매칭 동작:
      • 대소문자 구분 없음
      • 부분 단어 일치
      • 모든 키워드는 모든 필드와 일치할 수 있습니다.
      • 키워드 중 하나와 일치하는 엔터티를 반환합니다.
    • 일치하는 엔터티와 해당 관계를 반환합니다.
    • 예시 쿼리:
      • 단일 키워드: "예산"
      • 여러 키워드: "예산 유틸리티"
      • 특수 문자 포함: "예산 및 유틸리티"
  • 오픈 노드
    • 이름으로 특정 노드 검색
    • 입력: names (string[])
    • 보고:
      • 요청된 엔터티
      • 요청된 엔터티 간의 관계
    • 존재하지 않는 노드를 자동으로 건너뜁니다.

Claude Desktop과 함께 사용

설정

claude_desktop_config.json에 다음을 추가하세요.

도커

{ "mcpServers": { "memory": { "command": "docker", "args": ["run", "-i", "--rm", "mcp/memory"] } } }

엔피엑스

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

사용자 정의 설정이 가능한 NPX

다음 환경 변수를 사용하여 서버를 구성할 수 있습니다.

{ "mcpServers": { "memory": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-memory" ], "env": { "MEMORY_FILE_PATH": "/path/to/custom/memory.json" } } } }
  • MEMORY_FILE_PATH : 메모리 저장 JSON 파일 경로(기본값: 서버 디렉토리의 memory.json )

시스템 프롬프트

메모리 활용 프롬프트는 사용 사례에 따라 달라집니다. 프롬프트를 변경하면 모델이 생성되는 메모리의 빈도와 유형을 파악하는 데 도움이 됩니다.

다음은 채팅 개인화 프롬프트 예시입니다. Claude.ai 프로젝트 의 "맞춤 설정 지침" 필드에서 이 프롬프트를 사용할 수 있습니다.

Follow these steps for each interaction: 1. User Identification: - You should assume that you are interacting with default_user - If you have not identified default_user, proactively try to do so. 2. Memory Retrieval: - Always begin your chat by saying only "Remembering..." and retrieve all relevant information from your knowledge graph - Always refer to your knowledge graph as your "memory" - When searching your memory, you can use multiple keywords to find related information - Example searches: * Single concept: "programming" * Related concepts: "programming python" * Specific domain with role: "work engineer" 3. Memory Creation: - While conversing with the user, be attentive to any new information that falls into these categories: a) Basic Identity (age, gender, location, job title, education level, etc.) b) Behaviors (interests, habits, etc.) c) Preferences (communication style, preferred language, etc.) d) Goals (goals, targets, aspirations, etc.) e) Relationships (personal and professional relationships up to 3 degrees of separation) - When storing information, use specific and descriptive keywords that will help in future searches 4. Memory Update: - If any new information was gathered during the interaction, update your memory as follows: a) Create entities for recurring organizations, people, and significant events b) Connect them to the current entities using relations c) Store facts about them as observations d) Use clear and searchable terms in entity names and observations to facilitate future retrieval

건물

도커:

docker build -t mcp/memory -f src/memory/Dockerfile .

특허

이 MCP 서버는 MIT 라이선스에 따라 라이선스가 부여됩니다. 즉, MIT 라이선스의 조건에 따라 소프트웨어를 자유롭게 사용, 수정 및 배포할 수 있습니다. 자세한 내용은 프로젝트 저장소의 LICENSE 파일을 참조하세요.

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

이 MCP 서버는 로컬 지식 그래프를 활용하여 상호 작용 전반에 걸쳐 사용자 정보를 기억함으로써 채팅 애플리케이션에 대한 지속적인 메모리 통합을 제공합니다.

  1. Core Concepts
    1. Entities
    2. Relations
    3. Observations
  2. API
    1. Tools
  3. Usage with Claude Desktop
    1. Setup
    2. System Prompt
    3. Building
    4. License
ID: mdsegdy7ox