statecli-mcp-server 0.1.0 → 0.1.2

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.
Files changed (3) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +153 -415
  3. package/package.json +2 -1
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 StateCLI
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
@@ -1,415 +1,153 @@
1
- # StateCLI - MCP Server for State Replay & Self-Debugging
2
-
3
- > **For AI Agents:** Memory, replay, and undo capability for your actions.
4
-
5
- [![npm version](https://img.shields.io/npm/v/statecli-mcp-server.svg)](https://www.npmjs.com/package/statecli-mcp-server)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
-
8
- **MCP Server** | **State Management** | **Agent Self-Debugging** | **Rollback Capability**
9
-
10
- ---
11
-
12
- ## Installation
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
- ```
30
-
31
- ---
32
-
33
- ## Available Tools
34
-
35
- | Tool | Description | Use When |
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 |
42
-
43
- ---
44
-
45
- ## Quick Example
46
-
47
- ```javascript
48
- // Checkpoint before risky operation
49
- await statecli_checkpoint({ entity: "order:123", name: "before-refund" });
50
-
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
- ```
61
-
62
- ---
63
-
64
- ## Why AI Agents Need This
65
-
66
- | Problem | Solution |
67
- |---------|----------|
68
- | "I changed something but don't know what" | `statecli_replay(entity)` |
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)` |
72
-
73
- ---
74
-
75
- ## Tool Reference
76
-
77
- ### `statecli_replay`
78
-
79
- Replay state changes for an entity. Shows step-by-step what happened.
80
-
81
- ```json
82
- {
83
- "entity": "order:7421",
84
- "actor": "ai-agent"
85
- }
86
- ```
87
-
88
- ### `statecli_undo`
89
-
90
- Undo state changes. Rollback when something went wrong.
91
-
92
- ```json
93
- {
94
- "entity": "order:7421",
95
- "steps": 3
96
- }
97
- ```
98
-
99
- ### `statecli_checkpoint`
100
-
101
- Create named checkpoint before making changes.
102
-
103
- ```json
104
- {
105
- "entity": "order:7421",
106
- "name": "before-refund"
107
- }
108
- ```
109
-
110
- ### `statecli_log`
111
-
112
- View state change history for an entity.
113
-
114
- ```json
115
- {
116
- "entity": "order:7421",
117
- "since": "1h ago",
118
- "actor": "ai-agent"
119
- }
120
- ```
121
-
122
- ### `statecli_track`
123
-
124
- Explicitly track a state change.
125
-
126
- ```json
127
- {
128
- "entity_type": "order",
129
- "entity_id": "7421",
130
- "state": { "status": "paid", "amount": 49.99 }
131
- }
132
- ```
133
-
134
- ---
135
-
136
- ## Agent Self-Debugging Pattern
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
171
-
172
- ### Claude Desktop
173
-
174
- Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
175
-
176
- ```json
177
- {
178
- "mcpServers": {
179
- "statecli": {
180
- "command": "npx",
181
- "args": ["-y", "statecli-mcp-server"]
182
- }
183
- }
184
- }
185
- ```
186
-
187
- ### Cursor
188
-
189
- Add to `.cursor/mcp.json`:
190
-
191
- ```json
192
- {
193
- "mcpServers": {
194
- "statecli": {
195
- "command": "npx",
196
- "args": ["-y", "statecli-mcp-server"]
197
- }
198
- }
199
- }
200
- ```
201
-
202
- ### Windsurf
203
-
204
- Add to MCP settings:
205
-
206
- ```json
207
- {
208
- "mcpServers": {
209
- "statecli": {
210
- "command": "npx",
211
- "args": ["-y", "statecli-mcp-server"]
212
- }
213
- }
214
- }
215
- ```
216
-
217
- ---
218
-
219
- ## CLI Usage
220
-
221
- ```bash
222
- # Initialize configuration
223
- statecli init
224
-
225
- # Track a state change
226
- statecli track order 7421 -d '{"status": "pending"}'
227
-
228
- # Replay changes
229
- statecli replay order:7421
230
-
231
- # View log
232
- statecli log order:7421 --since "1h ago"
233
-
234
- # Create checkpoint
235
- statecli checkpoint order:7421 before-payment
236
-
237
- # Undo last change
238
- statecli undo order:7421
239
-
240
- # Get current state
241
- statecli state order:7421
242
-
243
- # List all entities
244
- statecli list
245
-
246
- # Start MCP server
247
- statecli serve
248
- ```
249
-
250
- ---
251
-
252
- ## Programmatic Usage
253
-
254
- ```typescript
255
- import { StateCLI } from 'statecli-mcp-server';
256
-
257
- const cli = new StateCLI();
258
-
259
- // Track state
260
- cli.track('order', '7421', { status: 'pending' }, 'ai-agent');
261
-
262
- // Replay
263
- const replay = cli.replay('order:7421');
264
-
265
- // Checkpoint
266
- cli.checkpoint('order:7421', 'before-payment');
267
-
268
- // Undo
269
- cli.undo('order:7421', 1);
270
-
271
- // Log with wildcards
272
- const log = cli.log('order:*', { since: '1h ago' });
273
- ```
274
-
275
- ---
276
-
277
- ## Integration Examples
278
-
279
- ### LangChain
280
-
281
- ```javascript
282
- import { AgentExecutor } from "langchain/agents";
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
- });
297
- ```
298
-
299
- ### AutoGPT
300
-
301
- ```python
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)
316
- ```
317
-
318
- ### CrewAI
319
-
320
- ```python
321
- from crewai import Agent, Task
322
- from statecli import statecli_mcp_tool
323
-
324
- agent = Agent(
325
- role="Developer",
326
- tools=[statecli_mcp_tool],
327
- allow_delegation=True
328
- )
329
- ```
330
-
331
- ---
332
-
333
- ## Output Format
334
-
335
- All outputs are JSON-stable:
336
-
337
- ```json
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
- }
352
- ```
353
-
354
- ---
355
-
356
- ## Performance
357
-
358
- - **Write latency:** < 1ms (async, non-blocking)
359
- - **Read latency:** < 5ms (local SQLite)
360
- - **Storage:** ~100 bytes per state change
361
- - **Overhead:** Negligible for production use
362
-
363
- ---
364
-
365
- ## Configuration
366
-
367
- Create `.statecli/config.json`:
368
-
369
- ```json
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
- ```
385
-
386
- ---
387
-
388
- ## Development
389
-
390
- ```bash
391
- npm install
392
- npm run build
393
- npm test
394
- ```
395
-
396
- ---
397
-
398
- ## Links
399
-
400
- - **GitHub:** https://github.com/statecli/mcp-server
401
- - **NPM:** https://www.npmjs.com/package/statecli-mcp-server
402
- - **Examples:** https://github.com/statecli/examples
403
- - **Issues:** https://github.com/statecli/mcp-server/issues
404
-
405
- ---
406
-
407
- ## License
408
-
409
- MIT - Free for all use including commercial AI agents
410
-
411
- ---
412
-
413
- ## Keywords
414
-
415
- state-management, mcp-server, ai-agent-tools, debugging, replay, undo, rollback, agent-memory, self-debugging, autonomous-agents, model-context-protocol, time-travel-debugging, checkpoint, agent-introspection, state-tracking, langchain-tools, autogpt-plugins, crewai-tools
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!
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "statecli-mcp-server",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
+ "mcpName": "io.github.charo360/statecli",
4
5
  "description": "MCP Server for State Replay & Self-Debugging - Memory, replay, and undo capability for AI agents",
5
6
  "main": "./dist/index.js",
6
7
  "bin": {