statemap-mcp 0.1.9 → 0.1.11
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/dist/index.js +18 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,13 @@ import { resolve } from "node:path";
|
|
|
7
7
|
function loadConfig() {
|
|
8
8
|
const apiKey = process.env.STATEMAP_API_KEY;
|
|
9
9
|
if (!apiKey) {
|
|
10
|
-
return { error:
|
|
10
|
+
return { error: `STATEMAP_API_KEY not set. Statemap gives your AI agent persistent memory of your system's entire state model — data models, state containers, transitions, invariants, and read dependencies — so it can detect drift, enforce constraints, and maintain architectural coherence across sessions.
|
|
11
|
+
|
|
12
|
+
1. Create a free account at https://statemap.io
|
|
13
|
+
2. Copy your API key from the Keys tab
|
|
14
|
+
3. Add to your MCP config: "env": { "STATEMAP_API_KEY": "sm_..." }
|
|
15
|
+
|
|
16
|
+
Free tier includes 1 project, snapshots, CI integration (50 runs/month), and the full MCP toolset.` };
|
|
11
17
|
}
|
|
12
18
|
let projectId = process.env.STATEMAP_PROJECT_ID || "";
|
|
13
19
|
let baseUrl = process.env.STATEMAP_BASE_URL || "https://statemap.io";
|
|
@@ -23,7 +29,9 @@ function loadConfig() {
|
|
|
23
29
|
catch {
|
|
24
30
|
}
|
|
25
31
|
if (!projectId) {
|
|
26
|
-
return { error:
|
|
32
|
+
return { error: `No project connected. Run statemap_init to create or select a project — this writes a .statemap config file to your repo root.
|
|
33
|
+
|
|
34
|
+
Or set STATEMAP_PROJECT_ID env var manually. See https://statemap.io` };
|
|
27
35
|
}
|
|
28
36
|
return { projectId, baseUrl: baseUrl.replace(/\/$/, ""), apiKey };
|
|
29
37
|
}
|
|
@@ -286,7 +294,7 @@ let configError = "error" in loaded ? loaded.error : null;
|
|
|
286
294
|
let config = "error" in loaded ? { projectId: "", baseUrl: "", apiKey: "" } : loaded;
|
|
287
295
|
const server = new McpServer({
|
|
288
296
|
name: "statemap",
|
|
289
|
-
version: "0.1.
|
|
297
|
+
version: "0.1.11",
|
|
290
298
|
}, {
|
|
291
299
|
instructions: `Statemap is a system state model for this project. Here's how to get started:
|
|
292
300
|
|
|
@@ -571,6 +579,12 @@ Re-run statemap_validate and statemap_divergence to confirm improvement.
|
|
|
571
579
|
- **Inferred connections** — looks related but no explicit FK, probable container assignment based on naming, etc. Present these individually.
|
|
572
580
|
Ask the architect to approve: they can rubber-stamp the obvious stuff ("all good") and cherry-pick the ambiguous ones.
|
|
573
581
|
|
|
582
|
+
### Step 11: Review info-level issues
|
|
583
|
+
After errors and warnings are resolved, review remaining info-level issues (e.g. "missing transition"). Present them grouped by pattern:
|
|
584
|
+
- **Read-only mirrors** — UI store states that just hydrate from API responses and are never mutated directly. Ask: **"Are these read-only? If so I'll mark them as intentional."**
|
|
585
|
+
- **Actually missing mutations** — models that do get mutated but have no transitions declared. Ask: **"Should I add transitions for these?"** If yes, search the codebase for the mutation logic and declare the transitions.
|
|
586
|
+
- **Append-only / implicit** — models like audit logs, usage records that are only written to by background processes. Ask: **"Are these write-only from a system process? I can add a single transition to represent that."**
|
|
587
|
+
|
|
574
588
|
## Principles
|
|
575
589
|
- The architect decides what's dead. You present and ask.
|
|
576
590
|
- Walk through EVERY entity type, not just models. Dead containers, transitions, read deps, and invariants accumulate just like dead models.
|
|
@@ -591,7 +605,7 @@ server.tool("statemap_init", "Initialize Statemap for this project. Lists your e
|
|
|
591
605
|
}, async ({ action, project_name, project_id }) => {
|
|
592
606
|
const apiKey = process.env.STATEMAP_API_KEY;
|
|
593
607
|
if (!apiKey) {
|
|
594
|
-
return text({ error:
|
|
608
|
+
return text({ error: `STATEMAP_API_KEY not set. Create a free account at https://statemap.io to get your API key. Free tier includes 1 project, snapshots, CI integration, and the full MCP toolset.` });
|
|
595
609
|
}
|
|
596
610
|
const baseUrl = (process.env.STATEMAP_BASE_URL || "https://statemap.io").replace(/\/$/, "");
|
|
597
611
|
if (action === "list") {
|