sequentum-mcp 1.1.3 → 1.2.1

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 (64) hide show
  1. package/CHANGELOG.md +138 -1
  2. package/README.md +245 -86
  3. package/dist/{api-client.d.ts → api/api-client.d.ts} +148 -4
  4. package/dist/api/api-client.d.ts.map +1 -0
  5. package/dist/api/api-client.js +853 -0
  6. package/dist/api/api-client.js.map +1 -0
  7. package/dist/{types.d.ts → api/types.d.ts} +183 -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 -1580
  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/utils/validation.d.ts +61 -0
  44. package/dist/utils/validation.d.ts.map +1 -0
  45. package/dist/utils/validation.js +153 -0
  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 +515 -54
  50. package/docs/troubleshooting.md +111 -38
  51. package/package.json +4 -3
  52. package/dist/api-client.d.ts.map +0 -1
  53. package/dist/api-client.js +0 -516
  54. package/dist/api-client.js.map +0 -1
  55. package/dist/oauth-metadata.d.ts.map +0 -1
  56. package/dist/oauth-metadata.js.map +0 -1
  57. package/dist/types.d.ts.map +0 -1
  58. package/dist/types.js.map +0 -1
  59. package/dist/validation.d.ts +0 -12
  60. package/dist/validation.d.ts.map +0 -1
  61. package/dist/validation.js +0 -22
  62. package/dist/validation.js.map +0 -1
  63. /package/dist/{oauth-metadata.d.ts → utils/oauth-metadata.d.ts} +0 -0
  64. /package/dist/{oauth-metadata.js → utils/oauth-metadata.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,140 @@
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
+
102
+ ## [1.1.4] - 2026-03-04
103
+
104
+ ### Added
105
+
106
+ - `delete_run` tool for deleting runs and associated data (PII compliance)
107
+ - **Billing & Cost Analysis** tools for detailed agent cost tracking:
108
+ - `get_agents_usage` - Get all agents with their costs for a date range, with filtering and sorting options
109
+ - `get_agent_cost_breakdown` - Get cost breakdown by usage type for a specific agent over time (for charting)
110
+ - `get_agent_runs_cost` - Get individual run costs for a specific agent with detailed run information
111
+
112
+ ### Changed
113
+
114
+ - Replaced Claude Desktop setup instructions with Custom Connectors approach (config file method caused Claude Desktop to break). Added plan-specific steps for Free/Pro/Max and Team/Enterprise accounts, with a link to [Claude's custom connectors documentation](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp).
115
+
116
+ ## [1.1.3] - 2026-02-17
117
+
118
+ ### Added
119
+
120
+
121
+ - `kill_agent` tool for forceful agent termination (as a last resort when `stop_agent` fails)
122
+ - OAuth 2.1 support with HTTP Streamable transport and RFC 8707 resource parameters
123
+ - OAuth2 Protected Resource Metadata endpoint for MCP client authentication
124
+ - Support for Dynamic Client Registration (DCR) and Client Instance Metadata Discovery (CIMD)
125
+ - New `oauth-metadata.ts` module for OAuth metadata handling
126
+ - Dockerfile for containerized deployment
127
+
128
+ ### Changed
129
+
130
+ - Enhanced `kill_agent` tool with improved functionality
131
+ - Improved 401 authentication error handling on the `/mcp` endpoint
132
+ - Refactored OAuth-related logic out of `index.ts` into dedicated `oauth-metadata.ts` module
133
+ - Shortened MCP tool descriptions to save tokens
134
+ - Removed unnecessary logging from authentication flow
135
+ - Updated README with OAuth server setup instructions and improved readability
136
+ - Improved `docs/tool-reference.md` and `docs/troubleshooting.md` documentation
137
+
3
138
  ## [1.0.2] - 2026-01-20
4
139
 
5
140
  ### Fixed
@@ -56,7 +191,9 @@
56
191
 
57
192
  ---
58
193
 
59
- [Unreleased]: https://github.com/Sequentum/sequentum-mcp/compare/v1.0.2...HEAD
194
+ [1.2.0]: https://github.com/Sequentum/sequentum-mcp/compare/v1.1.4...v1.2.0
195
+ [1.1.4]: https://github.com/Sequentum/sequentum-mcp/compare/v1.1.3...v1.1.4
196
+ [1.1.3]: https://github.com/Sequentum/sequentum-mcp/compare/v1.0.2...v1.1.3
60
197
  [1.0.2]: https://github.com/Sequentum/sequentum-mcp/compare/v1.0.1...v1.0.2
61
198
  [1.0.1]: https://github.com/Sequentum/sequentum-mcp/compare/v1.0.0...v1.0.1
62
199
  [1.0.0]: https://github.com/Sequentum/sequentum-mcp/releases/tag/v1.0.0
package/README.md CHANGED
@@ -3,12 +3,9 @@
3
3
  [![npm version](https://img.shields.io/npm/v/sequentum-mcp.svg)](https://www.npmjs.com/package/sequentum-mcp)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- `sequentum-mcp` lets your AI coding assistant (such as Claude, Cursor, or Copilot)
7
- control and manage your Sequentum web scraping agents. It acts as a Model Context Protocol
8
- (MCP) server, giving your AI assistant access to the full power of the Sequentum platform
9
- for agent automation, monitoring, and data extraction.
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.
10
7
 
11
- ## [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)
12
9
 
13
10
  ## Key Features
14
11
 
@@ -21,22 +18,132 @@ for agent automation, monitoring, and data extraction.
21
18
  ## Disclaimers
22
19
 
23
20
  `sequentum-mcp` exposes your Sequentum account data to MCP clients, allowing them to
24
- view, run, and manage your web scraping agents. Keep your API key secure and avoid
21
+ view, run, and manage your web scraping agents. Keep your credentials secure and avoid
25
22
  sharing sensitive information that you don't want accessible to MCP clients.
26
23
 
27
- ## Requirements
24
+ ## Getting Started
28
25
 
29
- - [Node.js](https://nodejs.org/) v18 or higher
30
- - [npm](https://www.npmjs.com/)
31
- - Sequentum account with API access
26
+ Add the Sequentum MCP server to your client with this configuration:
32
27
 
33
- ## Getting Started
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "sequentum": {
32
+ "url": "https://mcp.sequentum.com/mcp"
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ **Most clients support the OAuth configuration.** Claude Desktop uses a different setup via Custom Connectors — see [Claude Desktop](#claude-desktop) below. For other clients, when you first connect, you'll be prompted to:
39
+
40
+ 1. Log in with your Sequentum account
41
+ 2. Accept the OAuth authorization
42
+ 3. Grant access to the necessary permissions
43
+
44
+ Once authenticated, all tools become available in your client. For client-specific setup details, see [Set Up Your Client](#set-up-your-client) below.
45
+
46
+ ## Set Up Your Client
47
+
48
+ Select your client below for specific setup instructions. All clients use the remote OAuth server at `https://mcp.sequentum.com/mcp` unless noted otherwise.
49
+
50
+ ### Cursor
51
+
52
+ Go to `Cursor` > `Settings` > `Cursor Settings` > `MCP` and follow the prompts to add the Sequentum MCP server. Cursor 1.0+ includes native OAuth and Streamable HTTP support.
53
+
54
+ You can also add the server manually by editing your `mcp.json` file using the [configuration above](#getting-started).
55
+
56
+ ### Claude Desktop
57
+
58
+ > **Note:** Custom connectors are currently in beta. Free plan users are limited to one custom connector.
59
+
60
+ Claude Desktop connects to remote MCP servers using **Custom Connectors** rather than the config file. The setup differs based on your plan type. For full details, see [Claude's custom connectors documentation](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp).
61
+
62
+ **Free, Pro, and Max plans:**
63
+
64
+ 1. Navigate to **Settings** > **Connectors**.
65
+ 2. Click **"Add custom connector"** at the bottom of the section.
66
+ 3. Enter the Sequentum MCP server URL: `https://mcp.sequentum.com/mcp`
67
+ 4. Click **"Add"** to finish.
68
+
69
+ **Team and Enterprise plans:**
70
+
71
+ An Owner or Primary Owner must first add the connector to the organization:
72
+
73
+ 1. Navigate to **Organization settings** > **Connectors**.
74
+ 2. Click **"Add custom connector"** at the bottom of the section.
75
+ 3. Enter the Sequentum MCP server URL: `https://mcp.sequentum.com/mcp`
76
+ 4. Click **"Add"** to finish.
77
+
78
+ Then, each team member connects individually:
79
+
80
+ 1. Navigate to **Settings** > **Connectors**.
81
+ 2. Find the Sequentum connector in the list (it will have a "Custom" label).
82
+ 3. Click **"Connect"** to authenticate.
83
+
84
+ **Enabling per conversation:**
85
+
86
+ Once configured, enable the Sequentum connector in individual conversations via the **"+"** button on the lower left of the chat interface, then select **"Connectors"**.
34
87
 
35
- There are two ways to connect to the Sequentum MCP: running locally with an API key, or connecting to a remote server with OAuth authentication.
88
+ ### ChatGPT
36
89
 
37
- ### Option 1: Local (API Key)
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.
38
91
 
39
- Run the MCP server locally using `npx`. Add the following config to your MCP client:
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
+
99
+ ### Claude Code
100
+
101
+ Run the following command in your terminal:
102
+
103
+ ```bash
104
+ claude mcp add --transport http sequentum https://mcp.sequentum.com/mcp
105
+ ```
106
+
107
+ Then launch Claude Code with `claude`. You'll be prompted to authenticate with OAuth to Sequentum.
108
+
109
+ ### VS Code / GitHub Copilot
110
+
111
+ Open the Command Palette with `Ctrl+Shift+P` (or `Cmd+Shift+P` on macOS) and select `MCP: Add Server`. Enter the Sequentum MCP server URL:
112
+
113
+ ```
114
+ https://mcp.sequentum.com/mcp
115
+ ```
116
+
117
+ ### Windsurf
118
+
119
+ Configure via the `Configure MCP` option in Cascade (`Cmd+L` or `Ctrl+L`). Add the Sequentum MCP server URL:
120
+
121
+ ```
122
+ https://mcp.sequentum.com/mcp
123
+ ```
124
+
125
+ ### Other Clients
126
+
127
+ The Sequentum MCP Server follows standard MCP protocols and works with any client that supports:
128
+
129
+ - **OAuth authentication** (recommended)
130
+ - **Streamable HTTP** with automatic SSE fallback
131
+
132
+ Use the server URL `https://mcp.sequentum.com/mcp` in your client's MCP configuration.
133
+
134
+ The server supports [Client ID Metadata Documents (CIMD)](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-client-id-metadata-document-00) as the preferred client identification method, with [Dynamic Client Registration (RFC 7591)](https://datatracker.ietf.org/doc/html/rfc7591) as a fallback. MCP clients that support CIMD (such as Cursor) can use their own URL as a `client_id` without any prior registration.
135
+
136
+ ## Alternative: Local Setup (API Key)
137
+
138
+ If you prefer to run the MCP server locally (e.g., for custom deployments, offline use, or CI/CD pipelines), you can use `npx` with an API key instead of the hosted OAuth server.
139
+
140
+ **Requirements for local setup:**
141
+
142
+ - [Node.js](https://nodejs.org/) v18 or higher
143
+ - [npm](https://www.npmjs.com/)
144
+ - Sequentum API key
145
+
146
+ Add the following config to your MCP client:
40
147
 
41
148
  ```json
42
149
  {
@@ -52,64 +159,61 @@ Run the MCP server locally using `npx`. Add the following config to your MCP cli
52
159
  }
53
160
  ```
54
161
 
55
- #### Get Your API Key
162
+ ### Get Your API Key
56
163
 
57
164
  1. Log in to the [Sequentum Control Center](https://dashboard.sequentum.com)
58
- 2. Go to **Settings** **API Keys**
165
+ 2. Go to **Settings** > **API Keys**
59
166
  3. Click **Create API Key** and copy the generated key (starts with `sk-`)
60
167
 
61
- ### Option 2: Remote Server (OAuth)
168
+ ### Custom Sequentum Instance
62
169
 
63
- Connect to a hosted Sequentum MCP server using OAuth 2.0 authentication. Add the following config to your MCP client:
170
+ To connect to a custom Sequentum deployment, add the `SEQUENTUM_API_URL` environment variable:
64
171
 
65
172
  ```json
66
173
  {
67
174
  "mcpServers": {
68
175
  "sequentum": {
69
- "url": "https://mcp.sequentum.com/mcp"
176
+ "command": "npx",
177
+ "args": ["-y", "sequentum-mcp"],
178
+ "env": {
179
+ "SEQUENTUM_API_KEY": "sk-your-api-key-here",
180
+ "SEQUENTUM_API_URL": "https://your-custom-instance.sequentum.com"
181
+ }
70
182
  }
71
183
  }
72
184
  }
73
185
  ```
74
186
 
75
- > **QA environment:** Use `https://mcp-qa.sequentum.com/mcp` instead for testing against the QA server.
76
-
77
- When you connect for the first time, your MCP client will open a browser window for you to log in with your Sequentum account.
78
-
79
- The server supports [Client ID Metadata Documents (CIMD)](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-client-id-metadata-document-00) as the preferred client identification method, with [Dynamic Client Registration (RFC 7591)](https://datatracker.ietf.org/doc/html/rfc7591) as a fallback. MCP clients that support CIMD (such as Cursor) can use their own URL as a `client_id` without any prior registration.
80
-
81
- ### MCP Client Configuration Files
187
+ ### Local Environment Variables
82
188
 
83
- | Client | Config File Location |
84
- |--------|---------------------|
85
- | Claude Desktop (Windows) | `%APPDATA%\Claude\claude_desktop_config.json` |
86
- | Claude Desktop (macOS) | `~/Library/Application Support/Claude/claude_desktop_config.json` |
87
- | Cursor | `Cursor Settings` → `MCP` → `New MCP Server` |
189
+ | Variable | Required | Default | Description |
190
+ |----------|----------|---------|-------------|
191
+ | `SEQUENTUM_API_KEY` | Yes | -- | Your Sequentum API key (format: `sk-...`). Get this from the Sequentum Control Center under Settings > API Keys. |
192
+ | `SEQUENTUM_API_URL` | No | `https://dashboard.sequentum.com` | The base URL of your Sequentum instance. Override if using a custom deployment. |
88
193
 
89
- ## Your First Prompt
194
+ ## Example Usage
90
195
 
91
- Enter the following prompt in your MCP client to check if everything is working:
196
+ Once connected, try these prompts to start using Sequentum context in your AI assistant:
92
197
 
93
198
  ```
94
199
  What agents ran yesterday?
95
- ```
96
-
97
- Your MCP client should return a list of your Sequentum agents with their IDs, names, and status.
98
-
99
- ### Other Useful Prompts
100
-
101
- ```
102
200
  Run agent <agent name> now.
103
201
  Is agent <agent name> still running?
104
202
  What agents are scheduled to run today?
105
203
  Download the extracted data from agent <agent name>.
106
204
  How many records were found the last time <agent name> was run?
107
205
  What is my current balance?
206
+ Which agents cost the most this month?
108
207
  Schedule agent <agent name> to run every Monday at 9am.
109
208
  Look at the run log for <agent name> run at 9:22am. What caused the agent to fail?
209
+ Show me the cost breakdown for agent <agent name> in January.
210
+ What were the most expensive runs for agent <agent name>?
211
+ How much did I spend on server time vs exports last week?
110
212
  ```
111
213
 
112
- ## Tools
214
+ ## Available Tools
215
+
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.
113
217
 
114
218
  <!-- BEGIN AUTO GENERATED TOOLS -->
115
219
 
@@ -117,27 +221,35 @@ Look at the run log for <agent name> run at 9:22am. What caused the agent to fai
117
221
  - [`list_agents`](docs/tool-reference.md#list_agents)
118
222
  - [`get_agent`](docs/tool-reference.md#get_agent)
119
223
  - [`search_agents`](docs/tool-reference.md#search_agents)
120
- - **Run Management** (5 tools)
224
+ - **Run Management** (6 tools)
121
225
  - [`get_agent_runs`](docs/tool-reference.md#get_agent_runs)
122
226
  - [`get_run_status`](docs/tool-reference.md#get_run_status)
123
227
  - [`start_agent`](docs/tool-reference.md#start_agent)
124
228
  - [`stop_agent`](docs/tool-reference.md#stop_agent)
125
229
  - [`kill_agent`](docs/tool-reference.md#kill_agent)
230
+ - [`delete_run`](docs/tool-reference.md#delete_run)
126
231
  - **File Management** (2 tools)
127
232
  - [`get_run_files`](docs/tool-reference.md#get_run_files)
128
233
  - [`get_file_download_url`](docs/tool-reference.md#get_file_download_url)
129
234
  - **Version Management** (2 tools)
130
235
  - [`get_agent_versions`](docs/tool-reference.md#get_agent_versions)
131
236
  - [`restore_agent_version`](docs/tool-reference.md#restore_agent_version)
132
- - **Schedule Management** (4 tools)
237
+ - **Schedule Management** (8 tools)
133
238
  - [`list_agent_schedules`](docs/tool-reference.md#list_agent_schedules)
239
+ - [`get_agent_schedule`](docs/tool-reference.md#get_agent_schedule)
134
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)
135
244
  - [`delete_agent_schedule`](docs/tool-reference.md#delete_agent_schedule)
136
245
  - [`get_scheduled_runs`](docs/tool-reference.md#get_scheduled_runs)
137
- - **Billing & Credits** (3 tools)
246
+ - **Billing & Credits** (6 tools)
138
247
  - [`get_credits_balance`](docs/tool-reference.md#get_credits_balance)
139
248
  - [`get_spending_summary`](docs/tool-reference.md#get_spending_summary)
140
249
  - [`get_credit_history`](docs/tool-reference.md#get_credit_history)
250
+ - [`get_agents_usage`](docs/tool-reference.md#get_agents_usage)
251
+ - [`get_agent_cost_breakdown`](docs/tool-reference.md#get_agent_cost_breakdown)
252
+ - [`get_agent_runs_cost`](docs/tool-reference.md#get_agent_runs_cost)
141
253
  - **Space Management** (5 tools)
142
254
  - [`list_spaces`](docs/tool-reference.md#list_spaces)
143
255
  - [`get_space`](docs/tool-reference.md#get_space)
@@ -149,64 +261,111 @@ Look at the run log for <agent name> run at 9:22am. What caused the agent to fai
149
261
  - [`get_records_summary`](docs/tool-reference.md#get_records_summary)
150
262
  - [`get_run_diagnostics`](docs/tool-reference.md#get_run_diagnostics)
151
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)
152
268
 
153
269
  <!-- END AUTO GENERATED TOOLS -->
154
270
 
155
- ## Configuration
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 -->
156
324
 
157
- The Sequentum MCP server supports the following environment variables:
325
+ ## Troubleshooting
158
326
 
159
- | Variable | Required | Default | Description |
160
- |----------|----------|---------|-------------|
161
- | `SEQUENTUM_API_KEY` | Yes | | Your Sequentum API key (format: `sk-...`). Get this from the Sequentum Control Center under Settings API Keys. |
162
- | `SEQUENTUM_API_URL` | No | `https://dashboard.sequentum.com` | The base URL of your Sequentum instance. Override if using a custom deployment. |
327
+ | Error | Solution |
328
+ |-------|----------|
329
+ | OAuth login not opening | Ensure your client supports OAuth and Streamable HTTP. Try restarting the client. For Claude Desktop, use [Custom Connectors](#claude-desktop) instead of the config file. |
330
+ | Connection refused | Verify the URL is `https://mcp.sequentum.com/mcp` and check your network connection. |
331
+ | `SEQUENTUM_API_KEY required` | Local mode only. Add your API key to the `env` section of the MCP config. |
332
+ | `API Error 401: Unauthorized` | Your API key or OAuth token is invalid or expired. Re-authenticate or generate a new key. |
333
+ | `API Error 404: Not Found` | The agent, run, or file doesn't exist, or you don't have access to it. |
334
+ | `API Error 429: Too Many Requests` | Rate limit exceeded. Wait a moment and try again. |
163
335
 
164
- Pass them via the `env` property in the JSON configuration:
336
+ For more troubleshooting help, see the [Troubleshooting Guide](./docs/troubleshooting.md).
165
337
 
166
- ```json
167
- {
168
- "mcpServers": {
169
- "sequentum": {
170
- "command": "npx",
171
- "args": ["-y", "sequentum-mcp"],
172
- "env": {
173
- "SEQUENTUM_API_KEY": "sk-your-api-key-here"
174
- }
175
- }
176
- }
177
- }
178
- ```
338
+ ## CORS Origin Allowlist
179
339
 
180
- To use a custom Sequentum instance, add the `SEQUENTUM_API_URL`:
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:
181
349
 
182
- ```json
183
- {
184
- "mcpServers": {
185
- "sequentum": {
186
- "command": "npx",
187
- "args": ["-y", "sequentum-mcp"],
188
- "env": {
189
- "SEQUENTUM_API_KEY": "sk-your-api-key-here",
190
- "SEQUENTUM_API_URL": "https://your-custom-instance.sequentum.com"
191
- }
192
- }
193
- }
194
- }
350
+ ```
351
+ ALLOWED_ORIGINS="https://my-dashboard.example.com,https://other.example.com"
195
352
  ```
196
353
 
197
- ## Troubleshooting
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`.
198
355
 
199
- | Error | Solution |
200
- |-------|----------|
201
- | `SEQUENTUM_API_KEY required` | Add your API key to the `env` section of the MCP config |
202
- | `API Error 401: Unauthorized` | Your API key is invalid or expired. Generate a new one from the Control Center. |
203
- | `API Error 404: Not Found` | The agent, run, or file doesn't exist, or you don't have access to it. |
204
- | `API Error 429: Too Many Requests` | Rate limit exceeded. Wait a moment and try again. |
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.
205
357
 
206
- For more troubleshooting help, see the [Troubleshooting Guide](./docs/troubleshooting.md).
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).
207
365
 
208
366
  ## Links
209
367
 
368
+ - [Sequentum MCP Server](https://mcp.sequentum.com)
210
369
  - [Sequentum Dashboard](https://dashboard.sequentum.com)
211
370
  - [Sequentum API Documentation](https://dashboard.sequentum.com/api-docs/index.html)
212
371
  - [Model Context Protocol](https://modelcontextprotocol.io/)