Skip to main content

Darwin RAG

A local-first RAG engine that ingests documents, indexes them with BM25 + dense embeddings, and exposes search via an MCP server for AI agent integration.

  • Ingestion — PDF, Markdown, HTML, images (OCR), CSV, Excel, ODS, URLs
  • Indexing — BM25 keyword + dense embedding hybrid index with configurable chunking strategies
  • Search — Hybrid, semantic, or keyword retrieval with reranking, diversity rerank, and structural penalties
  • Generation — LLM-backed answer synthesis via LiteLLM (OpenAI, Anthropic, Gemini, etc.)
  • Observability — Structured logging with per-session history, queryable via MCP
  • Isolation — Multiple independent stores for tenant/project separation
  • Deployment — stdio (AI agent subprocess), SSE, or Streamable HTTP; Docker-ready
  • Local-first — Everything runs locally, fully offline-capable after setup

Built by BrightDotDev.
License: MIT with Attribution


Quick Start

1. Install

pip install darwin-rag

2. Set up models

# Interactive — detects hardware, pick your models
darwin-admin setup interactive

# Or one-shot (embedding-only, no prompts)
darwin-admin setup --preset required

3. Start the MCP server & connect

# stdio mode — for AI agent subprocess (Claude Desktop, Cursor, etc.)
darwin mcp

# Or HTTP mode — for remote clients
darwin mcp --http --port 8765

Configure your MCP client:

{
  "mcpServers": {
    "darwin": {
      "command": "darwin",
      "args": ["mcp"],
      "env": {
        "OPENAI_API_KEY": "sk-..."  // At least one LLM provider key
      }
    }
  }
}

Or generate config automatically:

darwin config claude          # Claude Desktop config
darwin config cursor          # Cursor config
darwin config all --copy      # All clients + copy to clipboard

MCP Tools

Tool Description
search_darwin Query the knowledge base with hybrid/semantic/keyword search
search_lists Search structured data (CSVs, JSON arrays) by field values
get_search_results List saved search results
get_search_result_by_id Load a saved search result by filename
get_schema Inspect schemas for structured files (keys, types, record counts)
run_pipeline Ingest + index documents from a path or URL
purge_artifacts Delete pipeline artifacts for specific files
create_store Create a new isolated data store
list_files List all tracked files with pipeline status
file_status Detailed status for a single file across all stages
get_logs Query session logs (oldest first, INFO excluded)

Full documentation: docs/mcp.md


Remote / HTTP Mode

Start the server on a network-accessible endpoint:

# SSE transport (legacy)
darwin mcp --sse --host 0.0.0.0 --port 8765

# Streamable HTTP transport (recommended for production)
darwin mcp --http --host 0.0.0.0 --port 8765

Configure your MCP client with the URL:

{
  "mcpServers": {
    "darwin": {
      "url": "http://your-host:8765/mcp"  // or /sse for SSE mode
    }
  }
}

Environment Variables

Variable Required Description
OPENAI_API_KEY No* OpenAI provider key
ANTHROPIC_API_KEY No* Anthropic provider key
GEMINI_API_KEY No* Google Gemini provider key
MISTRAL_API_KEY No* Mistral AI provider key
GROQ_API_KEY No* Groq provider key
COHERE_API_KEY No* Cohere provider key
TOGETHER_API_KEY No* Together AI provider key
OPENROUTER_API_KEY No* OpenRouter provider key
DEEPSEEK_API_KEY No* DeepSeek provider key
DARWIN_BASE_DIR No Override the base data directory
NO_COLOR No Set to any value to disable ANSI color output

* At least one LLM provider key is required for answer generation. Search/indexing works without any.


Setup Details

Command What it does
darwin-admin setup interactive Guided setup — detect hardware, choose models
darwin-admin setup --preset required Download embedding model only (fastest)
darwin-admin setup --preset recommended Embedding + reranker + OCR models
darwin-admin setup logging Reconfigure logging only
darwin-admin setup validate Validate current setup

See docs/setup.md for the full walkthrough including Docker, from-source install, and API key configuration.


CLI Reference

darwin — User CLI

Command Description
darwin mcp Start MCP server (stdio, --sse or --http for network)
darwin config [client] Generate MCP client config

darwin-admin — Power-user CLI

Command Description
darwin-admin setup Setup models, logging, and configuration
darwin-admin status System status overview
darwin-admin models Model registry: list, install, switch, keys
darwin-admin store Data store: status, files, audit, health, repair
darwin-admin pipeline Ingestion pipeline: run, ingest, index, purge
darwin-admin search Interactive search
darwin-admin logs Structured log viewer and management
darwin-admin system System information
darwin-admin uninstall Remove Darwin data and configuration

See docs/admin.md for the full command reference.


Python API

For embedding darwin-rag as a library in your own app:

from core import Darwin

d = Darwin()
d.ingest("./papers", recursive=True)
results = d.search("what is this paper about")
records = d.search_records(filters={"status": "active"})

Full reference: docs/api.md


Documentation

Doc What
setup.md Full setup walkthrough
mcp.md MCP server, tools, resources, transports
admin.md Admin CLI reference
architecture.md For developers and contributors
pipeline.md Ingestion & indexing
retrieval.md Search engine
storage.md DarwinStore
models.md Model registry & inference
logger.md Structured logging
orchestrators.md High-level business logic
api.md Python API (Darwin class)

Contributing

Found a bug? Want to add something? You're welcome here.

  • Issues — open one at github.com/BrightDotDev/DARWIN/issues
  • Code — fork, branch, PR. Keep it minimal.
  • AI-generated code is fine — but you own what you ship. Test it before submitting.

Read CONTRIBUTING.md for the full guidelines.


License

MIT with Attribution — see LICENSE.

Core architecture and implementation by BrightDotDev.

Download files

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

Source Distribution

darwin_rag-0.2.18.tar.gz (342.1 kB view details)

Uploaded Source

Built Distribution

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

darwin_rag-0.2.18-py3-none-any.whl (392.3 kB view details)

Uploaded Python 3

File details

Details for the file darwin_rag-0.2.18.tar.gz.

File metadata

  • Download URL: darwin_rag-0.2.18.tar.gz
  • Upload date:
  • Size: 342.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for darwin_rag-0.2.18.tar.gz
Algorithm Hash digest
SHA256 01ca3237654baf6eea841392848835b1ff59df552d7f84f1561a526980339a7b
MD5 b78681b8cecdf9b2c94fe08315d0d40c
BLAKE2b-256 c44e46717ccbdc0b2c2ba190483ffdac4a5a62fed974b617cb78b25527a358a6

See more details on using hashes here.

File details

Details for the file darwin_rag-0.2.18-py3-none-any.whl.

File metadata

  • Download URL: darwin_rag-0.2.18-py3-none-any.whl
  • Upload date:
  • Size: 392.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for darwin_rag-0.2.18-py3-none-any.whl
Algorithm Hash digest
SHA256 d045a6f7e700df9ae69093a7e147e244add90715a2d23d2b1a0c967efc31f5d9
MD5 f2753cc7ccda052846174f38c5b5a2ad
BLAKE2b-256 733ded552ec9ecea512e8abed6f364a1e954923a72303cccb1e221c2d9e14427

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.18 This release

2 files

0.2.17

2 files

0.2.16

2 files

0.2.15

2 files

0.2.14

2 files

0.2.13

2 files

0.2.12

2 files

0.2.11

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.5

2 files

0.2.3

2 files

0.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page