@synapsor/runner 0.1.10 → 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.
Files changed (26) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +49 -25
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/runner.mjs +266 -18
  5. package/docs/README.md +6 -0
  6. package/docs/cloud-mode.md +18 -0
  7. package/docs/cloud-push.md +54 -0
  8. package/docs/current-scope.md +1 -1
  9. package/docs/mcp-clients.md +123 -0
  10. package/docs/release-notes.md +30 -0
  11. package/docs/runner-bundles.md +59 -0
  12. package/examples/support-plan-credit/.env.example +10 -0
  13. package/examples/support-plan-credit/README.md +107 -10
  14. package/examples/support-plan-credit/expected-output/cloud-push-response.json +9 -0
  15. package/examples/support-plan-credit/expected-output/proposal-created.json +23 -0
  16. package/examples/support-plan-credit/expected-output/receipt.json +13 -0
  17. package/examples/support-plan-credit/expected-output/replay-summary.json +13 -0
  18. package/examples/support-plan-credit/expected-output/tools-preview.txt +15 -0
  19. package/examples/support-plan-credit/mcp-client-examples/claude-desktop.json +20 -0
  20. package/examples/support-plan-credit/mcp-client-examples/cursor-global.mcp.json +20 -0
  21. package/examples/support-plan-credit/mcp-client-examples/cursor-project.mcp.json +20 -0
  22. package/examples/support-plan-credit/mcp-client-examples/generic-stdio.json +17 -0
  23. package/examples/support-plan-credit/mcp-client-examples/generic-streamable-http.json +5 -0
  24. package/examples/support-plan-credit/mcp-client-examples/openai-agents-stdio.ts +19 -0
  25. package/examples/support-plan-credit/mcp-client-examples/openai-agents-streamable-http.ts +20 -0
  26. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ### Cloud Adoption Loop
6
+
7
+ - Stages `@synapsor/spec@0.1.4`, `@synapsor/dsl@0.1.4`, and
8
+ `@synapsor/runner@0.1.11` without publishing them.
9
+ - Adds a seven-file MCP client bundle for Claude Desktop, Cursor, OpenAI Agents
10
+ SDK, and generic stdio/Streamable HTTP clients, including OpenAI-safe tool
11
+ aliases.
12
+ - Productizes local and Cloud-generated Runner bundles with placeholder env
13
+ wiring, validation/run instructions, and no embedded credentials or rows.
14
+ - Adds a network-free adoption quickstart verifier and a real local
15
+ Runner-to-Cloud-to-ZIP-to-Runner verification path around the flagship
16
+ `support-plan-credit` contract.
17
+ - Documents the Cloud registry/version/bundle loop and avoids implying managed
18
+ runner fleets, SAML/SCIM, hosted policy enforcement, or enterprise SLA.
19
+ - Adds `SYNAPSOR_CLOUD_WORKSPACE` support and explicit Cloud push failure tests
20
+ for authorization, validation, conflict, server, and network outcomes.
21
+ - Corrects `cloud push --help` so it describes the implemented authenticated
22
+ upload path and the network-free dry-run instead of the removed pre-registry
23
+ limitation.
24
+
25
+ ## 0.1.10
26
+
5
27
  ### Policy Auto-Approval
6
28
 
7
29
  - Stages `@synapsor/spec@0.1.3`, `@synapsor/dsl@0.1.3`, and
package/README.md CHANGED
@@ -6,10 +6,11 @@
6
6
 
7
7
  Stop giving AI agents `execute_sql()`. Give them reviewed business actions.
8
8
 
9
- Synapsor Runner is an Open-source MCP safety layer for Postgres and MySQL. It
10
- sits between Claude, Cursor, OpenAI Agents SDK, or another MCP client and your
11
- database so the model can inspect scoped data and propose changes without
12
- receiving raw SQL, write credentials, approval tools, or commit authority.
9
+ Synapsor Runner is an open-source, local-first MCP server that exposes reviewed semantic
10
+ capabilities over Postgres and MySQL, stages risky writes as proposals, and
11
+ keeps evidence and replay for agent actions. It sits between Claude, Cursor,
12
+ OpenAI Agents SDK, or another MCP client and your database so the model does
13
+ not receive raw SQL, write credentials, approval tools, or commit authority.
13
14
 
14
15
  ```text
15
16
  Without Synapsor:
@@ -25,9 +26,12 @@ With Synapsor Runner:
25
26
  Try the no-database quick demo:
26
27
 
27
28
  ```bash
28
- npx @synapsor/runner demo --quick
29
+ npx -y @synapsor/runner demo --quick
29
30
  ```
30
31
 
32
+ You will see semantic tools instead of raw SQL, an exact proposal rather than
33
+ an immediate write, approval/apply outside MCP, and a receipt/replay record.
34
+
31
35
  ## The Five-Line Model
32
36
 
33
37
  Your agent talks to Synapsor Runner, not directly to your database.
@@ -70,7 +74,7 @@ Run the guided quick demo first. It does not require Docker, a database, a
70
74
  config file, an MCP client, or a Synapsor Cloud account.
71
75
 
72
76
  ```bash
73
- npx @synapsor/runner demo --quick
77
+ npx -y @synapsor/runner demo --quick
74
78
  ```
75
79
 
76
80
  In a terminal, it walks through the safety model step by step. In CI, piped
@@ -82,7 +86,7 @@ It does not prove database connectivity. It shows the proposal, evidence, and
82
86
  replay flow without giving the runner a database URL.
83
87
 
84
88
  ```bash
85
- npx @synapsor/runner demo inspect
89
+ npx -y @synapsor/runner demo inspect
86
90
  ```
87
91
 
88
92
  Then choose one path:
@@ -129,6 +133,13 @@ are a good start. Use Runner when you need the agent-facing boundary around
129
133
  those reads, or when database-backed actions must become proposals before any
130
134
  durable write happens.
131
135
 
136
+ ## More Than A Tool Proxy
137
+
138
+ Synapsor is intentionally more than an MCP wrapper. The public packages include
139
+ a versioned contract, DSL compiler, schema validation, conformance fixtures,
140
+ Runner enforcement, proposal/evidence/replay artifacts, Cloud registry push,
141
+ and C++/Cloud round-trip verification.
142
+
132
143
  ## Connect Your Postgres Or MySQL
133
144
 
134
145
  Use a staging or disposable database first:
@@ -310,6 +321,16 @@ See [`docs/dsl-json-parity.md`](docs/dsl-json-parity.md) for the current
310
321
  field-by-field support matrix across JSON spec, DSL, runner enforcement,
311
322
  C++/Cloud compatibility, and Cloud push.
312
323
 
324
+ After a real push, open **Contract registry** in Synapsor Cloud to inspect the
325
+ immutable version, semantic capabilities, workflows, visible and kept-out
326
+ fields, policy references, warnings, and registry audit events. Downloading a
327
+ runner bundle returns the same normalized contract with placeholder local
328
+ wiring and ready-to-copy MCP configs.
329
+
330
+ - [Cloud push](docs/cloud-push.md)
331
+ - [Runner bundles](docs/runner-bundles.md)
332
+ - [MCP client configs](docs/mcp-clients.md)
333
+
313
334
  Your `synapsor.runner.json` supplies local wiring: database env var names,
314
335
  SQLite store path, MCP transport settings, and local debug options. The
315
336
  contract supplies the portable meaning: contexts, capabilities, evidence,
@@ -953,8 +974,9 @@ per lifecycle event; it is not a hosted central ledger.
953
974
 
954
975
  This is local indexed search for local/dev/staging usage. It is not a hosted
955
976
  central ledger, not RBAC/SSO, not cross-runner search, and not compliance
956
- retention. Synapsor Cloud is the upgrade path for central searchable audit,
957
- team governance, retention, and production operations.
977
+ retention. Synapsor Cloud adds a shared contract registry and enabled hosted
978
+ activity/evidence surfaces; confirm retention and production operations for
979
+ the specific design-partner deployment.
958
980
 
959
981
  ## Connect Claude, Cursor, Or Another MCP Client
960
982
 
@@ -1217,24 +1239,25 @@ internals.
1217
1239
 
1218
1240
  | Need | Synapsor Runner | Synapsor Cloud |
1219
1241
  | --- | --- | --- |
1220
- | Local MCP server | Yes | Managed |
1221
- | Local trusted context bindings | Yes | Org/session integrated |
1242
+ | Local MCP server | Yes | Contracts export back to Runner; a managed fleet is not claimed |
1243
+ | Local trusted context bindings | Yes | Contract bindings are registered; hosted session behavior is pilot-specific |
1222
1244
  | Local semantic capabilities | Yes | Hosted registry + versioning |
1223
1245
  | Local evidence/proposal/replay | Yes | Central searchable ledger |
1224
- | Local approval | CLI/UI | Multi-user approvals |
1225
- | Writeback | Guarded single-row `UPDATE` | Managed production orchestration |
1246
+ | Local approval | CLI/UI | Existing team approval surfaces where enabled for a pilot |
1247
+ | Writeback | Guarded single-row `UPDATE` | Cloud-linked jobs exist; managed production orchestration is not claimed |
1226
1248
  | MCP risk audit | Static/local | Continuous/org-wide |
1227
- | RBAC/SSO | No | Yes |
1228
- | Policy packs | No/basic | Yes |
1229
- | Workflow builder | No | Yes |
1249
+ | RBAC/SSO | No | RBAC where configured; SAML/SCIM are not in this beta |
1250
+ | Policy packs | Local reviewed subset | Registry preserves policies; hosted enforcement is not implied |
1251
+ | Workflow builder | No | Existing Cloud authoring surfaces; full public DAG parity is not claimed |
1230
1252
  | Native branches/time travel | No | Yes |
1231
1253
  | Settlement policies | No | Yes |
1232
- | Compliance exports | No | Yes |
1233
- | Production support/SLA | No | Yes |
1254
+ | Compliance exports | No | Audit/retention primitives exist; legal hold/certification are not claimed |
1255
+ | Production support/SLA | No | Design-partner support; no enterprise SLA is claimed |
1234
1256
 
1235
- The runner is useful by itself for local/staging safety. Synapsor Cloud is for
1236
- teams, production governance, central audit, managed runners, enterprise
1237
- controls, and proprietary Synapsor platform features.
1257
+ The runner is useful by itself for local/staging safety. Synapsor Cloud adds a
1258
+ shared contract registry, immutable versions, downloadable Runner bundles, and
1259
+ existing team activity/evidence/approval surfaces where enabled. Managed
1260
+ runners, SAML/SCIM, legal hold, and an enterprise SLA remain future work.
1238
1261
 
1239
1262
  Portable contracts can be checked locally before Cloud import:
1240
1263
 
@@ -1251,7 +1274,7 @@ synapsor-runner cloud push ./synapsor.contract.json \
1251
1274
 
1252
1275
  ## Current Limitations
1253
1276
 
1254
- Supported in the current alpha:
1277
+ Supported in the current `0.1.x` line:
1255
1278
 
1256
1279
  - stdio MCP server;
1257
1280
  - authenticated HTTP MCP server for app/server deployments;
@@ -1327,9 +1350,10 @@ Synapsor name, logo, hosted cloud service, or proprietary Synapsor platform
1327
1350
  features. See [docs/licensing.md](docs/licensing.md) and
1328
1351
  [TRADEMARKS.md](TRADEMARKS.md).
1329
1352
 
1330
- Synapsor Cloud, hosted governance, managed runners, advanced policy/workflow
1331
- engines, enterprise controls, and native Synapsor DBMS/C++ internals remain
1332
- proprietary.
1353
+ Synapsor Cloud, hosted governance, advanced policy/workflow engines, enterprise
1354
+ controls, and native Synapsor DBMS/C++ internals are outside this Apache-2.0
1355
+ repository. Managed runners and other hosted features, where offered, are
1356
+ proprietary and are not implied by the OSS package.
1333
1357
 
1334
1358
  ## Developer And Contributor Commands
1335
1359
 
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAYA,OAAO,EAAoP,KAAK,WAAW,EAA2F,MAAM,6BAA6B,CAAC;AAoB1Y,OAAO,EAA6G,KAAK,YAAY,EAAwB,MAAM,2BAA2B,CAAC;AAE/L,OAAO,EAOL,KAAK,gBAAgB,EAEtB,MAAM,mCAAmC,CAAC;AA6U3C,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAyD1D;AA+DD,KAAK,SAAS,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAE9E,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE;IACP,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;CACvC,GACL,OAAO,CAAC,MAAM,CAAC,CA2TjB;AA+tED,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAS/H"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAYA,OAAO,EAAoP,KAAK,WAAW,EAA2F,MAAM,6BAA6B,CAAC;AAoB1Y,OAAO,EAA6G,KAAK,YAAY,EAAwB,MAAM,2BAA2B,CAAC;AAE/L,OAAO,EAOL,KAAK,gBAAgB,EAEtB,MAAM,mCAAmC,CAAC;AAgV3C,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAyD1D;AA+DD,KAAK,SAAS,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAE9E,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE;IACP,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;CACvC,GACL,OAAO,CAAC,MAAM,CAAC,CA2TjB;AAowED,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAS/H"}
package/dist/runner.mjs CHANGED
@@ -8436,6 +8436,191 @@ function stringOrDefault(value, fallback) {
8436
8436
  return typeof value === "string" && value.trim() ? value.trim() : fallback;
8437
8437
  }
8438
8438
 
8439
+ // apps/runner/package.json
8440
+ var package_default = {
8441
+ name: "@synapsor/runner",
8442
+ version: "0.1.11",
8443
+ description: "Stop giving AI agents execute_sql; expose reviewed Postgres/MySQL MCP actions with proposals, approval, writeback, and replay.",
8444
+ license: "Apache-2.0",
8445
+ type: "module",
8446
+ bin: {
8447
+ "synapsor-runner": "dist/cli.js"
8448
+ },
8449
+ files: [
8450
+ "dist/cli.js",
8451
+ "dist/cli.d.ts",
8452
+ "dist/cli.d.ts.map",
8453
+ "dist/local-ui.d.ts",
8454
+ "dist/local-ui.d.ts.map",
8455
+ "dist/runner.mjs",
8456
+ "docs/**/*.md",
8457
+ "examples/dangerous-mcp-tools.json",
8458
+ "examples/app-owned-writeback/**",
8459
+ "examples/claude-desktop-postgres/**",
8460
+ "examples/cursor-postgres/**",
8461
+ "examples/mcp-postgres-billing-app-handler/**",
8462
+ "examples/mysql-refund-agent/**",
8463
+ "examples/openai-agents-http/**",
8464
+ "examples/openai-agents-stdio/**",
8465
+ "examples/raw-sql-vs-synapsor/**",
8466
+ "examples/reference-support-billing-app/**",
8467
+ "examples/support-plan-credit/**",
8468
+ "examples/support-billing-agent/**",
8469
+ "fixtures/**",
8470
+ "schemas/**",
8471
+ "recipes/**/*.json",
8472
+ "README.md",
8473
+ "CHANGELOG.md",
8474
+ "LICENSE",
8475
+ "NOTICE",
8476
+ "TRADEMARKS.md"
8477
+ ],
8478
+ keywords: [
8479
+ "mcp",
8480
+ "postgres",
8481
+ "mysql",
8482
+ "ai-agents",
8483
+ "sql-safety",
8484
+ "database-safety",
8485
+ "openai-agents",
8486
+ "claude",
8487
+ "cursor",
8488
+ "writeback",
8489
+ "replay",
8490
+ "model-context-protocol"
8491
+ ],
8492
+ engines: {
8493
+ node: ">=22.5.0"
8494
+ },
8495
+ scripts: {
8496
+ build: "tsc -b && node ../../scripts/build-runner-package.mjs",
8497
+ prepack: "cd ../.. && corepack pnpm build:runner-package",
8498
+ test: "vitest run"
8499
+ },
8500
+ dependencies: {
8501
+ "@modelcontextprotocol/sdk": "1.29.0",
8502
+ mysql2: "^3.11.0",
8503
+ pg: "^8.13.0",
8504
+ zod: "^3.25.0"
8505
+ },
8506
+ devDependencies: {
8507
+ typescript: "^5.7.0",
8508
+ vitest: "^3.2.0"
8509
+ },
8510
+ homepage: "https://synapsor.ai",
8511
+ repository: {
8512
+ type: "git",
8513
+ url: "git+https://github.com/Synapsor/Synapsor-Runner.git"
8514
+ },
8515
+ bugs: {
8516
+ url: "https://synapsor.ai/contact"
8517
+ },
8518
+ publishConfig: {
8519
+ access: "public"
8520
+ }
8521
+ };
8522
+
8523
+ // packages/dsl/package.json
8524
+ var package_default2 = {
8525
+ name: "@synapsor/dsl",
8526
+ version: "0.1.4",
8527
+ description: "Preview SQL-like Synapsor authoring DSL compiler for canonical @synapsor/spec contracts.",
8528
+ license: "Apache-2.0",
8529
+ type: "module",
8530
+ main: "dist/index.js",
8531
+ types: "dist/index.d.ts",
8532
+ bin: {
8533
+ "synapsor-dsl": "dist/cli.js"
8534
+ },
8535
+ files: [
8536
+ "dist/**",
8537
+ "examples/**",
8538
+ "README.md",
8539
+ "package.json"
8540
+ ],
8541
+ scripts: {
8542
+ build: "tsc -b",
8543
+ test: "vitest run"
8544
+ },
8545
+ dependencies: {
8546
+ "@synapsor/spec": "workspace:^0.1.4"
8547
+ },
8548
+ devDependencies: {
8549
+ typescript: "^5.7.0",
8550
+ vitest: "^3.2.0"
8551
+ },
8552
+ keywords: [
8553
+ "synapsor",
8554
+ "dsl",
8555
+ "ai-agents",
8556
+ "mcp",
8557
+ "database-safety"
8558
+ ],
8559
+ engines: {
8560
+ node: ">=22.5.0"
8561
+ },
8562
+ publishConfig: {
8563
+ access: "public"
8564
+ },
8565
+ repository: {
8566
+ type: "git",
8567
+ url: "git+https://github.com/Synapsor/Synapsor-Runner.git",
8568
+ directory: "packages/dsl"
8569
+ },
8570
+ homepage: "https://github.com/Synapsor/Synapsor-Runner/tree/main/packages/dsl#readme",
8571
+ bugs: {
8572
+ url: "https://github.com/Synapsor/Synapsor-Runner/issues"
8573
+ }
8574
+ };
8575
+
8576
+ // packages/spec/package.json
8577
+ var package_default3 = {
8578
+ name: "@synapsor/spec",
8579
+ version: "0.1.4",
8580
+ description: "Canonical Synapsor contract schemas, types, validation, and conformance fixtures.",
8581
+ license: "Apache-2.0",
8582
+ type: "module",
8583
+ main: "dist/index.js",
8584
+ types: "dist/index.d.ts",
8585
+ bin: {
8586
+ "synapsor-spec": "dist/cli.js"
8587
+ },
8588
+ files: [
8589
+ "dist/**",
8590
+ "schemas/**",
8591
+ "examples/**",
8592
+ "fixtures/**",
8593
+ "README.md",
8594
+ "package.json"
8595
+ ],
8596
+ scripts: {
8597
+ build: "tsc -b",
8598
+ test: "vitest run"
8599
+ },
8600
+ keywords: [
8601
+ "synapsor",
8602
+ "ai-agents",
8603
+ "mcp",
8604
+ "database-safety",
8605
+ "contracts"
8606
+ ],
8607
+ engines: {
8608
+ node: ">=22.5.0"
8609
+ },
8610
+ publishConfig: {
8611
+ access: "public"
8612
+ },
8613
+ repository: {
8614
+ type: "git",
8615
+ url: "git+https://github.com/Synapsor/Synapsor-Runner.git",
8616
+ directory: "packages/spec"
8617
+ },
8618
+ homepage: "https://github.com/Synapsor/Synapsor-Runner/tree/main/packages/spec#readme",
8619
+ bugs: {
8620
+ url: "https://github.com/Synapsor/Synapsor-Runner/issues"
8621
+ }
8622
+ };
8623
+
8439
8624
  // apps/runner/src/cli.ts
8440
8625
  var adapters = { postgres: postgresAdapter, mysql: mysqlAdapter };
8441
8626
  var handlerReceiptStatuses = /* @__PURE__ */ new Set(["applied", "already_applied", "conflict", "failed"]);
@@ -10042,18 +10227,21 @@ async function contractBundle(args) {
10042
10227
  const firstSource = firstCapability?.source ?? "local_postgres";
10043
10228
  const engine = inferContractBundleEngine(contract);
10044
10229
  const readUrlEnv = engine === "mysql" ? "SYNAPSOR_DATABASE_READ_URL" : "SYNAPSOR_DATABASE_READ_URL";
10230
+ const hasProposals = contract.capabilities.some((capability) => capability.kind === "proposal");
10231
+ const sourceConfig = {
10232
+ engine,
10233
+ read_url_env: readUrlEnv,
10234
+ statement_timeout_ms: 3e3
10235
+ };
10236
+ if (hasProposals) sourceConfig.write_url_env = "SYNAPSOR_DATABASE_WRITE_URL";
10045
10237
  const runnerConfig = {
10046
10238
  version: 1,
10047
- mode: contract.capabilities.some((capability) => capability.kind === "proposal") ? "review" : "read_only",
10239
+ mode: hasProposals ? "review" : "read_only",
10048
10240
  result_format: 2,
10049
10241
  storage: { sqlite_path: "./.synapsor/local.db" },
10050
10242
  contracts: ["./synapsor.contract.json"],
10051
10243
  sources: {
10052
- [firstSource]: {
10053
- engine,
10054
- read_url_env: readUrlEnv,
10055
- statement_timeout_ms: 3e3
10056
- }
10244
+ [firstSource]: sourceConfig
10057
10245
  }
10058
10246
  };
10059
10247
  await fs3.mkdir(outDir, { recursive: true });
@@ -10064,11 +10252,9 @@ async function contractBundle(args) {
10064
10252
  `, "utf8");
10065
10253
  await fs3.writeFile(path3.join(outDir, ".env.example"), bundleEnvExample(contract, readUrlEnv, engine), "utf8");
10066
10254
  await fs3.writeFile(path3.join(outDir, "README.md"), bundleReadme(contract), "utf8");
10067
- await fs3.writeFile(path3.join(outDir, "mcp-client-examples", "generic-stdio.json"), `${JSON.stringify({
10068
- command: cliCommandName(),
10069
- args: ["mcp", "serve", "--config", "./synapsor.runner.json", "--store", "./.synapsor/local.db"]
10070
- }, null, 2)}
10071
- `, "utf8");
10255
+ for (const [name, content] of Object.entries(bundleMcpClientExamples())) {
10256
+ await fs3.writeFile(path3.join(outDir, "mcp-client-examples", name), content, "utf8");
10257
+ }
10072
10258
  process2.stdout.write(`created runner bundle: ${outDir}
10073
10259
  `);
10074
10260
  process2.stdout.write("No database URLs, write credentials, tokens, or customer rows were included.\n");
@@ -10087,6 +10273,7 @@ function bundleEnvExample(contract, readUrlEnv, engine) {
10087
10273
  "# Fill these locally. Do not commit real values.",
10088
10274
  `# Set ${readUrlEnv} to your read-only ${engine === "mysql" ? "MySQL" : "Postgres"} URL.`,
10089
10275
  `${readUrlEnv}=`,
10276
+ ...contract.capabilities.some((capability) => capability.kind === "proposal") ? ["# Optional: separate least-privilege write URL for guarded direct UPDATE writeback.", "SYNAPSOR_DATABASE_WRITE_URL="] : [],
10090
10277
  `${tenantBinding?.key ?? "SYNAPSOR_TENANT_ID"}=acme`,
10091
10278
  `${principalBinding?.key ?? "SYNAPSOR_PRINCIPAL"}=local_operator`,
10092
10279
  ""
@@ -10113,12 +10300,70 @@ function bundleReadme(contract) {
10113
10300
  "```bash",
10114
10301
  "cp .env.example .env",
10115
10302
  "# edit .env, then export the values in your shell",
10116
- `${cliCommandName()} contract validate ./synapsor.contract.json`,
10117
- `${cliCommandName()} mcp serve --config ./synapsor.runner.json --store ./.synapsor/local.db`,
10303
+ "set -a && . ./.env && set +a",
10304
+ "npx -y -p @synapsor/runner synapsor-runner contract validate ./synapsor.contract.json",
10305
+ "npx -y -p @synapsor/runner synapsor-runner config validate --config ./synapsor.runner.json",
10306
+ "npx -y -p @synapsor/runner synapsor-runner tools preview --config ./synapsor.runner.json --store ./.synapsor/local.db",
10307
+ "npx -y -p @synapsor/runner synapsor-runner mcp serve --config ./synapsor.runner.json --store ./.synapsor/local.db",
10308
+ "```",
10309
+ "",
10310
+ "Approval and apply remain outside the model-facing MCP catalog. Inspect local history with:",
10311
+ "",
10312
+ "```bash",
10313
+ "npx -y -p @synapsor/runner synapsor-runner replay show latest --store ./.synapsor/local.db",
10314
+ "npx -y -p @synapsor/runner synapsor-runner cloud push ./synapsor.contract.json --dry-run",
10118
10315
  "```",
10119
10316
  ""
10120
10317
  ].join("\n");
10121
10318
  }
10319
+ function bundleMcpClientExamples() {
10320
+ const packageArgs = ["-y", "-p", "@synapsor/runner", "synapsor-runner"];
10321
+ const stdioArgs = [...packageArgs, "mcp", "serve", "--config", "./synapsor.runner.json", "--store", "./.synapsor/local.db"];
10322
+ const server = { command: "npx", args: stdioArgs };
10323
+ const json = (value) => `${JSON.stringify(value, null, 2)}
10324
+ `;
10325
+ return {
10326
+ "claude-desktop.json": json({ mcpServers: { "synapsor-runner": server } }),
10327
+ "cursor-project.mcp.json": json({ mcpServers: { "synapsor-runner": { type: "stdio", ...server } } }),
10328
+ "cursor-global.mcp.json": json({
10329
+ mcpServers: {
10330
+ "synapsor-runner": {
10331
+ type: "stdio",
10332
+ command: "npx",
10333
+ args: [...packageArgs, "mcp", "serve", "--config", "<absolute-path-to-bundle>/synapsor.runner.json", "--store", "<absolute-path-to-bundle>/.synapsor/local.db"]
10334
+ }
10335
+ }
10336
+ }),
10337
+ "generic-stdio.json": json({ name: "synapsor-runner", transport: "stdio", ...server }),
10338
+ "generic-streamable-http.json": json({ name: "synapsor-runner", transport: "streamable-http", url: "http://127.0.0.1:8766/mcp" }),
10339
+ "openai-agents-stdio.ts": `import { Agent, MCPServerStdio, run } from "@openai/agents";
10340
+
10341
+ const synapsor = new MCPServerStdio({
10342
+ name: "Synapsor Runner",
10343
+ fullCommand: "npx -y -p @synapsor/runner synapsor-runner mcp serve --config ./synapsor.runner.json --store ./.synapsor/local.db --alias-mode openai",
10344
+ });
10345
+ await synapsor.connect();
10346
+ try {
10347
+ const agent = new Agent({ name: "Reviewed database agent", instructions: "Use only Synapsor business tools. Inspect evidence before proposing a change.", mcpServers: [synapsor] });
10348
+ console.log((await run(agent, "Inspect the customer and propose a safe next action.")).finalOutput);
10349
+ } finally {
10350
+ await synapsor.close();
10351
+ }
10352
+ `,
10353
+ "openai-agents-streamable-http.ts": `import { Agent, MCPServerStreamableHttp, run } from "@openai/agents";
10354
+
10355
+ // Start Runner separately with: synapsor-runner mcp serve --transport streamable-http --alias-mode openai --config ./synapsor.runner.json --store ./.synapsor/local.db
10356
+ const synapsor = new MCPServerStreamableHttp({ name: "Synapsor Runner", url: "http://127.0.0.1:8766/mcp" });
10357
+ await synapsor.connect();
10358
+ try {
10359
+ const agent = new Agent({ name: "Reviewed database agent", instructions: "Use only Synapsor business tools. Inspect evidence before proposing a change.", mcpServers: [synapsor] });
10360
+ console.log((await run(agent, "Inspect the customer and propose a safe next action.")).finalOutput);
10361
+ } finally {
10362
+ await synapsor.close();
10363
+ }
10364
+ `
10365
+ };
10366
+ }
10122
10367
  async function configValidate(args) {
10123
10368
  const configPath = optionalArg(args, "--config") ?? "synapsor.runner.json";
10124
10369
  const result = await validateConfigFile(configPath);
@@ -11949,7 +12194,7 @@ async function cloudPush(args) {
11949
12194
  if (!target2) throw new Error("cloud push requires <synapsor.contract.json>");
11950
12195
  const parsed = JSON.parse(await fs3.readFile(target2, "utf8"));
11951
12196
  const contract = normalizeContract(parsed);
11952
- const workspace = (optionalArg(args, "--workspace") ?? optionalArg(args, "--project") ?? process2.env.SYNAPSOR_WORKSPACE_ID ?? process2.env.SYNAPSOR_PROJECT_ID ?? "").trim();
12197
+ const workspace = (optionalArg(args, "--workspace") ?? optionalArg(args, "--project") ?? process2.env.SYNAPSOR_CLOUD_WORKSPACE ?? process2.env.SYNAPSOR_WORKSPACE_ID ?? process2.env.SYNAPSOR_PROJECT_ID ?? "").trim();
11953
12198
  const name = (optionalArg(args, "--name") ?? contract.metadata?.name ?? "").trim();
11954
12199
  const description = (optionalArg(args, "--description") ?? contract.metadata?.description ?? "").trim();
11955
12200
  const idempotencyKey = optionalArg(args, "--idempotency-key");
@@ -11962,7 +12207,9 @@ async function cloudPush(args) {
11962
12207
  description,
11963
12208
  source: "runner",
11964
12209
  source_versions: {
11965
- "@synapsor/runner": process2.env.npm_package_version ?? "unknown"
12210
+ "@synapsor/spec": package_default3.version,
12211
+ "@synapsor/dsl": package_default2.version,
12212
+ "@synapsor/runner": process2.env.npm_package_version ?? package_default.version
11966
12213
  },
11967
12214
  activate: args.includes("--activate"),
11968
12215
  idempotency_key: idempotencyKey,
@@ -11997,7 +12244,7 @@ async function cloudPush(args) {
11997
12244
  const apiUrl = (optionalArg(args, "--api-url") ?? process2.env.SYNAPSOR_CLOUD_BASE_URL ?? "").trim();
11998
12245
  const token = (optionalArg(args, "--token") ?? process2.env.SYNAPSOR_CLOUD_TOKEN ?? process2.env.SYNAPSOR_RUNNER_TOKEN ?? "").trim();
11999
12246
  if (!workspace) {
12000
- throw new Error("cloud push upload requires --workspace <project_id> or SYNAPSOR_WORKSPACE_ID/SYNAPSOR_PROJECT_ID.");
12247
+ throw new Error("cloud push upload requires --workspace <project_id> or SYNAPSOR_CLOUD_WORKSPACE/SYNAPSOR_WORKSPACE_ID/SYNAPSOR_PROJECT_ID.");
12001
12248
  }
12002
12249
  if (!apiUrl || !token) {
12003
12250
  throw new Error("cloud push upload requires --api-url plus --token/SYNAPSOR_CLOUD_TOKEN. Use --dry-run for local validation without a network call.");
@@ -16622,8 +16869,9 @@ instead of being ignored.
16622
16869
  ${cmd} cloud push ./synapsor.contract.json --dry-run [--workspace <id>] [--name <registry-name>]
16623
16870
 
16624
16871
  cloud push validates and normalizes the contract locally, then prints the
16625
- payload summary. Upload is intentionally not reported as successful until a
16626
- real Cloud registry endpoint is wired.
16872
+ payload summary. With --dry-run it makes no network request. Without --dry-run
16873
+ it uploads to the authenticated Cloud registry and reports the stored contract,
16874
+ version, digest, and registry URL returned by the server.
16627
16875
  `,
16628
16876
  up: `Usage:
16629
16877
  ${cmd} up --config ./synapsor.runner.json --store ./.synapsor/local.db [--transport stdio|streamable-http]
package/docs/README.md CHANGED
@@ -49,6 +49,8 @@ then read the concepts once the safety boundary is visible.
49
49
 
50
50
  - [MCP Client Setup](mcp-client-setup.md): connect Claude, Cursor, VS Code, or
51
51
  another stdio MCP client.
52
+ - [MCP Client Configs](mcp-clients.md): complete Claude, Cursor, OpenAI Agents,
53
+ generic stdio, and Streamable HTTP templates.
52
54
  - `examples/claude-desktop-postgres/`: copy-paste Claude Desktop config for the
53
55
  Postgres billing fixture.
54
56
  - `examples/cursor-postgres/`: copy-paste Cursor config for the Postgres
@@ -96,6 +98,10 @@ then read the concepts once the safety boundary is visible.
96
98
  scope, database roles, receipt grants, local ledger backup, restart behavior,
97
99
  Docker/systemd shapes, TLS, and release-gate expectations.
98
100
  - [Cloud Mode](cloud-mode.md): what stays local and what Cloud-linked mode adds.
101
+ - [Cloud Push](cloud-push.md): register a validated local contract in the
102
+ versioned Cloud registry.
103
+ - [Runner Bundles](runner-bundles.md): download the same immutable contract and
104
+ its local MCP wiring from Cloud.
99
105
  - [Release Notes](release-notes.md): release history and behavior changes.
100
106
  - [Release Policy](release-policy.md): stable gates and publish verification.
101
107
  - [Licensing](licensing.md): Apache-2.0 scope, trademark boundary, and what is
@@ -6,6 +6,8 @@ guarded writeback, or replay.
6
6
 
7
7
  Cloud-linked mode is for teams that need a shared control plane:
8
8
 
9
+ - versioned canonical contract registry and server-computed digests;
10
+ - Cloud-to-local runner bundle downloads;
9
11
  - team approvals and RBAC;
10
12
  - hosted evidence/replay search;
11
13
  - runner registration and heartbeat;
@@ -17,6 +19,22 @@ The local runner still keeps database credentials in your environment. MCP
17
19
  client config snippets should contain command paths and runner arguments, not
18
20
  database URLs or write credentials.
19
21
 
22
+ Push and retrieve the portable contract without moving database credentials
23
+ into Cloud:
24
+
25
+ ```bash
26
+ synapsor-runner cloud push ./synapsor.contract.json --dry-run
27
+ synapsor-runner cloud push ./synapsor.contract.json \
28
+ --workspace "$SYNAPSOR_WORKSPACE_ID" \
29
+ --name support-plan-credit
30
+ ```
31
+
32
+ See [Cloud Push](cloud-push.md) and [Runner Bundles](runner-bundles.md).
33
+
34
+ Cloud registry storage preserves approval policies but does not, by itself,
35
+ mean hosted policy enforcement is enabled. Local Runner enforcement and hosted
36
+ Cloud approval enforcement are separate runtime boundaries.
37
+
20
38
  Run the local smoke for this mode with:
21
39
 
22
40
  ```bash
@@ -0,0 +1,54 @@
1
+ # Push A Contract To Synapsor Cloud
2
+
3
+ Cloud push registers the same canonical contract that you validate and run
4
+ locally. Cloud stores a normalized immutable version, computes its digest,
5
+ records the actor, and makes the safety boundary visible in the workspace
6
+ registry.
7
+
8
+ ## Preview Without A Network Call
9
+
10
+ ```bash
11
+ synapsor-runner cloud push ./synapsor.contract.json --dry-run
12
+ synapsor-runner cloud push ./synapsor.contract.json --dry-run --json
13
+ ```
14
+
15
+ Dry-run validates and normalizes locally. It performs no network request.
16
+
17
+ ## Push
18
+
19
+ ```bash
20
+ export SYNAPSOR_CLOUD_BASE_URL="https://api.synapsor.ai"
21
+ export SYNAPSOR_CLOUD_TOKEN="<workspace-scoped-token>"
22
+ export SYNAPSOR_WORKSPACE_ID="<workspace-id>"
23
+
24
+ synapsor-runner cloud push ./synapsor.contract.json \
25
+ --name support-plan-credit
26
+ ```
27
+
28
+ The response includes the contract id, immutable version id, server-computed
29
+ digest, summary counts, status, and registry path. Identical normalized content
30
+ is idempotent; changed content creates the next version.
31
+
32
+ Tokens are sent in the authorization header and are never part of the contract.
33
+ Database URLs, passwords, private keys, and model-controlled tenant bindings
34
+ are rejected by server-side validation.
35
+
36
+ `SYNAPSOR_CLOUD_WORKSPACE` is accepted as an alias for
37
+ `SYNAPSOR_WORKSPACE_ID`. Explicit `--workspace` wins over environment values.
38
+
39
+ Cloud push fails before upload when local validation fails. HTTP failures are
40
+ reported distinctly for invalid/expired tokens (`401`), insufficient workspace
41
+ permission (`403`), missing workspace/API paths (`404`), registry conflicts
42
+ (`409`), server validation (`422`), and Cloud/network failures. Error output
43
+ does not echo the bearer token.
44
+
45
+ ## Cloud To Local
46
+
47
+ Open **Contract registry** in the workspace, choose a version, and download its
48
+ runner bundle. The ZIP contains the normalized contract, local runner wiring,
49
+ placeholder environment file, README, and MCP client examples. It contains no
50
+ live credentials or table rows.
51
+
52
+ Cloud currently preserves approval policy definitions in the contract and
53
+ bundle. Hosted approval-policy enforcement remains a separate Cloud feature;
54
+ do not infer it from registry storage alone.
@@ -2,7 +2,7 @@
2
2
 
3
3
  The canonical scope page is [Current Limitations](limitations.md).
4
4
 
5
- Current alpha scope:
5
+ Current `0.1.x` scope:
6
6
 
7
7
  - local semantic MCP tools for Postgres/MySQL-backed business actions;
8
8
  - schema inspection and guided config generation;
@@ -0,0 +1,123 @@
1
+ # MCP Client Configs
2
+
3
+ Synapsor Runner exposes reviewed semantic tools over standard MCP. The model
4
+ receives inspect/propose capabilities; it does not receive raw SQL, database
5
+ credentials, approval commands, or apply commands.
6
+
7
+ The complete copy-paste templates live in:
8
+
9
+ - [`examples/support-plan-credit/mcp-client-examples/`](../examples/support-plan-credit/mcp-client-examples/)
10
+ - every local `synapsor-runner contract bundle` output;
11
+ - every downloadable Synapsor Cloud runner bundle.
12
+
13
+ Before connecting a client, validate the local boundary:
14
+
15
+ ```bash
16
+ synapsor-runner config validate --config ./synapsor.runner.json
17
+ synapsor-runner tools preview --config ./synapsor.runner.json --store ./.synapsor/local.db
18
+ ```
19
+
20
+ Set database and trusted-context values in the environment that launches the
21
+ MCP process. Keep real URLs and tokens in your shell or secret manager, not in
22
+ the checked-in client JSON.
23
+
24
+ ## Stdio
25
+
26
+ Use stdio for Claude Desktop, Cursor, and other local MCP clients:
27
+
28
+ ```json
29
+ {
30
+ "command": "npx",
31
+ "args": [
32
+ "-y", "-p", "@synapsor/runner", "synapsor-runner",
33
+ "mcp", "serve", "--config", "./synapsor.runner.json",
34
+ "--store", "./.synapsor/local.db"
35
+ ]
36
+ }
37
+ ```
38
+
39
+ Relative paths are resolved from the MCP client's working directory. Use the
40
+ project template when the client starts in your repository; replace the marked
41
+ bundle path in the global template when it does not.
42
+
43
+ ### Claude Desktop
44
+
45
+ 1. Open Claude Desktop settings and choose the developer option to edit its MCP
46
+ configuration.
47
+ 2. Merge `claude-desktop.json` into the existing `mcpServers` object.
48
+ 3. Replace the marked working directory or use absolute paths when Claude does
49
+ not start in the bundle directory.
50
+ 4. Restart Claude Desktop completely, then confirm the two semantic tools are
51
+ listed.
52
+
53
+ Claude Desktop launched from a graphical session may not inherit your terminal
54
+ environment. Supply the required env values through the OS process environment
55
+ or a local secret-manager wrapper; do not paste production credentials into a
56
+ repository file.
57
+
58
+ ### Cursor
59
+
60
+ For one repository, place the project template at `.cursor/mcp.json`. For a
61
+ global setup, merge `cursor-global.mcp.json` through Cursor's MCP settings and
62
+ replace every `<absolute-path-to-bundle>` marker. Restart the MCP server from
63
+ Cursor settings after editing.
64
+
65
+ The model-facing list should contain only the contract's inspect/propose tools.
66
+ If Cursor reports a missing config or store, use absolute paths and rerun
67
+ `tools preview` from the same working directory.
68
+
69
+ ### OpenAI Agents SDK
70
+
71
+ Install the SDK in your agent project and run either TypeScript template:
72
+
73
+ ```bash
74
+ npm install @openai/agents
75
+ ```
76
+
77
+ OpenAI function names cannot contain dots. The stdio template therefore starts
78
+ Runner with `--alias-mode openai`; model-visible names use `__`, while result
79
+ metadata preserves the canonical dotted Synapsor capability name.
80
+
81
+ ## Streamable HTTP
82
+
83
+ ```bash
84
+ synapsor-runner mcp serve \
85
+ --transport streamable-http \
86
+ --alias-mode openai \
87
+ --host 127.0.0.1 \
88
+ --port 8766 \
89
+ --config ./synapsor.runner.json \
90
+ --store ./.synapsor/local.db
91
+ ```
92
+
93
+ Connect a standard Streamable HTTP MCP client to
94
+ `http://127.0.0.1:8766/mcp`. Keep it on loopback for local development. For a
95
+ network deployment, terminate TLS, require authentication, restrict network
96
+ access, and follow the [production guide](production.md).
97
+
98
+ Use `--alias-mode openai` for the OpenAI Agents SDK. Omit it for clients that
99
+ accept canonical dotted names, or use `--alias-mode both` only during a planned
100
+ migration where duplicate canonical/alias tools are acceptable.
101
+
102
+ ## Verify The Boundary
103
+
104
+ ```bash
105
+ synapsor-runner tools preview --config ./synapsor.runner.json --store ./.synapsor/local.db
106
+ synapsor-runner smoke call --config ./synapsor.runner.json --store ./.synapsor/local.db
107
+ ```
108
+
109
+ The preview must list semantic capabilities and must not list `execute_sql`,
110
+ approval/apply tools, database URLs, write credentials, or model-controlled
111
+ tenant authority.
112
+
113
+ ## Troubleshooting
114
+
115
+ - `ENOENT` or missing config: use absolute config/store paths.
116
+ - empty tool list: run `contract validate`, then `tools preview` against the
117
+ exact config used by the client.
118
+ - database connection failure: verify the client process received the read URL
119
+ and trusted tenant/principal env values.
120
+ - OpenAI rejects a dotted name: start Runner with `--alias-mode openai`.
121
+ - HTTP `initialize` failure: use `mcp serve --transport streamable-http`, not
122
+ the legacy `serve-http` JSON-RPC bridge.
123
+ - no ready message: inspect client stderr; Runner keeps stdout protocol-clean.
@@ -12,6 +12,36 @@ for the Synapsor Cloud CLI.
12
12
 
13
13
  ## Unreleased
14
14
 
15
+ Prepared package versions: `@synapsor/spec@0.1.4`,
16
+ `@synapsor/dsl@0.1.4`, and `@synapsor/runner@0.1.11`. Nothing in this section
17
+ is published until the manual release commands are run.
18
+
19
+ ### Cloud Adoption Loop
20
+
21
+ - Adds complete Claude, Cursor, OpenAI Agents SDK, and generic MCP templates to
22
+ local and Cloud-generated Runner bundles.
23
+ - Adds a flagship adoption verifier and a real local Cloud registry/version/ZIP
24
+ bundle round trip.
25
+ - Expands the `support-plan-credit` walkthrough from no-database validation to
26
+ Docker-backed policy tiers, MCP setup, Cloud push, bundle download, replay,
27
+ cleanup, and troubleshooting.
28
+ - Supports `SYNAPSOR_CLOUD_WORKSPACE` and verifies distinct 401/403/404/409/422,
29
+ server, and network errors without exposing tokens.
30
+ - Clarifies that Cloud registry/versioning is beta-ready while managed runners,
31
+ SAML/SCIM, hosted policy enforcement, legal hold, and enterprise SLA are not
32
+ part of this release.
33
+ - Corrects `cloud push --help` to describe the real authenticated registry
34
+ upload and network-free dry-run behavior.
35
+
36
+ ## 0.1.10
37
+
38
+ ### Policy Auto-Approval
39
+
40
+ - Adds portable approval-policy references and threshold rules.
41
+ - Adds DSL `AUTO APPROVE WHEN field <= integer` and the three-tier
42
+ `support-plan-credit` example: policy approval, operator review, and bound
43
+ rejection.
44
+
15
45
  ## 0.1.9
16
46
 
17
47
  ### CLI Hygiene
@@ -0,0 +1,59 @@
1
+ # Runner Bundles
2
+
3
+ A runner bundle is the portable Cloud-to-local side of the canonical loop:
4
+
5
+ ```text
6
+ local DSL/spec -> cloud push -> immutable registry version -> runner bundle -> local Runner
7
+ ```
8
+
9
+ Every bundle contains:
10
+
11
+ ```text
12
+ synapsor.contract.json
13
+ synapsor.runner.json
14
+ .env.example
15
+ README.md
16
+ mcp-client-examples/
17
+ claude-desktop.json
18
+ cursor-project.mcp.json
19
+ cursor-global.mcp.json
20
+ openai-agents-stdio.ts
21
+ openai-agents-streamable-http.ts
22
+ generic-stdio.json
23
+ generic-streamable-http.json
24
+ ```
25
+
26
+ It never contains database passwords, write credentials, live API tokens,
27
+ private keys, customer rows, or machine-specific local paths.
28
+
29
+ ## Create Locally
30
+
31
+ ```bash
32
+ synapsor-runner contract bundle ./synapsor.contract.json \
33
+ --out ./synapsor-runner-bundle
34
+ ```
35
+
36
+ ## Run A Downloaded Bundle
37
+
38
+ ```bash
39
+ cd ./synapsor-runner-bundle
40
+ cp .env.example .env
41
+ set -a && . ./.env && set +a
42
+
43
+ npx -y -p @synapsor/runner synapsor-runner contract validate ./synapsor.contract.json
44
+ npx -y -p @synapsor/runner synapsor-runner config validate --config ./synapsor.runner.json
45
+ npx -y -p @synapsor/runner synapsor-runner tools preview --config ./synapsor.runner.json --store ./.synapsor/local.db
46
+ npx -y -p @synapsor/runner synapsor-runner mcp serve --config ./synapsor.runner.json --store ./.synapsor/local.db
47
+ ```
48
+
49
+ For the OpenAI Agents SDK, use the included TypeScript examples. Their stdio
50
+ command enables `--alias-mode openai`; the Streamable HTTP example includes the
51
+ matching server command. Claude, Cursor, and generic templates use canonical
52
+ dotted capability names.
53
+
54
+ Approval and writeback remain outside the model-facing MCP tool surface. Use
55
+ `proposals`, `apply`, `receipts`, and `replay` from a trusted operator shell.
56
+
57
+ The bundle's `.env.example` contains names and placeholders only. Fill it for a
58
+ local or staging source, source it into the shell or process that launches your
59
+ MCP client, and keep the resulting `.env` out of source control.
@@ -0,0 +1,10 @@
1
+ # Disposable Docker example credentials only. Do not reuse in staging or production.
2
+ PLAN_CREDIT_POSTGRES_READ_URL=postgresql://synapsor_reader:synapsor_reader_password@127.0.0.1:55438/synapsor_runner_plan_credit
3
+ PLAN_CREDIT_POSTGRES_WRITE_URL=postgresql://synapsor_writer:synapsor_writer_password@127.0.0.1:55438/synapsor_runner_plan_credit
4
+ SYNAPSOR_TENANT_ID=acme
5
+ SYNAPSOR_PRINCIPAL=local_support_agent
6
+
7
+ # Optional Cloud registry upload. Keep real values outside git.
8
+ SYNAPSOR_CLOUD_BASE_URL=
9
+ SYNAPSOR_CLOUD_TOKEN=
10
+ SYNAPSOR_WORKSPACE_ID=
@@ -12,15 +12,46 @@ This example shows three enforcement tiers on one support action:
12
12
  - Node 22.5+
13
13
  - Port `55438` available
14
14
 
15
+ Install the stable CLI once for the commands below:
16
+
17
+ ```bash
18
+ npm install --global @synapsor/runner
19
+ synapsor-runner --version
20
+ ```
21
+
22
+ When working from this source checkout, use `corepack pnpm runner` in place of
23
+ `synapsor-runner`.
24
+
25
+ ## No-Database Check
26
+
27
+ Validate the authored boundary before starting Docker:
28
+
29
+ ```bash
30
+ synapsor-runner dsl compile examples/support-plan-credit/contract.synapsor \
31
+ --out /tmp/support-plan-credit.contract.json \
32
+ --strict
33
+ synapsor-runner contract validate /tmp/support-plan-credit.contract.json
34
+ synapsor-runner config validate \
35
+ --config examples/support-plan-credit/synapsor.runner.json
36
+ synapsor-runner cloud push /tmp/support-plan-credit.contract.json \
37
+ --dry-run \
38
+ --workspace local-preview \
39
+ --name support-plan-credit
40
+ ```
41
+
42
+ This compiles, validates, and previews the Cloud payload without opening a
43
+ network connection or connecting to a database. From a source checkout,
44
+ `corepack pnpm verify:adoption` runs this boundary check plus the no-database
45
+ quick demo and MCP config validation.
46
+
15
47
  ## Quick Start
16
48
 
17
49
  ```bash
18
50
  docker compose -f examples/support-plan-credit/docker-compose.yml up -d
19
51
 
20
- export PLAN_CREDIT_POSTGRES_READ_URL="postgresql://synapsor_reader:synapsor_reader_password@localhost:55438/synapsor_runner_plan_credit"
21
- export PLAN_CREDIT_POSTGRES_WRITE_URL="postgresql://synapsor_writer:synapsor_writer_password@localhost:55438/synapsor_runner_plan_credit"
22
- export SYNAPSOR_TENANT_ID="acme"
23
- export SYNAPSOR_PRINCIPAL="local_support_agent"
52
+ set -a
53
+ . examples/support-plan-credit/.env.example
54
+ set +a
24
55
 
25
56
  synapsor-runner tools preview \
26
57
  --config examples/support-plan-credit/synapsor.runner.json \
@@ -32,6 +63,9 @@ synapsor-runner mcp serve \
32
63
  --store ./tmp/support-plan-credit/local.db
33
64
  ```
34
65
 
66
+ The checked-in `.env.example` contains disposable localhost Docker credentials
67
+ only. Never reuse them for staging or production.
68
+
35
69
  ## Walkthrough
36
70
 
37
71
  Inspect the customer first:
@@ -98,6 +132,13 @@ synapsor-runner apply latest --config examples/support-plan-credit/synapsor.runn
98
132
  The live smoke test mutates `updated_at` before apply and proves stale proposals
99
133
  return `VERSION_CONFLICT` without changing the source row.
100
134
 
135
+ Run the complete Docker-backed scenario, including all three policy tiers and
136
+ the stale-row conflict:
137
+
138
+ ```bash
139
+ corepack pnpm test:live-apply
140
+ ```
141
+
101
142
  ## What The Agent Never Sees
102
143
 
103
144
  The contract keeps these fields out:
@@ -118,6 +159,37 @@ auto-approval: enabled
118
159
  No raw SQL, approval tools, commit tools, write credentials, or model-controlled
119
160
  tenant authority are exposed to MCP.
120
161
 
162
+ Representative outputs are checked in under [`expected-output/`](expected-output/)
163
+ so you can compare the tool boundary, proposal, receipt, replay, and Cloud push
164
+ shape without guessing which state should change.
165
+
166
+ ## Connect An MCP Client
167
+
168
+ Copy the matching template from [`mcp-client-examples/`](mcp-client-examples/):
169
+
170
+ - Claude Desktop: `claude-desktop.json`
171
+ - Cursor project/global: `cursor-project.mcp.json`, `cursor-global.mcp.json`
172
+ - OpenAI Agents SDK: stdio and Streamable HTTP TypeScript examples
173
+ - generic MCP: stdio and Streamable HTTP JSON examples
174
+
175
+ For Streamable HTTP, run:
176
+
177
+ ```bash
178
+ synapsor-runner mcp serve \
179
+ --transport streamable-http \
180
+ --alias-mode openai \
181
+ --host 127.0.0.1 \
182
+ --port 8766 \
183
+ --config examples/support-plan-credit/synapsor.runner.json \
184
+ --store ./tmp/support-plan-credit/local.db
185
+ ```
186
+
187
+ The OpenAI client receives `support__inspect_customer` and
188
+ `support__propose_plan_credit`; Runner preserves the dotted canonical names in
189
+ tool metadata and results. For Claude, Cursor, or generic MCP clients, omit
190
+ `--alias-mode openai` to expose `support.inspect_customer` and
191
+ `support.propose_plan_credit`. Approval and apply remain outside MCP.
192
+
121
193
  ## How The Policy Is Governed
122
194
 
123
195
  The auto-approval policy lives in `contract.synapsor`:
@@ -153,11 +225,11 @@ synapsor-runner cloud push examples/support-plan-credit/synapsor.contract.json -
153
225
  Real push uses your Cloud env vars:
154
226
 
155
227
  ```bash
156
- export SYNAPSOR_CONTROL_PLANE_URL="https://api.synapsor.ai"
157
- export SYNAPSOR_RUNNER_TOKEN="syn_wbr_..."
228
+ export SYNAPSOR_CLOUD_BASE_URL="https://api.synapsor.ai"
229
+ export SYNAPSOR_CLOUD_TOKEN="<workspace-scoped-token>"
230
+ export SYNAPSOR_WORKSPACE_ID="<workspace_id>"
158
231
 
159
232
  synapsor-runner cloud push examples/support-plan-credit/synapsor.contract.json \
160
- --workspace <workspace_id> \
161
233
  --name support-plan-credit
162
234
  ```
163
235
 
@@ -166,11 +238,36 @@ placeholder env names:
166
238
 
167
239
  ```bash
168
240
  curl -H "Authorization: Bearer $SYNAPSOR_CLOUD_TOKEN" \
169
- "$SYNAPSOR_CONTROL_PLANE_URL/v1/control/projects/<workspace_id>/agent-contracts/support-plan-credit/versions/latest"
241
+ "$SYNAPSOR_CLOUD_BASE_URL/v1/control/projects/$SYNAPSOR_WORKSPACE_ID/agent-contracts/<contract_id>/versions/<version_id>"
170
242
 
171
243
  curl -H "Authorization: Bearer $SYNAPSOR_CLOUD_TOKEN" \
172
- "$SYNAPSOR_CONTROL_PLANE_URL/v1/control/projects/<workspace_id>/agent-contracts/support-plan-credit/runner-bundle" \
173
- -o support-plan-credit-runner-bundle.json
244
+ "$SYNAPSOR_CLOUD_BASE_URL/v1/control/projects/$SYNAPSOR_WORKSPACE_ID/agent-contracts/<contract_id>/versions/<version_id>/runner-bundle?download=1" \
245
+ -o support-plan-credit-runner-bundle.zip
174
246
  ```
175
247
 
248
+ The push response supplies `<contract_id>` and `<version_id>`. The Cloud
249
+ workspace also exposes the same download from **Contract registry**.
250
+
176
251
  No Cloud account is needed to run this local example.
252
+
253
+ ## Clean Up
254
+
255
+ ```bash
256
+ docker compose -f examples/support-plan-credit/docker-compose.yml down -v
257
+ rm -rf ./tmp/support-plan-credit
258
+ ```
259
+
260
+ ## Troubleshooting
261
+
262
+ - `synapsor-runner: command not found`: install `@synapsor/runner` globally or
263
+ use `corepack pnpm runner` from this repository.
264
+ - port `55438` is busy: stop the previous example container or change the
265
+ published port and both URLs in `.env.example` together.
266
+ - missing table/connection: wait for the Docker health check, then rerun the
267
+ command from the repository root with the `.env.example` values exported.
268
+ - OpenAI rejects dotted tool names: start the MCP server with
269
+ `--alias-mode openai` and use the OpenAI template.
270
+ - proposal stays pending: `$100` intentionally requires
271
+ `proposals approve`; only the `$25` tier is policy-approved.
272
+ - apply reports a conflict: the row changed after the proposal read. Inspect
273
+ the new row, create a fresh proposal, and do not bypass the version guard.
@@ -0,0 +1,9 @@
1
+ {
2
+ "ok": true,
3
+ "contract_id": "act_support_plan_credit_example",
4
+ "contract_version_id": "act_support_plan_credit_example_v1",
5
+ "version_number": 1,
6
+ "status": "draft",
7
+ "digest": "sha256:<server-computed-digest>",
8
+ "registry_url": "/workspace/contracts?contract=<contract_id>"
9
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "proposal_id": "wrp_example_low_risk_credit",
3
+ "capability": "support.propose_plan_credit",
4
+ "status": "approved",
5
+ "approval_actor": "policy:support_propose_plan_credit_auto_approval",
6
+ "target": {
7
+ "table": "customers",
8
+ "id": "CUS-3001",
9
+ "tenant_id": "acme"
10
+ },
11
+ "change_set": {
12
+ "plan_credit_cents": {
13
+ "before": 0,
14
+ "after": 2500
15
+ },
16
+ "credit_reason": {
17
+ "before": null,
18
+ "after": "SLA outage ticket SUP-481"
19
+ }
20
+ },
21
+ "source_database_changed": false,
22
+ "evidence_handle": "evidence://local/example-plan-credit"
23
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "receipt_id": "rct_example_plan_credit",
3
+ "proposal_id": "wrp_example_low_risk_credit",
4
+ "status": "applied",
5
+ "rows_affected": 1,
6
+ "guards": {
7
+ "tenant": "passed",
8
+ "primary_key": "passed",
9
+ "allowed_columns": "passed",
10
+ "expected_version": "passed",
11
+ "idempotency": "passed"
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "proposal_id": "wrp_example_low_risk_credit",
3
+ "events": [
4
+ "scoped_read",
5
+ "evidence_saved",
6
+ "proposal_created",
7
+ "policy_approved",
8
+ "guarded_writeback_applied",
9
+ "receipt_recorded"
10
+ ],
11
+ "source_database_changed_before_approval": false,
12
+ "final_status": "applied"
13
+ }
@@ -0,0 +1,15 @@
1
+ Synapsor tools preview: ok
2
+
3
+ Exposed to MCP:
4
+ - support.inspect_customer
5
+ - support.propose_plan_credit
6
+
7
+ Not exposed to MCP:
8
+ - execute_sql / raw query tools
9
+ - approval tools
10
+ - commit/apply tools
11
+ - database URLs
12
+ - write credentials
13
+ - model-controlled tenant authority
14
+
15
+ auto-approval: enabled
@@ -0,0 +1,20 @@
1
+ {
2
+ "mcpServers": {
3
+ "synapsor-runner": {
4
+ "command": "npx",
5
+ "args": [
6
+ "-y",
7
+ "-p",
8
+ "@synapsor/runner",
9
+ "synapsor-runner",
10
+ "mcp",
11
+ "serve",
12
+ "--config",
13
+ "examples/support-plan-credit/synapsor.runner.json",
14
+ "--store",
15
+ "./tmp/support-plan-credit/local.db"
16
+ ],
17
+ "cwd": "<absolute-path-to-Synapsor-Runner>"
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "mcpServers": {
3
+ "synapsor-runner": {
4
+ "type": "stdio",
5
+ "command": "npx",
6
+ "args": [
7
+ "-y",
8
+ "-p",
9
+ "@synapsor/runner",
10
+ "synapsor-runner",
11
+ "mcp",
12
+ "serve",
13
+ "--config",
14
+ "<absolute-path-to-Synapsor-Runner>/examples/support-plan-credit/synapsor.runner.json",
15
+ "--store",
16
+ "<absolute-path-to-Synapsor-Runner>/tmp/support-plan-credit/local.db"
17
+ ]
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "mcpServers": {
3
+ "synapsor-runner": {
4
+ "type": "stdio",
5
+ "command": "npx",
6
+ "args": [
7
+ "-y",
8
+ "-p",
9
+ "@synapsor/runner",
10
+ "synapsor-runner",
11
+ "mcp",
12
+ "serve",
13
+ "--config",
14
+ "examples/support-plan-credit/synapsor.runner.json",
15
+ "--store",
16
+ "./tmp/support-plan-credit/local.db"
17
+ ]
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "synapsor-runner",
3
+ "transport": "stdio",
4
+ "command": "npx",
5
+ "args": [
6
+ "-y",
7
+ "-p",
8
+ "@synapsor/runner",
9
+ "synapsor-runner",
10
+ "mcp",
11
+ "serve",
12
+ "--config",
13
+ "examples/support-plan-credit/synapsor.runner.json",
14
+ "--store",
15
+ "./tmp/support-plan-credit/local.db"
16
+ ]
17
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "synapsor-runner",
3
+ "transport": "streamable-http",
4
+ "url": "http://127.0.0.1:8766/mcp"
5
+ }
@@ -0,0 +1,19 @@
1
+ import { Agent, MCPServerStdio, run } from "@openai/agents";
2
+
3
+ const synapsor = new MCPServerStdio({
4
+ name: "Synapsor Runner",
5
+ fullCommand: "npx -y -p @synapsor/runner synapsor-runner mcp serve --config examples/support-plan-credit/synapsor.runner.json --store ./tmp/support-plan-credit/local.db --alias-mode openai",
6
+ });
7
+
8
+ await synapsor.connect();
9
+ try {
10
+ const agent = new Agent({
11
+ name: "Support operations agent",
12
+ instructions: "Use only Synapsor business tools. Inspect evidence before proposing a plan credit.",
13
+ mcpServers: [synapsor],
14
+ });
15
+ const result = await run(agent, "Inspect customer CUS-3001 and propose a $25 plan credit for SLA outage ticket SUP-481.");
16
+ console.log(result.finalOutput);
17
+ } finally {
18
+ await synapsor.close();
19
+ }
@@ -0,0 +1,20 @@
1
+ import { Agent, MCPServerStreamableHttp, run } from "@openai/agents";
2
+
3
+ // Start Runner with --alias-mode openai so model-visible tool names are valid OpenAI function names.
4
+ const synapsor = new MCPServerStreamableHttp({
5
+ name: "Synapsor Runner",
6
+ url: "http://127.0.0.1:8766/mcp",
7
+ });
8
+
9
+ await synapsor.connect();
10
+ try {
11
+ const agent = new Agent({
12
+ name: "Support operations agent",
13
+ instructions: "Use only Synapsor business tools. Inspect evidence before proposing a plan credit.",
14
+ mcpServers: [synapsor],
15
+ });
16
+ const result = await run(agent, "Inspect customer CUS-3001 and propose a $25 plan credit for SLA outage ticket SUP-481.");
17
+ console.log(result.finalOutput);
18
+ } finally {
19
+ await synapsor.close();
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synapsor/runner",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Stop giving AI agents execute_sql; expose reviewed Postgres/MySQL MCP actions with proposals, approval, writeback, and replay.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",