mrmainspring 0.1.1 → 0.1.3

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,49 +1,49 @@
1
- # Mr Mainspring
2
-
3
- Installable MCP backend for local agent demos. It exposes memory, Grimoire
4
- policy/secret storage, payment intent tools, audit trail tools, Casper anchoring
5
- boundaries, and x402 settlement-provider wiring.
6
-
7
- ## Install
8
-
1
+ # Mr Mainspring
2
+
3
+ Installable MCP backend for local agent demos. It exposes memory, Grimoire
4
+ policy/secret storage, payment intent tools, audit trail tools, Casper anchoring
5
+ boundaries, and x402 settlement-provider wiring.
6
+
7
+ ## Install
8
+
9
9
  ```bash
10
10
  npm install -g mrmainspring
11
11
  mainspring setup cursor
12
12
  ```
13
13
 
14
14
  Run the stdio MCP server:
15
-
16
- ```bash
17
- mainspring
18
- ```
19
-
20
- For local development from this repository:
21
-
22
- ```bash
23
- npm run build
24
- npm run mcp:stdio
25
- ```
26
-
15
+
16
+ ```bash
17
+ mainspring
18
+ ```
19
+
20
+ For local development from this repository:
21
+
22
+ ```bash
23
+ npm run build
24
+ npm run mcp:stdio
25
+ ```
26
+
27
27
  ## Environment
28
28
 
29
29
  No environment variables are required for local memory, Grimoire, audit, or
30
30
  payment preflight tools. `mainspring setup` creates the local config, data, and
31
31
  logs directories under the user's standard app config folder. Use
32
32
  `SIGIL_ENV_FILE` to point at a specific env file for advanced setups.
33
-
34
- Important package boundaries:
35
-
33
+
34
+ Important package boundaries:
35
+
36
36
  - Keep `.env`, local keys, and generated demo data outside the npm package.
37
- - Real Casper submission remains gated by `CASPER_ENABLE_REAL_SUBMISSION=true`.
38
- - Real x402 settlement remains gated by `X402_ENABLE_REAL_SETTLEMENT=true` and
39
- a configured `X402_SIGNER_URL`.
40
- - The signer private key must live outside the repository workspace.
41
-
42
- ## Library Entry
43
-
44
- ```ts
45
- import { createSigilServer } from "mrmainspring";
46
- ```
47
-
48
- The CLI entry is also exported as `mrmainspring/mcp`, but importing it starts
49
- the stdio server; use the package bin for normal MCP client configuration.
37
+ - Real Casper submission remains gated by `CASPER_ENABLE_REAL_SUBMISSION=true`.
38
+ - Real x402 settlement remains gated by `X402_ENABLE_REAL_SETTLEMENT=true` and
39
+ a configured `X402_SIGNER_URL`.
40
+ - The signer private key must live outside the repository workspace.
41
+
42
+ ## Library Entry
43
+
44
+ ```ts
45
+ import { createSigilServer } from "mrmainspring";
46
+ ```
47
+
48
+ The CLI entry is also exported as `mrmainspring/mcp`, but importing it starts
49
+ the stdio server; use the package bin for normal MCP client configuration.
package/dist/cli.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
2
  import { dirname } from "node:path";
3
+ import { spawnSync } from "node:child_process";
3
4
  import { loadConfig } from "./config.js";
4
5
  import { ensureGrimoireMasterKey, loadLocalEnvFile, resolveEnvPath } from "./env-file.js";
5
6
  import { getDefaultMainspringPaths } from "./paths.js";
6
- const VERSION = "0.1.1";
7
+ const VERSION = "0.1.2";
7
8
  const HELP = `Mr Mainspring MCP server
8
9
 
9
10
  Usage:
@@ -14,12 +15,14 @@ Usage:
14
15
  mainspring config Print MCP client config JSON
15
16
  mainspring setup [client] Initialize local files and print MCP config
16
17
  mainspring doctor Check the local setup
18
+ mainspring update Show how to update to the latest version
17
19
 
18
20
  MCP client config:
19
21
  {
20
22
  "mcpServers": {
21
23
  "mainspring": {
22
- "command": "mainspring"
24
+ "command": "npx",
25
+ "args": ["-y", "mrmainspring"]
23
26
  }
24
27
  }
25
28
  }
@@ -61,6 +64,13 @@ export function runCliCommand(args) {
61
64
  process.stdout.write(formatDoctorReport());
62
65
  return true;
63
66
  }
67
+ if (command === "update") {
68
+ process.stdout.write("To update Mr Mainspring:\n\n" +
69
+ " npm install -g mrmainspring@latest\n\n" +
70
+ "or if using npx (no install needed):\n\n" +
71
+ " npx mrmainspring@latest\n\n");
72
+ return true;
73
+ }
64
74
  process.stderr.write(`Unknown command: ${command}\n\n${HELP}`);
65
75
  process.exitCode = 1;
66
76
  return true;
@@ -93,7 +103,8 @@ export function formatMcpConfig() {
93
103
  return JSON.stringify({
94
104
  mcpServers: {
95
105
  mainspring: {
96
- command: "mainspring"
106
+ command: "npx",
107
+ args: ["-y", "mrmainspring"]
97
108
  }
98
109
  }
99
110
  }, null, 2);
@@ -118,6 +129,9 @@ function formatDoctorReport(env = process.env) {
118
129
  lines.push(formatCheck(existsSync(envFile), `Config file: ${envFile}`, "Config file missing; run mainspring init"));
119
130
  lines.push(formatCheck(existsSync(paths.dataDir), `Data dir: ${paths.dataDir}`, "Data dir missing; run mainspring init"));
120
131
  lines.push(formatCheck(existsSync(paths.logsDir), `Logs dir: ${paths.logsDir}`, "Logs dir missing; run mainspring init"));
132
+ const casperBin = envCopy.CASPER_CLIENT_BIN ?? "casper-client";
133
+ const casperProbe = spawnSync(casperBin, ["--version"], { stdio: "pipe" });
134
+ lines.push(formatCheck(!casperProbe.error, `casper-client: ${casperBin}`, `casper-client not found at "${casperBin}" — optional, needed for on-chain anchoring (cargo install casper-client)`));
121
135
  try {
122
136
  const config = loadConfig(envCopy);
123
137
  lines.push(`[ok] Storage backend: ${config.storage.backend}`);
package/dist/config.js CHANGED
@@ -14,7 +14,7 @@ export function loadConfig(env = process.env) {
14
14
  memoryAnchorPackageHash: optionalEnv(env.MEMORY_ANCHOR_PACKAGE_HASH),
15
15
  submissionEnabled: parseBoolean(env.CASPER_ENABLE_REAL_SUBMISSION),
16
16
  clientBin: optionalEnv(env.CASPER_CLIENT_BIN) ?? "casper-client",
17
- clientWslDistro: optionalEnv(env.CASPER_CLIENT_WSL_DISTRO),
17
+ clientWslDistro: process.platform === "win32" ? optionalEnv(env.CASPER_CLIENT_WSL_DISTRO) : null,
18
18
  anchorSubmissionMode: parseCasperAnchorSubmissionMode(env.CASPER_ANCHOR_SUBMISSION_MODE),
19
19
  gasPriceTolerance: optionalEnv(env.CASPER_GAS_PRICE_TOLERANCE) ?? "10",
20
20
  pricingMode: optionalEnv(env.CASPER_PRICING_MODE) ?? "classic",
package/package.json CHANGED
@@ -1,61 +1,62 @@
1
- {
2
- "name": "mrmainspring",
3
- "version": "0.1.1",
4
- "description": "Mr Mainspring MCP backend with memory, Grimoire policies, audit, Casper anchoring, and x402 settlement boundaries.",
5
- "license": "MIT",
6
- "type": "module",
7
- "bin": {
8
- "mainspring": "dist/index.js"
9
- },
10
- "main": "./dist/server.js",
11
- "types": "./dist/server.d.ts",
12
- "exports": {
13
- ".": {
14
- "types": "./dist/server.d.ts",
15
- "import": "./dist/server.js"
16
- },
17
- "./mcp": {
18
- "types": "./dist/index.d.ts",
19
- "import": "./dist/index.js"
20
- },
21
- "./package.json": "./package.json"
22
- },
23
- "publishConfig": {
24
- "access": "public"
25
- },
26
- "files": [
27
- "dist/**/*.js",
28
- "dist/**/*.d.ts",
29
- "LICENSE",
30
- "README.md",
31
- "package.json"
32
- ],
33
- "scripts": {
34
- "build": "tsc -p tsconfig.json",
35
- "demo:stdio": "npm run build && tsx scripts/demo-stdio.ts",
36
- "demo:x402-http": "tsx scripts/x402-demo-http-server.ts",
37
- "demo:x402-sidecars": "tsx scripts/x402-local-sidecars.ts",
38
- "demo:x402-sidecars:smoke": "tsx scripts/x402-local-sidecars.ts --smoke",
39
- "dev": "tsx src/index.ts",
40
- "mcp:stdio": "node dist/index.js",
41
- "prepack": "npm run build",
42
- "smoke:x402-payment-fetch": "tsx scripts/x402-payment-fetch-smoke.ts",
43
- "test": "vitest run",
44
- "x402:facilitator": "tsx scripts/x402-facilitator-sidecar.ts",
45
- "x402:resource": "tsx scripts/x402-local-sidecars.ts",
46
- "x402:signer": "tsx scripts/x402-signer-sidecar.ts"
47
- },
48
- "dependencies": {
49
- "@modelcontextprotocol/sdk": "^1.13.0",
50
- "zod": "^3.25.76"
51
- },
52
- "devDependencies": {
53
- "@types/node": "^22.15.30",
54
- "tsx": "^4.19.4",
55
- "typescript": "^5.8.3",
56
- "vitest": "^4.1.8"
57
- },
58
- "engines": {
59
- "node": ">=20.0.0"
60
- }
61
- }
1
+ {
2
+ "name": "mrmainspring",
3
+ "version": "0.1.3",
4
+ "description": "Mr Mainspring MCP backend with memory, Grimoire policies, audit, Casper anchoring, and x402 settlement boundaries.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "mainspring": "dist/index.js",
9
+ "mrmainspring": "dist/index.js"
10
+ },
11
+ "main": "./dist/server.js",
12
+ "types": "./dist/server.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/server.d.ts",
16
+ "import": "./dist/server.js"
17
+ },
18
+ "./mcp": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/index.js"
21
+ },
22
+ "./package.json": "./package.json"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "files": [
28
+ "dist/**/*.js",
29
+ "dist/**/*.d.ts",
30
+ "LICENSE",
31
+ "README.md",
32
+ "package.json"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsc -p tsconfig.json",
36
+ "demo:stdio": "npm run build && tsx scripts/demo-stdio.ts",
37
+ "demo:x402-http": "tsx scripts/x402-demo-http-server.ts",
38
+ "demo:x402-sidecars": "tsx scripts/x402-local-sidecars.ts",
39
+ "demo:x402-sidecars:smoke": "tsx scripts/x402-local-sidecars.ts --smoke",
40
+ "dev": "tsx src/index.ts",
41
+ "mcp:stdio": "node dist/index.js",
42
+ "prepack": "npm run build",
43
+ "smoke:x402-payment-fetch": "tsx scripts/x402-payment-fetch-smoke.ts",
44
+ "test": "vitest run",
45
+ "x402:facilitator": "tsx scripts/x402-facilitator-sidecar.ts",
46
+ "x402:resource": "tsx scripts/x402-local-sidecars.ts",
47
+ "x402:signer": "tsx scripts/x402-signer-sidecar.ts"
48
+ },
49
+ "dependencies": {
50
+ "@modelcontextprotocol/sdk": "^1.13.0",
51
+ "zod": "^3.25.76"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^22.15.30",
55
+ "tsx": "^4.19.4",
56
+ "typescript": "^5.8.3",
57
+ "vitest": "^4.1.8"
58
+ },
59
+ "engines": {
60
+ "node": ">=20.0.0"
61
+ }
62
+ }