Skip to main content
Glama
Knowledge Graph Memory Server

Knowledge Graph Memory Server

by AgentWong

최적화된 메모리 MCP 서버

이 프로젝트는 Claude AI의 코딩 능력, 우수한 AI 워크플로우, 그리고 신속한 설계를 테스트하고 시연하기 위한 것입니다. 이 프로젝트는 Python 메모리 MCP 서버(공식 버전은 Java로 되어 있는 것으로 알고 있습니다)의 포크(fork) 형태로, 백엔드에 SQLite를 사용합니다.

지식 그래프 메모리 서버

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

핵심 개념

엔티티

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

  • 고유한 이름(식별자)

  • 엔터티 유형(예: "사람", "조직", "이벤트")

  • 관찰 목록

예:

지엑스피1

처지

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

예:

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

관찰

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

  • 문자열로 저장됨

  • 특정 엔터티에 첨부됨

  • 독립적으로 추가하거나 제거할 수 있습니다

  • 원자적이어야 함(관찰당 하나의 사실)

예:

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

Related MCP server: Knowledge Graph Memory Server

API

도구

  • 엔티티 생성

    • 지식 그래프에 여러 개의 새 엔터티 만들기

    • 입력: entities (객체 배열)

      • 각 객체에는 다음이 포함됩니다.

        • name (문자열): 엔터티 식별자

        • entityType (문자열): 유형 분류

        • observations (문자열[]): 연관된 관찰

    • 기존 이름이 있는 엔터티를 무시합니다.

  • 관계 생성

    • 엔터티 간에 여러 개의 새로운 관계를 생성합니다.

    • 입력: relations (객체 배열)

      • 각 객체에는 다음이 포함됩니다.

        • from (문자열): 소스 엔터티 이름

        • to (문자열): 대상 엔터티 이름

        • relationType (문자열): 활성태의 관계 유형

    • 중복된 관계를 건너뜁니다.

  • 관찰 추가

    • 기존 엔터티에 새로운 관찰 추가

    • 입력: observations (객체 배열)

      • 각 객체에는 다음이 포함됩니다.

        • entityName (문자열): 대상 엔티티

        • contents (문자열[]): 추가할 새로운 관찰

    • 엔터티당 추가된 관찰 결과를 반환합니다.

    • 엔터티가 존재하지 않으면 실패합니다.

  • 엔티티 삭제

    • 엔터티와 해당 관계 제거

    • 입력: entityNames (string[])

    • 연관된 관계의 계단식 삭제

    • 엔터티가 존재하지 않으면 자동 작업

  • 관찰 삭제

    • 엔터티에서 특정 관찰을 제거합니다.

    • 입력: deletions (객체 배열)

      • 각 객체에는 다음이 포함됩니다.

        • entityName (문자열): 대상 엔티티

        • observations (string[]): 제거할 관찰

    • 관찰이 존재하지 않으면 조용한 작동

  • 관계 삭제

    • 그래프에서 특정 관계 제거

    • 입력: relations (객체 배열)

      • 각 객체에는 다음이 포함됩니다.

        • from (문자열): 소스 엔터티 이름

        • to (문자열): 대상 엔터티 이름

        • relationType (문자열): 관계 유형

    • 관계가 존재하지 않으면 자동 작업

  • 읽기_그래프

    • 지식 그래프 전체를 읽어보세요

    • 입력이 필요하지 않습니다

    • 모든 엔터티와 관계가 포함된 완전한 그래프 구조를 반환합니다.

  • 검색_노드

    • 쿼리 기반 노드 검색

    • 입력: query (문자열)

    • 검색 범위:

      • 엔터티 이름

      • 엔터티 유형

      • 관찰 내용

    • 일치하는 엔터티와 해당 관계를 반환합니다.

  • 오픈 노드

    • 이름으로 특정 노드 검색

    • 입력: 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"
      ]
    }
  }
}

시스템 프롬프트

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

다음은 채팅 개인화 프롬프트 예시입니다. 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"

3. Memory
   - 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)

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
     b) Store facts about them as observations

건물

도커:

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

특허

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

Available Tools

9 tools
add_observationsAdd ObservationsB

Add new observations to existing entities in the knowledge graph

Inputs: observations (required). Returns: results

create_entitiesCreate EntitiesB

Create multiple new entities in the knowledge graph

Inputs: entities (required). Returns: entities

create_relationsCreate RelationsC

Create multiple new relations between entities in the knowledge graph. Relations should be in active voice

Inputs: relations (required). Returns: relations

delete_entitiesDelete EntitiesA

Delete multiple entities and their associated relations from the knowledge graph

Inputs: entityNames (required). Returns: message, success

delete_observationsDelete ObservationsC

Delete specific observations from entities in the knowledge graph

Inputs: deletions (required). Returns: message, success

delete_relationsDelete RelationsB

Delete multiple relations from the knowledge graph

Inputs: relations (required). Returns: message, success

open_nodesOpen NodesB

Open specific nodes in the knowledge graph by their names

Inputs: names (required). Returns: entities, relations

read_graphRead GraphB

Read the entire knowledge graph

Inputs: no named parameters. Returns: entities, relations

search_nodesSearch NodesB

Search for nodes in the knowledge graph based on a query

Inputs: query (required). Returns: entities, relations

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 9 tools

    Disambiguation4/5

    Most tools have distinct purposes, but 'open_nodes' and 'search_nodes' could cause some confusion as both involve accessing nodes, though 'open_nodes' seems to retrieve specific nodes by name while 'search_nodes' queries based on criteria. The CRUD operations for entities, relations, and observations are clearly separated, reducing major overlap.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with snake_case, such as 'add_observations', 'create_entities', and 'delete_relations'. This predictability makes it easy for agents to understand and use the tool set without confusion from mixed conventions.

    Tool Count5/5

    With 9 tools, the server is well-scoped for managing a knowledge graph, covering core operations like creation, deletion, reading, and searching. This count is appropriate as it provides comprehensive functionality without being overwhelming or too sparse for the domain.

    Completeness4/5

    The tool set offers strong coverage with CRUD operations for entities, relations, and observations, plus reading and searching capabilities. A minor gap is the lack of update tools for entities or relations, which might require workarounds like delete-and-recreate, but core workflows are well-supported.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers