@seamward/setup-mcp 0.1.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,31 @@
1
+ Seamward Setup MCP Proprietary License
2
+
3
+ Copyright (c) 2026 Seamward. All rights reserved.
4
+
5
+ This software and its accompanying documentation are proprietary to Seamward.
6
+ Possession, installation, or availability through a package registry does not
7
+ grant a licence to use, copy, modify, distribute, sublicense, sell, or create
8
+ derivative works from the software.
9
+
10
+ You may use the software only to the extent expressly permitted by a written
11
+ agreement with Seamward, including an applicable customer, evaluation, pilot,
12
+ or partner agreement. If that agreement conflicts with this notice, the
13
+ written agreement controls.
14
+
15
+ Except where applicable law does not permit the restriction, you may not:
16
+
17
+ 1. redistribute, publish, sublicense, lease, sell, or transfer the software;
18
+ 2. reverse engineer, decompile, disassemble, or attempt to derive source code
19
+ from any distributed binary or package; or
20
+ 3. remove or alter proprietary notices.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS" TO THE MAXIMUM EXTENT PERMITTED BY LAW,
23
+ WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF
24
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
25
+ NON-INFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED BY LAW, SEAMWARD IS NOT
26
+ LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR EXEMPLARY DAMAGES,
27
+ OR FOR LOSS OF DATA, REVENUE, PROFITS, OR BUSINESS OPPORTUNITY, ARISING FROM OR
28
+ RELATED TO THE SOFTWARE.
29
+
30
+ No trademark rights are granted. All rights not expressly granted in a written
31
+ agreement with Seamward are reserved.
package/README.md ADDED
@@ -0,0 +1,265 @@
1
+ # Seamward local setup MCP
2
+
3
+ `@seamward/setup-mcp` is a repository-scoped stdio server for coding agents.
4
+ It analyzes one backend service, identifies its independent integration
5
+ boundaries, proposes collector instrumentation, verifies the reviewed source,
6
+ and connects each binding to the matching Seamward Integration.
7
+
8
+ The normal experience starts with one request:
9
+
10
+ > Set up Seamward in this project.
11
+
12
+ That is the entire customer prompt. The MCP owns repository analysis, boundary
13
+ and contract discovery, change previews, repository verification, environment
14
+ file safety, and remote status checks. The customer does not name a provider,
15
+ protocol, contract path, setup action, or verification command.
16
+
17
+ The coding agent handles discovery and setup sequencing. You approve only two
18
+ meaningful trust boundaries:
19
+
20
+ 1. Apply the proposed local dependency, generated file, and source changes.
21
+ 2. Connect the reviewed contract to Seamward. This either registers and
22
+ activates a new version or links an exact already-active version to the
23
+ reviewed local evidence without a remote write.
24
+
25
+ The server never reads or edits environment files. It does not return source
26
+ contents, credential values, absolute paths, or customer data.
27
+
28
+ ## Install and configure a client
29
+
30
+ Use the project installer from one deployable backend service:
31
+
32
+ ```bash
33
+ npx @seamward/setup@alpha
34
+ ```
35
+
36
+ The installer completes browser authorization, stores the short-lived
37
+ credential outside the repository, installs this package at an exact version,
38
+ and adds project-scoped configuration for Claude Code, Cursor, and Codex. It
39
+ previews every project file before applying the changes. Node.js 22 or newer is
40
+ required.
41
+
42
+ The project root and approved workspace environment cannot be changed through
43
+ an MCP tool call. Run one setup server per deployable service. Manual stdio configuration
44
+ remains supported for embedded and headless clients, but it is not the default
45
+ customer path.
46
+
47
+ ## What the agent does
48
+
49
+ The default server exposes five high-level operations:
50
+
51
+ | Operation | Effect |
52
+ | ---------------------- | --------------------------------------------------------------------- |
53
+ | `prepare_setup` | Read-only analysis and a readable proposal |
54
+ | `apply_local_setup` | One approved local apply and deterministic source verification |
55
+ | `review_remote_setup` | Preview Integration create/reuse decisions and exact contract effects |
56
+ | `connect_remote_setup` | Apply the approved Integration and contract lifecycle idempotently |
57
+ | `check_setup_status` | Read-only local, contract, and first-observation status |
58
+
59
+ Internal plan records remain inside `.seamward/`. A user does not copy setup
60
+ identifiers or protocol confirmation phrases between calls.
61
+
62
+ If discovery finds clear integration boundaries and contract candidates,
63
+ preparation proceeds automatically for all of them. Each business boundary gets
64
+ its own plan, generated collector binding, runtime Connection key and ingest
65
+ token variable names, contract lifecycle, and first-observation status. Each
66
+ binding owns its token. If a boundary is ambiguous, the tool
67
+ returns readable choices such as `inbound webhooks`, `outbound HTTP API`, `queue
68
+ consumer`, or `scheduled feed`, then waits for the user to choose. Unsupported
69
+ service shapes stop with a manual-setup explanation.
70
+
71
+ The read-only preparation output includes stable local binding identifiers for
72
+ the coding agent. A reviewer may include or exclude bindings before local
73
+ approval without copying those identifiers. Scripts, tests, fixtures, mocks,
74
+ tools, build output, and provider simulators are excluded from automatic
75
+ service discovery.
76
+
77
+ Automatic source transformation currently supports outbound Node.js HTTP
78
+ client calls and inbound Node.js webhook handlers. The same one-line prompt can
79
+ discover inbound HTTP servers, queue publishers, queue consumers, and scheduled
80
+ feeds, but preparation stops before approval and gives the manual integration
81
+ path for those boundaries. It never labels discovery-only coverage as an
82
+ automatic setup.
83
+
84
+ During the local approval, the server installs the exact supported collector,
85
+ writes plan-owned files, applies supported JavaScript or TypeScript source
86
+ instrumentation, runs the project's verification scripts, and records evidence
87
+ that binds the resulting source files to that successful run. The operation
88
+ restores package metadata, lockfiles, generated files, setup state, and source
89
+ files if verification fails. Unsupported or uncertain source shapes stop with
90
+ manual guidance instead of leaving partial edits or asking the coding agent to
91
+ bypass the reviewed plan with separate editing tools.
92
+
93
+ Verification receives an allowlisted child-process environment with no
94
+ application credentials. The setup engine supplies an internal
95
+ verification-only mode so the generated collector cannot start or transmit an
96
+ observation while existing handler results and errors remain testable. The
97
+ generated collector is also inert when `NODE_ENV=test`, so a project's ordinary
98
+ test suite does not require production credentials or transmit observations.
99
+ The setup engine does not open environment files. Project verification scripts
100
+ still run exactly as the repository defines them, including any file or network
101
+ access those scripts perform. Outside setup verification and test processes, an
102
+ observed operation fails clearly when its Connection key or ingest token is
103
+ missing or invalid, rather than silently running without monitoring.
104
+
105
+ Repeating the same reviewed setup reuses the verified plan and leaves source
106
+ unchanged. Replanning a contract does not wrap an already observed webhook
107
+ boundary again. Existing collector-backed webhook files are recorded as
108
+ already instrumented rather than wrapped with a second collector.
109
+
110
+ During the remote approval, the server proposes a readable name and provider for
111
+ every reviewed local binding. It reuses one exact existing Integration when the
112
+ business identity and scope match, otherwise it previews creating a new
113
+ Integration in the approved workspace environment. The reviewer can edit the
114
+ name and provider or select a preferred existing Integration before applying the
115
+ remote operation. No customer copies an internal Integration ID into a prompt.
116
+ It then connects each exact reviewed OpenAPI contract. When no exact active version
117
+ exists, it registers one immutable draft and activates that version. When the
118
+ active version already matches, it links the existing version without a remote
119
+ write. Identical retries reconcile safely. An ambiguous mapping stops before
120
+ any remote change and asks the user to choose in plain language.
121
+
122
+ An exact Integration command remains available as compatibility mode. The
123
+ normal source-scoped authorization lets the setup API create or reuse reviewed
124
+ Integrations without broad workspace write access.
125
+
126
+ JSON Schema requires an explicit operation binding. Automatic setup reports
127
+ that limitation before local approval and routes the user to the manual CLI
128
+ contract workflow, where the binding can be reviewed explicitly.
129
+
130
+ ## Authorization and runtime configuration
131
+
132
+ The project installer uses OAuth with PKCE and binds its grant to one user,
133
+ workspace and workspace environment. Access tokens are short-lived and refresh only
134
+ while the grant remains active. The credential file is stored in the user's
135
+ configuration directory with owner-only permissions. The MCP receives a
136
+ credential reference, not the token value.
137
+
138
+ The installer and MCP never open `.env` files, and no MCP operation accepts a
139
+ credential value. A workspace API key and process environment remain available
140
+ only as an advanced compatibility path for headless automation.
141
+
142
+ Runtime observation delivery is a separate boundary. The deployed service
143
+ needs every binding's public Connection key and its Integration-owned ingest
144
+ token in the generated secret-environment variable names. The setup MCP does
145
+ not read, write, or manage those entries.
146
+
147
+ Package installation receives a reduced environment that excludes Seamward and
148
+ common credential variables. Project verification receives a strict allowlist
149
+ of operating-system process variables plus the internal verification flag.
150
+ Credentials are never printed in tool output.
151
+
152
+ ## Status and recovery
153
+
154
+ `check_setup_status` is read-only. It reports one of these states:
155
+
156
+ | State | Meaning |
157
+ | ------------------------ | -------------------------------------------------------------------- |
158
+ | `not_prepared` | Run setup preparation |
159
+ | `local_changes_required` | Apply or finish the proposed source changes |
160
+ | `ready_to_connect` | Local verification passed; review or reconcile the remote connection |
161
+ | `waiting_for_traffic` | Current contract evidence is active; send an instrumented request |
162
+ | `partially_connected` | At least one binding is connected while another still needs action |
163
+ | `connected` | Seamward accepted traffic from this setup |
164
+ | `stale` | Verified source changed; review and apply local setup again |
165
+ | `conflict` | Local or remote state changed and needs a fresh review |
166
+
167
+ A failed remote connection can be retried through the same approved operation.
168
+ If draft registration succeeded before activation failed, the retry uses the
169
+ recorded draft instead of creating another one.
170
+
171
+ For a multi-Integration connection, each binding reports its own outcome. If a
172
+ remote service failure interrupts the batch, completed bindings stay recorded,
173
+ the failed binding reports its stable error code, and later bindings report
174
+ `not_attempted`. Retrying the same approved operation reconciles completed
175
+ work instead of creating duplicate contract versions.
176
+
177
+ An interrupted exact-active reconciliation is also safe to retry. If local
178
+ registration evidence was recorded before local activation evidence, the retry
179
+ revalidates the current source, contract, setup state, and active version, then
180
+ converges without a remote mutation. `waiting_for_traffic` is reported only
181
+ when current source evidence is verified and the locally recorded activation
182
+ still matches Seamward's active version.
183
+
184
+ Multi-binding plans are loaded from `.seamward/integrations/` when the MCP
185
+ process restarts. Status therefore reports every prepared binding rather than
186
+ falling back to `not_prepared` after the coding agent is reopened.
187
+
188
+ If an Integration boundary is removed from the source, the next setup preview
189
+ lists that binding as a removal. Seamward snapshots current and retired binding
190
+ files together, applies the reviewed changes, removes only unchanged generated
191
+ files and local state that it owns, then verifies the final project tree. Any
192
+ failure restores the full snapshot. The remote Integration and contract stay
193
+ active deliberately so deleting local source cannot silently destroy remote
194
+ evidence. A customer can retire the remote Integration separately after
195
+ reviewing its retention requirements.
196
+
197
+ ## Error contract
198
+
199
+ Every failed operation returns `schemaVersion` plus an `error` object with
200
+ `code`, `message`, `retryable`, and `recovery`. `retryable: true` means the same
201
+ request may succeed after waiting or restoring network health. It never means
202
+ that an agent may bypass a fresh review when local or remote state changed.
203
+
204
+ | Code | Retryable | Recovery |
205
+ | ------------------------------ | --------- | --------------------------------------------------------------------------------------------------------------------- |
206
+ | `plan_not_found` | No | Run `prepare_setup` |
207
+ | `legacy_plan_requires_replan` | No | Run `prepare_setup` and review the replacement plan |
208
+ | `confirmation_required` | No | Approve the requested trust boundary |
209
+ | `no_matching_actions` | No | Prepare again and choose a proposed operation |
210
+ | `invalid_input` | No | Correct the request to match the tool schema |
211
+ | `scan_limit_exceeded` | No | Narrow the service root, then prepare again |
212
+ | `generated_file_conflict` | No | Review the changed generated file before preparing again |
213
+ | `apply_in_progress` | Yes | Wait for the active local apply, then retry |
214
+ | `setup_preview_stale` | No | Run `review_remote_setup` again and approve the current Integration preview |
215
+ | `idempotency_conflict` | No | Use the original request for that key, or review again before applying a different request |
216
+ | `verification_failed` | No | Fix the source or project checks, then prepare and apply again |
217
+ | `setup_state_conflict` | No | Check status, then prepare and review current state |
218
+ | `stale_setup_lock` | No | Confirm no apply is running, remove only the reported lock, then prepare |
219
+ | `configuration_required` | No | Run `npx @seamward/setup@alpha` to authorize this service in its workspace environment, then restart the coding agent |
220
+ | `contract_preview_expired` | No | Run `review_remote_setup` again |
221
+ | `contract_activation_conflict` | No | Read contract state and run `review_remote_setup` again |
222
+ | `authentication_required` | No | Run `npx @seamward/setup@alpha` and approve this service in its workspace environment again |
223
+ | `insufficient_scope` | No | Reauthorize this service in its workspace environment with `npx @seamward/setup@alpha`, then restart the coding agent |
224
+ | `integration_scope_mismatch` | No | Choose the correct boundary and prepare again |
225
+ | `integration_mapping_required` | No | Select the matching existing Integration or adjust the proposal, then review again |
226
+ | `contract_version_conflict` | No | Choose a new version or review the existing immutable version |
227
+ | `source_verification_required` | No | Run `apply_local_setup` and resolve source verification |
228
+ | `not_found` | No | Verify workspace and Integration access, then review again |
229
+ | `remote_conflict` | No | Read remote state and run `review_remote_setup` again |
230
+ | `rate_limited` | Yes | Wait for the retry interval, then repeat the same request |
231
+ | `service_unavailable` | Yes | Wait for service recovery, then repeat the same request |
232
+ | `remote_request_failed` | No | Verify the request and access configuration, then review again |
233
+ | `remote_response_invalid` | No | Report the invalid service response before trying again |
234
+ | `plan_conflict` | No | Run `prepare_setup` and review the current plan |
235
+ | `internal_error` | No | Inspect local logs and report the failure |
236
+
237
+ Older alpha setup state is migrated only during an approved local apply. If an
238
+ existing generated target cannot be proven safe, migration stops without
239
+ overwriting it.
240
+
241
+ ## Privacy and trust boundaries
242
+
243
+ - Repository analysis is local and read-only.
244
+ - Environment files are neither read nor changed.
245
+ - Source contents, literal private URLs, credentials, and absolute paths are
246
+ not returned from operations.
247
+ - Current-file evidence is stored locally in `.seamward/setup-state.json`.
248
+ - Editing a verified source file makes its evidence stale.
249
+ - Seamward Cloud receives only an explicitly registered contract and redacted
250
+ collector observations. Exact-active reconciliation changes local evidence
251
+ only and creates no remote audit event.
252
+ - The local and remote writes remain distinct host approval boundaries.
253
+
254
+ ## CLI fallback
255
+
256
+ `@seamward/cli` uses the same discovery, planning, verification, and remote API
257
+ implementation. Use the CLI for terminal automation and CI when a coding agent
258
+ cannot run a local MCP server. The CLI is an advanced interface; the MCP is the
259
+ recommended interactive setup experience.
260
+
261
+ ## Machine contract
262
+
263
+ The default stdio server publishes setup schema `seamward.setup-mcp/5` and the
264
+ five high-level operations above. State is stored per Integration under
265
+ `.seamward/integrations/`.