chronicle-mcp
# chronicle-mcp
**chronicle-mcp** is a local Model Context Protocol (MCP) server providing persistent, queryable memory for Crusader Kings II tabletop-style roleplaying sessions. It equips AI agents with direct tools to log and retrieve characters, timeline events, and lore documents ("tomes"), backed entirely by plain JSON files on disk.
## Features & Safe Upsert Behavior
- **Explicit ID Upserting**: Calling `upsert_character` or `upsert_tome` without an `id` always creates a new record with a fresh ID, even if an existing character or tome shares the same name/title (crucial for tabletop RP campaigns with recurring or dynastic names across generations).
- **Lookup Helpers**: Use `find_character_by_name` or `find_tome_by_title` to search for existing records and retrieve their `id` before performing updates with `upsert_*`.
- **Standardized Responses**: All tool responses follow a consistent `{ success: boolean, ...data, message?: string }` shape.
- **Robust Storage**: Fast in-memory cached reads paired with ~300ms debounced disk writes and automatic recovery for corrupted JSON files.
## Setup
1. Install dependencies:
```bash
npm install
```
2. Build the project:
```bash
npm run build
```
## Running the Smoke Test
To run the complete automated smoke test suite (including isolated CRUD, non-overwriting upsert checks, and corrupt file recovery tests) against a temporary scratch directory (`./data-test/`), run:
```bash
npm run test:smoke
```
## Antigravity CLI Registration
Register `chronicle-mcp` in your Antigravity CLI configuration (global at `~/.gemini/config/mcp_config.json` or project-level at `.agents/mcp_config.json`):
```json
{
"mcpServers": {
"chronicle": {
"command": "node",
"args": ["/path/to/chronicle-mcp/build/index.js"],
"env": {
"CHRONICLE_DATA_DIR": "/path/to/chronicle-mcp/data"
}
}
}
}
```
*(Replace `/path/to/chronicle-mcp` with the absolute path to your local `chronicle-mcp` installation directory).*
## Data & Backups
All persistent campaign memory is stored in three plain JSON files inside the `data/` directory (`characters.json`, `timeline.json`, and `tomes.json`). Creating a full backup of your RP campaign is as simple as copying or committing the `data/` folder. You can also customize the data storage location by setting the `CHRONICLE_DATA_DIR` environment variable in your `mcp_config.json`.
"# chronicle-mcp"
TDQS
Scored across 44 tools
Three redundant pairs exist: get_tome/find_tome_by_title, get_character/find_character_by_name, and get_house/find_house_by_name, where the get_* tools already accept exact titles/names, so an agent can easily pick the wrong one. Similarly, list_commands vs list_skills and the many upsert_* vs update_* tools have overlapping intents that rely on descriptions alone to separate.
Nearly all 44 tools follow a snake_case verb_noun pattern (get_character, upsert_tome, delete_house, list_threads). The only wrinkle is inconsistent verb choice for creation: create_campaign, upsert_character, and log_timeline_event all mean 'make a new record', which is a minor deviation from an otherwise predictable scheme.
At 44 tools this is well past the heavy threshold for what is essentially one domain (campaign state management). The per-entity surfaces (tomes, characters, houses, threads) multiply the same five operations across resources, and the redundant find_* lookups add count without adding capability.
Characters, houses, tomes, threads, and the timeline all have full list/get/upsert/delete coverage, which is good. But campaigns lack get-by-id, update, and delete (only create/set_active/list), and secrets have upsert/list but no get_secret or delete_secret, leaving real lifecycle gaps.