Elasticsearch Knowledge Graph

by j3k0

6 stars
Not rated
GitHub

About

Elasticsearch-based knowledge graph that tracks access patterns to prioritize recent, important, and frequently accessed information with advanced search capabilities and complete CRUD operations.

Details

Author
j3k0
Repository
j3k0/mcp-brain-tools
GitHub stars
6
Categories
Developer Tools, Design, File Management, AI, Search, Knowledge Base, Frontend
Tags
#visualization

- Spaced repetition freshness — each entity has a review interval that doubles on verification (capped at 365 days). Confidence labels (fresh/normal/aging/stale/archival) tell agents what to trust.
- Progressive search — queries return fresh results first, automatically widening to include older data only when needed.
- Observations as entities — each observation gets its own freshness lifecycle, so "build is broken" (1-day review) and "founded in 2015" (365-day review) age independently.
- Memory zones — isolate knowledge by project, team, or domain.
- AI-powered filtering — optional Groq integration scores search results by relevance.
- DRY by design — tool descriptions guide agents not to store what's already in code, git, or docs.

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 Elasticsearch Knowledge Graph
    Command (node, npx, python, etc.) node
    Arguments
    • Argument 1 /path/to/mcp-brain-tools/dist/index.js
    Environment
    • ES_NODE http://localhost:9200
    • GROQ_API_KEY your-key-here

    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

npm install
npm run build

Add to your Claude Code, Claude Desktop, or other MCP client config:

{
  "mcpServers": {
    "memory": {
      "command": "node",
      "args": ["/path/to/mcp-brain-tools/dist/index.js"],
      "env": {
        "ES_NODE": "http://localhost:9200",
        "GROQ_API_KEY": "your-key-here"
      }
    }
  }
}

GROQ_API_KEY is optional — enables AI-powered search filtering and zone relevance scoring.

The memory hook runs on every user message and automatically injects relevant context — no agent cooperation needed.

Add to ~/.claude/settings.json:

{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "node /path/to/mcp-brain-tools/dist/memory-hook.js"
          }
        ]
      }
    ]
  }
}

The hook uses the same ES_NODE, AI_API_KEY/GROQ_API_KEY, AI_API_BASE, and AI_MODEL env vars (set them in the env block of your settings, or export them in your shell profile).

AI_API_BASE defaults to Groq's endpoint but accepts any OpenAI-compatible API URL.

create_entities

Create entities with optional observations and reviewInterval.

update_entities

Update existing entities.

delete_entities

Delete entities (with optional cascade).

add_observations

Add observations as separate entities with own freshness.

verify_entity

Confirm entity is still accurate, extend review interval.

search_nodes

Search with progressive freshness filtering.

open_nodes

Get specific entities by name with freshness metadata.

get_recent

Get recently accessed entities.

create_relations

Create relationships between entities.

delete_relations

Remove relationships.

inspect_knowledge_graph

AI-powered entity retrieval with tentative answers.

inspect_files

AI-powered file content inspection.

list_zones

List memory zones (with AI relevance scoring).

create_zone

Manage memory zones.

delete_zone

Manage memory zones.

copy_entities

Transfer entities between zones.

move_entities

Transfer entities between zones.

merge_zones

Merge zones with conflict resolution.

zone_stats

Get entity/relation counts for a zone.

mark_important

Boost entity relevance score.

get_time_utc

Get current UTC time.

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "elasticsearch knowledge graph": {
            "env": {
                "ES_NODE": "http://localhost:9200",
                "GROQ_API_KEY": "your-key-here"
            },
            "args": [
                "/path/to/mcp-brain-tools/dist/index.js"
            ],
            "command": "node"
        }
    }
}

Linux

{
    "env": {
        "ES_NODE": "http://localhost:9200",
        "GROQ_API_KEY": "your-key-here"
    },
    "args": [
        "/path/to/mcp-brain-tools/dist/index.js"
    ],
    "command": "node"
}

Macos

{
    "env": {
        "ES_NODE": "http://localhost:9200",
        "GROQ_API_KEY": "your-key-here"
    },
    "args": [
        "/path/to/mcp-brain-tools/dist/index.js"
    ],
    "command": "node"
}

Windows

{
    "env": {
        "ES_NODE": "http://localhost:9200",
        "GROQ_API_KEY": "your-key-here"
    },
    "args": [
        "/path/to/mcp-brain-tools/dist/index.js"
    ],
    "command": "node"
}

mcp-brain-tools

An MCP server that gives AI agents persistent memory with built-in freshness tracking and spaced repetition. Backed by Elasticsearch.

Unlike simple key-value memory stores, mcp-brain-tools tracks how old each piece of knowledge is, flags what needs review, and lets agents verify information to keep it fresh — inspired by how spaced repetition helps humans retain knowledge.

Features

- Spaced repetition freshness — each entity has a review interval that doubles on verification (capped at 365 days). Confidence labels (fresh/normal/aging/stale/archival) tell agents what to trust.
- Progressive search — queries return fresh results first, automatically widening to include older data only when needed.
- Observations as entities — each observation gets its own freshness lifecycle, so "build is broken" (1-day review) and "founded in 2015" (365-day review) age independently.
- Memory zones — isolate knowledge by project, team, or domain.
- AI-powered filtering — optional Groq integration scores search results by relevance.
- DRY by design — tool descriptions guide agents not to store what's already in code, git, or docs.

Setup

Prerequisites

- Node.js >= 18
- Docker (for Elasticsearch) or a remote Elasticsearch instance

Install and build

npm install
npm run build

Start Elasticsearch

npm run es:start

Or point to your own instance via ES_NODE environment variable.

Configure your MCP client

Add to your Claude Code, Claude Desktop, or other MCP client config:

{
  "mcpServers": {
    "memory": {
      "command": "node",
      "args": ["/path/to/mcp-brain-tools/dist/index.js"],
      "env": {
        "ES_NODE": "http://localhost:9200",
        "GROQ_API_KEY": "your-key-here"
      }
    }
  }
}

GROQ_API_KEY is optional — enables AI-powered search filtering and zone relevance scoring.

Install the auto-memory hook (Claude Code only)

The memory hook runs on every user message and automatically injects relevant context — no agent cooperation needed.

Add to ~/.claude/settings.json:

{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "node /path/to/mcp-brain-tools/dist/memory-hook.js"
          }
        ]
      }
    ]
  }
}

The hook uses the same ES_NODE, AI_API_KEY/GROQ_API_KEY, AI_API_BASE, and AI_MODEL env vars (set them in the env block of your settings, or export them in your shell profile).

AI_API_BASE defaults to Groq's endpoint but accepts any OpenAI-compatible API URL.

How it works

Entities and observations

Entities represent anything worth remembering — people, projects, decisions, facts. Each entity has:

- A name and type
- Spaced repetition fields: verifiedAt, reviewInterval, nextReviewAt
- A confidence label computed from freshness: 1 - (daysSinceVerified / reviewInterval)

Observations are stored as separate entities linked via is_observation_of relations. Each observation has its own review cadence:

```

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.