Integrations: Docling, Langflow, Airbyte & more
Use MDDB alongside AI/ML, ELT and observability tools to build document processing and RAG pipelines. AI agents that talk to MDDB directly over MCP are covered in AGENTS.
Architecture Overview #
graph LR
subgraph Content Sources
PDF[PDF / DOCX / PPTX]
DOCLING[Docling
IBM Document Parser]
WP[WordPress]
WPEXP[wpexporter]
WPSYNC[WordPress
Sync plugin]
AB[Airbyte
300+ ELT sources]
GHA[GitHub Action
repo docs / READMEs]
SITES[Sitemaps, URL lists,
S3 prefixes]
end
subgraph Storage & Search
MDDB[mddbd
:11023 / :11024]
BOLT[(BoltDB)]
VEC[(Vector Index)]
OS[(OpenSearch
optional, for scale-out)]
end
subgraph Output & Orchestration
SSG[SSG
Static Site Generator]
LF[Langflow
Visual RAG Builder]
LLM[LLM
Claude / GPT / Llama]
DEPLOY[GitHub Pages
Cloudflare / Netlify]
GRAFANA[Grafana
datasource plugin]
CHROME[Chrome extension
toolbar stats]
LC[LangChain / LangGraph
langchain-mddb]
AGENT[AI agents
MCP clients]
ES[Elasticsearch-style
clients]
end
PDF -->|parse| DOCLING
DOCLING -->|markdown| MDDB
WP -->|export| WPEXP
WPEXP -->|markdown| MDDB
WP -->|live hooks| WPSYNC
WPSYNC -->|/v1/add /v1/delete| MDDB
AB -->|destination-mddb| MDDB
GHA -->|/v1/add per file| MDDB
SITES -->|scheduled sync| MDDB
MDDB --> BOLT
MDDB --> VEC
MDDB -.->|export + webhooks| OS
MDDB -->|fetch docs| SSG
SSG -->|static HTML| DEPLOY
LF -->|REST / MCP| MDDB
LF -.->|query| OS
LF -->|generate| LLM
LLM -->|answer| LF
MDDB -->|/v1/temporal /v1/aggregate| GRAFANA
CHROME -->|/v1/stats| MDDB
LC -->|gRPC| MDDB
AGENT -->|MCP| MDDB
ES -->|/es subset| MDDB
1. Docling → MDDB (Document Ingestion) #
Docling is IBM's document parser that converts PDF, DOCX, PPTX, and HTML into structured Markdown. Since MDDB stores Markdown natively, this is a natural fit.
MDDB converts PDF, DOCX, ODT, RTF, XLSX, ODS, PPTX, ODP, EPUB, CSV, EML and MBOX itself on upload (see BULK-IMPORT), and marks each result with meta.conversionConfidence. It has no OCR and no layout model: a scanned PDF is stored with confidence 0. Reach for Docling when documents are scans, or when their tables and reading order need a layout model; filter: {"conversionConfidence": {"lt": 0.5}} finds the documents worth sending through it.
Install Docling #
pip install docling
Basic: Parse and Store a Single Document #
from docling.document_converter import DocumentConverter
import requests
MDDB_URL = "http://localhost:11023"
# Step 1: Parse PDF to Markdown with Docling
converter = DocumentConverter()
result = converter.convert("report.pdf")
markdown = result.document.export_to_markdown()
# Step 2: Store in MDDB
requests.post(f"{MDDB_URL}/v1/add", json={
"collection": "reports",
"key": "report-2026-q1",
"lang": "en_US",
"meta": {
"source": ["docling"],
"type": ["pdf"],
"title": ["Q1 2026 Report"],
},
"contentMd": markdown,
})
Batch: Ingest a Folder of Documents #
"""
Bulk-import a folder of documents via Docling → MDDB.
Supports PDF, DOCX, PPTX, HTML.
"""
from docling.document_converter import DocumentConverter
from pathlib import Path
import requests
MDDB_URL = "http://localhost:11023"
COLLECTION = "knowledge-base"
INPUT_DIR = Path("./documents")
converter = DocumentConverter()
supported = {".pdf", ".docx", ".pptx", ".html", ".htm"}
for file in INPUT_DIR.iterdir():
if file.suffix.lower() not in supported:
continue
print(f"Processing: {file.name}")
result = converter.convert(str(file))
markdown = result.document.export_to_markdown()
resp = requests.post(f"{MDDB_URL}/v1/add", json={
"collection": COLLECTION,
"key": file.stem,
"lang": "en_US",
"meta": {
"source": ["docling"],
"type": [file.suffix.lstrip(".")],
"filename": [file.name],
},
"contentMd": markdown,
})
if resp.status_code == 200:
print(f" OK: {file.name}")
else:
print(f" ERROR: {resp.text}")
# Embeddings are generated automatically in the background
print("Done. Check embedding progress:")
print(requests.get(f"{MDDB_URL}/v1/vector-stats").json())
With Chunking (for Better Vector Search) #
Long documents should be split into chunks for more precise semantic search:
from docling.document_converter import DocumentConverter
from docling.chunking import HybridChunker
import requests
MDDB_URL = "http://localhost:11023"
converter = DocumentConverter()
result = converter.convert("manual.pdf")
# Docling's built-in chunker splits by sections/paragraphs
chunker = HybridChunker(tokenizer="sentence-transformers/all-MiniLM-L6-v2")
chunks = list(chunker.chunk(result.document))
for i, chunk in enumerate(chunks):
text = chunk.text
# Skip very short chunks
if len(text.strip()) < 50:
continue
requests.post(f"{MDDB_URL}/v1/add", json={
"collection": "manual",
"key": f"manual-chunk-{i:04d}",
"lang": "en_US",
"meta": {
"source": ["docling"],
"chunk_index": [str(i)],
"parent_doc": ["manual.pdf"],
},
"contentMd": text,
})
print(f"Imported {len(chunks)} chunks from manual.pdf")
Docker Pipeline #
# docker-compose.yml
services:
mddb:
image: tradik/mddb:latest
ports:
- "11023:11023"
- "11024:11024"
- "9000:9000"
volumes:
- mddb-data:/app/data
environment:
MDDB_EMBEDDING_PROVIDER: openai
MDDB_EMBEDDING_API_KEY: ${OPENAI_API_KEY}
docling-ingest:
build:
context: .
dockerfile: Dockerfile.docling
volumes:
- ./documents:/documents
environment:
MDDB_URL: http://mddb:11023
depends_on:
- mddb
volumes:
mddb-data:
# Dockerfile.docling
FROM python:3.11-slim
RUN pip install docling requests
COPY ingest.py /app/ingest.py
CMD ["python", "/app/ingest.py"]
2. Langflow + MDDB (Visual RAG Orchestration) #
Langflow is a visual framework for building LLM workflows. MDDB can be integrated as a retrieval component via REST API or MCP.
Install Langflow #
pip install langflow
langflow run
# Opens at http://localhost:7860
Option A: Custom Python Component (REST API) #
Create a custom Langflow component that queries MDDB:
"""
MDDB Search Component for Langflow.
Save as: mddb_component.py
Import in Langflow via Custom Components.
"""
from langflow.custom import Component
from langflow.io import MessageTextInput, IntInput, Output
from langflow.schema import Data
import requests
class MDDBSearch(Component):
display_name = "MDDB Semantic Search"
description = "Search MDDB knowledge base using semantic/vector search."
icon = "search"
inputs = [
MessageTextInput(
name="query",
display_name="Search Query",
info="Natural language query to search for.",
),
MessageTextInput(
name="mddb_url",
display_name="MDDB URL",
value="http://localhost:11023",
info="MDDB server address.",
),
MessageTextInput(
name="collection",
display_name="Collection",
value="docs",
info="MDDB collection to search.",
),
IntInput(
name="top_k",
display_name="Top K",
value=5,
info="Number of results to return.",
),
]
outputs = [
Output(display_name="Results", name="results", method="search"),
]
def search(self) -> list[Data]:
response = requests.post(
f"{self.mddb_url}/v1/vector-search",
json={
"collection": self.collection,
"query": self.query,
"topK": self.top_k,
"threshold": 0.6,
"includeContent": True,
},
)
results = response.json().get("results", [])
return [
Data(data={
"key": r["document"]["key"],
"content": r["document"].get("contentMd", ""),
"score": r["score"],
"meta": r["document"].get("meta", {}),
})
for r in results
]
Using in Langflow
- Open Langflow UI → My Collection → New Project
- Go to Custom Components → upload
mddb_component.py - Build a flow:
[Chat Input] → [MDDB Semantic Search] → [Parse Data] → [Prompt] → [LLM] → [Chat Output]
The Prompt template:
Answer the user's question based on the following documents from the knowledge base.
Cite sources by their key.
Context:
{documents}
Question: {query}
Option B: Langflow + MDDB via MCP #
If your Langflow version supports MCP tool calling, connect MDDB directly:
{
"mcpServers": {
"mddb": {
"command": "docker",
"args": [
"run", "-i", "--rm", "--network", "host",
"-v", "mddb-data:/app/data",
"-e", "MDDB_MCP_STDIO=true",
"tradik/mddb:latest"
]
}
}
}
Available MCP tools for Langflow: semantic_search, full_text_search, hybrid_search, search_documents, add_document, import_url, and 48 more.
Option C: Langflow API Tool (No Custom Code) #
Use Langflow's built-in API Request component to call MDDB directly:
- Add an API Request component
- Set Method: POST
- Set URL:
http://localhost:11023/v1/vector-search - Set Body:
{
"collection": "docs",
"query": "{query}",
"topK": 5,
"includeContent": true
}
- Connect:
[Chat Input] → [API Request] → [Parse Data] → [Prompt] → [LLM] → [Chat Output]
Full Langflow RAG Flow Example #
graph LR
INPUT[Chat Input] --> MDDB[MDDB Search
vector-search]
MDDB --> PARSE[Parse Data
extract contentMd]
PARSE --> PROMPT[Prompt Template
context + question]
INPUT --> PROMPT
PROMPT --> LLM[OpenAI / Claude
/ Ollama]
LLM --> OUTPUT[Chat Output]
3. OpenSearch + MDDB #
MDDB and OpenSearch overlap on search, but they are built for different sizes of deployment. MDDB is one process on one machine, with read-only followers for read scaling (REPLICATION); from 2.19.8 several MDDB clusters can share the collections, each holding whole collections (CLUSTER). OpenSearch is a cluster: an index is split into shards spread over nodes. This section says when MDDB is enough on its own, when OpenSearch is the better tool, how to move between them, and how to run both.
What each side does #
| MDDB | OpenSearch | |
|---|---|---|
| Deployment | One node; leader-follower replication copies the whole database to each follower. From 2.19.8, node groups each hold whole collections, never part of one (CLUSTER) | A cluster; shards and replicas spread one index over many nodes |
| Vector search | 8 index types (flat, HNSW, IVF, PQ, OPQ, SQ, SQ4, BQ) and algorithm: "auto", which picks one per query from the collection size, memory and filter (SEARCH). int8/int4 quantization and disk-only vectors cut memory (QUANTIZATION). Every vector of a collection lives on one machine |
k-NN plugin (Lucene, Faiss); vectors are split across shards and nodes |
| Measured vector scale | Synthetic 32-dimension corpus, recall@10 against the exact top 10 (BENCHMARK): 200k vectors, HNSW 0.46 ms p50 at recall 1.000; 2M vectors, trained IVF 14 ms p50 at recall 1.000. 2M took about 2 hours to load and 10 minutes to train IVF on one machine | Scales by adding nodes |
| Full text | TF-IDF, BM25, BM25F, PMISparse; 8 query modes (simple, boolean, phrase, wildcard, proximity, range, fuzzy, expression); stemming for 17 languages; synonyms, stop words, typo tolerance, per-query BM25 k1/b. One index per document, covering the body and metadata values; no custom analyzers |
Analyzer chains per field (tokenizers, token filters, ICU, language analyzers), per-field mappings |
| Aggregations | Facet counts (facetBy, facetScope: "all") and date histograms (/v1/aggregate) |
The full aggregation framework: metrics, buckets, pipelines, nested |
| Hybrid search | Built in: /v1/hybrid-search with alpha blending or RRF |
Hybrid query with a search pipeline that normalises and combines scores |
| For agents | 116 MCP tools, passages with path and line ranges, code symbols and graph, conversation memory (AGENTS) | Not built in |
| Around it | One binary, embedded storage, web panel, Prometheus metrics | Dashboards, ingest pipelines, alerting, security plugin, a large client and tooling ecosystem |
When MDDB alone is enough #
- The collection fits one machine. Vectors take dimensions × 4 bytes each in
float32, less with int8/int4, and disk-only collections keep only the
quantized copy in memory. Per collection,
algorithm: "auto"uses flat below 10k vectors, HNSW up to 1M and IVF above. - You want BM25 with stemming, synonyms and fuzzy matching, but not your own analyzers per field.
- Counts by metadata value and date histograms are the aggregations you need.
- The consumers are agents and RAG pipelines: MCP, passages, the code graph and the context budget are what MDDB is for.
When to add or choose OpenSearch #
- One index must outgrow one machine's memory or disk, or writes to one collection must scale beyond one leader. MDDB places whole collections on node groups and never splits one collection across nodes.
- Search depends on analyzers: per-field tokenisation, ICU, n-gram or edge n-gram fields, language analyzers MDDB's stemmers do not cover.
- You need aggregations beyond counts and histograms (metrics, pipeline, nested), or OpenSearch Dashboards, alerting and its security plugin.
- The organisation already runs an OpenSearch cluster and its tooling.
Moving between them: the /es subset #
MDDB_ES_COMPAT=true mounts a subset of the Elasticsearch REST API under
/es (ELASTICSEARCH-COMPAT): index,
get, delete, _bulk, _search, _count, _refresh, with match,
match_phrase, multi_match, bool, term, terms, range, top-level
knn and terms aggregations. Code written against an Elasticsearch-style
client can run against MDDB unchanged as long as it stays inside that subset;
every clause outside it is a 400 that names it, so nothing is silently
ignored. Mappings, analyzers, scroll and aggregations beyond terms are out
of scope.
CI runs the official elasticsearch-py against it. opensearch-py is not
tested in CI. It was checked by hand against a build with the
lexical embedding provider: opensearch-py 3.2.0 ran info, ping,
index, helpers.bulk, indices.refresh, indices.exists, get, search
with match, with bool + term and with Elasticsearch's top-level knn,
a terms aggregation, count and delete. OpenSearch's own k-NN syntax,
knn inside query, is refused; write it as top-level knn.
from opensearchpy import OpenSearch
client = OpenSearch(hosts=[{"host": "localhost", "port": 11023, "url_prefix": "es"}])
client.index(index="books", id="bear", body={"content": "Brown bears eat honey", "genre": "nature"})
client.indices.refresh(index="books")
client.search(index="books", body={
"query": {"bool": {"must": [{"match": {"content": "honey"}}],
"filter": [{"term": {"genre": "nature"}}]}},
})
# Vector search: top-level knn, embedded with the collection's provider
client.search(index="books", body={
"knn": {"field": "content", "k": 5, "num_candidates": 50,
"query_vector_builder": {"text_embedding": {"model_text": "what do bears eat"}}},
})
An index is an MDDB collection, and _source fields other than the content
become metadata. With authentication on, /es takes the same credentials as
/v1, plus Authorization: ApiKey <key>.
Running both: MDDB as the source, OpenSearch as an index #
Keep MDDB as the store and agent interface, and copy documents into OpenSearch for the searches that need it. MDDB stays the source of truth; OpenSearch can be rebuilt from it at any time.
# docker-compose.yml
services:
mddb:
image: tradik/mddb:latest
ports:
- "11023:11023"
volumes:
- mddb-data:/app/data
environment:
MDDB_EMBEDDING_PROVIDER: openai
MDDB_EMBEDDING_API_KEY: ${OPENAI_API_KEY}
opensearch:
image: opensearchproject/opensearch:2
ports:
- "9200:9200"
environment:
discovery.type: single-node
DISABLE_SECURITY_PLUGIN: "true"
volumes:
- os-data:/usr/share/opensearch/data
volumes:
mddb-data:
os-data:
The security plugin is off only to keep the example short; turn it on for anything reachable from outside.
Index
MDDB stores addedAt and updatedAt as Unix seconds, so map them with
epoch_second. Metadata values are lists of strings.
curl -X PUT http://localhost:9200/mddb-docs -H 'Content-Type: application/json' -d '{
"mappings": {
"properties": {
"key": { "type": "keyword" },
"collection": { "type": "keyword" },
"lang": { "type": "keyword" },
"contentMd": { "type": "text", "analyzer": "standard" },
"meta": { "type": "object", "dynamic": true },
"addedAt": { "type": "date", "format": "epoch_second" },
"updatedAt": { "type": "date", "format": "epoch_second" }
}
}
}'
Full copy
POST /v1/export with format: "ndjson" streams a collection;
GET /v1/stats lists the collections.
import json
import requests
MDDB_URL = "http://localhost:11023"
OS_URL = "http://localhost:9200"
INDEX = "mddb-docs"
def os_doc(collection: str, doc: dict) -> dict:
return {
"key": doc["key"],
"collection": collection,
"lang": doc.get("lang", ""),
"contentMd": doc.get("contentMd", ""),
"meta": doc.get("meta", {}),
"addedAt": doc.get("addedAt"),
"updatedAt": doc.get("updatedAt"),
}
def sync_collection(collection: str) -> None:
resp = requests.post(f"{MDDB_URL}/v1/export",
json={"collection": collection, "format": "ndjson"}, stream=True)
resp.raise_for_status()
lines = []
for line in resp.iter_lines():
if not line:
continue
doc = json.loads(line)
doc_id = f"{collection}|{doc['key']}|{doc.get('lang', '')}"
lines.append(json.dumps({"index": {"_index": INDEX, "_id": doc_id}}))
lines.append(json.dumps(os_doc(collection, doc)))
if len(lines) >= 2000: # 1000 documents per bulk request
requests.post(f"{OS_URL}/_bulk", data="\n".join(lines) + "\n",
headers={"Content-Type": "application/x-ndjson"}).raise_for_status()
lines = []
if lines:
requests.post(f"{OS_URL}/_bulk", data="\n".join(lines) + "\n",
headers={"Content-Type": "application/x-ndjson"}).raise_for_status()
for coll in requests.get(f"{MDDB_URL}/v1/stats").json().get("collections", []):
sync_collection(coll["name"])
Changes as they happen
A webhook keeps OpenSearch in step after the full copy. The events are
doc.added, doc.updated and doc.deleted; omit collection to receive
every collection.
curl -X POST http://localhost:11023/v1/webhooks -H 'Content-Type: application/json' -d '{
"url": "http://sync-service:8080/mddb-webhook",
"events": ["doc.added", "doc.updated", "doc.deleted"]
}'
The payload carries event, collection, key, lang, timestamp and, for
an add or update, the whole document, so the receiver does not read it back
from MDDB:
from fastapi import FastAPI, Request
import requests
app = FastAPI()
OS_URL = "http://localhost:9200"
INDEX = "mddb-docs"
@app.post("/mddb-webhook")
async def handle_webhook(request: Request):
p = await request.json()
doc_id = f"{p['collection']}|{p['key']}|{p.get('lang', '')}"
if p["event"] in ("doc.added", "doc.updated") and p.get("document"):
doc = p["document"]
requests.put(f"{OS_URL}/{INDEX}/_doc/{doc_id}", json={
"key": doc["key"], "collection": p["collection"], "lang": doc.get("lang", ""),
"contentMd": doc.get("contentMd", ""), "meta": doc.get("meta", {}),
"addedAt": doc.get("addedAt"), "updatedAt": doc.get("updatedAt"),
})
elif p["event"] == "doc.deleted":
requests.delete(f"{OS_URL}/{INDEX}/_doc/{doc_id}")
return {"ok": True}
A webhook is delivered up to four times (at once, then after 1, 5 and 15 seconds) and then dropped, so run the full copy again from time to time, or after the receiver was down.
Vectors in OpenSearch
MDDB does not export its vectors or offer an endpoint that embeds text for a
client. To search vectors in OpenSearch, embed the documents there: with an
OpenSearch ingest pipeline and a model connected to it, or in the sync
script, calling the same model as MDDB_EMBEDDING_MODEL so that both sides
rank alike. MDDB's own hybrid search (/v1/hybrid-search) already fuses BM25
and vectors in one call; merge results across the two systems only when one
side holds documents the other does not.
4. SSG — Static Site Generator from MDDB #
SSG is a high-performance static site generator written in Go with built-in MDDB support. It pulls Markdown content directly from MDDB collections and renders complete static websites with themes, minification, and deployment-ready output.
graph LR
subgraph Content Management
MDDB[MDDB
:11023]
PANEL[MDDB Panel
:9000]
end
subgraph Static Generation
SSG[SSG
Static Site Generator]
TPL[Templates
Go / Pongo2 / Mustache]
OPT[Optimizer
WebP / Minify / Sitemap]
end
subgraph Deployment
GH[GitHub Pages]
CF[Cloudflare Pages]
NL[Netlify / Vercel]
end
PANEL -->|edit content| MDDB
MDDB -->|fetch docs
REST API| SSG
SSG --> TPL
TPL --> OPT
OPT -->|static HTML/CSS/JS| GH
OPT --> CF
OPT --> NL
Generate a Site from MDDB Collection #
# Install SSG
brew install spagu/tap/ssg
# or: go install github.com/spagu/ssg@latest
# Generate site from MDDB collection
ssg --mddb-url=http://localhost:11023 \
--mddb-collection=blog \
--mddb-lang=en_US \
krowy example.com
# Output in ./public/ — ready to deploy
CLI Flags #
| Flag | Description | Default |
|---|---|---|
--mddb-url |
MDDB server URL (enables MDDB mode) | — |
--mddb-collection |
Collection to fetch posts from | — |
--mddb-key |
API key for authentication | — |
--mddb-lang |
Language filter | en_US |
--mddb-timeout |
Request timeout in seconds | 30 |
Dev Server with Live Reload #
# Watch MDDB for changes, auto-rebuild
ssg serve --mddb-url=http://localhost:11023 \
--mddb-collection=blog \
krowy example.com
# Opens at http://localhost:8080 with file watching
CI/CD Pipeline: MDDB → SSG → GitHub Pages #
# .github/workflows/deploy.yml
name: Deploy Site
on:
workflow_dispatch:
schedule:
- cron: '0 */6 * * *' # every 6 hours
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install SSG
run: |
curl -sL https://github.com/spagu/ssg/releases/latest/download/ssg_linux_amd64.tar.gz | tar xz
sudo mv ssg /usr/local/bin/
- name: Build site from MDDB
run: |
ssg --mddb-url=${{ secrets.MDDB_URL }} \
--mddb-collection=blog \
--mddb-key=${{ secrets.MDDB_API_KEY }} \
krowy ${{ vars.SITE_DOMAIN }}
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
Docker Pipeline #
# docker-compose.yml
services:
mddb:
image: tradik/mddb:latest
ports:
- "11023:11023"
- "9000:9000"
volumes:
- mddb-data:/app/data
ssg:
image: spagu/ssg:latest
depends_on:
- mddb
command: >
ssg --mddb-url=http://mddb:11023
--mddb-collection=blog
krowy example.com
volumes:
- ./public:/app/public
volumes:
mddb-data:
Structured frontmatter: what MDDB can and cannot hold #
SSG pages often carry structured frontmatter — an faq: list of objects, a
schema: Recipe JSON-LD block. MDDB's metadata is flat
(map<string, repeated string>) and cannot hold it directly. An importer that
stringifies nested YAML with Go's %v produces values like
map[answer:Yes question:Is it free?]; MDDB stores them faithfully, and the
site build fails later on a template that cannot render them
(issue #187).
Before ingesting a site with structured frontmatter, pick one of the three
patterns in API — JSON in a
single value, flattened leaf keys, or leaving the block in the markdown body.
POST /v1/validate warns when a value looks stringified, so a pipeline can
catch it at import time rather than at render time:
curl -s -X POST "$MDDB/v1/validate" \
-H 'Content-Type: application/json' \
-d '{"collection":"site","meta":{"faq":["[map[answer:Yes question:Is it free?]]"]}}' \
| jq .warnings
Workflow: Edit in Panel → Generate → Deploy #
sequenceDiagram
participant U as Editor
participant P as MDDB Panel
participant M as MDDB
participant S as SSG
participant D as GitHub Pages
U->>P: Edit blog post in Panel
P->>M: POST /v1/add (save document)
Note over M: Webhook fires on doc.add
M->>S: Webhook triggers SSG build
S->>M: GET /v1/search (fetch all posts)
M->>S: Markdown documents + metadata
S->>S: Render templates, optimize assets
S->>D: Deploy static files
D->>U: Site updated at example.com
5. wpexporter — WordPress to MDDB Migration #
wpexporter is a Go toolkit for exporting WordPress content. It supports 14+ output formats including Markdown, and includes an MCP server (wpmcp) for AI-assisted migrations.
graph LR
subgraph WordPress
WP[WordPress Site]
REST[REST API
/wp-json/wp/v2]
XMLRPC[XML-RPC
/xmlrpc.php]
end
subgraph wpexporter
EXP[wpexportjson
Public content]
XR[wpxmlrpc
Private content]
MCP_WP[wpmcp
MCP Server]
end
subgraph MDDB
MDDB_S[mddbd
:11023]
MCP_MD[mddb-mcp
MCP Server]
BOLT[(BoltDB)]
VEC[(Vector Index)]
end
WP --> REST --> EXP
WP --> XMLRPC --> XR
WP --> MCP_WP
EXP -->|markdown export| MDDB_S
XR -->|markdown export| MDDB_S
MCP_WP -->|AI orchestration| MCP_MD
MDDB_S --> BOLT
MDDB_S --> VEC
Quick Export: WordPress → Markdown → MDDB #
# Step 1: Export WordPress to Markdown
wpexportjson -url https://your-site.com -format markdown -output ./wp-export/
# Step 2: Bulk import into MDDB
for file in wp-export/*.md; do
key=$(basename "$file" .md)
content=$(cat "$file")
curl -X POST http://localhost:11023/v1/add \
-H 'Content-Type: application/json' \
-d "{
\"collection\": \"blog\",
\"key\": \"$key\",
\"lang\": \"en_US\",
\"meta\": {\"source\": [\"wordpress\"]},
\"contentMd\": $(echo "$content" | jq -Rs .)
}"
done
Python: Full Migration with Metadata #
"""
Migrate WordPress → MDDB with full metadata preservation.
Uses wpexportjson JSON output for richer metadata.
"""
import subprocess
import json
import requests
from pathlib import Path
MDDB_URL = "http://localhost:11023"
WP_URL = "https://your-site.com"
COLLECTION = "blog"
# Step 1: Export WordPress as JSON (includes metadata)
subprocess.run([
"wpexportjson",
"-url", WP_URL,
"-format", "json",
"-output", "./wp-export.json",
])
# Step 2: Load and import into MDDB
with open("wp-export.json") as f:
posts = json.load(f)
for post in posts:
slug = post.get("slug", "")
title = post.get("title", "")
content_md = post.get("content_markdown", post.get("content", ""))
categories = post.get("categories", [])
tags = post.get("tags", [])
date = post.get("date", "")
resp = requests.post(f"{MDDB_URL}/v1/add", json={
"collection": COLLECTION,
"key": slug,
"lang": "en_US",
"meta": {
"title": [title],
"source": ["wordpress"],
"wp_url": [f"{WP_URL}/{slug}/"],
"category": categories if categories else ["uncategorized"],
"tags": tags,
"date": [date],
},
"contentMd": f"# {title}\n\n{content_md}",
})
status = "OK" if resp.status_code == 200 else f"ERROR: {resp.text}"
print(f" {slug}: {status}")
print(f"\nMigrated {len(posts)} posts. Embeddings generating in background.")
AI-Assisted Migration via MCP #
Both wpexporter (wpmcp) and MDDB (mddb-mcp) have MCP servers. Connect both to Claude Desktop and let the AI orchestrate the migration:
{
"mcpServers": {
"wordpress": {
"command": "wpmcp",
"args": [],
"env": {
"WP_URL": "https://your-site.com",
"WP_USER": "admin",
"WP_APP_PASSWORD": "xxxx xxxx xxxx xxxx"
}
},
"mddb": {
"command": "docker",
"args": [
"run", "-i", "--rm", "--network", "host",
"-v", "mddb-data:/app/data",
"-e", "MDDB_MCP_STDIO=true",
"tradik/mddb:latest"
]
}
}
}
Then ask Claude:
"Migrate all posts from WordPress to MDDB collection 'blog'. Preserve categories, tags, and dates as metadata. Skip draft posts."
sequenceDiagram
participant U as User
participant C as Claude Desktop
participant WP as wpmcp
(WordPress)
participant MD as mddb-mcp
(MDDB)
U->>C: "Migrate all published posts
from WordPress to MDDB"
C->>WP: tool: list_posts(status=published)
WP->>C: 142 posts with metadata
loop For each post
C->>WP: tool: get_post(id=N, format=markdown)
WP->>C: Markdown content + meta
C->>MD: tool: add_document(collection=blog,
key=slug, contentMd=...)
MD->>C: OK
end
C->>MD: tool: vector_reindex(collection=blog)
MD->>C: Reindexing 142 documents
C->>U: "Done! Migrated 142 posts.
Embeddings generating in background."
Full WordPress Migration Pipeline #
graph TB
subgraph s1["1. Export"]
WP[WordPress] -->|REST API| WPEXP[wpexporter]
WP -->|XML-RPC| WPEXP
WPEXP -->|markdown + metadata| MD_FILES[Markdown Files]
end
subgraph s2["2. Store and Index"]
MD_FILES -->|bulk import| MDDB[MDDB]
MDDB -->|auto-embed| VEC[(Vector Index)]
MDDB -->|store| BOLT[(BoltDB)]
end
subgraph s3["3. Use"]
MDDB -->|MCP| CLAUDE[Claude / AI Agents]
MDDB -->|REST| SSG_N[SSG
New Static Site]
MDDB -->|vector search| RAG[RAG Pipeline]
end
style WP fill:#21759b,color:#fff
style MDDB fill:#00d4aa,color:#000
style CLAUDE fill:#d97706,color:#fff
6. Airbyte → MDDB (ELT Destination Connector) #
Airbyte is an open-source ELT platform with 300+ source connectors. The MDDB Airbyte destination ships records from any Airbyte source (Postgres, MySQL, Salesforce, Stripe, S3, …) directly into MDDB via POST /v1/add. Each Airbyte stream maps to its own MDDB collection.
Image #
| Registry | Image |
|---|---|
| Docker Hub | tradik/airbyte-destination-mddb:0.1.1 |
| GHCR | ghcr.io/tradik/airbyte-destination-mddb:0.1.1 (multi-arch + SLSA build-provenance) |
Source: integrations/airbyte-destination/
Register the connector in Airbyte UI #
- Settings → Destinations → ⊕ New connector.
- Fill in:
- Connector display name:
MDDB - Docker repository name:
tradik/airbyte-destination-mddb - Docker image tag:
0.1.1 - Connector documentation URL:
https://github.com/tradik/mddb/tree/main/integrations/airbyte-destination
- Connector display name:
- Add. Airbyte runs
specand renders the form. - Destinations → ⊕ New destination → MDDB → fill
mddbUrl(e.g.https://mddb.tradik.com) and optionalapiKey(bearervk_…) → Set up destination. Airbyte executescheckagainst the MDDB instance and should reportSUCCEEDED.
Configuration (spec) #
| Field | Default | Description |
|---|---|---|
mddbUrl |
https://mddb.tradik.com |
MDDB base URL, no trailing /. |
apiKey |
(empty) | Bearer token (vk_…). Empty = MDDB without auth. |
keyField |
id |
Record field used as the MDDB document key. SHA-1 of the record on miss. |
language |
en_US |
Locale stored on every document. |
batchSize |
100 |
Records buffered before flush. Flush also triggered on every Airbyte STATE message and at end-of-stream. |
timeoutSeconds |
30 |
HTTP timeout per request. |
verifySsl |
true |
Set false only for self-signed dev instances. |
Record mapping #
Airbyte record {"id":"u-42","email":"a@b.c","tags":["pro","beta"]} on stream users becomes:
{
"collection": "users",
"key": "u-42",
"lang": "en_US",
"meta": {
"id": ["u-42"],
"email": ["a@b.c"],
"tags": ["pro", "beta"]
},
"contentMd": "<!-- emittedAt=… -->\n```json\n{ …record… }\n```\n"
}
contentMd carries the full record inside a fenced JSON code block — FTS + vector search index it out of the box. meta follows the native MDDB map<string,[]string> schema.
Sync modes #
append— every record upserted bykey(existing docs replaced, no orphan deletion).append_dedup— same semantics (/v1/addis upsert-by-key by nature).overwrite— not advertised; if forced by the source, the connector logsWARNand falls back to append-upsert. Orphans are not deleted (MDDB has no batch-delete-by-collection).
Reliability #
- HTTP retry 3× with exponential backoff on
429/5xx(urllib3.Retry). - Flush on every
AirbyteMessage(STATE)so partial syncs don't lose in-flight batches. - 40 unit tests, 97% coverage, CI matrix on Python 3.12 & 3.13.
Example flow: Postgres → MDDB #
- Source → Postgres pointing at the table you want to index (e.g.
wiki.articles). - Destination → MDDB with
keyField=slug,language=en_US. - Connection → select streams, sync mode
Append + Deduped(the connector treats both append modes identically). - Run sync. MDDB ingests each row, embeds it (auto-vector if configured), and indexes for FTS/vector/hybrid search.
# Verify on the MDDB side
curl -s https://mddb.tradik.com/v1/search \
-H 'content-type: application/json' \
-d '{"collection":"articles","query":"vector index","limit":5}'
7. WordPress ⇄ MDDB (Sync plugin) #
integrations/wordpress-plugin/ — first-party WordPress plugin that mirrors posts and pages (or any public post type) into MDDB. Unlike wpexporter (one-shot bulk migration), this plugin keeps the two stores in lock-step: every save / publish / trash / delete in WordPress is reflected in MDDB in real time.
Since plugin 0.2.0 the bridge is two-way: the plugin's opt-in mddb-sync/v1 REST routes let the wordpress_publish / wordpress_set_status MCP tools create, update and (un)publish posts and pages from any MCP client — tags, categories, custom taxonomies, meta fields and Polylang/WPML translations included. See MCP.md → WordPress Publishing Tools.
| Property | Value |
|---|---|
| Plugin slug | mddb-sync |
| Release tag prefix | wp-v (e.g. wp-v0.1.0) — separate from core MDDB vX.Y.Z tags |
| Release asset | mddb-sync-<version>.zip attached to each GitHub Release |
| WP requires | 6.2+ |
| PHP requires | 8.2+ |
Hooks #
wp_after_insert_post→POST /v1/add(autosaves & revisions skipped; drafts opt-in).wp_trash_postandbefore_delete_post→POST /v1/delete.rest_api_init→ registersPOST /wp-json/mddb-sync/v1/publish+/status(only when Remote publishing is enabled; bearer publish key required).pre_set_site_transient_update_plugins+plugins_api→ self-update channel hittingrepos/tradik/mddb/releases/latest.
Settings (Settings → MDDB Sync) #
| Field | What |
|---|---|
| MDDB URL | Base URL, e.g. https://mddb.tradik.com. |
| API key | Bearer token (vk_…); empty for unauthenticated dev instances. |
| Collection | Defaults to a slug derived from the site host. |
| Sync events | Toggle save / delete / include-drafts independently. |
| Post types | Any registered public post type. |
| Language detection | Auto (Polylang → WPML → site locale), or pin one source. |
| Key strategy | posttype-id (default), posttype-slug, or permalink path. |
Document shape #
{
"collection": "example_com",
"key": "post-42",
"lang": "en_US",
"meta": {
"postType": ["post"],
"status": ["publish"],
"title": ["Hello world"],
"slug": ["hello-world"],
"permalink": ["https://example.com/hello-world/"],
"author": ["Jane Author"],
"publishedAt": ["2026-05-19T10:14:00+00:00"],
"categories": ["News"],
"tags": ["intro", "demo"]
},
"contentMd": "# Hello world\n\nHello world.\n"
}
contentMd runs the post body through the standard the_content filter, then strips tags — shortcodes, blocks, and oEmbed embeds are expanded first so the indexed text matches the rendered page.
Build & release #
The workflow .github/workflows/wordpress-plugin.yml runs composer audit + PHPCS (WordPress security ruleset) + PHPStan level 5 + PHPUnit on PHP 8.1 / 8.2 / 8.3 / 8.4 on every PR and push touching integrations/wordpress-plugin/**. The 8.3 leg enforces ≥90 % line coverage. Pushing a wp-v* tag builds the runtime zip and attaches it to a GitHub Release — that asset is what the in-plugin updater downloads.
8. GitHub Action → MDDB (CI sync) #
integrations/github-action/ — native Node 24 JavaScript action that ingests repository files into an MDDB collection on every push (or any other workflow trigger). Drop it into a workflow to keep an MDDB collection in sync with your docs/, README.md, OpenAPI specs, or any other text/markdown/JSON artefacts that live in git.
# .github/workflows/sync-docs.yml
name: Sync docs to MDDB
on:
push:
branches: [main]
paths: ['docs/**', 'README.md']
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: tradik/mddb/integrations/github-action@gha-v0
with:
mddb-url: https://mddb.tradik.com
api-key: ${{ secrets.MDDB_API_KEY }}
collection: project-docs
path: |
docs/**/*.md
README.md
ignore: docs/draft/**
key-prefix: ${{ github.repository }}/
Inputs #
| Input | Default | Description |
|---|---|---|
mddb-url |
https://mddb.tradik.com |
MDDB base URL. |
api-key |
(empty) | Bearer token (vk_…). |
collection |
required | Target MDDB collection. |
path |
**/*.md |
Newline-separated globs (inline ! for negation). |
ignore |
(empty) | Newline-separated exclude globs. |
key-strategy |
path |
path (slug of relative path), hash (sha1 of content), filename (basename). |
key-prefix |
(empty) | Prefix every key — useful when several repos share one collection. |
concurrency |
8 |
Parallel /v1/add requests. |
dry-run |
false |
Walk + build documents without contacting MDDB. |
fail-on-error |
true |
Set to false to demote upload failures to job warnings. |
Outputs #
documents-scanned, documents-added, documents-failed.
Document shape #
A file at docs/guide/intro.md containing # Hello produces:
{
"collection": "project-docs",
"key": "tradik/mddb/docs/guide/intro.md",
"lang": "en_US",
"meta": {
"source": ["github-action"],
"path": ["docs/guide/intro.md"],
"extension": [".md"],
"size": ["7"],
"repository": ["tradik/mddb"],
"ref": ["<commit sha>"]
},
"contentMd": "# Hello"
}
Markdown and plain-text (.md, .markdown, .mdx, .txt, .rst, .adoc) are stored verbatim. JSON / YAML / TOML / HTML / CSS / JS / TS / Python / Go / Rust / Bash files are wrapped in a fenced code block with the matching language so FTS + vector indexing recognise the structure.
Tests & release #
57 unit tests with 90%+ Jest coverage (statements / branches / functions / lines). The workflow .github/workflows/github-action.yml runs format check + ESLint + Jest with coverage on a Node 24 & 26 matrix, rebuilds dist/ and asserts it matches the committed bundle (verify-dist), and dry-runs the action against the integration's own README (smoke). Pushing a gha-v* tag verifies package.json.version, force-moves floating gha-v<major> / gha-v<major>.<minor> tags, and publishes a GitHub Release — so consumers can pin to @gha-v0, @gha-v0.1, or @gha-v0.1.0.
9. Grafana → MDDB (Datasource plugin) #
integrations/grafana-datasource/ — native Grafana 10/11/12/13 datasource plugin that turns MDDB into a first-class panel source. Five query types map directly to MDDB endpoints, so a dashboard can mix MDDB content signals (hot documents, FTS results, metadata facets, event histograms) with Prometheus/Loki/Tempo on the same page.
Note: MDDB also exposes a Prometheus-compatible
/metricsendpoint for server-level metrics (request rate, latency, database size, embedding queue) — see docs/TELEMETRY. This plugin is the complement: it queries MDDB content, not Prometheus metrics.
Plugin ID & supported versions #
| Plugin ID | tradik-mddb-datasource |
| Type | Datasource (frontend-only, no backend Go binary) |
| Grafana | >=10.0.0 (tested against Grafana 13.0.1) |
Source: integrations/grafana-datasource/
Install #
# 1. Build the plugin
cd integrations/grafana-datasource && make build
# 2. Drop dist/ into Grafana's plugin directory
docker run --rm -p 3000:3000 \
-e GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=tradik-mddb-datasource \
-v "$(pwd)/dist:/var/lib/grafana/plugins/tradik-mddb-datasource" \
grafana/grafana:13.0.1
Or make docker to bake the plugin into a tradik/mddb-grafana-datasource:<version> image.
In Grafana: Configuration → Data sources → Add data source → MDDB, set the base URL (https://mddb.tradik.com), optional default collection, and a bearer API key — stored encrypted in secureJsonData. Save & test pings /v1/stats and distinguishes auth vs server vs network failures.
Query types #
| Query type | MDDB endpoint | Output shape | Best panel |
|---|---|---|---|
| Temporal histogram | POST /v1/temporal/histogram |
Time + count time-series | Time series |
| Hot documents | POST /v1/temporal/hot |
docId / accessCount / lastAccessAt table | Table / Bar chart |
| Metadata aggregate | POST /v1/aggregate |
value/count table or time bucket series | Pie / Bar / Time series |
| Full-text search | POST /v1/fts |
key / lang / score / highlight table | Table |
| Database stats | POST /v1/stats |
per-collection documents / revisions / embeddings | Stat / Table |
Dashboard time range is applied automatically as from / to (seconds). Grafana dashboard variables are interpolated into collection, query, and facetKey via getTemplateSrv().replace().
Example: temporal access histogram #
Datasource: MDDB
Query type: Temporal histogram (time-series)
Collection: blog
Event type: access
Interval: day
Yields a time series plottable on any Grafana time-series panel; combine with a documents per collection Prometheus query on the same dashboard to correlate ingest with reads.
Tests & release #
Pure-logic Jest tests on query.ts, transform.ts, client.ts, and datasource.ts enforce ≥90% coverage. make package produces a versioned plugin zip; tag-driven releases use grafana-v<version> and ship the zip as a GitHub Release asset for grafana-cli plugins install --pluginUrl or signing-service submission.
10. Chrome Extension → MDDB (Browser toolbar) #
integrations/chrome-extension/ — Manifest V3 Chrome extension that turns the browser toolbar into a live status panel for an MDDB instance. Configure a server URL and optional API key once, then see the total document count on the toolbar badge, a stats popup (documents / revisions / collections / mode / uptime + top-5 collections), and a one-click link to the MDDB admin panel.
Designed for developers and ops folks who already work in the browser — no terminal round-trip needed to see whether ingestion is flowing.
Install #
| Pre-built zip | Download mddb-browser-<version>.zip from releases, unzip, then Load unpacked in chrome://extensions (developer mode on). |
| From source | cd integrations/chrome-extension && make package → dist/mddb-browser-<version>.zip. |
| Minimum Chrome | 120 |
Options #
| Field | Notes |
|---|---|
| MDDB server URL | Base URL, e.g. https://mddb.tradik.com or http://localhost:11023. Stored in chrome.storage.local. |
| API key | Optional. Sent as X-API-Key. |
| Admin panel URL | Optional override. Defaults to <server-origin>:3000. |
| Background refresh | 30 – 3600 seconds, or 0 to disable the badge poll. |
Permissions & privacy #
Declares only storage + alarms. Host access is requested at save time for the configured server's origin only — no broad <all_urls> permission is asked up front. No analytics, no telemetry, no third-party calls. Bundled privacy policy and terms of use; canonical copies at tradik.com/privacy and tradik.com/terms.
Endpoints used #
| Method | Path | Purpose |
|---|---|---|
GET |
/v1/health |
"Test connection" button on the options page. |
GET |
/v1/stats |
Popup body + badge counter. |
Both are sent with credentials: 'omit'; the optional API key is forwarded as X-API-Key.
Tests & release #
98 Jest (jsdom) unit tests covering the client, refresh worker, popup/options DOM, and background service worker with ≥90% coverage enforced. The workflow .github/workflows/chrome-extension.yml runs format check + ESLint + tests with coverage on a Node 24 & 26 matrix, runs npm audit --omit=dev --audit-level=high, builds + packages the extension, smoke-validates the packaged manifest, and uploads the zip as an artefact. Pushing a chrome-ext-v<version> tag verifies that package.json and manifest.json versions match the tag, rebuilds + repackages from source, force-moves floating chrome-ext-v<major> / chrome-ext-v<major>.<minor> tags, and publishes a GitHub Release with the zip attached.
11. Full Pipeline: All Integrations Together #
Combine all tools for a complete content platform:
graph TB
subgraph p1["1. Content Sources"]
WP[WordPress] -->|wpexporter| WPEXP[wpexporter
markdown + meta]
FILES[PDF / DOCX / PPTX] -->|parse| DOCLING[Docling]
end
subgraph p2["2. MDDB - Central Hub"]
WPEXP -->|bulk import| MDDB[MDDB
:11023 / :11024]
DOCLING -->|markdown + chunks| MDDB
MDDB -->|primary store| BOLT[(BoltDB)]
MDDB -->|auto-embed| VEC[(Vector Index)]
MDDB -->|webhook sync| OS[(OpenSearch
scale search)]
end
subgraph p3["3. Orchestration and AI"]
LF[Langflow] -->|semantic search| MDDB
LF -->|BM25 / kNN| OS
LF -->|generate| LLM[LLM]
LLM --> LF
MDDB -->|MCP| CLAUDE[Claude Desktop]
end
subgraph p4["4. Output"]
MDDB -->|REST API| SSG[SSG
Static Site Generator]
SSG -->|HTML/CSS/JS| DEPLOY[GitHub Pages
Cloudflare
Netlify]
LF --> WEBAPP[Web App]
MDDB -->|REST| API[Custom Apps]
end
style WP fill:#21759b,color:#fff
style MDDB fill:#00d4aa,color:#000
style LLM fill:#d97706,color:#fff
style SSG fill:#7c3aed,color:#fff
style CLAUDE fill:#d97706,color:#fff
Step-by-Step #
- Import — wpexporter migrates WordPress content; Docling parses PDFs/DOCX into Markdown
- Store — MDDB stores all documents with metadata in BoltDB
- Index — MDDB indexes full text at once and embeds in the background; a copy can go to OpenSearch when one index must outgrow one machine (§3)
- Search — Langflow orchestrates RAG over MDDB's hybrid search (BM25 + vectors in one call); OpenSearch only where it holds what MDDB does not
- Answer — LLM generates answers from retrieved context, cites sources
- Publish — SSG renders static sites from MDDB collections, deploys to CDN
- Manage — Claude Desktop via MCP (116 tools), Panel UI, REST/gRPC APIs
When to Use What #
| Scenario | Recommendation |
|---|---|
| Migrate from WordPress | wpexporter → MDDB |
| Parse PDF/DOCX to Markdown | Docling → MDDB |
| Generate static website | MDDB → SSG |
| RAG, agents and search on one machine (measured to 2M vectors) | MDDB only |
| One index larger than a machine, custom analyzers, full aggregations | MDDB + OpenSearch (§3) |
| Existing Elasticsearch-style client code | MDDB /es subset (ELASTICSEARCH-COMPAT) |
| Visual workflow building | MDDB + Langflow |
| AI agent integration | MDDB MCP (116 tools, AGENTS) |
| AI-assisted migration | wpmcp + mddb-mcp via Claude |
| Full production pipeline | All together |
← Back to README · LLM Connections → · RAG Pipeline →
12. LangChain ⇄ MDDB (VectorStore, Retriever, Store) #
A developer choosing a retrieval backend inside LangChain picks from the list
that has an adapter. langchain-mddb puts MDDB on that list.
pip install "langchain-mddb[client]"
from langchain_mddb import MddbVectorStore
store = MddbVectorStore(collection="docs", address="localhost:11024")
store.add_texts(["Restart the service with systemctl."], [{"kind": "runbook"}])
retriever = store.as_retriever(search_kwargs={"k": 5, "filter": {"kind": "runbook"}})
It is a thin layer over clients/python — the
adapter's whole job is mapping LangChain's interface onto the client. Two places
where the two disagree, and which way this resolves them:
MDDB embeds server-side. LangChain's contract assumes the application owns
an embedding function and passes vectors in; MDDB is configured with a provider
and embeds on write. One model per collection rather than one per application,
and no vectors on the wire. similarity_search_by_vector raises rather than
quietly re-embedding with a different model, because a caller reaching for it
is usually trying to keep two systems in one vector space.
Hybrid is the default. LangChain's similarity_search means vector search;
MDDB's better answer for most corpora is a keyword/vector blend. Following the
framework here would mean the adapter returns worse results than the same
server queried directly. search_type="vector" gets the literal reading.
The store also exposes recommended_settings(), which asks the server how this
collection should be searched (SRCH-010) — choosing
search_type by hand is guessing, and the server has measured.
Filters translate equality and membership. Operator forms ({"$gt": ...})
raise rather than being dropped: a dropped condition silently widens the search.
Deep Agents filesystem backend #
MddbBackend gives a Deep Agents
agent its virtual filesystem in an MDDB collection: ls, read, write,
edit, glob, grep (literal, with line numbers), delete,
upload_files, download_files, plus history() — the revisions MDDB keeps
for every write.
from deepagents.backends import CompositeBackend, StateBackend
from langchain_mddb import MddbBackend
backend = CompositeBackend(
default=StateBackend(),
routes={"/memories/": MddbBackend(collection="agent-memory")},
)
edit writes back with the revision it read, so two subagents editing one
file cannot lose a change: one of them gets "changed since it was read" and
retries. Files are documents keyed by path, with path, dir and
dirPrefix metadata, so a listing is one indexed query and the same files
are searchable with full_text_search and semantic_search. Install with
pip install "langchain-mddb[client,deepagents]" (Python 3.11+).
LangGraph Store: long-term agent memory #
MddbStore implements LangGraph's BaseStore — the interface behind a
graph's long-term memory, Deep Agents' StoreBackend and LangMem — on one
MDDB collection (default langgraph_store). Sync and async: put, get,
delete, search, list_namespaces, batch.
from langchain_mddb import MddbStore
store = MddbStore(collection="agent-memory", address="localhost:11024",
ttl={"default_ttl": 60 * 24 * 30, "refresh_on_read": True})
store.put(("users", "u1", "semantic"), "tea", {"content": "Prefers green tea", "kind": "preference"})
store.search(("users", "u1"), query="what does the user drink?", limit=5) # hybrid, with score
store.search(("users", "u1"), filter={"kind": "preference"}) # newest first
store.list_namespaces(prefix=("users",), max_depth=2)
| LangGraph | MDDB |
|---|---|
| store | one collection |
namespace + key |
document key users/u1/semantic/tea (labels and key escaped: %, /, |) |
value |
content_md = the value as JSON (what the server embeds and full-text indexes) |
| namespace prefix | meta.nsPrefix = every prefix of meta.ns — one indexed equality filter |
filter={"kind": "x"} |
meta.value.kind = "x" (JSON-encoded, so 3 ≠ "3"); $eq too; $gt, $ne, nested or list values raise NotImplementedError |
search(query=...) |
HybridSearch, score = combined score; items put with index=False are left out |
search() without query |
Search sorted by updatedAt descending |
list_namespaces |
the distinct meta.ns values (GetMetaKeys), with prefix/suffix (* wildcard), max_depth, limit, offset |
| TTL (minutes) | SetTTL in seconds; refresh_on_read sets it again on get/search |
MDDB embeds server-side with the collection's provider, and it embeds the
stored value whole: index={"embed", "dims"} is accepted so a configuration
ports from another store, and fields other than ["$"] warn rather than
pretend to narrow it. Expiry is best-effort, as LangGraph describes it.
Memory types are namespaces, not API. The convention from LangMem:
| Memory | Namespace | Holds |
|---|---|---|
| semantic | ("users", user_id, "semantic") |
facts and preferences |
| episodic | ("users", user_id, "episodic") |
summaries of past interactions |
| procedural | ("agents", agent_id, "procedural") |
the agent's own instructions; a collection's responsePrompt (RAG-002) is the server-side counterpart |
store.search(("users", user_id)) then reads all of one user's memory, and
list_namespaces(prefix=("users",), max_depth=2) lists the users.
Deep Agents keeps an agent's files in the store with StoreBackend — one
namespace per user, so files persist across threads and never cross users:
from dataclasses import dataclass
from deepagents import create_deep_agent
from deepagents.backends import StoreBackend
from langchain_mddb import MddbStore
@dataclass
class Context:
user_id: str
store = MddbStore(collection="agent-files")
agent = create_deep_agent(
model=llm, # any tool-calling chat model
backend=StoreBackend(store=store, namespace=lambda rt: ("users", rt.context.user_id, "files")),
store=store,
context_schema=Context,
)
agent.invoke({"messages": [("user", "remember that I drink green tea")]},
{"configurable": {"thread_id": "t1"}}, context=Context(user_id="alice"))
# Another thread, same user: the files written in t1 are there.
agent.invoke({"messages": [("user", "what do I drink?")]},
{"configurable": {"thread_id": "t2"}}, context=Context(user_id="alice"))
Run locally against a live server (with a scripted model), the second thread
reads the file the first one wrote, and another user's namespace does not see
it. On LangGraph Platform the user comes from rt.server_info.user.identity
instead of the context.
Install with pip install "langchain-mddb[client,store]".