@synapsor/runner 1.5.0 → 1.5.4

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 (83) hide show
  1. package/CHANGELOG.md +134 -3
  2. package/README.md +108 -113
  3. package/dist/authoring.d.ts +23 -0
  4. package/dist/authoring.d.ts.map +1 -0
  5. package/dist/authoring.mjs +1318 -0
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +4 -5
  8. package/dist/local-ui.d.ts +14 -0
  9. package/dist/local-ui.d.ts.map +1 -1
  10. package/dist/runner.mjs +12334 -5256
  11. package/dist/runtime.mjs +817 -149
  12. package/dist/shadow.d.ts +36 -0
  13. package/dist/shadow.d.ts.map +1 -0
  14. package/dist/shadow.mjs +5362 -0
  15. package/docs/README.md +25 -2
  16. package/docs/alternatives.md +122 -0
  17. package/docs/capability-authoring.md +49 -1
  18. package/docs/client-recipes.md +218 -0
  19. package/docs/cloud-mode.md +18 -0
  20. package/docs/contract-testing.md +9 -7
  21. package/docs/cursor-plugin.md +78 -0
  22. package/docs/database-enforced-scope.md +8 -0
  23. package/docs/dsl-reference.md +45 -4
  24. package/docs/effect-regression.md +39 -2
  25. package/docs/fresh-developer-usability.md +110 -0
  26. package/docs/getting-started-own-database.md +102 -5
  27. package/docs/guarded-crud-writeback.md +10 -1
  28. package/docs/host-compatibility.md +59 -0
  29. package/docs/http-mcp.md +222 -207
  30. package/docs/limitations.md +9 -2
  31. package/docs/local-mode.md +11 -7
  32. package/docs/mcp-audit.md +166 -2
  33. package/docs/mcp-client-setup.md +28 -11
  34. package/docs/mcp-clients.md +43 -8
  35. package/docs/openai-agents-sdk.md +16 -2
  36. package/docs/oss-vs-cloud.md +3 -0
  37. package/docs/production.md +72 -7
  38. package/docs/release-notes.md +131 -4
  39. package/docs/runner-bundles.md +7 -2
  40. package/docs/runner-config-reference.md +96 -6
  41. package/docs/running-a-runner-fleet.md +42 -13
  42. package/docs/security-boundary.md +58 -8
  43. package/docs/shadow-studies.md +47 -4
  44. package/docs/store-lifecycle.md +93 -5
  45. package/docs/troubleshooting-first-run.md +46 -0
  46. package/examples/openai-agents-http/README.md +10 -4
  47. package/examples/openai-agents-http/agent.py +2 -2
  48. package/examples/runner-fleet/Dockerfile +7 -2
  49. package/examples/runner-fleet/README.md +11 -7
  50. package/examples/runner-fleet/docker-compose.yml +4 -4
  51. package/examples/runner-fleet/mint-dev-token.mjs +1 -1
  52. package/examples/runner-fleet/start-tls-runner.sh +21 -0
  53. package/examples/runner-fleet/synapsor.runner.json +27 -1
  54. package/examples/support-billing-agent/README.md +18 -0
  55. package/examples/support-billing-agent/app/README.md +6 -0
  56. package/examples/support-billing-agent/app/contract.ts +28 -0
  57. package/examples/support-billing-agent/app/effect-adapter.mjs +23 -0
  58. package/examples/support-billing-agent/app/record-shadow-outcomes.mjs +44 -0
  59. package/examples/support-billing-agent/scripts/run-evaluation.sh +6 -5
  60. package/examples/support-plan-credit/README.md +54 -3
  61. package/examples/support-plan-credit/mcp-client-examples/README.md +23 -0
  62. package/examples/support-plan-credit/mcp-client-examples/claude-code.sh +34 -0
  63. package/examples/support-plan-credit/mcp-client-examples/codex.config.toml +24 -0
  64. package/examples/support-plan-credit/mcp-client-examples/generic-stdio.mjs +35 -0
  65. package/examples/support-plan-credit/mcp-client-examples/generic-streamable-http.json +4 -1
  66. package/examples/support-plan-credit/mcp-client-examples/generic-streamable-http.mjs +31 -0
  67. package/examples/support-plan-credit/mcp-client-examples/google-adk.py +40 -0
  68. package/examples/support-plan-credit/mcp-client-examples/langchain.mjs +29 -0
  69. package/examples/support-plan-credit/mcp-client-examples/llamaindex.py +36 -0
  70. package/examples/support-plan-credit/mcp-client-examples/openai-agents-stdio.ts +1 -1
  71. package/examples/support-plan-credit/mcp-client-examples/openai-agents-streamable-http.ts +5 -1
  72. package/examples/support-plan-credit/mcp-client-examples/vscode.mcp.json +20 -0
  73. package/examples/support-plan-credit/synapsor/actions/support.propose_plan_credit.contract-tests.generated.json +221 -0
  74. package/examples/support-plan-credit/synapsor/actions/support.propose_plan_credit.ts +34 -0
  75. package/examples/support-plan-credit/synapsor.contract.json +0 -3
  76. package/fixtures/mcp-audit/README.md +14 -0
  77. package/fixtures/mcp-audit/cursor-bypass-config.json +38 -0
  78. package/fixtures/mcp-audit/dangerous-tools-list.json +33 -0
  79. package/fixtures/mcp-audit/reviewed-proposal-tools-list.json +60 -0
  80. package/package.json +18 -3
  81. package/schemas/mcp-audit-report.schema.json +100 -1
  82. package/schemas/synapsor.contract-tests.schema.json +1 -1
  83. package/schemas/synapsor.runner.schema.json +80 -0
package/docs/README.md CHANGED
@@ -23,6 +23,10 @@ no-database demo, wire your database, then read deeper concepts.
23
23
 
24
24
  ## 02 Why Raw SQL Is Dangerous
25
25
 
26
+ - [Choose The Smallest Safe Database Boundary](alternatives.md): compare raw
27
+ database MCP, direct read-only access, hand-built application tools, and
28
+ Synapsor Runner, including when each is sufficient and what remains outside
29
+ Runner's protection.
26
30
  - [Security Boundary](security-boundary.md): what the model can and cannot see.
27
31
  - [Why Synapsor Over Prompt And Application
28
32
  Guardrails](why-synapsor-vs-app-guardrails.md): where SQL authority lives,
@@ -44,10 +48,14 @@ no-database demo, wire your database, then read deeper concepts.
44
48
  ## 04 Connect Your DB
45
49
 
46
50
  - [Connect Your Own Database](getting-started-own-database.md): inspect a
47
- staging Postgres/MySQL database, generate `synapsor.runner.json`, preview
48
- semantic tools, and serve them over MCP.
51
+ staging Postgres/MySQL database, generate canonical reviewed artifacts, open
52
+ the first-action workbench, add the tools to Cursor, and inspect the local
53
+ activation report.
49
54
  - [Use Your Own Database](use-your-own-database.md): short entry point that
50
55
  links to the canonical own-database guide.
56
+ - [Fresh-Developer Usability Protocol](fresh-developer-usability.md): the
57
+ repeatable five-person launch gate, timing rules, safety blockers, and honest
58
+ reporting template. External participant results are not yet claimed.
51
59
  - [Doctor](doctor.md): redacted setup checks, handler probes, direct SQL
52
60
  writeback probes, and receipt-table guidance.
53
61
  - [Database-Enforced Scope](database-enforced-scope.md): application-level
@@ -64,6 +72,14 @@ no-database demo, wire your database, then read deeper concepts.
64
72
 
65
73
  ## 05 Generate Capabilities
66
74
 
75
+ - [Connect Your Own
76
+ Database](getting-started-own-database.md#draft-another-safe-action-with-a-coding-agent):
77
+ describe one action, let a coding agent complete only the restricted
78
+ TypeScript draft, validate it deterministically, preview an exact staging
79
+ Data PR, and activate the reviewed digest outside MCP.
80
+ - [Cursor Plugin](cursor-plugin.md): project-scoped `/synapsor-protect`, Safe
81
+ Action diagnostics, package verification, and the explicit no-activation
82
+ boundary.
67
83
  - [Reviewed Prisma, Drizzle, And OpenAPI
68
84
  Candidates](schema-api-candidates.md): turn structural developer artifacts
69
85
  into deterministic, disabled canonical review candidates without executing
@@ -90,6 +106,9 @@ no-database demo, wire your database, then read deeper concepts.
90
106
 
91
107
  ## 06 Serve MCP
92
108
 
109
+ - [Host Compatibility](host-compatibility.md): exact Tested,
110
+ Protocol-tested, Unsupported, and Unknown claims for Cursor and other MCP
111
+ hosts, including the inline-review fallback.
93
112
  - [Inline Proposal Review With MCP Apps](mcp-apps.md): display-only proposal
94
113
  cards where supported, exact protocol versions, tested compatibility, and
95
114
  secure standalone review fallback.
@@ -97,6 +116,10 @@ no-database demo, wire your database, then read deeper concepts.
97
116
  another stdio MCP client.
98
117
  - [MCP Client Configs](mcp-clients.md): complete Claude, Cursor, OpenAI Agents,
99
118
  generic stdio, and Streamable HTTP templates.
119
+ - [Client And Framework Recipes](client-recipes.md): one proposal-only
120
+ support-plan-credit flow for Claude Code, Codex, VS Code, OpenAI Agents,
121
+ LangChain/LangGraph, Google ADK, LlamaIndex, and generic MCP clients, with
122
+ explicit evidence labels.
100
123
  - `examples/claude-desktop-postgres/`: copy-paste Claude Desktop config for the
101
124
  Postgres billing fixture.
102
125
  - `examples/cursor-postgres/`: copy-paste Cursor config for the Postgres
@@ -0,0 +1,122 @@
1
+ # Choose The Smallest Safe Database Boundary
2
+
3
+ You do not always need Synapsor Runner. Choose the smallest boundary that
4
+ matches the authority and evidence your agent actually needs.
5
+
6
+ ## Decision Summary
7
+
8
+ | Approach | Good fit | Main boundary | Main trade-off |
9
+ | --- | --- | --- | --- |
10
+ | Direct database MCP | Disposable local data, synthetic demos, or tightly isolated development | Database credential and server implementation | The model can express SQL and may hold broad query authority |
11
+ | Read-only database access | Exploration where database permissions and result exposure are already acceptable | Read-only role, views, RLS, and query controls | Read-only is not data-safe by itself; broad reads can still expose another tenant or sensitive columns |
12
+ | Hand-built application tool | A few stable business operations already owned by one application team | Application endpoint or stored procedure | Your team owns every scope, review, retry, conflict, receipt, and investigation guarantee |
13
+ | Synapsor Runner | Consequential reads or writes needing a shared reviewed boundary | Canonical capabilities plus Runner and database controls | Adds contract and operating machinery; it does not replace database security or application handlers |
14
+
15
+ ## Direct Or Raw Database MCP
16
+
17
+ A raw database MCP server can be appropriate when all data is synthetic,
18
+ disposable, and isolated from production. It is also useful for a trusted
19
+ developer exploring a local database where arbitrary SQL is the intended
20
+ power.
21
+
22
+ It is a poor model-facing production boundary when a tool accepts SQL, table
23
+ names, columns, predicates, tenant identifiers, or credentials chosen by the
24
+ model. Prompt instructions and SQL blocklists do not remove that authority.
25
+ Read-only credentials limit writes but can still permit broad or cross-tenant
26
+ reads.
27
+
28
+ Audit a server before adopting Runner or any other replacement:
29
+
30
+ ```bash
31
+ npx -y @synapsor/runner audit --example dangerous-db-mcp
32
+ npx -y @synapsor/runner audit ./tools-list.json
33
+ ```
34
+
35
+ The audit is a structural review, not a penetration test or certification.
36
+
37
+ ## Read-Only Database Access
38
+
39
+ Direct read-only access is often sufficient when:
40
+
41
+ - the agent is used by trusted internal developers;
42
+ - the database role can see only the rows and columns those users may see;
43
+ - restricted views or PostgreSQL row-level security enforce tenant scope;
44
+ - query cost and result size are bounded independently;
45
+ - no proposal, approval, receipt, or replay record is required.
46
+
47
+ Read-only does not mean harmless. Sensitive fields, cross-tenant records,
48
+ expensive queries, and data useful for later attacks can all be exposed without
49
+ a write. Keep the credential least-privileged and test the database policy as
50
+ the real authorization floor.
51
+
52
+ ## Hand-Built Application Tools
53
+
54
+ A narrow application endpoint or stored procedure is often the best answer for
55
+ one or two stable operations. Trusted code should choose a fixed parameterized
56
+ query, derive tenant and principal scope from authenticated state, validate
57
+ business rules, and return only the required fields.
58
+
59
+ This may be enough when one team owns the entire path and does not need a
60
+ shared contract or review ledger. The team must still design and test:
61
+
62
+ - immutable intent and idempotency under retries;
63
+ - stale-data and concurrent-write conflicts;
64
+ - approval identity and quorum outside the model;
65
+ - exact before/after evidence and affected-row bounds;
66
+ - receipts, investigation, replay, and ambiguous-crash handling.
67
+
68
+ Runner can also route an approved proposal to an app-owned executor. Use that
69
+ boundary for external side effects, multi-table transactions, free-form
70
+ application logic, and operations the built-in guarded adapters intentionally
71
+ do not support.
72
+
73
+ ## Synapsor Runner
74
+
75
+ Runner is useful when the model should receive reviewed semantic capabilities
76
+ instead of SQL and the organization needs the same trust mechanics across
77
+ tools or teams:
78
+
79
+ - trusted tenant and principal values stay outside model arguments;
80
+ - visible and kept-out fields are reviewed in one portable contract;
81
+ - model-facing writes create exact proposals without changing source data;
82
+ - activation, approval, apply, and compensation remain outside MCP;
83
+ - guarded apply rechecks scope, policy, conflict, bounds, and idempotency;
84
+ - evidence, proposal history, receipts, and replay preserve the lifecycle.
85
+
86
+ This is not magic and it is not a claim that these mechanics cannot be built in
87
+ application code. Runner packages a specific enforcement and evidence model so
88
+ each integration does not invent a subtly different one.
89
+
90
+ ## What Runner Does Not Protect
91
+
92
+ Runner governs traffic that passes through its reviewed capabilities. It does
93
+ not:
94
+
95
+ - prevent prompt injection or make arbitrary SQL safe;
96
+ - stop a separate raw database tool, leaked credential, or application bypass;
97
+ - replace PostgreSQL RLS, restricted views, database grants, or network policy;
98
+ - make a deployment compliant with HIPAA, PCI DSS, SOC 2, or another standard;
99
+ - provide backups, disaster recovery, or protection from a trusted host or
100
+ database administrator;
101
+ - safely infer tenant scope, hidden fields, approval policy, or write authority.
102
+
103
+ Keep least-privilege roles, RLS or tenant-restricted views, encryption,
104
+ monitoring, tested backups, and application authorization underneath Runner.
105
+ For PostgreSQL, prefer transaction-bound RLS when the topology supports it. For
106
+ MySQL, use restricted views, per-tenant credentials, or isolated deployments
107
+ where required.
108
+
109
+ ## A Practical Evaluation
110
+
111
+ 1. Audit the model-facing tools and identify who chooses SQL, tenant scope,
112
+ fields, predicates, approval, and commit timing.
113
+ 2. Keep direct read-only access if database policy already provides the exact
114
+ safe boundary and no review lifecycle is needed.
115
+ 3. Keep a hand-built tool if it is narrow, well-tested, and its operational
116
+ guarantees are sufficient.
117
+ 4. Try Runner on one consequential staging action when you need an exact Data
118
+ PR, approval outside the agent, guarded commit, receipt, and replay.
119
+
120
+ Continue with [Connect Your Own Database](getting-started-own-database.md),
121
+ [Security Boundary](security-boundary.md), or the deeper [build-versus-adopt
122
+ analysis](why-synapsor-vs-app-guardrails.md).
@@ -22,6 +22,49 @@ store path, MCP transport settings, and local development flags. The model sees
22
22
  semantic capabilities such as `billing.inspect_invoice`, not raw SQL, table
23
23
  names, write credentials, approval tools, or commit tools.
24
24
 
25
+ ## Code-First TypeScript Path
26
+
27
+ Applications that prefer TypeScript can author the same canonical contract
28
+ through the optional `@synapsor/runner/authoring` frontend:
29
+
30
+ ```ts
31
+ import { defineCapability } from "@synapsor/runner/authoring";
32
+
33
+ export const waiveLateFee = defineCapability({
34
+ name: "billing.propose_late_fee_waiver",
35
+ kind: "proposal",
36
+ context: "local_operator",
37
+ source: "app_postgres",
38
+ subject: { resource: "billing.invoice", primary_key: "id", tenant_key: "tenant_id" },
39
+ args: {
40
+ invoice_id: { type: "string", required: true, max_length: 128 },
41
+ reason: { type: "string", required: true, max_length: 500 },
42
+ },
43
+ lookup: { id_from_arg: "invoice_id" },
44
+ visible_fields: ["id", "tenant_id", "late_fee_cents", "waiver_reason", "updated_at"],
45
+ kept_out_fields: ["card_token", "internal_risk_note"],
46
+ evidence: { required: true, query_audit: true },
47
+ max_rows: 1,
48
+ proposal: {
49
+ action: "waive_late_fee",
50
+ operation: { kind: "update" },
51
+ allowed_fields: ["late_fee_cents", "waiver_reason"],
52
+ patch: { late_fee_cents: { fixed: 0 }, waiver_reason: { from_arg: "reason" } },
53
+ numeric_bounds: { late_fee_cents: { minimum: 0, maximum: 10000 } },
54
+ conflict_guard: { column: "updated_at" },
55
+ approval: { mode: "human", required_role: "billing_lead" },
56
+ writeback: { mode: "direct_sql" },
57
+ },
58
+ });
59
+ ```
60
+
61
+ Compose typed resources, contexts, capabilities, workflows, and policies with
62
+ `defineContract`, then use `contractJson` to write reviewable canonical JSON.
63
+ `compileContract` validates and normalizes through `@synapsor/spec`; this API
64
+ does not add semantics, raw SQL, or model-controlled predicates. The flagship
65
+ [support/billing action](../examples/support-billing-agent/app/contract.ts)
66
+ uses this frontend. JSON and DSL remain supported and conformance-equivalent.
67
+
25
68
  ## Contract/DSL Path
26
69
 
27
70
  Write a small DSL contract:
@@ -153,7 +196,8 @@ reviewed runner JSON capabilities. Current parity:
153
196
  | arg `enum` | `ARG risk_level STRING ENUM('low', 'medium', 'high') REQUIRED` | 1.4.121 | Supports 1..64 same-type string, number, or boolean values; duplicates and mixed types fail compilation. |
154
197
  | proposal `numeric_bounds` | `BOUND column 1..2500`, `BOUND column ..2500`, or `BOUND column 1..` | 0.1.8 | Applies to patched numeric columns. Strict mode warns when a NUMBER arg is patched without arg min/max or a matching `BOUND`. |
155
198
  | proposal `transition_guards` | `TRANSITION status ALLOW pending -> approved\|rejected` or `TRANSITION status FROM current_status ALLOW open -> closed` | 0.1.8 | Values are state strings; use `|` for multiple target states. |
156
- | proposal `conflict_guard` | `CONFLICT GUARD updated_at` | 0.1 | If omitted, DSL emits an explicit weak-guard acknowledgement. Prefer a real row-version column. |
199
+ | proposal `conflict_guard` | `CONFLICT GUARD updated_at` | 0.1 | Required for ordinary UPDATE authoring. It compiles to an exact version-column check. Omission fails instead of silently weakening concurrency protection. |
200
+ | proposal weak `conflict_guard` | `CONFLICT GUARD WEAK ROW HASH ACKNOWLEDGED` | 1.4.4 | Explicit legacy escape hatch for an ordinary single-row source-DB UPDATE only. It hashes the captured projection and may miss concurrent changes outside that projection. It is rejected for DELETE, reversible writes, bounded sets, and Runner-ledger authority. |
157
201
  | proposal `approval` | `APPROVAL ROLE billing_lead` | 0.1 | Local mode records the required role; enforcement is still outside the model-facing MCP tool. |
158
202
  | proposal `approval.required_approvals` | `REQUIRE 2 APPROVALS` | 1.1 | Optional 1..10 distinct-reviewer quorum; defaults to 1. |
159
203
  | proposal `writeback` | `WRITEBACK DIRECT SQL`, `WRITEBACK APP HANDLER EXECUTOR name`, `WRITEBACK CLOUD WORKER`, `WRITEBACK NONE` | 0.1.7 | Handler URLs/tokens stay in `synapsor.runner.json`; contracts carry only the handler name. |
@@ -480,6 +524,8 @@ Canonical Synapsor names use dots, such as `billing.inspect_invoice`. Some
480
524
  clients require function-safe names. Use:
481
525
 
482
526
  ```bash
527
+ export SYNAPSOR_RUNNER_HTTP_TOKEN="$(node -e 'process.stdout.write(require("node:crypto").randomBytes(32).toString("base64url"))')"
528
+
483
529
  synapsor-runner mcp serve-streamable-http \
484
530
  --config ./synapsor.runner.json \
485
531
  --store ./.synapsor/local.db \
@@ -490,6 +536,8 @@ synapsor-runner mcp serve-streamable-http \
490
536
  The model sees aliases such as `billing__inspect_invoice`. Runner includes the
491
537
  canonical name in tool metadata and descriptions so audit/replay still use the
492
538
  real capability name.
539
+ This loopback token is opaque endpoint access, not tenant identity. See
540
+ [HTTP MCP](http-mcp.md) before using a network listener.
493
541
 
494
542
  ## Why Not `execute_sql`
495
543
 
@@ -0,0 +1,218 @@
1
+ # Client And Framework Recipes
2
+
3
+ Every recipe on this page connects to the same reviewed Runner boundary:
4
+
5
+ - `support.inspect_customer`
6
+ - `support.propose_plan_credit`
7
+
8
+ The model never receives SQL, database credentials, trusted tenant identity,
9
+ approval, apply, activation, or revert authority. A proposal call returns an
10
+ exact effect with `source_database_changed: false`; a human reviews and applies
11
+ it outside the model-facing client.
12
+
13
+ Checked-in files live in
14
+ [`examples/support-plan-credit/mcp-client-examples/`](../examples/support-plan-credit/mcp-client-examples/).
15
+ They contain command paths and environment-variable names only.
16
+
17
+ ## Evidence Labels
18
+
19
+ | Label | Meaning |
20
+ | --- | --- |
21
+ | Host-tested | The named host was exercised manually at the recorded version. |
22
+ | Configuration-tested | The named host's current CLI or config parser accepted the recipe. |
23
+ | Protocol-tested | Runner completed MCP initialization and `tools/list` through the official MCP SDK using the same command/transport. |
24
+ | Recipe-checked | The file is syntax-checked, secret-scanned, and matched to current official framework documentation. Its framework runtime was not executed here. |
25
+ | Unknown | No compatibility claim is made. |
26
+
27
+ Protocol evidence is not presented as proof of editor UI behavior. Current
28
+ evidence is summarized in [Host Compatibility](host-compatibility.md).
29
+
30
+ ## Shared Preflight
31
+
32
+ Run from the Runner repository root after supplying your own environment-bound
33
+ staging credentials and trusted scope:
34
+
35
+ ```bash
36
+ npx -y -p @synapsor/runner synapsor-runner tools preview \
37
+ --config ./examples/support-plan-credit/synapsor.runner.json \
38
+ --store ./tmp/support-plan-credit/local.db
39
+ ```
40
+
41
+ The list must include the two semantic tools above and must not include
42
+ `execute_sql`, approve, apply, commit, activation, or revert tools.
43
+
44
+ Use this exact proposal input in each client:
45
+
46
+ ```json
47
+ {
48
+ "customer_id": "CUS-3001",
49
+ "credit_cents": 2500,
50
+ "reason": "SLA outage ticket SUP-481"
51
+ }
52
+ ```
53
+
54
+ Expected result: a proposal id, exact before/after effect, evidence handle, and
55
+ `source_database_changed: false`. Review it outside the client in the secured
56
+ Workbench or operator CLI. Do not add an approval or apply MCP server/tool to
57
+ make the client flow feel shorter.
58
+
59
+ ## Cursor
60
+
61
+ **Status:** configuration-tested and protocol-tested with Cursor 3.7.21 on
62
+ Linux; final manual editor UI verification remains a release gate.
63
+
64
+ Use Runner's owned project lifecycle:
65
+
66
+ ```bash
67
+ synapsor-runner mcp install cursor --project --dry-run \
68
+ --config ./examples/support-plan-credit/synapsor.runner.json \
69
+ --store ./tmp/support-plan-credit/local.db
70
+ synapsor-runner mcp install cursor --project --yes \
71
+ --config ./examples/support-plan-credit/synapsor.runner.json \
72
+ --store ./tmp/support-plan-credit/local.db
73
+ synapsor-runner mcp status cursor --project --check-launch
74
+ ```
75
+
76
+ Ask Cursor to inspect `CUS-3001`, then call
77
+ `support.propose_plan_credit` with the shared input. Review the Data PR outside
78
+ the model-facing tool surface.
79
+
80
+ ## Claude Desktop
81
+
82
+ **Status:** configuration-parsed and protocol-tested; manual Desktop UI
83
+ behavior is not claimed.
84
+
85
+ Merge
86
+ [`claude-desktop.json`](../examples/support-plan-credit/mcp-client-examples/claude-desktop.json)
87
+ into Claude Desktop's `mcpServers`, restart the app, and verify the exact tool
88
+ list. Then ask for the shared proposal call.
89
+
90
+ ## Claude Code
91
+
92
+ **Status:** configuration-tested with Claude Code 2.1.216 and
93
+ protocol-tested; a manual model-driven call remains a release gate.
94
+
95
+ Run the checked command from the repository root:
96
+
97
+ ```bash
98
+ bash ./examples/support-plan-credit/mcp-client-examples/claude-code.sh
99
+ ```
100
+
101
+ Claude Code records project-scoped MCP configuration without embedding source
102
+ credentials. It will print the exact proposal prompt after configuration.
103
+
104
+ Official source checked 2026-07-20:
105
+ [Claude Code MCP](https://code.claude.com/docs/en/mcp).
106
+
107
+ ## Codex
108
+
109
+ **Status:** configuration-tested with Codex CLI 0.144.6 and protocol-tested;
110
+ a manual model-driven call remains a release gate.
111
+
112
+ Merge the contents of
113
+ [`codex.config.toml`](../examples/support-plan-credit/mcp-client-examples/codex.config.toml)
114
+ into the trusted project's `.codex/config.toml`, start Codex from the repository
115
+ root, and ask it to list the Synapsor tools before making the shared proposal
116
+ call.
117
+
118
+ Official source checked 2026-07-20:
119
+ [Codex MCP configuration](https://developers.openai.com/codex/mcp/).
120
+
121
+ ## VS Code
122
+
123
+ **Status:** configuration-parsed and protocol-tested; manual VS Code UI
124
+ behavior is not claimed.
125
+
126
+ Copy or merge
127
+ [`vscode.mcp.json`](../examples/support-plan-credit/mcp-client-examples/vscode.mcp.json)
128
+ into `.vscode/mcp.json`. Start the server from VS Code, inspect the listed
129
+ tools, and ask for the shared proposal call.
130
+
131
+ Official source checked 2026-07-20:
132
+ [VS Code MCP servers](https://code.visualstudio.com/docs/agent-customization/mcp-servers).
133
+
134
+ ## OpenAI Agents SDK
135
+
136
+ **Status:** recipe-checked and underlying stdio/Streamable HTTP protocol-tested.
137
+ The exact SDK examples remain protocol-only until their agent calls are run
138
+ with an owner-supplied model API key.
139
+
140
+ Install `@openai/agents`, then run either:
141
+
142
+ - [`openai-agents-stdio.ts`](../examples/support-plan-credit/mcp-client-examples/openai-agents-stdio.ts)
143
+ - [`openai-agents-streamable-http.ts`](../examples/support-plan-credit/mcp-client-examples/openai-agents-streamable-http.ts)
144
+
145
+ Both examples instruct the agent to inspect the semantic tool list and create
146
+ the shared proposal. OpenAI-safe aliases are enabled where required; canonical
147
+ Synapsor capability names remain in result metadata.
148
+
149
+ Official source checked 2026-07-20:
150
+ [OpenAI Agents SDK MCP guide](https://openai.github.io/openai-agents-js/guides/mcp/).
151
+
152
+ ## LangChain And LangGraph
153
+
154
+ **Status:** recipe-checked and protocol-only.
155
+
156
+ Install `@langchain/mcp-adapters` and run
157
+ [`langchain.mjs`](../examples/support-plan-credit/mcp-client-examples/langchain.mjs).
158
+ It calls `getTools()`, refuses an unsafe tool surface, and invokes the proposal
159
+ tool directly. The returned proposal still requires human review outside the
160
+ agent.
161
+
162
+ Official source checked 2026-07-20:
163
+ [LangChain JavaScript MCP](https://docs.langchain.com/oss/javascript/langchain/mcp).
164
+ LangGraph can use the same LangChain MCP tools; no Synapsor-specific SDK is
165
+ needed.
166
+
167
+ ## Google ADK
168
+
169
+ **Status:** recipe-checked and protocol-only.
170
+
171
+ Install the current Google ADK Python package and run
172
+ [`google-adk.py`](../examples/support-plan-credit/mcp-client-examples/google-adk.py)
173
+ with `GOOGLE_ADK_MODEL` and the provider credential supplied through the
174
+ environment. The `McpToolset` is filtered to the two reviewed Synapsor tools.
175
+
176
+ Official source checked 2026-07-20:
177
+ [Google ADK MCP tools](https://adk.dev/tools-custom/mcp-tools/).
178
+
179
+ ## LlamaIndex
180
+
181
+ **Status:** recipe-checked and protocol-only.
182
+
183
+ Install `llama-index-tools-mcp` and run
184
+ [`llamaindex.py`](../examples/support-plan-credit/mcp-client-examples/llamaindex.py).
185
+ It uses `BasicMCPClient` to list tools and make the shared proposal call without
186
+ requiring a model-provider API.
187
+
188
+ Official source checked 2026-07-20:
189
+ [LlamaIndex MCP tools](https://developers.llamaindex.ai/python/examples/tools/mcp/).
190
+
191
+ ## Generic MCP Clients
192
+
193
+ **Status:** protocol-tested through the official TypeScript MCP SDK.
194
+
195
+ Use:
196
+
197
+ - [`generic-stdio.mjs`](../examples/support-plan-credit/mcp-client-examples/generic-stdio.mjs)
198
+ - [`generic-streamable-http.mjs`](../examples/support-plan-credit/mcp-client-examples/generic-streamable-http.mjs)
199
+
200
+ Each script performs MCP initialization, validates `tools/list`, rejects
201
+ model-visible commit authority, and makes the shared proposal call. The HTTP
202
+ script reads its bearer token from `SYNAPSOR_RUNNER_HTTP_TOKEN`; it never embeds
203
+ one.
204
+
205
+ Official source checked 2026-07-20:
206
+ [Build an MCP client](https://modelcontextprotocol.io/docs/develop/build-client).
207
+
208
+ ## Verify The Checked Recipes
209
+
210
+ ```bash
211
+ corepack pnpm test:mcp-client-configs
212
+ ```
213
+
214
+ That deterministic gate syntax-checks and secret-scans every recipe and proves
215
+ the shared stdio tool surface. To additionally make the proposal call against
216
+ the disposable support-plan-credit PostgreSQL fixture, set
217
+ `SYNAPSOR_CLIENT_RECIPES_CALL=1` after exporting the fixture's environment.
218
+ The call creates a proposal but performs no approval or source mutation.
@@ -19,6 +19,24 @@ The local Runner still keeps database credentials in your environment. MCP
19
19
  client config snippets contain command paths and Runner arguments, not database
20
20
  URLs or write credentials.
21
21
 
22
+ Keep Cloud and MCP credentials distinct:
23
+
24
+ | Credential | Purpose | Issuer/provisioner | Never substitutes for |
25
+ | --- | --- | --- | --- |
26
+ | Cloud user session | Human control-panel/CLI identity and subscription/RBAC checks | Synapsor Cloud identity system | MCP tenant identity or database access |
27
+ | Cloud service/API key | Contract push and scoped Cloud administration | Synapsor Cloud | MCP endpoint access |
28
+ | Source-scoped Runner token | Runner registration, heartbeat, lease, activity, and result calls for one Cloud source | Synapsor Cloud Connect Runner flow | Model-facing MCP access or operator approval |
29
+ | Opaque MCP endpoint token | Loopback or explicitly single-tenant HTTP endpoint access | Customer operator/secret manager | User/tenant identity |
30
+ | Signed MCP access JWT | Shared HTTP client identity and verified tenant/principal claims | Customer identity provider/authorization server | Cloud subscription credential or DB role |
31
+ | Operator credential | Activation, approval, apply, reconcile, dead-letter, and revert authority | Customer operator identity system | Model-facing MCP capability |
32
+ | Database/handler credential | Local read or trusted post-approval effect | Customer secret manager/database/application | Cloud or MCP authentication |
33
+
34
+ Cloud-linked mode does not require networked MCP: a desktop client can still
35
+ launch the local Runner over stdio. If the local Runner exposes Streamable HTTP,
36
+ the same [HTTP MCP](http-mcp.md) channel and identity profiles apply. Cloud API
37
+ keys and source-scoped Runner tokens are never accepted as shortcuts for MCP
38
+ session authentication.
39
+
22
40
  ## Trust Boundary
23
41
 
24
42
  ```text
@@ -11,10 +11,11 @@ synapsor-runner contract test \
11
11
  --config ./synapsor.runner.json
12
12
  ```
13
13
 
14
- Static mode checks tool exposure, operator-only boundaries, argument limits,
15
- transition guards, bounded-set caps, and other assertions that do not require a
16
- database. Add `--live` to call the actual MCP runtime for scoped reads,
17
- proposals, evidence/replay redaction, and source-unchanged checks.
14
+ Static mode checks tool exposure, operator-only boundaries, trusted scope,
15
+ evidence and approval requirements, exact proposal effects, conflict guards,
16
+ argument limits, transition guards, bounded-set caps, and other assertions that
17
+ do not require a database. Add `--live` to call the actual MCP runtime for
18
+ scoped reads, proposals, evidence/replay redaction, and source-unchanged checks.
18
19
 
19
20
  ```bash
20
21
  synapsor-runner contract test \
@@ -37,9 +38,10 @@ Summary: 6 passed / 0 failed / 6 total
37
38
  ```
38
39
 
39
40
  Supported assertions cover valid scoped tools, cross-tenant denial,
40
- same-tenant cross-principal denial, kept-out
41
- fields, argument constraints, transition guards, set caps, unchanged source
42
- state before approval, and the absence of model-facing approval/writeback.
41
+ same-tenant cross-principal denial, trusted tenant/principal scope, required
42
+ evidence, approval-policy boundaries, kept-out fields, argument constraints,
43
+ transition guards, set caps, unchanged source state before approval, and the
44
+ absence of model-facing approval/writeback.
43
45
  Trusted tenant and principal values belong in test setup, not tool arguments.
44
46
 
45
47
  Use `cross_principal_deny` to prove both the allowed and denied sides of one
@@ -0,0 +1,78 @@
1
+ # Cursor plugin
2
+
3
+ The Synapsor Cursor plugin is an official-format Cursor plugin under
4
+ `plugins/cursor/synapsor`. It packages the project-scoped Runner MCP server,
5
+ `/synapsor-protect`, and thin Cursor wrappers over Runner's canonical Safe Action
6
+ instructions.
7
+
8
+ Current implementation evidence was checked against Cursor's public plugin,
9
+ plugin-reference, MCP, and deeplink documentation on 2026-07-20:
10
+
11
+ - <https://cursor.com/docs/plugins>
12
+ - <https://cursor.com/docs/reference/plugins>
13
+ - <https://cursor.com/docs/mcp>
14
+ - <https://cursor.com/docs/reference/deeplinks>
15
+
16
+ The locally installed Cursor version used for validation is recorded in
17
+ `development/runner-1.5.3-progress.md`. Protocol/static validation is not a
18
+ claim that Cursor Marketplace review has completed.
19
+
20
+ ## What the plugin installs
21
+
22
+ - one stdio MCP server pinned to `@synapsor/runner@1.5.3`;
23
+ - one `/synapsor-protect` agent command;
24
+ - one discoverable Safe Action skill;
25
+ - one file-scoped rule for `synapsor/actions/**/*.ts`;
26
+ - no hooks, automatic shell execution, credentials, or activation path.
27
+
28
+ The MCP entry uses Cursor's documented `${workspaceFolder}` interpolation for
29
+ `synapsor.runner.json` and `.synapsor/local.db`. It exposes only `mcp serve`.
30
+ Approval, apply, activation, commit, and revert remain outside MCP.
31
+
32
+ ## Build and verify
33
+
34
+ ```bash
35
+ corepack pnpm build:cursor-plugin
36
+ corepack pnpm verify:cursor-plugin
37
+ ```
38
+
39
+ The verifier checks the manifest and component formats, version pin, project
40
+ paths, secret-free package contents, command authority boundary, deterministic
41
+ package inventory, disposable local install/reinstall/removal, preservation of
42
+ unrelated Cursor configuration, and paths containing spaces.
43
+
44
+ ## Marketplace listing copy
45
+
46
+ **Name:** Synapsor
47
+
48
+ **Short description:** Turn one real application data change into a disabled,
49
+ reviewable MCP action without giving the Cursor agent SQL or commit authority.
50
+
51
+ **Security summary:** The plugin contains no database credentials or trusted
52
+ identity. Cursor can draft and validate disabled actions. Only a human using the
53
+ secured localhost Workbench can activate a reviewed digest; approval and apply
54
+ remain outside the model-facing MCP surface.
55
+
56
+ Required listing media:
57
+
58
+ - committed Synapsor logo from `assets/logo.svg`;
59
+ - screenshot of `/synapsor-protect` producing a disabled draft;
60
+ - screenshot of the Workbench exact-effect review and digest confirmation;
61
+ - 20-to-40-second GIF showing proposal, unchanged source, external approval,
62
+ guarded receipt, idempotent retry, and stale conflict.
63
+
64
+ ## Submission checklist
65
+
66
+ - [ ] Runner 1.5.3 package and plugin version agree.
67
+ - [ ] `corepack pnpm verify:cursor-plugin` passes from a clean checkout.
68
+ - [ ] Plugin is manually loaded in current stable Cursor at workspace scope.
69
+ - [ ] `/synapsor-protect` drafts and validates without activation.
70
+ - [ ] Exact Cursor `tools/list` contains only reviewed semantic tools.
71
+ - [ ] Another direct-write MCP server triggers Runner's bypass warning.
72
+ - [ ] Logo and listing media contain no secrets, local paths, or customer data.
73
+ - [ ] Privacy/security copy matches the OSS security boundary.
74
+ - [ ] Public repository and release links resolve.
75
+ - [ ] Owner submits the repository at <https://cursor.com/marketplace/publish>.
76
+
77
+ The final submission remains an explicit owner action. Do not claim that local
78
+ installation or static validation equals Marketplace approval.
@@ -11,6 +11,10 @@ from model arguments. Choose the database enforcement mode deliberately:
11
11
 
12
12
  These modes are defense in depth, not substitutes for least-privilege roles,
13
13
  restricted views, application authorization, or staging-first validation.
14
+ HTTP endpoint authentication is another independent layer: it establishes who
15
+ may call Runner and, for signed shared sessions, which trusted tenant/principal
16
+ claims are bound. It does not turn `application_scope` into database-enforced
17
+ isolation. See [HTTP MCP](http-mcp.md).
14
18
 
15
19
  ## Default: Application-Level Scope
16
20
 
@@ -49,6 +53,10 @@ with environment-bound capabilities.
49
53
  For shared production HTTP, prefer asymmetric JWT verification so Runner holds
50
54
  only public verification material. HS256 remains useful for local development
51
55
  and controlled deployments but gives Runner access to the signing secret.
56
+ Also declare `http_security.deployment: shared`, an exact HTTPS
57
+ audience/protected resource, a direct-TLS or trusted-proxy channel, and exact
58
+ Host/Origin policy. A static endpoint token cannot supply shared tenant or
59
+ principal identity.
52
60
 
53
61
  Run `doctor --json` or `tools preview --json` to inspect the effective
54
62
  per-source assurance mode and trusted-context binding. Server startup prints