-
Notifications
You must be signed in to change notification settings - Fork 4
CSDb Persistent Investigation Database MCP Server
The following files were used as context for generating this wiki page:
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 skills/claude-sleuth/assets/database-usage.md:1-3.
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 skills/claude-sleuth/assets/database-usage.md:81-86.
- Maintain Integrity: Ensure every entity is linked to a source grade and every relationship is grounded in evidence skills/claude-sleuth/assets/database-usage.md:70-75.
- Query Complex Links: Use graph-like tools to find neighbors and connections within the data server/worker.js:2-2.
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
Sources: server/schema.sql:14-139, server/worker.js:2-2, skills/claude-sleuth/assets/database-usage.md:11-60
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
|
Sources: server/README.md:27-39, server/worker.js:2-2
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
Sources: server/worker.js:2-4, server/schema.sql:14-30, skills/claude-sleuth/assets/database-usage.md:70-75
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.mdserver/README.md:5-21
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.mdserver/schema.sql:1-140, server/worker.js:2-2