Skip to main content

Zabob Memgraph - Knowledge graph visualization and MCP server

Project description

Zabob Memgraph - Knowledge Graph Server

Zabob Memgraph - Knowledge Graph Server

A Model Context Protocol (MCP) server for persistent knowledge graph storage with interactive web visualization. Part of the Zabob AI assistant ecosystem, designed for thread-safe multi-client support with Docker deployment.

๐Ÿ“– See DEPLOYMENT.md for comprehensive deployment options

๐Ÿ“– See USAGE_PATTERNS.md for usage examples

Imagine a future where your AI assistant not only can talk to you, but can remember important things, and can show you everything it remembers.

zabob Zabob remembers this future! Give him your plans and dreams, and he will remember not just the dream, but the journey to get there, even through the darkest nullspace.

alt text

Features

  • MCP Protocol - Standard Model Context Protocol for AI assistant integration
  • Multiple Transports - HTTP/SSE for server mode, stdio for Claude Desktop
  • Thread-safe SQLite backend - WAL mode for concurrent access without locking
  • Interactive D3.js visualization - Real-time graph exploration via web UI
  • Docker deployment - Multiple deployment patterns (HTTP server, stdio, local)
  • Persistent storage - Database with automatic backups and rotation
  • Full-text search - Search across entities, observations, and relations
  • Modern tooling - esbuild bundler, Python type checking, comprehensive tests

Quick Start

Docker Compose (Recommended)

# Clone repository
git clone https://github.com/BobKerns/zabob-memgraph.git
cd zabob-memgraph

# Start HTTP server with web UI
docker-compose up -d

# Access web UI at http://localhost:6789
# MCP endpoint at http://localhost:6789/mcp

Claude Desktop Integration

Add to your Claude Desktop MCP config:

stdio mode (local only):

{
  "mcpServers": {
    "zabob-memgraph": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-v", "${HOME}/.zabob/memgraph:/data/.zabob/memgraph",
        "bobkerns/zabob-memgraph:latest",
        "run"
      ]
    }
  }
}

HTTP mode (shareable across systems):

# Start HTTP server
docker run -d --name zabob-memgraph \
  -p 6789:6789 \
  -v ${HOME}/.zabob/memgraph:/data/.zabob/memgraph \
  bobkerns/zabob-memgraph:latest \
  start --host 0.0.0.0 --port 6789

Then configure Claude Desktop to connect to http://localhost:6789/mcp

๐Ÿ“– See DEPLOYMENT.md for complete deployment options

Usage

Basic Commands

# Start the server (auto-assigns port)
zabob-memgraph start

# Start on specific port
zabob-memgraph start --port 6789

# Run in foreground (stdio mode or development)
zabob-memgraph run

# Run with auto-reload (development)
zabob-memgraph run --reload

# Check server status
zabob-memgraph status

# Monitor server health
zabob-memgraph monitor

# Test all endpoints
zabob-memgraph test

# Stop server
zabob-memgraph stop

Docker Commands

# Run in foreground (stdio mode)
docker run --rm -i \
  -v ${HOME}/.zabob/memgraph:/data/.zabob/memgraph \
  bobkerns/zabob-memgraph:latest \
  run

# Run as HTTP server (background)
docker run -d --name zabob-memgraph \
  -p 6789:6789 \
  -v ${HOME}/.zabob/memgraph:/data/.zabob/memgraph \
  bobkerns/zabob-memgraph:latest \
  start --host 0.0.0.0 --port 6789

# Run development commands in container
docker run --rm -it \
  -v $(pwd):/app \
  bobkerns/zabob-memgraph:latest \
  lint

Development Commands

The CLI automatically detects development environments and enables additional commands:

# Development commands (available when .git exists or dev dependencies installed)
zabob-memgraph run --reload  # Run with auto-reload
zabob-memgraph build         # Build Docker image
zabob-memgraph lint          # Run type checking and linting
zabob-memgraph format        # Format code with ruff
zabob-memgraph clean         # Clean build artifacts

# Production commands (always available)
zabob-memgraph start         # Start server in background
zabob-memgraph stop          # Stop server
zabob-memgraph restart       # Restart server
zabob-memgraph status        # Check server status
zabob-memgraph open          # Open browser to web UI
zabob-memgraph test          # Test all endpoints
zabob-memgraph monitor       # Monitor server health

Development Setup:

# Clone repository
git clone <repository-url>
cd zabob-memgraph

# Install dependencies (dev commands auto-enabled)
uv sync

# Build web UI
pnpm install && pnpm run build:web

# Run with auto-reload
zabob-memgraph run --reload

Configuration

Data Directory

Configuration and data are stored in ~/.zabob/memgraph/:

~/.zabob/memgraph/
โ”œโ”€โ”€ config.json           # Server configuration
โ”œโ”€โ”€ server_info.json      # Current server status
โ”œโ”€โ”€ memgraph.log          # Application logs
โ”œโ”€โ”€ data/                 # Database files
โ”‚   โ””โ”€โ”€ knowledge_graph.db
โ””โ”€โ”€ backup/               # Automatic backups
    โ”œโ”€โ”€ knowledge_graph_1234567890.db
    โ””โ”€โ”€ ...

Configuration File

The config.json file supports these options:

{
  "default_port": 6789,
  "default_host": "localhost",
  "log_level": "INFO",
  "backup_on_start": true,
  "max_backups": 5,
  "data_dir": "~/.zabob/memgraph/data"
}

Environment Variables

For Docker or advanced deployments:

export MEMGRAPH_HOST=0.0.0.0
export MEMGRAPH_PORT=6789
export MEMGRAPH_LOG_LEVEL=DEBUG
export MEMGRAPH_CONFIG_DIR=/custom/path

MCP Tools

Zabob Memgraph provides these MCP tools for AI assistants:

  • create_entities - Create new entities with observations
  • create_relations - Create relationships between entities
  • add_observations - Add observations to existing entities
  • read_graph - Read the complete knowledge graph
  • search_nodes - Full-text search across entities and observations
  • delete_entities - Remove entities and their relations
  • delete_relations - Remove specific relationships
  • get_stats - Get graph statistics

HTTP Endpoints

When running in HTTP server mode:

  • GET / - Web visualization interface
  • POST /mcp - MCP protocol endpoint (SSE transport)
  • GET /health - Health check

Using MCP Tools

MCP tools are called through the protocol. Example using the web UI:

  1. Open http://localhost:6789
  2. View entities and relations in the interactive graph
  3. Search, zoom, and explore your knowledge graph

For Claude Desktop integration, tools are automatically available after configuration.

Architecture

Thread-Safe Design

The server uses SQLite with proper locking for concurrent access:

  • WAL mode: Enables concurrent readers
  • Proper transactions: Atomic operations prevent corruption
  • Connection pooling: Efficient resource management
  • Automatic retries: Handles temporary locking conflicts

Component Structure

zabob-memgraph/
โ”œโ”€โ”€ zabob-memgraph-dev.py         # Development CLI
โ”œโ”€โ”€ main.py                       # Server entrypoint
โ”œโ”€โ”€ memgraph/                     # Core package
โ”‚   โ”œโ”€โ”€ service.py                # Unified ASGI service (MCP + HTTP)
โ”‚   โ”œโ”€โ”€ mcp_service.py            # FastMCP server implementation
โ”‚   โ”œโ”€โ”€ knowledge_live.py         # Knowledge graph data layer
โ”‚   โ”œโ”€โ”€ sqlite_backend.py         # Thread-safe SQLite backend
โ”‚   โ”œโ”€โ”€ web/                      # Static web assets
โ”‚   โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”‚   โ”œโ”€โ”€ graph.bundle.js       # Bundled web UI (built)
โ”‚   โ”‚   โ””โ”€โ”€ style.css
โ”‚   โ””โ”€โ”€ web-src/                  # Web UI source
โ”‚       โ”œโ”€โ”€ mcp-client.js         # Browser MCP client
โ”‚       โ””โ”€โ”€ graph.js              # D3.js visualization
โ”œโ”€โ”€ docker-compose.yml            # Docker Compose config
โ””โ”€โ”€ Dockerfile                    # Container definition

Development

Setting Up Development Environment

# Clone repository
git clone <repository-url>
cd zabob-memgraph

# Install dependencies (enables dev commands)
uv sync

# Build web UI
pnpm install && pnpm run build:web

# Run in development mode with auto-reload
zabob-memgraph run --reload --port 6789

# Run tests
zabob-memgraph test

# Lint code
zabob-memgraph lint

# Format code
zabob-memgraph format

Docker Development

# Build Docker image
zabob-memgraph build

# Run in Docker (if configured)
zabob-memgraph start --docker --detach

# Check status
zabob-memgraph status

# Stop services
zabob-memgraph stop

Troubleshooting

Common Issues

Server already running:

zabob-memgraph status
zabob-memgraph stop

Port conflicts:

zabob-memgraph start --port 8081

Docker issues:

# Check if image exists
docker images | grep zabob-memgraph

# Build if missing
./zabob-memgraph-dev.py build

Database issues:

# Check logs
tail -f ~/.zabob-memgraph/memgraph.log

# Test server endpoints
zabob-memgraph test

Logs and Debugging

# View real-time logs
tail -f ~/.zabob/memgraph/memgraph.log

# Monitor server health
zabob-memgraph monitor

# Test all endpoints
zabob-memgraph test

Performance Notes

  • SQLite Performance: Excellent for read-heavy workloads with WAL mode
  • Docker Deployment: Recommended for production with volume persistence
  • Memory Usage: Low footprint suitable for resource-constrained environments
  • Scaling: Scale horizontally with multiple instances on different ports

Part of the Zabob Ecosystem

Zabob Memgraph is designed to work with other Zabob AI tools:

  • Zabob Core: Main AI assistant framework
  • Zabob Memgraph: Knowledge graph persistence (this project)
  • Zabob Tools: Additional MCP tools and utilities

The zabob- prefix helps identify tools in this ecosystem while maintaining distinct, memorable names.

Contributing

  1. Fork the repository

  2. Create a feature branch

  3. Use the development tools:

    ./zabob-memgraph-dev.py install
    ./zabob-memgraph-dev.py test
    ./zabob-memgraph-dev.py lint
    
  4. Submit a pull request

License

[License information]


Getting Started: zabob-memgraph start Need Help: zabob-memgraph --help Issues: GitHub Issues

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zabob_memgraph-0.1.12.tar.gz (358.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zabob_memgraph-0.1.12-py3-none-any.whl (355.9 kB view details)

Uploaded Python 3

File details

Details for the file zabob_memgraph-0.1.12.tar.gz.

File metadata

  • Download URL: zabob_memgraph-0.1.12.tar.gz
  • Upload date:
  • Size: 358.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zabob_memgraph-0.1.12.tar.gz
Algorithm Hash digest
SHA256 17cb4578284d9ac30f4ff2ebf5b0636ca1df433b4c1d790ff0ec0958e594c668
MD5 f7f853a5467a6db8748453ff2ff88415
BLAKE2b-256 d69a807567f9257d5baaf04fe9c725dae3f8514d73dd658bd16f8d65b8aec45b

See more details on using hashes here.

Provenance

The following attestation bundles were made for zabob_memgraph-0.1.12.tar.gz:

Publisher: on_release.yml on BobKerns/zabob-memgraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zabob_memgraph-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: zabob_memgraph-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 355.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zabob_memgraph-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 598e856f6c75eb077fef0c2287762b7bd8ff2165036d1fbb45c45498f2a8d4a6
MD5 8e951730dfe1dad567d6a96f503d457d
BLAKE2b-256 61bca43a933631a5eca777deaf4ad17adc30ca441300f308bb31996574325e2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for zabob_memgraph-0.1.12-py3-none-any.whl:

Publisher: on_release.yml on BobKerns/zabob-memgraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page