KiwiFS can import rows from relational and document databases, converting each record into a markdown page with structured frontmatter.
PostgreSQL
kiwifs import --from postgres \
--dsn "postgres://user:pass@localhost:5432/mydb" \
--table users \
--prefix people/ \
--root ./knowledge
Options
| Flag | Description |
|---|
--dsn | PostgreSQL connection string (required) |
--table | Table name |
--query | Custom SQL query (overrides --table) |
--columns | Comma-separated fields to include |
--prefix | Path prefix in KiwiFS (default: table name) |
--limit | Max rows to import |
--dry-run | Preview without writing |
kiwifs import --from postgres \
--dsn "postgres://user:pass@localhost/mydb" \
--query "SELECT id, name, email FROM users WHERE active = true" \
--prefix active-users/
MySQL
kiwifs import --from mysql \
--dsn "user:pass@tcp(localhost:3306)/mydb" \
--table articles \
--prefix articles/
Same flags as PostgreSQL. The DSN format follows Go’s mysql driver convention.
SQLite
kiwifs import --from sqlite \
--db ./data.db \
--table entries \
--prefix entries/
| Flag | Description |
|---|
--db | Path to SQLite database file (required) |
--table | Table name |
--query | Custom SQL query (overrides --table) |
MongoDB
kiwifs import --from mongodb \
--uri "mongodb://localhost:27017" \
--database myapp \
--collection articles \
--prefix articles/
| Flag | Description |
|---|
--uri | MongoDB connection URI (required) |
--database | Database name (required) |
--collection | Collection name (required) |
Firestore
kiwifs import --from firestore \
--project my-gcp-project \
--collection users \
--prefix users/
| Flag | Description |
|---|
--project | GCP project ID (required) |
--collection | Firestore collection name (required) |
Firestore requires Google Cloud credentials. Set GOOGLE_APPLICATION_CREDENTIALS or run within a GCP environment.
DynamoDB
kiwifs import --from dynamodb \
--table my-table \
--region us-east-1 \
--prefix dynamo/
| Flag | Description |
|---|
--table | DynamoDB table name (required) |
--region | AWS region (required) |
--prefix | Path prefix in KiwiFS |
--limit | Max items to import |
Uses your default AWS credentials (~/.aws/credentials, AWS_PROFILE, or IAM role).
Redis
kiwifs import --from redis \
--addr "localhost:6379" \
--pattern "article:*" \
--prefix redis/
| Flag | Description |
|---|
--addr | Redis address (default: localhost:6379) |
--password | Redis password |
--redis-db | Redis database number (default: 0) |
--pattern | Key glob pattern to import (default: *) |
--prefix | Path prefix in KiwiFS |
Each matching key becomes a markdown page. Hash keys become frontmatter fields; string values become the page body.
Elasticsearch
kiwifs import --from elasticsearch \
--url "http://localhost:9200" \
--table my-index \
--prefix search/
| Flag | Description |
|---|
--url | Elasticsearch URL (required) |
--table | Index name (required) |
--query | Elasticsearch query JSON (optional, defaults to match-all) |
--prefix | Path prefix in KiwiFS |
--limit | Max documents to import |
MCP usage
All database imports are also available via the kiwi_import MCP tool:
{
"tool": "kiwi_import",
"arguments": {
"from": "postgres",
"dsn": "postgres://user:pass@localhost/mydb",
"table": "users",
"prefix": "people/",
"dry_run": true
}
}
Use dry_run: true to preview what would be imported before writing any files.
Each imported record becomes a markdown file:
---
_imported_at: "2026-04-25T18:46:15Z"
_source: users
_source_id: pg:users:42
name: Jane Doe
email: jane@example.com
role: admin
---
# Jane Doe
> Auto-imported from users (row pg:users:42)
Re-importing the same data is idempotent — KiwiFS compares _source_id and field values, skipping unchanged records.