sequentum-mcp 1.1.4 → 1.2.2

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 (60) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +104 -3
  3. package/dist/{api-client.d.ts → api/api-client.d.ts} +106 -4
  4. package/dist/api/api-client.d.ts.map +1 -0
  5. package/dist/{api-client.js → api/api-client.js} +345 -99
  6. package/dist/api/api-client.js.map +1 -0
  7. package/dist/{types.d.ts → api/types.d.ts} +122 -12
  8. package/dist/api/types.d.ts.map +1 -0
  9. package/dist/{types.js → api/types.js} +57 -0
  10. package/dist/api/types.js.map +1 -0
  11. package/dist/index.js +11 -1737
  12. package/dist/index.js.map +1 -1
  13. package/dist/server/cors.d.ts +33 -0
  14. package/dist/server/cors.d.ts.map +1 -0
  15. package/dist/server/cors.js +72 -0
  16. package/dist/server/cors.js.map +1 -0
  17. package/dist/server/handlers.d.ts +49 -0
  18. package/dist/server/handlers.d.ts.map +1 -0
  19. package/dist/server/handlers.js +1031 -0
  20. package/dist/server/handlers.js.map +1 -0
  21. package/dist/server/http-server.d.ts +13 -0
  22. package/dist/server/http-server.d.ts.map +1 -0
  23. package/dist/server/http-server.js +393 -0
  24. package/dist/server/http-server.js.map +1 -0
  25. package/dist/server/policies.d.ts +19 -0
  26. package/dist/server/policies.d.ts.map +1 -0
  27. package/dist/server/policies.js +32 -0
  28. package/dist/server/policies.js.map +1 -0
  29. package/dist/server/prompts.d.ts +19 -0
  30. package/dist/server/prompts.d.ts.map +1 -0
  31. package/dist/server/prompts.js +464 -0
  32. package/dist/server/prompts.js.map +1 -0
  33. package/dist/server/resources.d.ts +26 -0
  34. package/dist/server/resources.d.ts.map +1 -0
  35. package/dist/server/resources.js +348 -0
  36. package/dist/server/resources.js.map +1 -0
  37. package/dist/server/tools.d.ts +9 -0
  38. package/dist/server/tools.d.ts.map +1 -0
  39. package/dist/server/tools.js +977 -0
  40. package/dist/server/tools.js.map +1 -0
  41. package/dist/utils/oauth-metadata.d.ts.map +1 -0
  42. package/dist/utils/oauth-metadata.js.map +1 -0
  43. package/dist/{validation.d.ts → utils/validation.d.ts} +25 -2
  44. package/dist/utils/validation.d.ts.map +1 -0
  45. package/dist/{validation.js → utils/validation.js} +43 -3
  46. package/dist/utils/validation.js.map +1 -0
  47. package/docs/prompts-reference.md +370 -0
  48. package/docs/resources-reference.md +300 -0
  49. package/docs/tool-reference.md +244 -2
  50. package/package.json +4 -3
  51. package/dist/api-client.d.ts.map +0 -1
  52. package/dist/api-client.js.map +0 -1
  53. package/dist/oauth-metadata.d.ts.map +0 -1
  54. package/dist/oauth-metadata.js.map +0 -1
  55. package/dist/types.d.ts.map +0 -1
  56. package/dist/types.js.map +0 -1
  57. package/dist/validation.d.ts.map +0 -1
  58. package/dist/validation.js.map +0 -1
  59. /package/dist/{oauth-metadata.d.ts → utils/oauth-metadata.d.ts} +0 -0
  60. /package/dist/{oauth-metadata.js → utils/oauth-metadata.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,104 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.0] - TBD
4
+
5
+ ### Added
6
+
7
+ - **ChatGPT Apps support:**
8
+ - CORS allowlist extended in `src/server/cors.ts` to permit `https://chatgpt.com`, `https://platform.openai.com`, and any subdomain depth under `chatgpt.com` (e.g. `connector.chatgpt.com`). `https://chat.openai.com` is intentionally omitted — OpenAI retired that origin in mid-2024 and redirects it to `chatgpt.com`; no live ChatGPT surface issues that Origin header. Same multi-level subdomain pattern and trust rationale as the Claude entries.
9
+ - `openWorldHint` added to all 13 write tools per the MCP spec. Tools that scrape arbitrary external websites on behalf of the caller (`start_agent`, `run_space_agents`, `start_agent_build`) are `true`. Tools that only mutate Sequentum's internal state (`stop_agent`, `kill_agent`, `delete_run`, `restore_agent_version`, schedule CRUD, `stop_agent_build`) are `false`. Required by OpenAI's ChatGPT App submission review.
10
+ - ChatGPT setup instructions added to `README.md` under "Set Up Your Client".
11
+ - **Claude Connectors Directory support:**
12
+ - Origin-header allowlist (`src/server/cors.ts`) replaces the previous wildcard `Access-Control-Allow-Origin: *`. Permits Claude domains (`claude.ai`, `claude.com`, and all subdomain depths), Sequentum domains, and (when `DEBUG=1`) localhost / `127.0.0.1` / `[::1]`. Additional exact-match origins can be appended at startup via `ALLOWED_ORIGINS` (comma-separated; defaults are always preserved — see README). Requests from non-allowlisted browser origins to `/mcp` receive 403; requests without an `Origin` header (native MCP clients such as Cursor, Claude Desktop, Claude Code) pass through unaffected. `Vary: Origin` is set unconditionally so intermediate caches cannot conflate responses across origins.
13
+ - Privacy Policy section added to `README.md` with a plain-language data-handling summary and a link to `https://www.sequentum.com/privacy-policy`.
14
+ - **Agent Builder tools** (3 new tools):
15
+ - `start_agent_build` — Start an AI-powered agent build session from a natural language prompt. The agent is saved to the workspace automatically once the AI creates it.
16
+ - `get_agent_build_status` — Poll the status of an agent build session. Stop polling on any terminal status: `completed`, `ready`, `error`, or `cancelled`. The session tears down automatically.
17
+ - `stop_agent_build` — Abort an in-progress build session early (optional). Has no effect once a terminal status is reached. Any agent already saved to the workspace persists.
18
+ - **Agent Building prompts** (2 new prompts):
19
+ - `build-agent-from-prompt` — End-to-end workflow: resolve space, start session, poll until complete, fetch and show the resulting agent
20
+ - `inspect-agent-draft` — Check the status of an existing build session and show the resulting agent once available
21
+ - **`validateString` extended** with `minLength`, `maxLength`, and `trim` options (via new `StringValidationOptions` interface). Fully backward-compatible — existing callers that pass a boolean are unaffected.
22
+ - New types in `src/api/types.ts`: `AgentBuilderSessionStatus`, `ExternalStartAgentBuildRequest`, `ExternalStartAgentBuildResponse`, `ExternalSessionStatusResponse`
23
+ - **User-controlled polling cadence for Agent Builder:**
24
+ - Added optional `pollingPreference` argument to both `build-agent-from-prompt` and `inspect-agent-draft` prompts. Accepts `"fast"` / `"normal"` / `"slow"` or any free-form instruction (e.g. `"poll every 5 seconds"`, `"be patient, this is a big site"`). When provided, the directive is templated into the prompt as a high-priority instruction the model honors when polling `get_agent_build_status`.
25
+ - Added a `POLLING CADENCE` paragraph to the `get_agent_build_status` tool description so user-expressed cadence preferences are also respected when the tool is invoked outside the prompts (e.g. via plain-chat usage). Default is a moderate cadence with backoff (~5s start, ~15–30s ceiling).
26
+ - `title` annotation added to all 39 tools — human-readable label used by Anthropic's Connectors Directory and OpenAI's ChatGPT App submission.
27
+ - `destructiveHint: false` explicitly set on `start_agent_build` and `stop_agent_build` (previously defaulted to `true` because `readOnlyHint: false` was set without `destructiveHint`).
28
+ - **Sufficiency and prompt-handling policies.** New `src/server/policies.ts` is the single source of truth for two LLM-facing policy strings:
29
+ - `SUFFICIENCY_POLICY` is sent to every MCP client as the server `instructions` (on `initialize`). Directs the model to ask one consolidated clarifying question when a build/run request lacks an unambiguous URL, target data, or scope qualifier, and explicitly forbids silent extrapolation by analogy across sites or schemas.
30
+ - `PROMPT_HANDLING_POLICY` is appended to the `start_agent_build` tool description and inlined into the `build-agent-from-prompt` prompt template (rendered as a `**GUARDRAIL:**` preamble before the numbered steps). Directs the model to pass the user's wording through verbatim, allow only trivial normalizations (e.g. adding `https://`), and never invent fields, output formats, lazy-load instructions, pagination strategies, etc.
31
+ - Net behavior change: the model asks for missing details instead of silently expanding sparse user input into verbose `start_agent_build` prompts.
32
+
33
+ ### Documentation
34
+
35
+ - `docs/tool-reference.md` — Updated count to 39 tools, new Agent Builder category in Quick Reference and full section
36
+ - `docs/prompts-reference.md` — Updated count to 9 prompts, new Agent Building category in Quick Reference and full sections for both prompts
37
+ - `docs/resources-reference.md` — Added cross-reference note explaining that saved agents become accessible via existing `sequentum://agents/{agentId}` resource
38
+
39
+ ### Security
40
+
41
+ - Prompt arguments (`prompt`, `spaceName`, `sessionId`, `pollingPreference`) in `src/server/prompts.ts` are now sanitized before interpolation: newlines stripped, trimmed, and enforced per-argument length limits. Reduces prompt-injection surface via user-controlled strings.
42
+ - `pollingPreference` de-elevated from an `IMPORTANT DIRECTIVE` banner to an advisory instruction, reducing its authority in the model's context.
43
+ - `get_agent_build_status` handler now wraps raw backend `error` messages with a generic user-facing string (`"Build failed. Please review your prompt and try again."`). Raw error is still logged at `DEBUG=1` for operators. Prevents leakage of backend stack traces or internal endpoint paths to clients.
44
+ - `sessionId` parameter validated with `maxLength: 256` at both agent-builder handler call sites.
45
+ - `stop_agent_build` handler now returns structured JSON (`{ stopped: true, sessionId }`) instead of free-form English prose, consistent with all other tool handlers.
46
+ - `redactDebugArgs` in `src/server/handlers.ts` extended to mask `prompt` and `comments` fields in addition to existing sensitive keys.
47
+ - The new sufficiency and prompt-handling policies (see **Added**) reduce the surface for the model to silently extrapolate user requests across sites or schemas — defense in depth against accidental leakage of inferred-but-wrong details into a build.
48
+
49
+ ### Tests
50
+
51
+ - Annotation regression tests strengthened in `src/server/handlers.test.ts`: every tool must have a non-empty `title` and `readOnlyHint` defined. Write-tool annotations are now validated against per-tool expectation tables — `openWorldHint` and `destructiveHint` must match an explicit expected value, not just be defined. Adding a new write tool without classifying both hints fails the build; changing an existing value without updating the table also fails.
52
+ - Handler-dispatch tests added for the three agent-builder tools via `InMemoryTransport` + `Client`: `start_agent_build` rejects prompts below `minLength: 10`; `get_agent_build_status` sanitizes the `error` field; `stop_agent_build` returns the expected JSON shape.
53
+ - CORS regression tests added in `src/server/cors.test.ts` covering exact-origin matches, claude/chatgpt subdomain depth (single and multi-level), `ALLOWED_ORIGINS` env-var append semantics, debug-mode localhost / IPv6 loopback, and adversarial rejections (e.g. `https://claude.ai.evil.com`, `https://notclaude.ai`, wrong scheme, uppercase).
54
+ - Policy-wiring regression tests added in `src/server/handlers.test.ts`: `client.getInstructions()` equals `SUFFICIENCY_POLICY`; the `start_agent_build` tool description contains `PROMPT_HANDLING_POLICY`; the `build-agent-from-prompt` template embeds `PROMPT_HANDLING_POLICY`. Ensures the constants reach all three injection surfaces and prevents silent drift.
55
+
56
+ ---
57
+
58
+ ## [1.2.0] - 2026-03-12
59
+
60
+ ### Added
61
+
62
+ - **MCP Prompts** (9 reusable workflow templates):
63
+ - `debug-agent` -- Diagnose why an agent is failing
64
+ - `agent-health-check` -- Comprehensive health overview for an agent
65
+ - `spending-report` -- Spending and credits report
66
+ - `cost-analysis` -- Analyze costs across agents
67
+ - `run-and-monitor` -- Start an agent and monitor until completion
68
+ - `space-overview` -- Overview of all agents in a space
69
+ - `daily-operations-report` -- Daily operations report across all agents
70
+ - `schedule-agent` -- Walk through creating or reviewing schedules
71
+ - `compare-runs` -- Compare last successful vs failed run
72
+ - **MCP Resources** (18 read-only, URI-addressable data endpoints):
73
+ - 7 static resources: agent list, spaces, credits balance, monthly spending, agent costs, recent runs summary, upcoming schedules
74
+ - 11 resource templates: agent detail, agent versions, agent schedules, agent cost breakdown, agent runs, run status, run files, run diagnostics, latest failure, space detail, space agents
75
+ - **Schedule Management** tools:
76
+ - `get_agent_schedule` -- Get details of a specific schedule
77
+ - `update_agent_schedule` -- Update an existing schedule's timing, parameters, or settings
78
+ - `enable_agent_schedule` -- Enable a previously disabled schedule
79
+ - `disable_agent_schedule` -- Disable a schedule without deleting it
80
+ - New `src/server/handlers.test.ts` with handler unit tests
81
+ - Expanded test coverage for API client and index module
82
+ - Documentation: `docs/prompts-reference.md` and `docs/resources-reference.md`
83
+
84
+ ### Changed
85
+
86
+ - **Major architecture refactoring**: Split monolithic `src/index.ts` (~2000 lines) into a modular structure:
87
+ - `src/server/tools.ts` -- Tool definitions and schemas
88
+ - `src/server/handlers.ts` -- MCP server factory and tool handler dispatch
89
+ - `src/server/http-server.ts` -- HTTP/Streamable transport, session management, OAuth discovery
90
+ - `src/server/prompts.ts` -- Prompt definitions and message builders
91
+ - `src/server/resources.ts` -- Resource and resource template definitions with URI dispatcher
92
+ - `src/api/api-client.ts` -- API client (moved from `src/`)
93
+ - `src/api/types.ts` -- TypeScript interfaces and enums (moved from `src/`)
94
+ - `src/utils/validation.ts` -- Input validation helpers (moved from `src/`)
95
+ - `src/utils/oauth-metadata.ts` -- OAuth metadata builder (moved from `src/`)
96
+ - Extracted shared validation logic into `src/utils/validation.ts` to eliminate duplicate code
97
+ - Added URI validation for resource endpoints
98
+ - Improved atomic session control in HTTP server
99
+ - Updated `docs/tool-reference.md` with the 4 new schedule tools (36 total)
100
+ - Updated `README.md` with prompts, resources sections and references to new documentation
101
+
3
102
  ## [1.1.4] - 2026-03-04
4
103
 
5
104
  ### Added
@@ -92,6 +191,7 @@
92
191
 
93
192
  ---
94
193
 
194
+ [1.2.0]: https://github.com/Sequentum/sequentum-mcp/compare/v1.1.4...v1.2.0
95
195
  [1.1.4]: https://github.com/Sequentum/sequentum-mcp/compare/v1.1.3...v1.1.4
96
196
  [1.1.3]: https://github.com/Sequentum/sequentum-mcp/compare/v1.0.2...v1.1.3
97
197
  [1.0.2]: https://github.com/Sequentum/sequentum-mcp/compare/v1.0.1...v1.0.2
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  The [Sequentum MCP Server](https://mcp.sequentum.com) connects your AI coding assistant to Sequentum using the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction), giving your AI tools direct access to web scraping agents, run management, scheduling, analytics, and more. Sequentum hosts and manages a remote MCP server with OAuth authentication, so there's nothing to install.
7
7
 
8
- ## [Tool Reference](./docs/tool-reference.md) | [Troubleshooting](./docs/troubleshooting.md) | [Changelog](./CHANGELOG.md)
8
+ ## [Tool Reference](./docs/tool-reference.md) | [Prompts Reference](./docs/prompts-reference.md) | [Resources Reference](./docs/resources-reference.md) | [Troubleshooting](./docs/troubleshooting.md) | [Changelog](./CHANGELOG.md)
9
9
 
10
10
  ## Key Features
11
11
 
@@ -85,6 +85,17 @@ Then, each team member connects individually:
85
85
 
86
86
  Once configured, enable the Sequentum connector in individual conversations via the **"+"** button on the lower left of the chat interface, then select **"Connectors"**.
87
87
 
88
+ ### ChatGPT
89
+
90
+ > **Note:** While the Sequentum app is pending directory approval, you can connect via Developer Mode. Apps & Connectors → Developer Mode is currently available on **Plus, Pro, Business, Enterprise, and Education** plans (Education is web-only). On Business / Enterprise / Education accounts, only **workspace owners and admins** can access Advanced settings — regular members will not see the option. See [OpenAI's Developer Mode documentation](https://platform.openai.com/docs/developer-mode) for current eligibility.
91
+
92
+ 1. In ChatGPT, go to **Settings** > **Apps & Connectors** > **Advanced settings** and enable **Developer mode**.
93
+ 2. Navigate to **Settings** > **Apps & Connectors** and click **Create app** (it appears once Developer mode is enabled).
94
+ 3. Enter the connector name `Sequentum` and URL: `https://mcp.sequentum.com/mcp`
95
+ 4. Click **Create**. You'll be prompted to sign in with your Sequentum account via OAuth.
96
+
97
+ Once connected, enable Sequentum in a conversation via the **+** button near the message composer, then select your connector from the list.
98
+
88
99
  ### Claude Code
89
100
 
90
101
  Run the following command in your terminal:
@@ -202,7 +213,7 @@ How much did I spend on server time vs exports last week?
202
213
 
203
214
  ## Available Tools
204
215
 
205
- The Sequentum MCP Server provides tools across 8 categories for interacting with the Sequentum platform. See the [Tool Reference](./docs/tool-reference.md) for detailed documentation.
216
+ The Sequentum MCP Server provides 39 tools across 9 categories for interacting with the Sequentum platform. See the [Tool Reference](./docs/tool-reference.md) for detailed documentation.
206
217
 
207
218
  <!-- BEGIN AUTO GENERATED TOOLS -->
208
219
 
@@ -223,9 +234,13 @@ The Sequentum MCP Server provides tools across 8 categories for interacting with
223
234
  - **Version Management** (2 tools)
224
235
  - [`get_agent_versions`](docs/tool-reference.md#get_agent_versions)
225
236
  - [`restore_agent_version`](docs/tool-reference.md#restore_agent_version)
226
- - **Schedule Management** (4 tools)
237
+ - **Schedule Management** (8 tools)
227
238
  - [`list_agent_schedules`](docs/tool-reference.md#list_agent_schedules)
239
+ - [`get_agent_schedule`](docs/tool-reference.md#get_agent_schedule)
228
240
  - [`create_agent_schedule`](docs/tool-reference.md#create_agent_schedule)
241
+ - [`update_agent_schedule`](docs/tool-reference.md#update_agent_schedule)
242
+ - [`enable_agent_schedule`](docs/tool-reference.md#enable_agent_schedule)
243
+ - [`disable_agent_schedule`](docs/tool-reference.md#disable_agent_schedule)
229
244
  - [`delete_agent_schedule`](docs/tool-reference.md#delete_agent_schedule)
230
245
  - [`get_scheduled_runs`](docs/tool-reference.md#get_scheduled_runs)
231
246
  - **Billing & Credits** (6 tools)
@@ -246,9 +261,67 @@ The Sequentum MCP Server provides tools across 8 categories for interacting with
246
261
  - [`get_records_summary`](docs/tool-reference.md#get_records_summary)
247
262
  - [`get_run_diagnostics`](docs/tool-reference.md#get_run_diagnostics)
248
263
  - [`get_latest_failure`](docs/tool-reference.md#get_latest_failure)
264
+ - **Agent Builder** (3 tools)
265
+ - [`start_agent_build`](docs/tool-reference.md#start_agent_build)
266
+ - [`get_agent_build_status`](docs/tool-reference.md#get_agent_build_status)
267
+ - [`stop_agent_build`](docs/tool-reference.md#stop_agent_build)
249
268
 
250
269
  <!-- END AUTO GENERATED TOOLS -->
251
270
 
271
+ ## Available Prompts
272
+
273
+ The server includes 9 reusable prompt templates that guide the AI through common multi-step workflows. See the [Prompts Reference](./docs/prompts-reference.md) for detailed documentation.
274
+
275
+ <!-- BEGIN AUTO GENERATED PROMPTS -->
276
+
277
+ - **Debugging & Diagnostics**
278
+ - [`debug-agent`](docs/prompts-reference.md#debug-agent) -- Diagnose why an agent is failing
279
+ - [`compare-runs`](docs/prompts-reference.md#compare-runs) -- Compare last successful vs failed run
280
+ - **Health & Monitoring**
281
+ - [`agent-health-check`](docs/prompts-reference.md#agent-health-check) -- Comprehensive health overview for an agent
282
+ - [`daily-operations-report`](docs/prompts-reference.md#daily-operations-report) -- Daily ops report across all agents
283
+ - [`space-overview`](docs/prompts-reference.md#space-overview) -- Overview of all agents in a space
284
+ - **Execution**
285
+ - [`run-and-monitor`](docs/prompts-reference.md#run-and-monitor) -- Start an agent and monitor until completion
286
+ - [`schedule-agent`](docs/prompts-reference.md#schedule-agent) -- Walk through creating a schedule
287
+ - **Billing & Costs**
288
+ - [`spending-report`](docs/prompts-reference.md#spending-report) -- Spending and credits report
289
+ - [`cost-analysis`](docs/prompts-reference.md#cost-analysis) -- Analyze costs across agents
290
+ - **Agent Building**
291
+ - [`build-agent-from-prompt`](docs/prompts-reference.md#build-agent-from-prompt) -- Build a new agent from a natural language description
292
+ - [`inspect-agent-draft`](docs/prompts-reference.md#inspect-agent-draft) -- Inspect a build session and decide whether to save or discard
293
+
294
+ <!-- END AUTO GENERATED PROMPTS -->
295
+
296
+ ## Available Resources
297
+
298
+ The server exposes 18 read-only resources (7 static + 11 templates) that AI clients can browse and pull into context. See the [Resources Reference](./docs/resources-reference.md) for detailed documentation.
299
+
300
+ <!-- BEGIN AUTO GENERATED RESOURCES -->
301
+
302
+ - **Static Resources** (7)
303
+ - [`sequentum://agents`](docs/resources-reference.md#agent-list) -- First page of all agents
304
+ - [`sequentum://spaces`](docs/resources-reference.md#spaces) -- All accessible spaces
305
+ - [`sequentum://billing/balance`](docs/resources-reference.md#credits-balance) -- Current credits balance
306
+ - [`sequentum://billing/spending`](docs/resources-reference.md#monthly-spending) -- Monthly spending summary
307
+ - [`sequentum://billing/agents-usage`](docs/resources-reference.md#agent-costs-current-month) -- Top agents by cost
308
+ - [`sequentum://analytics/runs`](docs/resources-reference.md#recent-runs-summary) -- Runs in the last 24 hours
309
+ - [`sequentum://analytics/upcoming-schedules`](docs/resources-reference.md#upcoming-schedules) -- Scheduled runs for next 7 days
310
+ - **Resource Templates** (11)
311
+ - [`sequentum://agents/{agentId}`](docs/resources-reference.md#agent-detail) -- Agent detail with configuration
312
+ - [`sequentum://agents/{agentId}/versions`](docs/resources-reference.md#agent-versions) -- Agent version history
313
+ - [`sequentum://agents/{agentId}/schedules`](docs/resources-reference.md#agent-schedules) -- Agent scheduled tasks
314
+ - [`sequentum://agents/{agentId}/cost-breakdown`](docs/resources-reference.md#agent-cost-breakdown) -- Agent cost by usage type
315
+ - [`sequentum://agents/{agentId}/runs`](docs/resources-reference.md#agent-runs) -- Agent run history
316
+ - [`sequentum://agents/{agentId}/runs/{runId}`](docs/resources-reference.md#run-status) -- Specific run status
317
+ - [`sequentum://agents/{agentId}/runs/{runId}/files`](docs/resources-reference.md#run-files) -- Run output files
318
+ - [`sequentum://agents/{agentId}/runs/{runId}/diagnostics`](docs/resources-reference.md#run-diagnostics) -- Run error diagnostics
319
+ - [`sequentum://agents/{agentId}/latest-failure`](docs/resources-reference.md#latest-failure) -- Most recent failure diagnostics
320
+ - [`sequentum://spaces/{spaceId}`](docs/resources-reference.md#space-detail) -- Space details
321
+ - [`sequentum://spaces/{spaceId}/agents`](docs/resources-reference.md#space-agents) -- Agents in a space
322
+
323
+ <!-- END AUTO GENERATED RESOURCES -->
324
+
252
325
  ## Troubleshooting
253
326
 
254
327
  | Error | Solution |
@@ -262,6 +335,34 @@ The Sequentum MCP Server provides tools across 8 categories for interacting with
262
335
 
263
336
  For more troubleshooting help, see the [Troubleshooting Guide](./docs/troubleshooting.md).
264
337
 
338
+ ## CORS Origin Allowlist
339
+
340
+ When the MCP server is accessed from a browser (e.g. the Claude web app or the ChatGPT connector), it checks the `Origin` header against an allowlist. By default the following origins are permitted:
341
+
342
+ - `https://claude.ai`, `https://claude.com`, and all subdomains (e.g. `team.claude.ai`)
343
+ - `https://chatgpt.com`, `https://platform.openai.com`, and all subdomains under `chatgpt.com` (e.g. `connector.chatgpt.com`)
344
+ - `https://dashboard.sequentum.com`
345
+ - `https://mcp.sequentum.com`
346
+ - `http://localhost:<port>`, `http://127.0.0.1:<port>`, and `http://[::1]:<port>` when `DEBUG=1`
347
+
348
+ To add your own origins (e.g. an internal dashboard), set the `ALLOWED_ORIGINS` environment variable to a comma-separated list of exact origins:
349
+
350
+ ```
351
+ ALLOWED_ORIGINS="https://my-dashboard.example.com,https://other.example.com"
352
+ ```
353
+
354
+ These origins are **appended** to the defaults — Claude, ChatGPT, and Sequentum access is preserved. Wildcards and regular expressions are not supported via the env var; if you need a subdomain wildcard, add a `RegExp` entry directly in `src/server/cors.ts`.
355
+
356
+ > **Note:** `Origin` matching is case-sensitive and does not include a path or query string. Native MCP clients (Cursor, Claude Desktop, Claude Code) send no `Origin` header and are not affected by this allowlist.
357
+
358
+ ## Privacy Policy
359
+
360
+ The Sequentum MCP Server accesses your Sequentum account data — including agent metadata, run history, scheduled tasks, billing information, and output files — solely to fulfill the requests you make through your AI assistant. By default, the MCP server acts as an authenticated proxy between your MCP client and the Sequentum API: request data is forwarded to the API and responses are returned to your client without being persisted or shared with third parties.
361
+
362
+ Operators may enable verbose request logging via the `DEBUG=1` environment variable for troubleshooting. In that mode the server redacts `Authorization`, `Cookie`, and `x-api-key` headers, but writes request bodies (which may include tool arguments) to stderr. The hosted server at `mcp.sequentum.com` does not run with `DEBUG=1`.
363
+
364
+ For the full Sequentum privacy policy, see [https://www.sequentum.com/privacy-policy](https://www.sequentum.com/privacy-policy).
365
+
265
366
  ## Links
266
367
 
267
368
  - [Sequentum MCP Server](https://mcp.sequentum.com)
@@ -2,19 +2,23 @@
2
2
  * Sequentum API Client
3
3
  * Handles all HTTP communication with the Sequentum Control Center API
4
4
  */
5
- import { AgentApiModel, AgentRunApiModel, AgentRunFileApiModel, AgentVersionModel, StartAgentRequest, AgentScheduleApiModel, CreateScheduleRequest, UpcomingScheduleApiModel, CreditsBalanceApiModel, SpendingSummaryApiModel, CreditHistoryApiModel, AgentsUsageApiResponse, AgentCostBreakdownApiModel, AgentRunsApiResponse, SpaceApiModel, SpaceAgentApiModel, RunSpaceAgentsResultApiModel, RunsSummaryApiModel, RecordsSummaryApiModel, RunDiagnosticsApiModel, ListAgentsRequest, PaginatedAgentsResponse, RunRemoveMethod } from "./types.js";
5
+ import { AgentApiModel, AgentRunApiModel, AgentRunFileApiModel, AgentVersionModel, StartAgentRequest, AgentScheduleApiModel, CreateScheduleRequest, UpdateScheduleRequest, UpcomingScheduleApiModel, CreditsBalanceApiModel, SpendingSummaryApiModel, CreditHistoryApiModel, AgentsUsageApiResponse, AgentCostBreakdownApiModel, AgentRunsApiResponse, SpaceApiModel, SpaceAgentApiModel, RunSpaceAgentsResultApiModel, RunsSummaryApiModel, RecordsSummaryApiModel, RunDiagnosticsApiModel, ListAgentsRequest, PaginatedAgentsResponse, RunRemoveMethod, ExternalStartAgentBuildRequest, ExternalStartAgentBuildResponse, ExternalSessionStatusResponse } from "./types.js";
6
6
  export declare class SequentumApiClient {
7
7
  private baseUrl;
8
8
  private apiKey;
9
9
  private accessToken;
10
10
  private requestTimeoutMs;
11
+ private maxRetries;
12
+ private baseDelayMs;
13
+ private maxDelayMs;
11
14
  /**
12
15
  * Create a new Sequentum API client
13
16
  * @param baseUrl - The base URL of the Sequentum API (e.g., https://dashboard.sequentum.com)
14
17
  * @param apiKey - The API key (sk-...) for authentication (optional if using OAuth2)
15
18
  * @param requestTimeoutMs - Request timeout in milliseconds (default: 30000)
19
+ * @param maxRetries - Maximum number of retries for transient failures (default: 3)
16
20
  */
17
- constructor(baseUrl: string, apiKey?: string | null, requestTimeoutMs?: number);
21
+ constructor(baseUrl: string, apiKey?: string | null, requestTimeoutMs?: number, maxRetries?: number);
18
22
  /**
19
23
  * Set the OAuth2 access token for Bearer authentication
20
24
  * @param token - The access token
@@ -29,11 +33,60 @@ export declare class SequentumApiClient {
29
33
  */
30
34
  private getAuthorizationHeader;
31
35
  /**
32
- * Make an authenticated request to the API
36
+ * Parse an error response body from the Sequentum API.
37
+ *
38
+ * The API returns errors in two formats:
39
+ * - BadRequestError / InternalServerError: { statusCode, statusDescription, message, severity }
40
+ * - ProblemDetails (RFC 7807): { type, title, status, detail, instance }
41
+ *
42
+ * This method tries both formats and returns a human-readable message.
43
+ */
44
+ private parseErrorBody;
45
+ /**
46
+ * Parse the Retry-After header value into seconds.
47
+ * Supports both delta-seconds (e.g. "120") and HTTP-date formats.
48
+ * @returns seconds to wait, or null if header is missing/unparseable
49
+ */
50
+ private parseRetryAfter;
51
+ /**
52
+ * Build a typed error from an HTTP error response.
53
+ * Reads the response body, parses it as JSON (handling both API error formats),
54
+ * and returns the appropriate error class.
55
+ */
56
+ private buildErrorFromResponse;
57
+ /**
58
+ * Calculate delay for exponential backoff with jitter.
59
+ * @param attempt - 0-based attempt number
60
+ * @param retryAfterSeconds - Optional Retry-After hint from the server
61
+ */
62
+ private getRetryDelay;
63
+ /**
64
+ * Sleep for the given number of milliseconds.
65
+ */
66
+ private sleep;
67
+ /**
68
+ * Core HTTP method used by both request<T>() and requestVoid().
69
+ * Handles authentication, timeout, error parsing, and automatic retry
70
+ * for transient failures (429, 502, 503, 504).
71
+ *
72
+ * @param endpoint - API path (e.g. "/api/v1/agent/all")
73
+ * @param options - fetch() options (method, body, etc.)
74
+ * @returns The raw Response object on success
75
+ * @throws ApiRequestError (or subclass) on HTTP errors after retries are exhausted
76
+ * @throws AuthenticationError if no credentials are configured
77
+ * @throws Error on timeout or network failure
78
+ */
79
+ private fetchWithRetry;
80
+ /**
81
+ * Make an authenticated request to the API and parse the JSON response.
82
+ * Includes automatic retry for transient failures (429, 502, 503, 504) on
83
+ * idempotent methods.
33
84
  */
34
85
  private request;
35
86
  /**
36
- * Make an authenticated request that doesn't expect a response body
87
+ * Make an authenticated request that doesn't expect a response body.
88
+ * Includes automatic retry for transient failures (429, 502, 503, 504) on
89
+ * idempotent methods.
37
90
  */
38
91
  private requestVoid;
39
92
  /**
@@ -140,6 +193,33 @@ export declare class SequentumApiClient {
140
193
  * @param scheduleId - The ID of the schedule to delete
141
194
  */
142
195
  deleteAgentSchedule(agentId: number, scheduleId: number): Promise<void>;
196
+ /**
197
+ * Get a specific schedule by ID
198
+ * @param agentId - The ID of the agent
199
+ * @param scheduleId - The ID of the schedule
200
+ * @returns The schedule details
201
+ */
202
+ getAgentSchedule(agentId: number, scheduleId: number): Promise<AgentScheduleApiModel>;
203
+ /**
204
+ * Update an existing schedule
205
+ * @param agentId - The ID of the agent
206
+ * @param scheduleId - The ID of the schedule to update
207
+ * @param request - The updated schedule configuration
208
+ * @returns The updated schedule
209
+ */
210
+ updateAgentSchedule(agentId: number, scheduleId: number, request: UpdateScheduleRequest): Promise<AgentScheduleApiModel>;
211
+ /**
212
+ * Enable a schedule so it runs according to its configuration
213
+ * @param agentId - The ID of the agent
214
+ * @param scheduleId - The ID of the schedule to enable
215
+ */
216
+ enableAgentSchedule(agentId: number, scheduleId: number): Promise<void>;
217
+ /**
218
+ * Disable a schedule so it will not run until re-enabled
219
+ * @param agentId - The ID of the agent
220
+ * @param scheduleId - The ID of the schedule to disable
221
+ */
222
+ disableAgentSchedule(agentId: number, scheduleId: number): Promise<void>;
143
223
  /**
144
224
  * Get upcoming scheduled runs
145
225
  * @param startDate - Optional start date (ISO format)
@@ -246,5 +326,27 @@ export declare class SequentumApiClient {
246
326
  * @param agentId - The ID of the agent
247
327
  */
248
328
  getLatestFailure(agentId: number): Promise<RunDiagnosticsApiModel>;
329
+ /**
330
+ * Start a new agent building session.
331
+ * Returns immediately with a sessionId — building runs asynchronously.
332
+ * Poll getAgentBuildStatus until status reaches a terminal value: "completed", "ready", "error", or "cancelled".
333
+ * @param request - The prompt and optional spaceId
334
+ */
335
+ startAgentBuild(request: ExternalStartAgentBuildRequest): Promise<ExternalStartAgentBuildResponse>;
336
+ /**
337
+ * Get the current status of an agent building session.
338
+ * Lightweight polling endpoint — call this until status reaches a terminal value: "completed", "ready", "error", or "cancelled".
339
+ * @param sessionId - The session ID returned from startAgentBuild
340
+ */
341
+ getAgentBuildStatus(sessionId: string): Promise<ExternalSessionStatusResponse>;
342
+ /**
343
+ * Abort an in-progress agent building session early.
344
+ * Has no effect once the session has already reached a terminal status.
345
+ * The agent draft (if already created) persists in the workspace — use
346
+ * the standard agents API to delete it if unwanted.
347
+ * Returns 204 No Content on success.
348
+ * @param sessionId - The session ID
349
+ */
350
+ stopAgentBuild(sessionId: string): Promise<void>;
249
351
  }
250
352
  //# sourceMappingURL=api-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../src/api/api-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,E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