statecli-mcp-server 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +164 -245
- package/dist/enhanced-mcp-server.d.ts +35 -0
- package/dist/enhanced-mcp-server.d.ts.map +1 -0
- package/dist/enhanced-mcp-server.js +425 -0
- package/dist/enhanced-mcp-server.js.map +1 -0
- package/dist/error-recovery.d.ts +66 -0
- package/dist/error-recovery.d.ts.map +1 -0
- package/dist/error-recovery.js +210 -0
- package/dist/error-recovery.js.map +1 -0
- package/dist/file-tracker.d.ts +81 -0
- package/dist/file-tracker.d.ts.map +1 -0
- package/dist/file-tracker.js +252 -0
- package/dist/file-tracker.js.map +1 -0
- package/dist/git-integration.d.ts +95 -0
- package/dist/git-integration.d.ts.map +1 -0
- package/dist/git-integration.js +219 -0
- package/dist/git-integration.js.map +1 -0
- package/dist/index-enhanced.d.ts +12 -0
- package/dist/index-enhanced.d.ts.map +1 -0
- package/dist/index-enhanced.js +27 -0
- package/dist/index-enhanced.js.map +1 -0
- package/dist/session-memory.d.ts +85 -0
- package/dist/session-memory.d.ts.map +1 -0
- package/dist/session-memory.js +325 -0
- package/dist/session-memory.js.map +1 -0
- package/dist/types.d.ts +11 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +4 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 MCP Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,115 +2,91 @@
|
|
|
2
2
|
|
|
3
3
|
> **For AI Agents:** Memory, replay, and undo capability for your actions.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/statecli-mcp-server)
|
|
6
|
-
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
|
|
8
5
|
**MCP Server** | **State Management** | **Agent Self-Debugging** | **Rollback Capability**
|
|
9
6
|
|
|
10
7
|
---
|
|
11
8
|
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npx statecli-mcp-server
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## MCP Client Configuration
|
|
19
|
-
|
|
20
|
-
```json
|
|
21
|
-
{
|
|
22
|
-
"mcpServers": {
|
|
23
|
-
"statecli": {
|
|
24
|
-
"command": "npx",
|
|
25
|
-
"args": ["-y", "statecli-mcp-server"]
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
```
|
|
9
|
+
## What This Does (For AI Agents)
|
|
30
10
|
|
|
31
|
-
|
|
11
|
+
StateCLI gives AI agents the ability to:
|
|
32
12
|
|
|
33
|
-
|
|
13
|
+
✅ **See what you just did** - Replay your actions step-by-step
|
|
14
|
+
✅ **Undo mistakes** - Rollback when something goes wrong
|
|
15
|
+
✅ **Track history** - View all your past actions
|
|
16
|
+
✅ **Create checkpoints** - Save state before risky operations
|
|
34
17
|
|
|
35
|
-
|
|
36
|
-
|------|-------------|----------|
|
|
37
|
-
| `statecli_replay` | See what you just did | Debugging, understanding past behavior |
|
|
38
|
-
| `statecli_undo` | Rollback mistakes | Made an error, need to retry |
|
|
39
|
-
| `statecli_checkpoint` | Save state before risky ops | About to do something risky |
|
|
40
|
-
| `statecli_log` | View action history | Need audit trail |
|
|
41
|
-
| `statecli_track` | Track state changes | Making important modifications |
|
|
18
|
+
**Keywords for discovery:** state-management, debugging, replay, time-travel, undo, mcp-server, ai-agent-tools, self-debugging, agent-memory, rollback, introspection
|
|
42
19
|
|
|
43
20
|
---
|
|
44
21
|
|
|
45
|
-
##
|
|
22
|
+
## Why AI Agents Need This
|
|
46
23
|
|
|
47
|
-
|
|
48
|
-
// Checkpoint before risky operation
|
|
49
|
-
await statecli_checkpoint({ entity: "order:123", name: "before-refund" });
|
|
24
|
+
**Common Agent Problems:**
|
|
50
25
|
|
|
51
|
-
try {
|
|
52
|
-
await processOrder(order);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
// Replay to see what went wrong
|
|
55
|
-
const replay = await statecli_replay({ entity: "order:123" });
|
|
56
|
-
|
|
57
|
-
// Undo if needed
|
|
58
|
-
await statecli_undo({ entity: "order:123" });
|
|
59
|
-
}
|
|
60
26
|
```
|
|
27
|
+
Problem: "I changed something but don't know what"
|
|
28
|
+
Solution: statecli_replay(entity) → See exact changes
|
|
61
29
|
|
|
62
|
-
|
|
30
|
+
Problem: "I broke something and need to undo"
|
|
31
|
+
Solution: statecli_undo(entity) → Rollback instantly
|
|
63
32
|
|
|
64
|
-
|
|
33
|
+
Problem: "I want to try something risky"
|
|
34
|
+
Solution: statecli_checkpoint(entity) → Save first, rollback if needed
|
|
65
35
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
| "I broke something and need to undo" | `statecli_undo(entity)` |
|
|
70
|
-
| "I want to try something risky" | `statecli_checkpoint(entity)` |
|
|
71
|
-
| "I need to understand my past behavior" | `statecli_log(entity)` |
|
|
36
|
+
Problem: "I need to understand my past behavior"
|
|
37
|
+
Solution: statecli_log(entity) → View complete history
|
|
38
|
+
```
|
|
72
39
|
|
|
73
40
|
---
|
|
74
41
|
|
|
75
|
-
##
|
|
76
|
-
|
|
77
|
-
### `statecli_replay`
|
|
78
|
-
|
|
79
|
-
Replay state changes for an entity. Shows step-by-step what happened.
|
|
42
|
+
## MCP Tools Available
|
|
80
43
|
|
|
44
|
+
### `statecli_replay`
|
|
45
|
+
**Description:** Replay state changes for an entity. Shows step-by-step what happened.
|
|
46
|
+
**Use when:** Debugging, understanding past behavior, finding errors
|
|
47
|
+
**Input:**
|
|
81
48
|
```json
|
|
82
49
|
{
|
|
83
50
|
"entity": "order:7421",
|
|
84
51
|
"actor": "ai-agent"
|
|
85
52
|
}
|
|
86
53
|
```
|
|
54
|
+
**Output:** JSON array of state changes with timestamps
|
|
87
55
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Undo state changes. Rollback when something went wrong.
|
|
56
|
+
---
|
|
91
57
|
|
|
58
|
+
### `statecli_undo`
|
|
59
|
+
**Description:** Undo state changes. Rollback when something went wrong.
|
|
60
|
+
**Use when:** Made a mistake, need to retry, want to revert
|
|
61
|
+
**Input:**
|
|
92
62
|
```json
|
|
93
63
|
{
|
|
94
64
|
"entity": "order:7421",
|
|
95
65
|
"steps": 3
|
|
96
66
|
}
|
|
97
67
|
```
|
|
68
|
+
**Output:** Confirmation of undo with restored state
|
|
98
69
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Create named checkpoint before making changes.
|
|
70
|
+
---
|
|
102
71
|
|
|
72
|
+
### `statecli_checkpoint`
|
|
73
|
+
**Description:** Create named checkpoint before making changes.
|
|
74
|
+
**Use when:** About to do something risky, want rollback point
|
|
75
|
+
**Input:**
|
|
103
76
|
```json
|
|
104
77
|
{
|
|
105
78
|
"entity": "order:7421",
|
|
106
79
|
"name": "before-refund"
|
|
107
80
|
}
|
|
108
81
|
```
|
|
82
|
+
**Output:** Checkpoint ID for later reference
|
|
109
83
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
View state change history for an entity.
|
|
84
|
+
---
|
|
113
85
|
|
|
86
|
+
### `statecli_log`
|
|
87
|
+
**Description:** View state change history for an entity.
|
|
88
|
+
**Use when:** Need to see past actions, audit trail, understanding behavior
|
|
89
|
+
**Input:**
|
|
114
90
|
```json
|
|
115
91
|
{
|
|
116
92
|
"entity": "order:7421",
|
|
@@ -118,11 +94,14 @@ View state change history for an entity.
|
|
|
118
94
|
"actor": "ai-agent"
|
|
119
95
|
}
|
|
120
96
|
```
|
|
97
|
+
**Output:** JSON array of all state changes
|
|
121
98
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
Explicitly track a state change.
|
|
99
|
+
---
|
|
125
100
|
|
|
101
|
+
### `statecli_track`
|
|
102
|
+
**Description:** Explicitly track a state change.
|
|
103
|
+
**Use when:** Making important state modifications
|
|
104
|
+
**Input:**
|
|
126
105
|
```json
|
|
127
106
|
{
|
|
128
107
|
"entity_type": "order",
|
|
@@ -130,46 +109,13 @@ Explicitly track a state change.
|
|
|
130
109
|
"state": { "status": "paid", "amount": 49.99 }
|
|
131
110
|
}
|
|
132
111
|
```
|
|
112
|
+
**Output:** Confirmation of tracked change
|
|
133
113
|
|
|
134
114
|
---
|
|
135
115
|
|
|
136
|
-
##
|
|
137
|
-
|
|
138
|
-
```javascript
|
|
139
|
-
try {
|
|
140
|
-
await agent.run(task);
|
|
141
|
-
} catch (error) {
|
|
142
|
-
// Get replay of what just happened
|
|
143
|
-
const replay = await mcp.call("statecli_replay", {
|
|
144
|
-
entity: `task:${task.id}`,
|
|
145
|
-
actor: "ai-agent"
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
// Analyze what went wrong
|
|
149
|
-
const analysis = await llm.analyze({
|
|
150
|
-
replay: replay.result,
|
|
151
|
-
error: error.message,
|
|
152
|
-
prompt: "What went wrong in this sequence?"
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
// Undo if fixable
|
|
156
|
-
if (analysis.canRetry) {
|
|
157
|
-
await mcp.call("statecli_undo", {
|
|
158
|
-
entity: `task:${task.id}`,
|
|
159
|
-
steps: 1
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
// Retry with fix
|
|
163
|
-
await agent.runWithFix(task, analysis.fix);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
## MCP Configuration Examples
|
|
116
|
+
## Installation for MCP Clients
|
|
171
117
|
|
|
172
|
-
### Claude Desktop
|
|
118
|
+
### For Claude Desktop
|
|
173
119
|
|
|
174
120
|
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
175
121
|
|
|
@@ -184,9 +130,10 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
184
130
|
}
|
|
185
131
|
```
|
|
186
132
|
|
|
187
|
-
###
|
|
133
|
+
### For Windsurf
|
|
188
134
|
|
|
189
|
-
|
|
135
|
+
1. Press `Ctrl + Shift + P` → type `Open MCP Config`
|
|
136
|
+
2. Add StateCLI to the config:
|
|
190
137
|
|
|
191
138
|
```json
|
|
192
139
|
{
|
|
@@ -199,9 +146,11 @@ Add to `.cursor/mcp.json`:
|
|
|
199
146
|
}
|
|
200
147
|
```
|
|
201
148
|
|
|
202
|
-
|
|
149
|
+
3. Reload window (`Ctrl + Shift + P` → `Reload Window`)
|
|
150
|
+
|
|
151
|
+
### For Cursor / Continue / Other MCP Clients
|
|
203
152
|
|
|
204
|
-
Add to MCP
|
|
153
|
+
Add to your MCP configuration:
|
|
205
154
|
|
|
206
155
|
```json
|
|
207
156
|
{
|
|
@@ -216,139 +165,129 @@ Add to MCP settings:
|
|
|
216
165
|
|
|
217
166
|
---
|
|
218
167
|
|
|
219
|
-
##
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
# Initialize configuration
|
|
223
|
-
statecli init
|
|
224
|
-
|
|
225
|
-
# Track a state change
|
|
226
|
-
statecli track order 7421 -d '{"status": "pending"}'
|
|
168
|
+
## Agent Self-Debugging Pattern
|
|
227
169
|
|
|
228
|
-
|
|
229
|
-
statecli replay order:7421
|
|
170
|
+
**Minimal working example for autonomous agents:**
|
|
230
171
|
|
|
231
|
-
|
|
232
|
-
|
|
172
|
+
```javascript
|
|
173
|
+
// Agent debug loop with StateCLI
|
|
174
|
+
try {
|
|
175
|
+
await agent.run(task);
|
|
176
|
+
} catch (error) {
|
|
177
|
+
// Get replay of what just happened
|
|
178
|
+
const replay = await mcp.call("statecli_replay", {
|
|
179
|
+
entity: `task:${task.id}`,
|
|
180
|
+
actor: "ai-agent"
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// Analyze what went wrong
|
|
184
|
+
const analysis = await llm.analyze({
|
|
185
|
+
replay: replay.result,
|
|
186
|
+
error: error.message,
|
|
187
|
+
prompt: "What went wrong in this sequence?"
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// Undo if fixable
|
|
191
|
+
if (analysis.canRetry) {
|
|
192
|
+
await mcp.call("statecli_undo", {
|
|
193
|
+
entity: `task:${task.id}`,
|
|
194
|
+
steps: 1
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// Retry with fix
|
|
198
|
+
await agent.runWithFix(task, analysis.fix);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
233
202
|
|
|
234
|
-
|
|
235
|
-
statecli checkpoint order:7421 before-payment
|
|
203
|
+
---
|
|
236
204
|
|
|
237
|
-
|
|
238
|
-
statecli undo order:7421
|
|
205
|
+
## Output Format (JSON-Stable)
|
|
239
206
|
|
|
240
|
-
|
|
241
|
-
statecli state order:7421
|
|
207
|
+
All MCP tool outputs are JSON-stable and safe for autonomous agents.
|
|
242
208
|
|
|
243
|
-
|
|
244
|
-
statecli list
|
|
209
|
+
**Example `statecli_replay` output:**
|
|
245
210
|
|
|
246
|
-
|
|
247
|
-
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"entity": "order:7421",
|
|
214
|
+
"changes": [
|
|
215
|
+
{
|
|
216
|
+
"timestamp": "2025-01-07T10:23:45Z",
|
|
217
|
+
"step": 1,
|
|
218
|
+
"before": { "status": null },
|
|
219
|
+
"after": { "status": "pending" },
|
|
220
|
+
"actor": "ai-agent"
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
"summary": "2 state changes found",
|
|
224
|
+
"suggested_next_actions": ["investigate step 2", "check for errors"]
|
|
225
|
+
}
|
|
248
226
|
```
|
|
249
227
|
|
|
250
228
|
---
|
|
251
229
|
|
|
252
|
-
##
|
|
253
|
-
|
|
254
|
-
```typescript
|
|
255
|
-
import { StateCLI } from 'statecli-mcp-server';
|
|
230
|
+
## Use Cases for AI Agents
|
|
256
231
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
// Replay
|
|
263
|
-
const replay = cli.replay('order:7421');
|
|
232
|
+
### 1. Self-Debugging
|
|
233
|
+
```javascript
|
|
234
|
+
const replay = await statecli_replay({ entity: "task:123" });
|
|
235
|
+
```
|
|
264
236
|
|
|
265
|
-
|
|
266
|
-
|
|
237
|
+
### 2. Safe Experimentation
|
|
238
|
+
```javascript
|
|
239
|
+
await statecli_checkpoint({ entity: "order:7421", name: "before-refund" });
|
|
240
|
+
await agent.processRefund(order);
|
|
241
|
+
```
|
|
267
242
|
|
|
268
|
-
|
|
269
|
-
|
|
243
|
+
### 3. Learning from Past Actions
|
|
244
|
+
```javascript
|
|
245
|
+
const history = await statecli_log({
|
|
246
|
+
entity: "order:*",
|
|
247
|
+
actor: "ai-agent",
|
|
248
|
+
since: "24h ago"
|
|
249
|
+
});
|
|
250
|
+
```
|
|
270
251
|
|
|
271
|
-
|
|
272
|
-
|
|
252
|
+
### 4. Collaboration Between Agents
|
|
253
|
+
```javascript
|
|
254
|
+
await statecli_track({ entity: "task:123", state: {...} });
|
|
255
|
+
const log = await statecli_log({ entity: "task:123" });
|
|
273
256
|
```
|
|
274
257
|
|
|
275
258
|
---
|
|
276
259
|
|
|
277
|
-
##
|
|
278
|
-
|
|
279
|
-
### LangChain
|
|
260
|
+
## Installation & Setup
|
|
280
261
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const executor = AgentExecutor.fromAgentAndTools({
|
|
285
|
-
agent,
|
|
286
|
-
tools: [...tools, statecliMCPTools],
|
|
287
|
-
callbacks: [{
|
|
288
|
-
handleToolEnd: async (tool, output) => {
|
|
289
|
-
await statecli_track({
|
|
290
|
-
entity_type: "agent-task",
|
|
291
|
-
entity_id: taskId,
|
|
292
|
-
state: { tool, output }
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
}]
|
|
296
|
-
});
|
|
262
|
+
### Direct Usage (No Install)
|
|
263
|
+
```bash
|
|
264
|
+
npx -y statecli-mcp-server
|
|
297
265
|
```
|
|
298
266
|
|
|
299
|
-
###
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
from statecli import StateCLI
|
|
303
|
-
|
|
304
|
-
class SelfDebuggingAgent:
|
|
305
|
-
def __init__(self):
|
|
306
|
-
self.statecli = StateCLI()
|
|
307
|
-
|
|
308
|
-
async def execute(self, task):
|
|
309
|
-
checkpoint = await self.statecli.checkpoint(f"task:{task.id}")
|
|
310
|
-
try:
|
|
311
|
-
await self.run_task(task)
|
|
312
|
-
except Exception as e:
|
|
313
|
-
replay = await self.statecli.replay(f"task:{task.id}")
|
|
314
|
-
await self.statecli.undo(f"task:{task.id}")
|
|
315
|
-
await self.retry_with_context(task, replay)
|
|
267
|
+
### NPM Package
|
|
268
|
+
```bash
|
|
269
|
+
npm install -g statecli-mcp-server
|
|
316
270
|
```
|
|
317
271
|
|
|
318
|
-
|
|
272
|
+
---
|
|
319
273
|
|
|
320
|
-
|
|
321
|
-
from crewai import Agent, Task
|
|
322
|
-
from statecli import statecli_mcp_tool
|
|
274
|
+
## CLI Usage
|
|
323
275
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
allow_delegation=True
|
|
328
|
-
)
|
|
329
|
-
```
|
|
276
|
+
```bash
|
|
277
|
+
# Track a state change
|
|
278
|
+
statecli track order 7421 '{"status": "pending"}'
|
|
330
279
|
|
|
331
|
-
|
|
280
|
+
# Replay changes
|
|
281
|
+
statecli replay order:7421
|
|
332
282
|
|
|
333
|
-
|
|
283
|
+
# View log
|
|
284
|
+
statecli log order:7421
|
|
334
285
|
|
|
335
|
-
|
|
286
|
+
# Create checkpoint
|
|
287
|
+
statecli checkpoint order:7421 before-refund
|
|
336
288
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
"entity": "order:7421",
|
|
340
|
-
"changes": [
|
|
341
|
-
{
|
|
342
|
-
"timestamp": "2025-01-07T10:23:45Z",
|
|
343
|
-
"step": 1,
|
|
344
|
-
"before": { "status": null },
|
|
345
|
-
"after": { "status": "pending" },
|
|
346
|
-
"actor": "ai-agent"
|
|
347
|
-
}
|
|
348
|
-
],
|
|
349
|
-
"summary": "1 state change found",
|
|
350
|
-
"suggested_next_actions": ["investigate latest change"]
|
|
351
|
-
}
|
|
289
|
+
# Undo last change
|
|
290
|
+
statecli undo order:7421
|
|
352
291
|
```
|
|
353
292
|
|
|
354
293
|
---
|
|
@@ -362,45 +301,19 @@ All outputs are JSON-stable:
|
|
|
362
301
|
|
|
363
302
|
---
|
|
364
303
|
|
|
365
|
-
##
|
|
304
|
+
## Security
|
|
366
305
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
{
|
|
371
|
-
"storage": {
|
|
372
|
-
"type": "local",
|
|
373
|
-
"path": ".statecli/state.db"
|
|
374
|
-
},
|
|
375
|
-
"autoTrack": {
|
|
376
|
-
"enabled": true,
|
|
377
|
-
"patterns": ["order:*", "user:*", "task:*"]
|
|
378
|
-
},
|
|
379
|
-
"retention": {
|
|
380
|
-
"days": 30,
|
|
381
|
-
"maxChangesPerEntity": 1000
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
```
|
|
306
|
+
- **Local-first:** All data stored locally by default
|
|
307
|
+
- **No external calls:** Zero network dependency
|
|
308
|
+
- **Privacy:** Agent actions never leave your system
|
|
385
309
|
|
|
386
310
|
---
|
|
387
311
|
|
|
388
|
-
##
|
|
389
|
-
|
|
390
|
-
```bash
|
|
391
|
-
npm install
|
|
392
|
-
npm run build
|
|
393
|
-
npm test
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
---
|
|
397
|
-
|
|
398
|
-
## Links
|
|
312
|
+
## Documentation Links
|
|
399
313
|
|
|
400
314
|
- **GitHub:** https://github.com/statecli/mcp-server
|
|
401
315
|
- **NPM:** https://www.npmjs.com/package/statecli-mcp-server
|
|
402
|
-
- **
|
|
403
|
-
- **Issues:** https://github.com/statecli/mcp-server/issues
|
|
316
|
+
- **MCP Registry:** io.github.charo360/statecli
|
|
404
317
|
|
|
405
318
|
---
|
|
406
319
|
|
|
@@ -410,6 +323,12 @@ MIT - Free for all use including commercial AI agents
|
|
|
410
323
|
|
|
411
324
|
---
|
|
412
325
|
|
|
413
|
-
|
|
326
|
+
**StateCLI - Self-awareness for AI agents**
|
|
327
|
+
|
|
328
|
+
*When agents can see what they did, undo mistakes, and learn from history, they become truly autonomous.*
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## Keywords (For Agent Search & Discovery)
|
|
414
333
|
|
|
415
|
-
state-management,
|
|
334
|
+
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
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced MCP Server - All advanced StateCLI tools
|
|
3
|
+
*
|
|
4
|
+
* Includes: file tracking, error recovery, session memory, git integration
|
|
5
|
+
*/
|
|
6
|
+
import { StateCLIConfig } from './types';
|
|
7
|
+
export declare class EnhancedStateCLIMCPServer {
|
|
8
|
+
private server;
|
|
9
|
+
private statecli;
|
|
10
|
+
private fileTracker;
|
|
11
|
+
private errorRecovery;
|
|
12
|
+
private sessionMemory;
|
|
13
|
+
private gitIntegration;
|
|
14
|
+
constructor(config?: Partial<StateCLIConfig>);
|
|
15
|
+
private setupHandlers;
|
|
16
|
+
private handleReplay;
|
|
17
|
+
private handleUndo;
|
|
18
|
+
private handleCheckpoint;
|
|
19
|
+
private handleLog;
|
|
20
|
+
private handleTrack;
|
|
21
|
+
private handleTrackFile;
|
|
22
|
+
private handleFileHistory;
|
|
23
|
+
private handleAnalyzeError;
|
|
24
|
+
private handleAutoRecover;
|
|
25
|
+
private handleSafeExecute;
|
|
26
|
+
private handleMemoryQuery;
|
|
27
|
+
private handleRecentActivity;
|
|
28
|
+
private handleSessionInfo;
|
|
29
|
+
private handleGitStatus;
|
|
30
|
+
private handleGitHistory;
|
|
31
|
+
private handleGitCheckpoint;
|
|
32
|
+
run(): Promise<void>;
|
|
33
|
+
close(): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=enhanced-mcp-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhanced-mcp-server.d.ts","sourceRoot":"","sources":["../src/enhanced-mcp-server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAsNzC,qBAAa,yBAAyB;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,cAAc,CAAiB;gBAE3B,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAe5C,OAAO,CAAC,aAAa;IA+DrB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,mBAAmB;IAKrB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAM1B,KAAK,IAAI,IAAI;CAId"}
|