cfgit
cfgit
Git-style version control for records that live in your database, without moving them.
cfgit gives history, diff, rollback, tags, promotion between environments and drift detection to the records that drive your system at runtime: agent configs, prompts, model routing, feature flags, pricing and policy tables. Your app keeps reading the same MongoDB or Postgres store, and scripts and admin tools can keep writing it. cfgit sits beside it, records every change it makes, and refuses to overwrite a change it did not record.
Try it in one command (nothing to set up: it brings its own throwaway database, about 10 seconds):
uvx --python 3.12 --from 'cfgit[demo]' cfg demoWhat you get
Drift detection.
cfg statusshows records someone changed outside cfgit;cfg diffshows what changed; keep it (adopt) or throw it away (restore --discard-drift).Safe writes. Every commit is transactional and compare-and-swap guarded, and confirmed by the database before it is reported. Partial edits with
cfg set, previews with--dry-run.Impact before you write. Which other records and which lines of code (
file:line) use a record, a risk level, and optional LLM narration (Claude, OpenAI or Gemini).Rollback and releases. Tags, restore to a tag or a point in time, and
cfg promotebetween dev and prod through the target's own rules.Built for agents. An MCP server with dry runs, strict arguments and self-explaining results, plus a skill for Claude Code and Codex.
Also: branches and PRs over live records, a local web UI, Slack/webhook notifications, write-time validation, secret stripping, and verified identity per environment.
Good for curated control-plane data edited by people and agents. Not for user content, events, logs or high-write tables.
Related MCP server: Postgres MCP
Use it from an agent
Or from a terminal (each installs the MCP server and the cfgit skill):
# Claude Code
claude plugin install cfgit --marketplace AusafMo/cfgit
# Codex
codex plugin marketplace add AusafMo/cfgit
codex plugin add cfgit@cfgitClaude Desktop: the button downloads
cfgit.mcpb. Open it and pick your.cfg.toml.Any other MCP client: run
uvx --from 'cfgit[mcp,mongo,postgres]' cfg-mcpover stdio withCFG_CONFIGset to your.cfg.toml.ChatGPT and claude.ai on the web only connect to remote MCP servers; cfgit runs locally beside your database, so they can't use it.
All the options, with copy buttons, are on the install page. What agents should know: docs/AGENTS.md.
Install
pip install 'cfgit[mongo,postgres,mcp]' # or just [mongo] / [postgres]Quick start
# .cfg.toml
[project]
name = "control-plane"
[[collection]]
name = "agent_configs"
id_field = "config_id"
[env.dev]
database = "mongo"
uri = "env:DEV_MONGODB_URI"
db = "my-dev-db"cfg init && cfg doctor # history store; secret / size check
cfg import --all -m "initial import" # start tracking
cfg status # anything changed outside cfgit?
cfg set agent_configs:planner model=fast --dry-run
cfg set agent_configs:planner model=fast -m "faster planner"
cfg log agent_configs:planner
cfg restore agent_configs:planner @1 -m "roll back"
cfg ui # local web UIDocumentation
Doc | What's inside |
Why cfgit, setup, everyday flows, UI, agents, impact, safety model | |
Every command with examples | |
| |
MCP server, client setup, what agents should know | |
Identity modes, tokens and permissions | |
MongoDB and Postgres details | |
Reading cfgit history from your own tools | |
Changes between versions | |
Everything else |
License
Apache-2.0. See LICENSE, NOTICE and CREDITS.md.
Available Tools
33 toolscfg_addA
Create a record: insert the live doc and record version 1 in one transaction. Refuses if a live doc with that id exists. A record removed with cfg_rm can be added again.
Inputs: record (required), message (required), doc_json (required), env, +5 more. Returns: object
cfg_adoptA
Accept an out-of-band live change: record the current live doc as a new version (record or all_records). Inspect it first with cfg_diff(a="=HEAD", b="=live"). To throw the change away instead, use cfg_restore(record, ref="=HEAD", discard_drift=true).
Inputs: env, author, record, dry_run, +4 more. Returns: object
cfg_branch_createB
Create a draft branch (writes branch metadata only; does not mutate runtime).
Inputs: name (required), env, author, message, +2 more. Returns: object
cfg_branch_deleteB
Delete a draft branch and its branch commits.
Inputs: name (required), env, author, dry_run, +1 more. Returns: object
cfg_branch_diffC
Compare a branch against another branch (or main) at the record level.
Inputs: range (required), env, author, config_file. Returns: object
cfg_branch_listA
List cfgit branches (requires [branches] enabled).
Inputs: env, author, config_file. Returns: object
cfg_branch_logC
List the commit history of a branch.
Inputs: branch (required), env, limit, author, +1 more. Returns: object
cfg_bulk_commitB
Commit multiple full documents as one batch intent.
`items` may be either:
[{"record":"collection:id","doc":{...}}, ...]
{"collection:id": {...}, ...}, or a JSON string in either shape.
Set dry_run=true to preview every record's delta (would_commit / noop / changed_outside_cfgit)
without writing; recommended before a collection-scale replace.
Inputs: items (required), message (required), env, author, +7 more. Returns: object
cfg_check_updateA
Check PyPI for a newer cfgit release. Call this at the start of a cfgit session; if
data.update_available is true and not data.snoozed, tell the user the new version and
offer to upgrade (pip install -U cfgit) or to snooze. NEVER upgrade for them.
Pass `snooze_days` (e.g. 30) to record a "don't ask again for N days" snooze when the user
asks to be reminded later. Best-effort and fail-silent; honors CFGIT_NO_UPDATE_CHECK.
Inputs: snooze_days. Returns: object
cfg_commitA
Replace a record with a full document (drift-guarded, versioned). Read it first with cfg_show ref="=live", edit that doc, and pass its oid as expected_live_oid. dry_run=true returns state="would_commit" with the field-level delta (on a branch: against the branch's current draft), the records and code that reference this record, and writes nothing.
Inputs: record (required), message (required), doc_json (required), expected_live_oid (required), +9 more. Returns: object
cfg_diffC
Show the field-level diff of a record between two refs.
Inputs: record (required), a, b, env, +2 more. Returns: object
cfg_doctorA
Read-only preflight before import/commit: reports secret-deny matches, oversized fields, and key issues per collection, with paste-ready secret_fields / ignore_fields snippets. Writes nothing.
Inputs: env, author, record, config_file, +1 more. Returns: object
cfg_exportA
Read-only snapshot of live documents into a portable, re-importable artifact. Pass a record for one, or omit it to export every configured collection. Each item is stamped with its cfgit head seq/oid. Feed the result back to cfg_import(from_export=...) to restore.
Inputs: env, author, record, config_file. Returns: object
cfg_fsckC
Check cfgit history/heads integrity and report any inconsistencies.
Inputs: env, author, config_file. Returns: object
cfg_identity_hashA
Hash a private identity token for .cfg.toml setup.
Prefer the local CLI for real human secrets:
`printf '%s' '<token>' | cfg identity-hash --stdin`.
Inputs: token (required). Returns: object
cfg_impactA
What a change touches: changed paths, risk, other records that mention this id, and file:line places code reads it (collection code_refs). Default compares =HEAD to =live (drift). Pass doc_json (a proposed full document) to see the impact of a change BEFORE writing it. use_llm adds provider narration (opt-in).
Inputs: record (required), a, b, env, +7 more. Returns: object
cfg_importA
Start tracking live records (record or all_records), or restore documents from a
cfg_export artifact via from_export (writes them back through the drift-guarded bulk-commit
path). dry_run=true previews either form (would_import / per-record delta) without writing.
Inputs: env, author, record, dry_run, +7 more. Returns: object
cfg_initC
Initialize cfgit history/heads (and branch refs if enabled) for the configured env.
Inputs: env, author, config_file. Returns: object
cfg_logB
List the commit history of a record, newest first. Each entry has seq, oid, op, author,
recorded_at, message, tags and changes (field-level diff vs the previous version).
Inputs: record (required), env, limit, since, +2 more. Returns: object
cfg_pr_closeA
Close a cfgit pull request without merging.
Inputs: id (required), env, author, config_file. Returns: object
cfg_pr_createC
Open a cfgit pull request from a head branch into a base branch.
Inputs: head (required), message (required), env, base, +2 more. Returns: object
cfg_pr_listC
List cfgit pull requests.
Inputs: env, author, status, config_file. Returns: object
cfg_pr_mergeB
Merge an open PR through the shared action layer.
Multi-record PRs use the adapter batch-atomic merge path. If that guarantee
is unavailable, the envelope returns `atomicity_unavailable` and runtime is
left unchanged.
Inputs: id (required), env, author, dry_run, +3 more. Returns: object
cfg_promoteA
Copy a record's version (or every record with a tag) from one env to another through the target's normal commit/add path. promote_ignore, ignored and secret fields keep the target's values; the target history records where the version came from. Preview with dry_run first.
Inputs: to_env (required), message (required), from_env (required), ref, +8 more. Returns: object
cfg_pr_showA
Show a cfgit pull request: its base/head branches, status and the records it touches. Use cfg_branch_diff(range="..") for the field-level changes.
Inputs: id (required), env, author, config_file. Returns: object
cfg_recent_historyC
Return recent cfgit history entries across all configured records.
Inputs: env, limit, author, config_file. Returns: object
cfg_restoreA
Restore one record (record + ref) or the whole system (tag or as_of) to a prior version, through the drift-guarded write path. A system restore never deletes: records created after the target point are reported (not_in_tag / did_not_exist) and left live; use cfg_rm for them. Preview with dry_run first.
Inputs: env, ref, tag, as_of, +7 more. Returns: object
cfg_rmA
Delete a record's live doc and record a tombstone version carrying the last doc. Refuses (state=blocked_by_references, also on dry_run) when other records or code (code_refs) mention the id, unless force. cfg_restore with record + ref "@" brings it back.
Inputs: record (required), message (required), env, force, +3 more. Returns: object
cfg_setA
Partial edit: set fields by dotted path, append to / remove from arrays. Computed from the current live doc atomically (no read needed; a concurrent write returns stale_base, just rerun). Drift-guarded and versioned. dry_run=true previews the delta and references.
Inputs: record (required), message (required), assignments (required), env, +6 more. Returns: object
cfg_showA
A record's document at a ref, as Extended JSON ({"$date": ...}, {"$numberDecimal": ...},
{"$oid": ...}) so it can be edited and sent back to cfg_commit unchanged in type. oid is
that version's hash: pass it as cfg_commit's expected_live_oid when ref is =live.
Inputs: record (required), env, ref, author, +1 more. Returns: object
cfg_statusC
Report drift: which live records changed outside cfgit vs their recorded head.
Inputs: env, author, record, config_file. Returns: object
cfg_tagA
Label every record's current version with a tag: a rollback point for cfg_restore(tag=...) and a release set for cfg_promote(tag=...).
Inputs: name (required), env, force, author, +1 more. Returns: object
cfg_whoamiC
Report the resolved identity, env, database, permission role, and identity mode.
Inputs: env, author, config_file. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 33 tools
Most tools target clearly distinct resources/actions, and the descriptions actively differentiate overlapping areas such as drift comparison, impact analysis, and branch diff. The main ambiguity is among the several mutating paths (cfg_set, cfg_commit, cfg_bulk_commit, cfg_import, cfg_adopt, cfg_restore), but their scopes are mostly clarified.
All tools share a cfg_ prefix and are readable, but conventions are mixed: action-first names like cfg_show and cfg_diff coexist with resource-first names like cfg_branch_list and cfg_pr_create. Noun-like names such as cfg_status, cfg_doctor, and cfg_fsck also break a strict verb_noun pattern.
With 33 tools, the surface is heavy for a config-versioning server, especially after adding five branch tools and five PR tools. Each tool appears purposeful, but the count exceeds a well-scoped range and increases selection burden.
The set covers record lifecycle, history, drift detection, import/export, promotion, tags, branches, PRs, integrity checks, and identity setup. Minor gaps remain, such as no obvious record/collection listing or search tool and no tag-listing operation.
Maintenance
Related MCP Connectors
Versioned agent memory in your own Postgres: portable context, permissioned, audit trail.
Zendesk configuration management for AI agents: propose, review, apply and roll back changes.
Versioned memory for agents: markdown docs with history, safe concurrent commits, human claim links.
Git-backed platform for skills, tools, and context for AI agents
Related MCP Servers
- AlicenseBqualityFmaintenanceAn MCP server that enables users to create and manage MongoDB Atlas clusters, users, and network access through natural language commands.614MIT
- AlicenseAqualityCmaintenancePostgres Pro is an open source Model Context Protocol (MCP) server built to support you and your AI agents throughout the entire development process—from initial coding, through testing and deployment, and to production tuning and maintenance.93,504MIT
- AlicenseAqualityBmaintenanceChange tracking for AI-era codebases. AI agents call it to log structured change events (entity + diff + reasoning) before the session ends, then query history with diff, blame, history, changeset, and search. Captures the intent that would otherwise evaporate.8248 PyPI27MIT
- AlicenseNot gradedqualityDmaintenanceProvides a memory layer for AI coding agents with Git-powered version control, enabling automatic tracking of prompts, context, and code diffs.194MIT