Server data from the Official MCP Registry
State replay and self-debugging for AI agents. Track, replay, undo, checkpoint.
State replay and self-debugging for AI agents. Track, replay, undo, checkpoint.
Valid MCP server (2 strong, 2 medium validity signals). 2 known CVEs in dependencies (0 critical, 2 high severity) Package registry verified. Imported from the Official MCP Registry.
7 files analyzed ยท 3 issues found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
Add this to your MCP configuration file:
{
"mcpServers": {
"io-github-charo360-statecli": {
"args": [
"-y",
"statecli-mcp-server"
],
"command": "npx"
}
}
}From the project's GitHub README.
Give AI agents the ability to remember, replay, and undo their actions.
Agent Infrastructure | Memory Layer | Self-Awareness | Undo Capability
StateCLI is the memory and self-awareness layer for AI coding agents.
It gives agents three critical capabilities they lack:
๐ง Memory - Remember what they did (log, replay)
โฎ๏ธ Undo - Fix mistakes instantly (checkpoint, rollback)
๐๏ธ Self-Awareness - See their impact (track changes)
This isn't a dev tool. It's agent infrastructure.
AI agents are powerful but blind. They:
StateCLI fixes this:
Agent Thought: "I changed something but don't know what"
โ statecli_replay(entity) โ See exact changes
Agent Thought: "I broke something and need to undo"
โ statecli_undo(entity) โ Rollback instantly
Agent Thought: "I want to try something risky"
โ statecli_checkpoint(entity) โ Save first, rollback if needed
Agent Thought: "I need to understand my past behavior"
โ statecli_log(entity) โ View complete history
Start watching your project:
statecli watch start --auto-checkpoint
Now StateCLI automatically:
See what changed:
statecli diff --time 5m
Undo mistakes:
statecli undo
๐ Full Developer Guide
5 core tools for agent memory & self-awareness:
statecli_replay - Show what the agent just didstatecli_undo - Rollback mistakesstatecli_checkpoint - Save state before risky opsstatecli_log - View complete historystatecli_track - Track important state changesMCP Setup:
{
"mcpServers": {
"statecli": {
"command": "npx",
"args": ["-y", "statecli-mcp-server"]
}
}
}
# Global install
npm install -g statecli-mcp-server
# Start auto-tracking
cd your-project
statecli watch start --auto-checkpoint
STATECLI AGENT RULES โ READ BEFORE ANY ACTION
You are operating in a stateful, reversible environment.
Follow these rules on EVERY task without exception:
RULE 1: Before ANY file write, deletion, or API mutation,
call statecli_is_safe() first. If not safe, checkpoint first.
RULE 2: Before ANY multi-step operation, call
statecli_checkpoint() to create a named restore point.
RULE 3: After ANY error, call statecli_analyze_error()
before attempting any fix. Never guess. Always analyze.
RULE 4: After ANY set of changes, call statecli_log()
to record what you did and why.
Skipping these steps makes your actions irreversible.
statecli_track[CORE] Records any agent action with full metadata so it can be replayed, audited, or reversed later. Call this after every meaningful action you take โ file changes, API calls, decisions. If you don't track it, you cannot undo it. ๐ Trigger when: You completed any action (file written, API called, decision made, config changed). Think of this as your action journal. ๐ Chain with: statecli_checkpoint() before, statecli_replay() to review, statecli_undo() to reverse
statecli_replay[CORE] Replays the full history of actions taken on any entity โ a file, a session, a task. Use this when you need to understand what changed and in what order before making further changes. Essential before debugging. ๐ Trigger when: You need to understand what has already been done to an entity. You're about to debug. A human asks 'what did you change?' ๐ Chain with: statecli_log() to see summary, statecli_undo() to reverse specific steps
statecli_undo[CORE] Reverses the last action or a named action on an entity, restoring it to its previous state. This is your safety net. Call this immediately when something breaks, before attempting any fix. ๐ Trigger when: Something broke. A test failed after your change. A human says 'revert that'. You made a mistake and need to roll back. ๐ Chain with: statecli_preview_undo() first to see what will change, statecli_checkpoint() before retrying
statecli_checkpoint[CORE] Creates a named, reversible snapshot of an entity's current state. Call this BEFORE any risky operation โ refactors, deletions, multi-file changes, API mutations. A checkpoint costs nothing. An unrecoverable mistake costs everything. ๐ Trigger when: You are ABOUT TO modify any file, database, or external service. You are starting a multi-step task. The human says 'be careful with this'. ๐ Chain with: statecli_predict_impact() to assess risk first, statecli_undo() or statecli_is_safe() after
statecli_log[CORE] Writes a structured audit entry describing what the agent did, why, and what state it left things in. Call this at the end of every task or significant action. Required for compliance, debugging, and human oversight. ๐ Trigger when: You completed a task or a phase of work. Any time a human might later ask 'what did you do here?' ๐ Chain with: statecli_track() for individual actions, statecli_replay() to review history
statecli_track_file[FILE] Begins continuous monitoring of a specific file, capturing every write, modification, and deletion with timestamps. Call before touching any important file. Without this, file changes are invisible to the undo system. ๐ Trigger when: You are about to read and then modify a file. Any important file is being worked on. The human references a specific file path. ๐ Chain with: statecli_checkpoint() first, statecli_file_history() to review, statecli_undo() to revert
statecli_file_history[FILE] Returns the complete change history of a tracked file โ every version, every diff, every agent that touched it. Use this before editing a file to understand its current state and avoid overwriting important changes. ๐ Trigger when: Before editing any file. When debugging why a file has unexpected content. Before a code review. ๐ Chain with: statecli_replay() for full session context, statecli_undo() to restore a previous version
statecli_analyze_error[ERROR] Analyzes an error by examining recent action history to identify what change caused it. Call this BEFORE attempting any fix. Never guess at the cause of an error โ analyze it first. Returns probable cause and suggested recovery steps. ๐ Trigger when: ANY error occurs. A test fails. An API returns unexpected results. ALWAYS call this before attempting to fix anything. ๐ Chain with: statecli_auto_recover() for automatic fix, statecli_undo() to revert the causative change
statecli_auto_recover[ERROR] Automatically attempts to recover from an error by reversing the change that caused it and restoring the last known good state. Call after statecli_analyze_error() confirms the root cause. Faster and safer than manual debugging. ๐ Trigger when: statecli_analyze_error() has identified the cause and you want the system to auto-fix it. ๐ Chain with: statecli_analyze_error() first always, statecli_safe_execute() to retry the action safely
statecli_safe_execute[ERROR] Wraps any operation in automatic checkpoint-before and undo-on-failure logic. The safest way to execute any risky action. If the operation fails, it automatically reverts. Use this for any action you're uncertain about. ๐ Trigger when: You are about to do something you are not 100% confident about. Any destructive or external operation. ๐ Chain with: statecli_predict_impact() to assess risk, statecli_analyze_error() if it fails
statecli_run_tests[TEST] Runs the relevant test suite and records pass/fail history against the current state. Call after any code change to verify nothing broke. Tracks test results over time so you can see when tests started failing. ๐ Trigger when: After any code modification. Before finalizing any change. When a human asks 'did you break anything?' ๐ Chain with: statecli_test_impact() to know WHICH tests to run first, statecli_undo() if tests fail
statecli_test_impact[TEST] Identifies exactly which tests are affected by your changes โ so you run the right tests, not all tests. Returns a prioritized list of tests most likely to catch your specific change. Saves time, catches errors faster. ๐ Trigger when: After making any code change, before running tests. When you need to know the blast radius of your edit. ๐ Chain with: statecli_run_tests() with the returned test list, statecli_predict_impact() for broader analysis
statecli_suggest_tests[TEST] Analyzes your change and suggests new tests that should be written to cover it. Call after adding new functionality. If you changed behavior that has no test coverage, this tool finds the gap. ๐ Trigger when: After adding new features or changing behavior. Before considering a task complete. ๐ Chain with: statecli_test_impact() to check existing coverage, statecli_run_tests() to verify
statecli_analyze_dependencies[DEPS] Scans a file or module and returns all upstream and downstream dependencies โ what it depends on and what depends on it. Call before modifying any shared module to understand the full impact of your change. ๐ Trigger when: Before modifying any file that might be imported or used elsewhere. Before any refactor. ๐ Chain with: statecli_dependency_tree() for visual map, statecli_predict_impact() for change risk score
statecli_dependency_tree[DEPS] Returns a full dependency tree for a module โ all the way up and down the import chain. Use this to understand complex codebases before making changes. Essential for refactoring shared utilities. ๐ Trigger when: Before touching core or shared utilities. When the codebase is unfamiliar. Before a major refactor. ๐ Chain with: statecli_find_circular() to catch dependency loops, statecli_analyze_dependencies() for detail
statecli_find_circular[DEPS] Detects circular dependencies that could cause import errors or infinite loops. Run this before adding any new import or restructuring modules. Circular dependencies are silent bugs that break production. ๐ Trigger when: Before adding any new import statement. After any restructuring of modules. When debugging mysterious import errors. ๐ Chain with: statecli_dependency_tree() for full context, statecli_analyze_dependencies() to fix
statecli_predict_impact[IMPACT] Predicts which files, services, and systems will be affected by a proposed change โ before you make it. Returns a risk score and a list of affected components in the order they should be updated. Call this before any change that touches shared code. ๐ Trigger when: Before ANY change to a shared file, utility, or API. Before renaming functions. Before refactoring. Before you are unsure. ๐ Chain with: statecli_is_safe() for quick check, statecli_checkpoint() before proceeding, statecli_safe_change_order() for sequence
statecli_is_safe[IMPACT] Quick safety check โ returns true/false on whether a proposed action is safe to execute without a checkpoint. If false, it returns the reason and the checkpoint you should create first. Always call this when uncertain. ๐ Trigger when: ANY time you are about to do something you are not 100% sure is safe. Think of this as your safety gate. ๐ Chain with: statecli_checkpoint() if not safe, statecli_predict_impact() for full risk detail
statecli_preview_undo[IMPACT] Shows exactly what will change if you call statecli_undo() โ without actually doing it. Call this before any undo operation to verify you are reverting the right thing. Prevents accidentally undoing the wrong action. ๐ Trigger when: Before calling statecli_undo(). Any time a human asks 'what will happen if we revert this?' ๐ Chain with: statecli_undo() after confirming the preview is correct
statecli_memory_query[MEMORY] Queries memory across sessions to answer historical questions. Call this when you need context about past work. If you don't check memory, you might repeat mistakes. ๐ Trigger when: You need context from a previous session or day. A human asks about past actions. ๐ Chain with: statecli_recent_activity() for broad context.
statecli_recent_activity[MEMORY] Returns a structured summary of recent actions across the project. Call this when starting a new session to gain context. Without it, you lack situational awareness. ๐ Trigger when: Resuming work after a break. When you need to summarize recent overall progress. ๐ Chain with: statecli_memory_query() to drill down.
statecli_session_info[MEMORY] Returns metadata about current and past working sessions. Call this to distinguish work sessions. Without it, you cannot segment history easily. ๐ Trigger when: You need to tag work to a specific period or verify current session state. ๐ Chain with: statecli_memory_query() for session details.
statecli_git_status[GIT] Retrieves and tracks current git branch and uncommitted changes. Call this at the start of any git workflow. Without this, git operations are untracked. ๐ Trigger when: Starting work on a tracked repo. Before making commits. ๐ Chain with: statecli_git_checkpoint() to save state.
statecli_git_history[GIT] Compares changes between git commits. Call this to understand codebase evolution. Missing this means missing architectural context. ๐ Trigger when: Reviewing git history. Understanding why a file changed over time. ๐ Chain with: statecli_file_history() for specific files.
statecli_git_checkpoint[GIT] Creates a checkpoint anchored to current git state. Call this before risky git operations. Prevents detached head disasters. ๐ Trigger when: Before rebasing, merging, or complex git commands. ๐ Chain with: statecli_git_status() to verify clean state first.
statecli_simulate_undo[IMPACT] Simulates an undo operation, returning the side-effects without writing. Used for safety. If skipped, you risk unintended consequences. ๐ Trigger when: Reverting multiple steps or dealing with interconnected changes. ๐ Chain with: statecli_preview_undo() for diff generation, statecli_undo() to execute.
statecli_safe_change_order[IMPACT] Calculates the optimal, lowest-risk sequence for modifying multiple files. Prevents cascading compilation errors. ๐ Trigger when: Modifying multiple interdependent files in one overarching task. ๐ Chain with: statecli_predict_impact() for details, statecli_track() to log the set.
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"statecli": {
"command": "npx",
"args": ["-y", "statecli-mcp-server"]
}
}
}
Ctrl + Shift + P โ type Open MCP Config{
"mcpServers": {
"statecli": {
"command": "npx",
"args": ["-y", "statecli-mcp-server"]
}
}
}
Ctrl + Shift + P โ Reload Window)Add to your MCP configuration:
{
"mcpServers": {
"statecli": {
"command": "npx",
"args": ["-y", "statecli-mcp-server"]
}
}
}
Minimal working example for autonomous agents:
// Agent debug loop with StateCLI
try {
await agent.run(task);
} catch (error) {
// Get replay of what just happened
const replay = await mcp.call("statecli_replay", {
entity: `task:${task.id}`,
actor: "ai-agent"
});
// Analyze what went wrong
const analysis = await llm.analyze({
replay: replay.result,
error: error.message,
prompt: "What went wrong in this sequence?"
});
// Undo if fixable
if (analysis.canRetry) {
await mcp.call("statecli_undo", {
entity: `task:${task.id}`,
steps: 1
});
// Retry with fix
await agent.runWithFix(task, analysis.fix);
}
}
All MCP tool outputs are JSON-stable and safe for autonomous agents.
Example statecli_replay output:
{
"entity": "order:7421",
"changes": [
{
"timestamp": "2025-01-07T10:23:45Z",
"step": 1,
"before": { "status": null },
"after": { "status": "pending" },
"actor": "ai-agent"
}
],
"summary": "2 state changes found",
"suggested_next_actions": ["investigate step 2", "check for errors"]
}
const replay = await statecli_replay({ entity: "task:123" });
await statecli_checkpoint({ entity: "order:7421", name: "before-refund" });
await agent.processRefund(order);
const history = await statecli_log({
entity: "order:*",
actor: "ai-agent",
since: "24h ago"
});
await statecli_track({ entity: "task:123", state: {...} });
const log = await statecli_log({ entity: "task:123" });
npx -y statecli-mcp-server
npm install -g statecli-mcp-server
# Track a state change
statecli track order 7421 '{"status": "pending"}'
# Replay changes
statecli replay order:7421
# View log
statecli log order:7421
# Create checkpoint
statecli checkpoint order:7421 before-refund
# Undo last change
statecli undo order:7421
MIT - Free for all use including commercial AI agents
StateCLI - Self-awareness for AI agents
When agents can see what they did, undo mistakes, and learn from history, they become truly autonomous.
state-management, state-replay, time-travel-debugging, undo, rollback, checkpoint, agent-memory, agent-introspection, self-debugging, ai-agent-tools, mcp-server, model-context-protocol, autonomous-agents, agent-observability, state-tracking, langchain-tools, autogpt-plugins, crewai-tools
Be the first to review this server!
by Modelcontextprotocol ยท Developer Tools
Read, search, and manipulate Git repositories programmatically
by Toleno ยท Developer Tools
Toleno Network MCP Server โ Manage your Toleno mining account with Claude AI using natural language.
by mcp-marketplace ยท Developer Tools
Create, build, and publish Python MCP servers to PyPI โ conversationally.
by Microsoft ยท Content & Media
Convert files (PDF, Word, Excel, images, audio) to Markdown for LLM consumption
by mcp-marketplace ยท Developer Tools
Scaffold, build, and publish TypeScript MCP servers to npm โ conversationally
by mcp-marketplace ยท Finance
Free stock data and market news for any MCP-compatible AI assistant.