cfgit
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CFG_CONFIG | Yes | Path to your .cfg.toml configuration file; set when running the cfg-mcp server over stdio with any other MCP client. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
cfgit versions live database records (Mongo documents / Postgres rows) like git: every write goes through a drift-guarded, transactional path and becomes a history version you can diff, promote and restore. The database stays the source of truth; nothing here edits it raw.
Addressing: records are "collection:id". Refs: =live (what the database holds now), =HEAD
(last recorded version), @, tag:, or an oid prefix. env picks the database from
.cfg.toml and defaults to "dev": pass env explicitly for anything else, and confirm with the
user before writing to a production env.
Every tool returns {status, code, message, data, state, next}. status ("ok" | "dirty" |
"error" | "commit_unknown" | ...) and state are authoritative: a refusal is a normal result
(status "dirty"/"error"), not an MCP error. MCP-level errors only mean bad arguments (unknown
or missing arguments are rejected). next explains a refusal: next.actions are ready tool
calls ({tool, args}); next.commands are the same in CLI spelling. An action marked
"writes": true changes data: preview it with dry_run and confirm with the user before running
it. Writes to an env marked needs_approval carry a warnings entry: get the user's go first.
A plain string that looks like a date on a new field is stored as text and comes back with a
warnings entry; send {"$date": ...} for a date. This server is pinned to the .cfg.toml it
started with; leave config_file unset.
Workflow:
cfg_status (drift: changed_outside_cfgit = someone wrote outside cfgit), cfg_diff to look.
Partial edits: cfg_set (dotted paths,
field+=/field-=for arrays). It recomputes from live atomically, so no read is needed.Whole-document edits: cfg_show(ref="=live") -> edit that doc -> cfg_commit(doc_json, expected_live_oid=). Commit REPLACES the record; a doc missing fields is refused (fields_removed) unless allow_remove_fields=true.
Values keep their stored type only as Extended JSON: {"$date": "...Z"}, {"$numberDecimal": "1.50"}, {"$oid": "..."}. cfg_show and cfg_export emit it; a plain ISO string over a stored date is refused (type_change_blocked) rather than silently changing the type.
Preview before writing: dry_run=true on cfg_commit / cfg_set / cfg_import / cfg_promote / cfg_rm / cfg_restore / cfg_adopt / cfg_pr_merge / cfg_branch_delete writes nothing and shows the delta plus the records and code (file:line) that reference the record. cfg_impact(record, doc_json=) gives the full impact report (risk, references, optional LLM narration) before a write; without doc_json it compares two stored refs (by default the drift, =HEAD to =live).
Drift: accept it with cfg_adopt, or discard it with cfg_restore(record, ref="=HEAD", discard_drift=true) (the discarded doc is kept in history).
Releases: cfg_tag a rollback point, cfg_promote(from_env, to_env, record or tag) to copy recorded versions between envs, cfg_restore(tag=...) to roll back.
A stale_base result means another write landed first: re-read and redo your edit (cfg_set: just rerun). commit_unknown means the database lost the commit acknowledgement: check cfg_log for the seq in data.records before retrying. Always pass a real
message: it is the history entry's reason.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| cfg_whoamiC | Report the resolved identity, env, database, permission role, and identity mode. |
| cfg_initC | Initialize cfgit history/heads (and branch refs if enabled) for the configured env. |
| cfg_statusC | Report drift: which live records changed outside cfgit vs their recorded head. |
| 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. |
| cfg_importA | Start tracking live records (record or all_records), or restore documents from a
|
| 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. |
| cfg_diffC | Show the field-level diff of a record between two refs. |
| 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). |
| 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. |
| cfg_bulk_commitB | Commit multiple full documents as one batch intent. |
| 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. |
| cfg_logB | List the commit history of a record, newest first. Each entry has seq, oid, op, author,
recorded_at, message, tags and |
| cfg_recent_historyC | Return recent cfgit history entries across all configured records. |
| 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. |
| cfg_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. |
| 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. |
| 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. |
| 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). |
| 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. |
| 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=...). |
| cfg_branch_listA | List cfgit branches (requires [branches] enabled). |
| cfg_branch_createB | Create a draft branch (writes branch metadata only; does not mutate runtime). |
| cfg_branch_deleteB | Delete a draft branch and its branch commits. |
| cfg_branch_diffC | Compare a branch against another branch (or main) at the record level. |
| cfg_branch_logC | List the commit history of a branch. |
| cfg_pr_createC | Open a cfgit pull request from a head branch into a base branch. |
| cfg_pr_listC | List cfgit pull requests. |
| 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. |
| cfg_pr_closeA | Close a cfgit pull request without merging. |
| cfg_pr_mergeB | Merge an open PR through the shared action layer. |
| cfg_fsckC | Check cfgit history/heads integrity and report any inconsistencies. |
| cfg_identity_hashA | Hash a private identity token for .cfg.toml setup. |
| cfg_check_updateA | Check PyPI for a newer cfgit release. Call this at the start of a cfgit session; if
|
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
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.