Memory MCP

Memory MCP

A production-grade memory server for LibreChat that stores conversation turns and distills durable memories like decisions, constraints, and assumptions. It provides hybrid retrieval and consistency auditing to ensure AI plans remain aligned with established context and previous decisions.

Category
Visit Server

README

Memory MCP

Production-grade Memory MCP server for single-tenant LibreChat workspaces. It stores raw conversation turns, distills durable memory (decisions/constraints/mistakes/assumptions/open questions), and provides hybrid retrieval plus plan consistency auditing.

Özellikler

  • Raw turn log + embedding + full-text indeksleme.
  • Distilled memory çıkarımı: kararlar, kısıtlar, hatalar, varsayımlar, açık sorular.
  • Dedup + supersede zinciri (eski kararlar korunur, stale tespit yapılır).
  • Hybrid retrieval: pgvector + PostgreSQL full-text + RRF fusion.
  • Fast / Deep modlar: öngörülebilir gecikme, token budget yönetimi.
  • Audit: plan/metinleri aktif karar/kısıtlar ve superseded öğelerle kontrol.
  • Shared import/export: HMAC imzalı paketlerle kontrollü paylaşım.
  • Gözlemlenebilirlik: JSON log + Prometheus metrikleri.

Kurulum

1) Ortam değişkenleri

.env dosyasını .env.example üzerinden oluşturun:

cp .env.example .env

Özellikle şunları ayarlayın:

  • DATABASE_URL
  • LLM_API_KEY
  • SHARED_HMAC_SECRET

2) Docker Compose

make up

3) Migrasyonlar

make migrate

4) Testler

make test

MCP Endpoint

MCP endpointi /mcp altında çalışır. Bu servis tool + arguments ile JSON alır.

Örnek:

curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "thread.create",
    "arguments": {}
  }'

LibreChat MCP yapılandırması

LibreChat MCP URL’nizi şu şekilde ayarlayın:

  • Uğur: https://mcp.datasins.com/mcp
  • Gökçe: https://mcp.gokce.ai/mcp

Plan Registry (Topic Separation)

Planlar ayrı çalışma konuları olarak yönetilir ve her thread bir plana bağlıdır.

plan.create

{
  "tool": "plan.create",
  "arguments": {
    "name": "memory-mcp-core",
    "meta": {"owner": "ugur"}
  }
}

thread.create

{
  "tool": "thread.create",
  "arguments": {
    "plan_id": "<plan_uuid>",
    "meta": {"topic": "ingest-pipeline"}
  }
}

Örnek Tool Payloadları

turn.ingest

{
  "tool": "turn.ingest",
  "arguments": {
    "thread_id": "<uuid>",
    "role": "user",
    "text": "Yeni karar: Postgres kullanılacak.",
    "external_turn_id": "librechat-turn-123",
    "embed_now": true
  }
}

external_turn_id aynı değerle gelen tekrar çağrılarda idempotent davranır.

distill.extract

{
  "tool": "distill.extract",
  "arguments": {
    "thread_id": "<uuid>",
    "turn_id": "<uuid>",
    "include_recent_turns": 4,
    "write_to_memory": true
  }
}

retrieve.context

{
  "tool": "retrieve.context",
  "arguments": {
    "thread_id": "<uuid>",
    "query": "Hangi kararlar aktif?",
    "mode": "fast",
    "scope": "distilled_only",
    "top_k": 8,
    "token_budget": 800,
    "recency_bias": 0.1,
    "explain": true
  }
}

audit.check_consistency

{
  "tool": "audit.check_consistency",
  "arguments": {
    "thread_id": "<uuid>",
    "proposed_plan_text": "SQLite kullanalım.",
    "deep": true
  }
}

shared.export

{
  "tool": "shared.export",
  "arguments": {
    "thread_id": "<uuid>",
    "types": ["decision", "constraint"],
    "include_mistakes": false,
    "expires_in_minutes": 60
  }
}

shared.import

{
  "tool": "shared.import",
  "arguments": {
    "payload": {"...": "..."},
    "signature": "<hmac>"
  }
}

Güvenlik

  • Pydantic doğrulama + sıkı enumlar.
  • Prompt injection güvenliği için sistem promptlarında açık uyarı.
  • HMAC imza ile export/import.
  • API anahtarları loglanmaz.

Notlar

  • EMBEDDING_DIM farklıysa migration güncellenmeli.
  • ENABLE_LLM_RERANK=true ise low-confidence deep retrieval’da LLM rerank aktif olur.
  • Retention politikaları .env içindeki RETENTION_* değişkenleriyle kontrol edilir.

LibreChat Uçtan Uca Kullanım Örnekleri

1) Yeni Plan Başlatma

  1. plan.create ile yeni plan oluşturun.
  2. thread.create ile plan altında bir thread açın.
  3. turn.ingest ile ilk kararları gönderin.

2) Mevcut Planı Devam Ettirme

  1. plan.list ile planları bulun.
  2. Mevcut planın thread ID’sini takip edin veya yeni thread ekleyin.
  3. distill.extract ile yeni turn’lerden karar/kısıt çıkarın.

3) Deep Audit

  1. retrieve.context ile mode=deep ve explain=true kullanın.
  2. audit.check_consistency ile plan metnini doğrulatın.
  3. stale_references çıktısını kontrol ederek superseded kararları güncelleyin.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured