Logotipo de memex-mcp

memex-mcp

Comunidad
STiFLeR7

Persistent memory for AI coding agents via MCP — a bitemporal knowledge graph of your codebase, served to Claude Code, Cursor, Gemini CLI, and any MCP client. Tree-sitter + Gemini Flash → Neo4j (via Graphiti). 12 MCP tools, hierarchical clusters, two-regime confidence decay.

EditorSTiFLeR7
Repositoriomemex
IdiomaPython
Forks
1
Estrellas
12
Herramientas disponibles
0
Tipo de transportestdio
Categorías
LicenciaMIT
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    memex-mcp ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    12 estrellas y 1 forks en el repositorio enlazado.

memex — trusted engineering context for agentic software engineering

A protocol-neutral engineering-context layer for AI coding agents. memex builds a bitemporal knowledge graph of your repository — modules, symbols, decisions, problems, evidence, and code evolution — and exposes bounded, provenance-aware context through Hermes MemoryProvider or MCP.

A daemon and MCP server that turns commits and file changes into structured engineering knowledge. Agents can receive relevant repository context before a task, with freshness and provenance preserved, without making memex a source of personal memory or raw session state.

PyPI PyPI downloads npm npm downloads Claude Code marketplace memex MCP server GitHub stars Tests CodeQL OpenSSF Scorecard License: MIT

memex — temporal knowledge graph MCP server for AI coding agents, built on Graphiti and Neo4j

Install

Via Claude Code marketplace

/plugin marketplace add STiFLeR7/claude-plugins
/plugin install memex-mcp@stifler-marketplace

Restart your Claude Code session.

Manual

bash
docker compose -f docker/docker-compose.yml up -d
cat > .env <<EOF
NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=memex-local
GEMINI_API_KEY=your-key-here
EOF
npx stifler-memex-mcp init --repo .
npx stifler-memex-mcp watch --repo .
npx stifler-memex-mcp serve --repo .

Hermes integration

The v0.9 Hermes integration is read-only. Hermes retains personal memory, raw session state, and execution state. memex supplies repository engineering context through a bounded ContextPacket; it does not ingest Hermes state.db, transcripts, prompts, or tool results.

Add the memex provider to Hermes' profile configuration:

yaml
memory:
  provider: memex
plugins:
  memex:
    repo_path: /absolute/path/to/repository
    prefetch_timeout_seconds: 7
    max_items: 8
    max_chars: 12000

If Hermes is not installed, use the same context selector through the MCP get_engineering_context tool. Both paths share the protocol-neutral memex core and fail open when retrieval is unavailable.

ChannelCommand
Claude Code marketplace/plugin install memex-mcp@stifler-marketplace
npx (no install)npx stifler-memex-mcp <cmd>
uvuv add memex-mcp
pippip install memex-mcp
sourcegit clone github.com/STiFLeR7/memex && uv sync

Self-hosted team deployment

For a shared team setup (one Neo4j + one memex-server, auth on by default, Neo4j's ports never exposed to the host):

bash
bash docker/bootstrap-team-env.sh
docker compose -f docker/docker-compose.team.yml up -d

See docker/TEAM-DEPLOY.md for the full flow, capturing the initial admin key, and the down -v footgun to avoid.

At a glance

PropertyValue
OutputA Neo4j graph populated continuously from your repo
StorageNeo4j via Graphiti. Bitemporal — every edge has created_at and optional expired_at
ContextBounded, ranked, provenance-aware ContextPacket
IntegrationsHermes MemoryProvider, MCP resources/tools, Claude Code, Cursor, Codex, Gemini CLI
Failure modeFail-open; agent execution continues without memex
GranularityScales from 50 to 5000+ modules via hierarchical Leiden clusters
SynthesisGemini Flash distills commits into Decision nodes; Pro for grounded synthesis
ConfidenceComputed at query time. Two-regime decay (validated half-life ~139d, unvalidated stale at 30d)
Write governancePer-node-type ACL, intent-confirmation on agent writes, explicit corroborates / supersedes semantics
Goal 10 evidence8/8 valid paired runs, 0 treatment failures, 0 treatment regressions

The lifecycle

MCP tools

14 tools — eight read, four write, two analytic.

Read

ToolWhen
get_project_contextSession start. Returns a cluster-level briefing under 1500 tokens regardless of repo size
get_symbol_contextBefore editing a function or class. Returns callers, callees, linked decisions
get_recent_decisionsLast N days of architectural decisions, optionally module-scoped
get_open_problemsActive bugs and tech debt, sorted by severity
search_contextHybrid search: semantic × keyword × graph traversal × RRF merge
get_stale_contextEdges whose composite confidence dropped below threshold
explain_changeGiven a commit SHA, cross-references the diff with linked Decision/Problem nodes and asks Gemini Pro for a grounded explanation
predict_impactGiven a file path, returns a ranked list of modules likely affected based on graph coupling (no LLM call)

Write

ToolWhen
record_decisionAfter making a technical choice. Supports corroborates (reinforce) and supersedes (replace)
record_problemWhen discovering a bug or piece of tech debt
resolve_problemWhen a tracked problem is fixed
invalidate_edgeWhen a stored fact is no longer true

Bitemporal confidence

Confidence is not a stored number that mutates. It is computed at query time from base_confidence, validation status, time since last reinforcement, and access count.

PropertyValue
Validated half-life~139 days
Unvalidated stale threshold30 days (composite < 0.3)
Recency τ90 days (exponential decay)
Composite formulaconf × recency × (1 + rehearsal_w × log(1 + access_count))
Conflict similarity threshold0.4 (below this + overlapping validity = conflict)
Intent-confirmation threshold0.85 (MCP write similarity check)

Hierarchical clusters

memex cluster runs hierarchical Leiden over a hybrid edge graph:

Edge typeWeight
Directory co-location1.0
Module imports2.0
Symbol callslog(1 + calls)
PropertyValue
Algorithmgraspologic.partition.hierarchical_leiden with fixed seed
NamingTF-IDF top-3 over module docstrings + symbol names, parent-dir fallback
ID pinningJaccard ≥ 0.5 across reruns (cluster names stay stable through renames)
User overrides.memex/clusters.yaml — any assignment can be locked
Context budgetget_project_context stays under 1500 tokens whether your repo has 50 or 5000 modules

Measure Your Savings

memex tracks token reduction metrics and human review actions locally in a SQLite database (~/.config/memex/telemetry.db).

You can query your savings at any time using the CLI:

bash
memex stats

Or view the raw JSON payload:

bash
memex stats --json

Or target a specific repository scope:

bash
memex stats --repo /path/to/repo

This returns an aggregation of:

  • Period Summaries: Calls, tokens returned, naive tokens (size of files requested), tokens saved, and token reduction percentage across today, last 7 days, last 30 days, and lifetime.
  • Top Tools: The most valuable tools sorted by total tokens saved.
  • Agent Clients: Active agents (Claude Code, Gemini CLI, Cursor, Codex) and their token saving distribution.
  • Validation Health: Total validated, unvalidated, and corroborated nodes, along with the elapsed days since the last review.

The same statistics are exposed via the HTTP MCP transport:

http
GET /stats?repo=/path/to/repo
Authorization: Bearer <your-key>

Connect your agent

Marketplace install above does this for you. Manual wiring in .claude/settings.json:

json
{
  "mcpServers": {
    "memex": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
    }
  }
}

Add to ~/.cursor/mcp.json:

json
{
  "mcpServers": {
    "memex": {
      "command": "npx",
      "args": ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
    }
  }
}

Add to ~/.gemini/settings.json:

json
{
  "mcpServers": {
    "memex": {
      "command": "npx",
      "args": ["-y", "stifler-memex-mcp", "serve", "--repo", "."]
    }
  }
}

Add to ~/.codex/config.toml:

toml
[mcp_servers.memex]
command = "npx"
args = ["-y", "stifler-memex-mcp", "serve", "--repo", "."]

memex can back Claude's native memory tool — agents read from a per-session graph projection plus a writable scratch zone.

bash
memex memory-tool serve --repo .                     # in-process
memex memory-tool serve --repo . --transport http    # FastAPI on :7464
python
from memex.memory_tool import MemexAsyncMemoryTool
memory_tool = MemexAsyncMemoryTool(repo_root=".")
client.beta.messages.run_tools(..., tools=[memory_tool])

Operating principles

#PrincipleThe bet
1Bitemporal, never destructiveEdges are expired, not deleted. WHERE r.expired_at IS NULL filters live state
2Confidence is computed, not storedMutating a number invites silent drift. Recompute every read
3Two regimes for decayValidated facts decay slowly; unvalidated facts must earn their place by being accessed
4Human in the loopmemex review queues lowest-confidence Decision nodes for explicit validation
5Write governancePer-node-type ACL. Decision.policy = open, Module.policy = locked. Intent-confirmation on similar-content writes
6Tokens are budgetedget_project_context stays under 1500 tokens at any repo size via Leiden clusters
7Synthesis only on commitsThe watcher batches by debounce window. Gemini Flash is not in the hot path of a tool call
8Pro for synthesis, Flash for extractionexplain_change uses Pro because grounding matters. Everything else uses Flash
9Multi-repo awareOne watcher + one MCP server can manage hundreds of repos. --repo switches scope
10Local-firstNeo4j runs in your Docker. Gemini is the only outbound call, and only on commits

When to use memex

Use it whenSkip it when
Multi-week or multi-month projectOne-shot script, throwaway prototype
You work across multiple agents (Claude, Cursor, Codex) and want shared contextYou only ever pair with one agent on one task
Architectural decisions are made over time and need to be rememberedThe whole project fits in a single 200k-token context window
You want to query "what did we decide about X" from any sessionYour repo is already small enough to paste into the prompt
Multiple developers using AI agents on the same codebaseSolo work where you never /clear

Project structure

memex/
├── memex/
│   ├── extractor/        tree-sitter + lockfile parsers
│   ├── graph/            Neo4j writes, confidence, archive, cluster engine
│   ├── synthesizer/      Gemini Flash → Decision nodes
│   ├── mcp_server/       14 MCP tools (read + write + analytic)
│   ├── memory_tool/      Anthropic memory_20250818 adapter
│   ├── watcher/          daemon + git hooks
│   └── cli.py            init / watch / serve / review / graph / cluster
├── tests/                unit, integration, and objective evaluation suites
├── docker/               Neo4j compose
├── npm/                  npx wrapper (publishes as stifler-memex-mcp)
└── Dockerfile            introspection-only image for MCP directory sandboxes

Commands

CommandWhat it does
memex initExtract baseline graph state, run first cluster pass
memex watchDaemon that listens for file + git events and writes to Neo4j
memex serveRun the MCP server (stdio, HTTP, or both)
memex reviewTUI that walks lowest-confidence decisions for human validation
memex graph --output graph.htmlSelf-contained D3 force layout with cluster overlays
memex cluster [--rerun] [--dry-run]Run Leiden over the hybrid edge graph; pin cluster IDs by Jaccard ≥ 0.5
memex memory-tool serveBack Anthropic's memory_20250818 tool with a graph projection
memex stats [--json] [--repo <path>]Show context token savings and telemetry stats

License

MIT. See LICENSE.

Author

Hill Patel (@STiFLeR7)

Core Contributors & Maintainers

  • Hill Patel (@STiFLeR7) — architect, maintainer
  • Nirvaan Lagishetty (@Nirvaan05) — lead contributor, maintainer

Contributing

Open an issue or PR. uv sync --all-extras installs the development toolchain. Run uv run pytest -m "not integration" for the offline suite and uv run ruff check . before opening a PR. Version bumps must update pyproject.toml, npm/package.json, server.json, and the team Docker image tag together.

The v0.9 release record is in CHANGELOG.md, with the architecture and evaluation evidence under docs/architecture/v0.9/.

Vannevar Bush, 1945: "Consider a future device for individual use, which is a sort of mechanized private file and library. It needs a name, and to coin one at random, memex will do."

Usa el MCP de memex-mcp con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado memex-mcp, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade memex-mcp como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de memex-mcp.
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "memex": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de memex-mcp y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de memex-mcp.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar memex-mcp para ayudarme con esta tarea?
memex-mcp
Claro. Lo he leído.
Esto he encontrado usando memex-mcp.

Preguntas frecuentes

¿Para qué sirve el servidor MCP memex-mcp?

memex-mcp es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP memex-mcp con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar memex-mcp con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de memex-mcp con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con memex-mcp conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP memex-mcp a TypingMind?

memex-mcp funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP memex-mcp en TypingMind?

memex-mcp ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP memex-mcp?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si memex-mcp requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇