statecli-mcp-server 0.1.2 โ†’ 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/README.md CHANGED
@@ -1,153 +1,334 @@
1
- # MCP Registry
2
-
3
- The MCP registry provides MCP clients with a list of MCP servers, like an app store for MCP servers.
4
-
5
- [**๐Ÿ“ค Publish my MCP server**](docs/modelcontextprotocol-io/quickstart.mdx) | [**โšก๏ธ Live API docs**](https://registry.modelcontextprotocol.io/docs) | [**๐Ÿ‘€ Ecosystem vision**](docs/design/ecosystem-vision.md) | ๐Ÿ“– **[Full documentation](./docs)**
6
-
7
- ## Development Status
8
-
9
- **2025-10-24 update**: The Registry API has entered an **API freeze (v0.1)** ๐ŸŽ‰. For the next month or more, the API will remain stable with no breaking changes, allowing integrators to confidently implement support. This freeze applies to v0.1 while development continues on v0. We'll use this period to validate the API in real-world integrations and gather feedback to shape v1 for general availability. Thank you to everyone for your contributions and patienceโ€”your involvement has been key to getting us here!
10
-
11
- **2025-09-08 update**: The registry has launched in preview ๐ŸŽ‰ ([announcement blog post](https://blog.modelcontextprotocol.io/posts/2025-09-08-mcp-registry-preview/)). While the system is now more stable, this is still a preview release and breaking changes or data resets may occur. A general availability (GA) release will follow later. We'd love your feedback in [GitHub discussions](https://github.com/modelcontextprotocol/registry/discussions/new?category=ideas) or in the [#registry-dev Discord](https://discord.com/channels/1358869848138059966/1369487942862504016) ([joining details here](https://modelcontextprotocol.io/community/communication)).
12
-
13
- Current key maintainers:
14
- - **Adam Jones** (Anthropic) [@domdomegg](https://github.com/domdomegg)
15
- - **Tadas Antanavicius** (PulseMCP) [@tadasant](https://github.com/tadasant)
16
- - **Toby Padilla** (GitHub) [@toby](https://github.com/toby)
17
- - **Radoslav (Rado) Dimitrov** (Stacklok) [@rdimitrov](https://github.com/rdimitrov)
18
-
19
- ## Contributing
20
-
21
- We use multiple channels for collaboration - see [modelcontextprotocol.io/community/communication](https://modelcontextprotocol.io/community/communication).
22
-
23
- Often (but not always) ideas flow through this pipeline:
24
-
25
- - **[Discord](https://modelcontextprotocol.io/community/communication)** - Real-time community discussions
26
- - **[Discussions](https://github.com/modelcontextprotocol/registry/discussions)** - Propose and discuss product/technical requirements
27
- - **[Issues](https://github.com/modelcontextprotocol/registry/issues)** - Track well-scoped technical work
28
- - **[Pull Requests](https://github.com/modelcontextprotocol/registry/pulls)** - Contribute work towards issues
29
-
30
- ### Quick start:
31
-
32
- #### Pre-requisites
33
-
34
- - **Docker**
35
- - **Go 1.24.x**
36
- - **ko** - Container image builder for Go ([installation instructions](https://ko.build/install/))
37
- - **golangci-lint v2.4.0**
38
-
39
- #### Running the server
40
-
41
- ```bash
42
- # Start full development environment
43
- make dev-compose
44
- ```
45
-
46
- This starts the registry at [`localhost:8080`](http://localhost:8080) with PostgreSQL. The database uses ephemeral storage and is reset each time you restart the containers, ensuring a clean state for development and testing.
47
-
48
- **Note:** The registry uses [ko](https://ko.build) to build container images. The `make dev-compose` command automatically builds the registry image with ko and loads it into your local Docker daemon before starting the services.
49
-
50
- By default, the registry seeds from the production API with a filtered subset of servers (to keep startup fast). This ensures your local environment mirrors production behavior and all seed data passes validation. For offline development you can seed from a file without validation with `MCP_REGISTRY_SEED_FROM=data/seed.json MCP_REGISTRY_ENABLE_REGISTRY_VALIDATION=false make dev-compose`.
51
-
52
- The setup can be configured with environment variables in [docker-compose.yml](./docker-compose.yml) - see [.env.example](./.env.example) for a reference.
53
-
54
- <details>
55
- <summary>Alternative: Running a pre-built Docker image</summary>
56
-
57
- Pre-built Docker images are automatically published to GitHub Container Registry:
58
-
59
- ```bash
60
- # Run latest stable release
61
- docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:latest
62
-
63
- # Run latest from main branch (continuous deployment)
64
- docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:main
65
-
66
- # Run specific release version
67
- docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:v1.0.0
68
-
69
- # Run development build from main branch
70
- docker run -p 8080:8080 ghcr.io/modelcontextprotocol/registry:main-20250906-abc123d
71
- ```
72
-
73
- **Available tags:**
74
- - **Releases**: `latest`, `v1.0.0`, `v1.1.0`, etc.
75
- - **Continuous**: `main` (latest main branch build)
76
- - **Development**: `main-<date>-<sha>` (specific commit builds)
77
-
78
- </details>
79
-
80
- #### Publishing a server
81
-
82
- To publish a server, we've built a simple CLI. You can use it with:
83
-
84
- ```bash
85
- # Build the latest CLI
86
- make publisher
87
-
88
- # Use it!
89
- ./bin/mcp-publisher --help
90
- ```
91
-
92
- See [the publisher guide](./docs/modelcontextprotocol-io/quickstart.mdx) for more details.
93
-
94
- #### Other commands
95
-
96
- ```bash
97
- # Run lint, unit tests and integration tests
98
- make check
99
- ```
100
-
101
- There are also a few more helpful commands for development. Run `make help` to learn more, or look in [Makefile](./Makefile).
102
-
103
- <!--
104
- For Claude and other AI tools: Always prefer make targets over custom commands where possible.
105
- -->
106
-
107
- ## Architecture
108
-
109
- ### Project Structure
110
-
111
- ```
112
- โ”œโ”€โ”€ cmd/ # Application entry points
113
- โ”‚ โ””โ”€โ”€ publisher/ # Server publishing tool
114
- โ”œโ”€โ”€ data/ # Seed data
115
- โ”œโ”€โ”€ deploy/ # Deployment configuration (Pulumi)
116
- โ”œโ”€โ”€ docs/ # Documentation
117
- โ”œโ”€โ”€ internal/ # Private application code
118
- โ”‚ โ”œโ”€โ”€ api/ # HTTP handlers and routing
119
- โ”‚ โ”œโ”€โ”€ auth/ # Authentication (GitHub OAuth, JWT, namespace blocking)
120
- โ”‚ โ”œโ”€โ”€ config/ # Configuration management
121
- โ”‚ โ”œโ”€โ”€ database/ # Data persistence (PostgreSQL)
122
- โ”‚ โ”œโ”€โ”€ service/ # Business logic
123
- โ”‚ โ”œโ”€โ”€ telemetry/ # Metrics and monitoring
124
- โ”‚ โ””โ”€โ”€ validators/ # Input validation
125
- โ”œโ”€โ”€ pkg/ # Public packages
126
- โ”‚ โ”œโ”€โ”€ api/ # API types and structures
127
- โ”‚ โ”‚ โ””โ”€โ”€ v0/ # Version 0 API types
128
- โ”‚ โ””โ”€โ”€ model/ # Data models for server.json
129
- โ”œโ”€โ”€ scripts/ # Development and testing scripts
130
- โ”œโ”€โ”€ tests/ # Integration tests
131
- โ””โ”€โ”€ tools/ # CLI tools and utilities
132
- โ””โ”€โ”€ validate-*.sh # Schema validation tools
133
- ```
134
-
135
- ### Authentication
136
-
137
- Publishing supports multiple authentication methods:
138
- - **GitHub OAuth** - For publishing by logging into GitHub
139
- - **GitHub OIDC** - For publishing from GitHub Actions
140
- - **DNS verification** - For proving ownership of a domain and its subdomains
141
- - **HTTP verification** - For proving ownership of a domain
142
-
143
- The registry validates namespace ownership when publishing. E.g. to publish...:
144
- - `io.github.domdomegg/my-cool-mcp` you must login to GitHub as `domdomegg`, or be in a GitHub Action on domdomegg's repos
145
- - `me.adamjones/my-cool-mcp` you must prove ownership of `adamjones.me` via DNS or HTTP challenge
146
-
147
- ## Community Projects
148
-
149
- Check out [community projects](docs/community-projects.md) to explore notable registry-related work created by the community.
150
-
151
- ## More documentation
152
-
153
- See the [documentation](./docs) for more details if your question has not been answered here!
1
+ # StateCLI - MCP Server for State Replay & Self-Debugging
2
+
3
+ > **For AI Agents:** Memory, replay, and undo capability for your actions.
4
+
5
+ **MCP Server** | **State Management** | **Agent Self-Debugging** | **Rollback Capability**
6
+
7
+ ---
8
+
9
+ ## What This Does (For AI Agents)
10
+
11
+ StateCLI gives AI agents the ability to:
12
+
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
17
+
18
+ **Keywords for discovery:** state-management, debugging, replay, time-travel, undo, mcp-server, ai-agent-tools, self-debugging, agent-memory, rollback, introspection
19
+
20
+ ---
21
+
22
+ ## Why AI Agents Need This
23
+
24
+ **Common Agent Problems:**
25
+
26
+ ```
27
+ Problem: "I changed something but don't know what"
28
+ Solution: statecli_replay(entity) โ†’ See exact changes
29
+
30
+ Problem: "I broke something and need to undo"
31
+ Solution: statecli_undo(entity) โ†’ Rollback instantly
32
+
33
+ Problem: "I want to try something risky"
34
+ Solution: statecli_checkpoint(entity) โ†’ Save first, rollback if needed
35
+
36
+ Problem: "I need to understand my past behavior"
37
+ Solution: statecli_log(entity) โ†’ View complete history
38
+ ```
39
+
40
+ ---
41
+
42
+ ## MCP Tools Available
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:**
48
+ ```json
49
+ {
50
+ "entity": "order:7421",
51
+ "actor": "ai-agent"
52
+ }
53
+ ```
54
+ **Output:** JSON array of state changes with timestamps
55
+
56
+ ---
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:**
62
+ ```json
63
+ {
64
+ "entity": "order:7421",
65
+ "steps": 3
66
+ }
67
+ ```
68
+ **Output:** Confirmation of undo with restored state
69
+
70
+ ---
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:**
76
+ ```json
77
+ {
78
+ "entity": "order:7421",
79
+ "name": "before-refund"
80
+ }
81
+ ```
82
+ **Output:** Checkpoint ID for later reference
83
+
84
+ ---
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:**
90
+ ```json
91
+ {
92
+ "entity": "order:7421",
93
+ "since": "1h ago",
94
+ "actor": "ai-agent"
95
+ }
96
+ ```
97
+ **Output:** JSON array of all state changes
98
+
99
+ ---
100
+
101
+ ### `statecli_track`
102
+ **Description:** Explicitly track a state change.
103
+ **Use when:** Making important state modifications
104
+ **Input:**
105
+ ```json
106
+ {
107
+ "entity_type": "order",
108
+ "entity_id": "7421",
109
+ "state": { "status": "paid", "amount": 49.99 }
110
+ }
111
+ ```
112
+ **Output:** Confirmation of tracked change
113
+
114
+ ---
115
+
116
+ ## Installation for MCP Clients
117
+
118
+ ### For Claude Desktop
119
+
120
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
121
+
122
+ ```json
123
+ {
124
+ "mcpServers": {
125
+ "statecli": {
126
+ "command": "npx",
127
+ "args": ["-y", "statecli-mcp-server"]
128
+ }
129
+ }
130
+ }
131
+ ```
132
+
133
+ ### For Windsurf
134
+
135
+ 1. Press `Ctrl + Shift + P` โ†’ type `Open MCP Config`
136
+ 2. Add StateCLI to the config:
137
+
138
+ ```json
139
+ {
140
+ "mcpServers": {
141
+ "statecli": {
142
+ "command": "npx",
143
+ "args": ["-y", "statecli-mcp-server"]
144
+ }
145
+ }
146
+ }
147
+ ```
148
+
149
+ 3. Reload window (`Ctrl + Shift + P` โ†’ `Reload Window`)
150
+
151
+ ### For Cursor / Continue / Other MCP Clients
152
+
153
+ Add to your MCP configuration:
154
+
155
+ ```json
156
+ {
157
+ "mcpServers": {
158
+ "statecli": {
159
+ "command": "npx",
160
+ "args": ["-y", "statecli-mcp-server"]
161
+ }
162
+ }
163
+ }
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Agent Self-Debugging Pattern
169
+
170
+ **Minimal working example for autonomous agents:**
171
+
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
+ ```
202
+
203
+ ---
204
+
205
+ ## Output Format (JSON-Stable)
206
+
207
+ All MCP tool outputs are JSON-stable and safe for autonomous agents.
208
+
209
+ **Example `statecli_replay` output:**
210
+
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
+ }
226
+ ```
227
+
228
+ ---
229
+
230
+ ## Use Cases for AI Agents
231
+
232
+ ### 1. Self-Debugging
233
+ ```javascript
234
+ const replay = await statecli_replay({ entity: "task:123" });
235
+ ```
236
+
237
+ ### 2. Safe Experimentation
238
+ ```javascript
239
+ await statecli_checkpoint({ entity: "order:7421", name: "before-refund" });
240
+ await agent.processRefund(order);
241
+ ```
242
+
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
+ ```
251
+
252
+ ### 4. Collaboration Between Agents
253
+ ```javascript
254
+ await statecli_track({ entity: "task:123", state: {...} });
255
+ const log = await statecli_log({ entity: "task:123" });
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Installation & Setup
261
+
262
+ ### Direct Usage (No Install)
263
+ ```bash
264
+ npx -y statecli-mcp-server
265
+ ```
266
+
267
+ ### NPM Package
268
+ ```bash
269
+ npm install -g statecli-mcp-server
270
+ ```
271
+
272
+ ---
273
+
274
+ ## CLI Usage
275
+
276
+ ```bash
277
+ # Track a state change
278
+ statecli track order 7421 '{"status": "pending"}'
279
+
280
+ # Replay changes
281
+ statecli replay order:7421
282
+
283
+ # View log
284
+ statecli log order:7421
285
+
286
+ # Create checkpoint
287
+ statecli checkpoint order:7421 before-refund
288
+
289
+ # Undo last change
290
+ statecli undo order:7421
291
+ ```
292
+
293
+ ---
294
+
295
+ ## Performance
296
+
297
+ - **Write latency:** < 1ms (async, non-blocking)
298
+ - **Read latency:** < 5ms (local SQLite)
299
+ - **Storage:** ~100 bytes per state change
300
+ - **Overhead:** Negligible for production use
301
+
302
+ ---
303
+
304
+ ## Security
305
+
306
+ - **Local-first:** All data stored locally by default
307
+ - **No external calls:** Zero network dependency
308
+ - **Privacy:** Agent actions never leave your system
309
+
310
+ ---
311
+
312
+ ## Documentation Links
313
+
314
+ - **GitHub:** https://github.com/statecli/mcp-server
315
+ - **NPM:** https://www.npmjs.com/package/statecli-mcp-server
316
+ - **MCP Registry:** io.github.charo360/statecli
317
+
318
+ ---
319
+
320
+ ## License
321
+
322
+ MIT - Free for all use including commercial AI agents
323
+
324
+ ---
325
+
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)
333
+
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"}