Skip to content

CSDb Persistent Investigation Database MCP Server

elb-pr edited this page Apr 7, 2026 · 2 revisions

CSDb: Persistent Investigation Database (MCP Server)

The Claude Sleuth Database (CSDb) is a specialized Model Context Protocol (MCP) server that provides a persistent, structured storage layer for all investigation data. Unlike local file-based storage, CSDb ensures that entities, relationships, timelines, and analytical notes survive across different Claude sessions and environments.

Built as a Cloudflare Worker backed by a D1 (SQLite) database, CSDb acts as the single source of truth for the intelligence cycle, enforcing referential integrity and data schemas at the point of entry.

Core Purpose

The primary role of CSDb is to move investigation state out of the LLM's ephemeral context window and into a durable relational structure. This allows an analyst to:

  • Resume Investigations: Load progress and notebooks exactly where they were left off.
  • Maintain Integrity: Ensure every entity is linked to a source grade and every relationship is grounded in evidence.
  • Query Complex Links: Use graph-like tools to find neighbors and connections within the data.

System Architecture: Natural Language to Code Entity Space

The following diagram illustrates how natural language investigation concepts (left) map to specific code entities and database tables within the CSDb architecture (right).

CSDb Entity Mapping

graph LR
    subgraph "Natural Language Space"
        A["'Who is this person?'"]
        B["'How are they linked?'"]
        C["'When did this happen?'"]
        D["'Where is the proof?'"]
        E["'My current thoughts'"]
    end

    subgraph "Code Entity Space (server/)"
        A --> T1["table: entities"]
        B --> T2["table: relationships"]
        C --> T3["table: timeline_events"]
        D --> T4["table: evidence_register"]
        E --> T5["table: notebook"]

        T1 --- F1["add_entity()"]
        T2 --- F2["add_relationship()"]
        T3 --- F3["add_timeline_event()"]
        T4 --- F4["register_evidence()"]
        T5 --- F5["save_notebook()"]
    end
Loading

High-Level Capabilities

CSDb exposes 26 MCP tools categorized into functional domains that correspond to the investigation phases.

Domain Purpose Key Code Symbols
Investigation Case lifecycle management create_investigation, list_investigations, load_investigation
Entities POLE entity management add_entity, search_entities, update_entity
Relationships Link analysis & Graphing add_relationship, get_neighbors, search_relationships
Timeline Chronological matrix add_timeline_event, get_timeline
Source Grading Admiralty 6x6 enforcement record_grade
Persistence Session state management save_progress, save_notebook, load_progress

Data Flow & Interaction Model

The following diagram shows the interaction between the Claude LLM, the MCP Server (Worker), and the D1 Database.

CSDb Data Flow

sequenceDiagram
    participant C as Claude (LLM)
    participant W as worker.js (MCP Server)
    participant D as D1 Database (SQLite)

    C->>W: Call Tool (e.g., "add_entity")
    Note over W: Validate Schema &<br/>Generate ID (PFX)
    W->>D: INSERT INTO entities (...)
    D-->>W: Success
    W-->>C: Return Entity ID (e.g., "P-123")
    
    C->>W: Call Tool ("save_progress")
    W->>D: UPSERT INTO progress (...)
    D-->>W: Success
Loading

Sub-Pages

Detailed instructions for deploying the CSDb server. This covers the "One-Click Deploy" button for Cloudflare Workers, manual configuration via wrangler.jsonc, and the use of server/setup.sh for local D1 database initialization.

  • Key Files: server/setup.sh, server/wrangler.jsonc, server/README.md

A technical reference for the underlying D1 SQL schema and the complete MCP toolset. This page explains the 12 POLE entity types, the Admiralty 6x6 grading constraints in the source_grades table, and the specific JSON schemas required for each tool call.

  • Key Files: server/schema.sql, server/worker.js, skills/claude-sleuth/assets/database-usage.md,

Clone this wiki locally