@workover/mcp 0.10.0 → 0.19.0

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/README.md CHANGED
@@ -36,14 +36,31 @@ production sign-in names the environment instead.
36
36
  - `workover_upload_image(docId, path, alt)` — put a local image into a document's media
37
37
  - `workover_list_images(docId, tabId?)` — the images in a document: file name, alt text and src
38
38
  - `workover_set_image(docId, src, filename?, alt?)` — set an image's file name (its WordPress media name) and/or alt text, as the editor's Edit image dialog does. Needs `workover login --write`
39
+ - `workover_doc_status(docId, status?)` — read a document's Workover status and the statuses its workflow offers (with whether you may move it to each, and why not), or set it through the browser's rules: role, workflow gates, approvals. Needs `workover login --write`, plus `--publish` to or from Published. Does not publish to WordPress
39
40
  - `workover_propose_edit(docId, markdown, note, tabId?, reasoning?)` — propose a revised version (rendered as suggestions; never applied or published automatically)
40
- - `workover_edit_doc(docId, markdown, note, tabId?)` — edit a document directly, no review step. Needs `workover login --write`
41
+ - `workover_edit_doc(docId, markdown?, title?, note, tabId?)` — edit a document directly, no review step. Needs `workover login --write`. Pass `title` to rename it: with no `markdown` only the name changes and the body is left as it is. A `# Heading` in the markdown never renames a document
41
42
  - `workover_style_guide(projectId?)` — the rules this team writes by
42
43
  - `workover_add_style_rule(text, projectId | organizationId)` — add a rule. Needs `workover login --rules`
43
44
  - `workover_list_tabs(docId)` — a document's tabs
44
45
  - `workover_create_tab(docId, title, parentId?)` — add an empty tab. Needs `workover login --write`
46
+ - `workover_report_feedback(summary, intent, problem, proposedFix?, tool?, kind?)` — tell the Workover team that a tool here fell short (a missing argument, a wrong answer, an error the agent could not act on), with the fix the agent proposes. It is filed as an issue in Workover's tracker. See [Feedback](#feedback)
45
47
 
46
- Everything the MCP server can do, the CLI can do too (`workover doc create|read|propose|write|list|search|tabs|tab-new|images|image`, `workover rules list|export|add`). That is deliberate: a newly-registered MCP server is not available in the session that registered it, so an agent that finds mid-task that it needs Workover has no way in until it restarts. A CLI subcommand works immediately.
48
+ **A hosted Help Center**, set up end to end. Every one of these needs `workover login --site`:
49
+
50
+ - `workover_create_project(name, workspace?, address?, start?)`: a new project that publishes to a Workover Help Center at `<address>.workover.site`. `start` is `blank`, `starter` or `empty` (for an import)
51
+ - `workover_create_site(projectId, address?)`: give an existing project a Help Center, or change its address
52
+ - `workover_import_site(projectId, url | dir, checkOnly?)`: import a public docs site, up to 500 pages with their navigation, or a docs folder on this machine (`_site.json` or Mintlify's `docs.json`) with its tabs, groups and order; waits about 50 seconds, then hands back progress
53
+ - `workover_set_site_appearance(projectId, from?, primary?, primaryDark?, searchPrompt?, logo?, logoDark?, favicon?, faviconDark?)`: colors, links and search prompt from a folder's config and the arguments, and the logo and favicon uploaded from image files
54
+ - `workover_add_site_redirects(projectId, from)`: add a folder's redirects; never changes one the site has
55
+ - `workover_add_api_reference(projectId, spec, tab?, group?, directory?)`: add an API reference tab made from an OpenAPI spec (an https URL), a page per endpoint with Try it. The site keeps it in step with the spec and publishes those pages itself
56
+ - `workover_sync_api_reference(projectId, checkOnly?)`: "the spec changed": sync the spec-backed tabs now, or with `checkOnly` list them and their last sync
57
+ - `workover_set_domain(projectId, domain, preverify?, moveFrom?)`: connect `docs.example.com` or `example.com/docs`, and return every DNS record to add, TXT included, as the app's Domain tab shows them (for a path, the proxy setup too). The agent hands these to the person, who adds them at their DNS provider. `moveFrom` (a project id in the same workspace) moves the domain from that Help Center in one step, keeping its verification, so the DNS stays as it is.
58
+ - `workover_check_site(projectId)`: which records are found, whether the domain is verified and the certificate issued, and for a path whether the live address serves the site
59
+ - `workover_publish_site(projectId, checkOnly?)`: publish the Help Center
60
+ - `workover_set_site_indexing(projectId, index)`: let search engines index it, or not
61
+ - `workover_site_status(projectId?)`: the site, its domain, the last import and publish; without a project, which projects have a Help Center
62
+
63
+ Everything the MCP server can do, the CLI can do too (`workover doc create|read|propose|write|list|search|tabs|tab-new|images|image`, `workover rules list|export|add`, `workover project create`, `workover site create|import|appearance|redirects|api|domain|check|publish|index|status`). That is deliberate: a newly-registered MCP server is not available in the session that registered it, so an agent that finds mid-task that it needs Workover has no way in until it restarts. A CLI subcommand works immediately.
47
64
 
48
65
  ## The style guide
49
66
 
@@ -109,6 +126,23 @@ The API endpoint comes from your `workover login` (defaults to `https://api.work
109
126
  sign-in is read on every call, so `workover login` takes effect without restarting the client.
110
127
  `WORKOVER_CONFIG` names a different sign-in file, as in the CLI.
111
128
 
129
+ ## Feedback
130
+
131
+ When one of these tools cannot do what a task needs, the agent can say so with
132
+ `workover_report_feedback`: what it was trying to do, what got in the way, and the change that
133
+ would have let it. Each report becomes an issue in the Workover team's tracker, where it is
134
+ triaged and, when it holds up, fixed. Every agent using this server benefits from the fix.
135
+
136
+ It is sent **only when the agent calls the tool**, and contains the fields the agent wrote, this
137
+ server's version and the MCP client's name. It is recorded against your Workover account. The tool
138
+ tells the agent never to include your document text, customer data or secrets, and the API
139
+ replaces anything that looks like a token or a password before storing it. The agent is asked to
140
+ tell you when it sends one. `DO_NOT_TRACK` does not turn this off, because it is not tracking: it
141
+ is a message the agent chose to send, like an email to support. Ask your agent not to send
142
+ feedback if you would rather it did not.
143
+
144
+ The CLI does the same with `workover feedback --summary ... --intent ... --problem ... --fix ...`.
145
+
112
146
  ## Usage data
113
147
 
114
148
  To learn which tools agents actually reach for and where they fail, this server records **one event
package/feedback.mjs ADDED
@@ -0,0 +1,123 @@
1
+ // Telling Workover what its tools could not do: the MCP server's `workover_report_feedback` and the
2
+ // CLI's `workover feedback` (WO-1435).
3
+ //
4
+ // THE SAME FILE ships in @workover/cli (apps/cli/feedback.mjs) and @workover/mcp
5
+ // (apps/mcp/feedback.mjs), as site-setup.mjs does, because the two packages are published
6
+ // separately and neither may depend on the other. `apps/mcp/feedback.test.mjs` fails when the
7
+ // copies differ.
8
+ //
9
+ // WHY THIS EXISTS. Usage telemetry (telemetry.mjs) says which tools were called and leaves us to
10
+ // guess what the agent wanted. The agent knows: it was asked for something, reached for a tool, and
11
+ // found the argument missing or the answer wrong. So it can say so, with the fix it would make, and
12
+ // the report lands as an issue in Workover's own Linear Triage, where accepting it and handing it to
13
+ // an agent for a PR is one step. Fix the tool, and the next agent does not hit the wall.
14
+ //
15
+ // WHAT IS SENT, and only when an agent or a person calls this: the fields below, as written, plus
16
+ // this package's version and the client's name. The api attributes it to the signed-in account and
17
+ // redacts anything that looks like a token. It is NOT a channel for the person's documents, and the
18
+ // tool description says so to the agent before it writes a word.
19
+ //
20
+ // No ANSI and no side effects beyond the one request: `call(path, { method, body })` resolves the
21
+ // parsed JSON or throws an Error carrying the API's own sentence, as in site-setup.mjs.
22
+
23
+ export const FEEDBACK_KINDS = ['missing_capability', 'bug', 'confusing', 'docs', 'other'];
24
+
25
+ /** What the tool tells the agent. The when-to and the never-include are the important half. */
26
+ export const FEEDBACK_TOOL_DESCRIPTION =
27
+ "Tell the Workover team that one of these tools fell short, so it gets fixed. Call it when a Workover tool could not do what the task needed (a missing filter, argument or tool), returned something wrong, failed with an error you could not act on, or when you had to work around it (reading many documents to answer one question, say). Write it as an issue: what you were trying to do, what got in the way, and the change to the tool that would have let you do it. It becomes an issue in Workover's tracker. Never include the person's document text, customer data, tokens or passwords: describe the shape of the problem, not its contents. Do not call it for problems outside Workover (your own environment, another service). Mention to the person that you sent it.";
28
+
29
+ export const FEEDBACK_INPUT_SCHEMA = {
30
+ type: 'object',
31
+ properties: {
32
+ summary: {
33
+ type: 'string',
34
+ description: 'One line naming the gap, like an issue title: "workover_search_docs cannot filter by project".',
35
+ },
36
+ intent: {
37
+ type: 'string',
38
+ description: 'What you, or the person you work for, were trying to do. The goal, not the tool call.',
39
+ },
40
+ problem: {
41
+ type: 'string',
42
+ description: 'What the Workover tools could not do or did wrong, and what you did instead. Quote an error message if there was one.',
43
+ },
44
+ proposedFix: {
45
+ type: 'string',
46
+ description: 'The change that would have let you do it: a new argument, a new tool, a clearer error. Concrete enough to build.',
47
+ },
48
+ tool: {
49
+ type: 'string',
50
+ description: 'The Workover tool this is about, e.g. "workover_search_docs". Leave it out when no single tool is at fault.',
51
+ },
52
+ kind: {
53
+ type: 'string',
54
+ enum: FEEDBACK_KINDS,
55
+ description: 'missing_capability (the tool cannot do it), bug (it did it wrong), confusing (an error or description misled you), docs (the tool description is wrong or missing), other.',
56
+ },
57
+ },
58
+ required: ['summary', 'intent', 'problem'],
59
+ };
60
+
61
+ /** Trimmed strings only; anything else the caller sent stays behind. */
62
+ const str = (v) => (typeof v === 'string' && v.trim() ? v.trim() : undefined);
63
+
64
+ /**
65
+ * Send one report. `meta` is { surface: 'mcp' | 'cli', version, client }.
66
+ * Resolves the api's answer: { status: 'filed' | 'queued' | 'duplicate', id, issue }.
67
+ */
68
+ export async function submitFeedback(call, args = {}, meta = {}) {
69
+ const missing = ['summary', 'intent', 'problem'].filter((k) => !str(args[k]));
70
+ if (missing.length) {
71
+ const e = new Error(
72
+ `Missing ${missing.join(', ')}. A report needs a one-line summary, what you were trying to do (intent) and what got in the way (problem).`,
73
+ );
74
+ e.status = 400;
75
+ throw e;
76
+ }
77
+ const body = {
78
+ summary: str(args.summary),
79
+ intent: str(args.intent),
80
+ problem: str(args.problem),
81
+ ...(str(args.proposedFix) ? { proposedFix: str(args.proposedFix) } : {}),
82
+ ...(str(args.tool) ? { tool: str(args.tool) } : {}),
83
+ kind: FEEDBACK_KINDS.includes(args.kind) ? args.kind : 'other',
84
+ surface: meta.surface === 'cli' ? 'cli' : 'mcp',
85
+ ...(str(meta.version) ? { version: str(meta.version) } : {}),
86
+ ...(str(meta.client) ? { client: str(meta.client) } : {}),
87
+ };
88
+ try {
89
+ return await call('/mcp/feedback', { method: 'POST', body });
90
+ } catch (e) {
91
+ // An api from before this route existed answers 404. Say that, rather than a bare "API error",
92
+ // so the agent tells the person the report did not go anywhere instead of retrying forever.
93
+ if (e?.status === 404 || /\(404\)/.test(String(e?.message))) {
94
+ const old = new Error(
95
+ "This Workover API does not accept feedback yet, so the report was not sent. Tell the person what you found instead; they can pass it on.",
96
+ );
97
+ old.status = 404;
98
+ throw old;
99
+ }
100
+ throw e;
101
+ }
102
+ }
103
+
104
+ /** The answer, as lines for a terminal or an MCP text result. */
105
+ export function renderFeedbackResult(res) {
106
+ if (res?.status === 'duplicate') {
107
+ return [
108
+ res.issue
109
+ ? `Already reported: this is ${res.issue.identifier} (${res.issue.url}). Nothing new was filed.`
110
+ : `Already reported (report #${res.id}). Nothing new was filed.`,
111
+ ];
112
+ }
113
+ if (res?.issue) {
114
+ return [
115
+ `Sent. Filed for the Workover team as ${res.issue.identifier}: ${res.issue.url}`,
116
+ 'Thank you. Tell the person you reported it.',
117
+ ];
118
+ }
119
+ return [
120
+ `Sent (report #${res?.id ?? '?'}). The Workover team will see it; it is filed in their tracker shortly.`,
121
+ 'Thank you. Tell the person you reported it.',
122
+ ];
123
+ }
package/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
- // Workover MCP server (Phase 2 — read tools). Lets Claude Code / any MCP client read the signed-in
3
- // user's Workover documents. Auth = the token stored by `workover login` (~/.workover/config.json).
4
- // Read-only for now; propose-edits (as suggestions) lands in Phase 3. Never publishes to WordPress.
2
+ // Workover MCP server. Lets Claude Code / any MCP client read, create and propose edits to the
3
+ // signed-in user's Workover documents, and (with `workover login --site`) set up and publish a hosted
4
+ // Workover Help Center. Auth = the token stored by `workover login` (~/.workover/config.json).
5
+ // Never publishes to WordPress.
5
6
  // The api caller + tool dispatch live in lib.mjs (injectable for tests); this file just wires reality.
6
7
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
7
8
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -12,7 +13,8 @@ import {
12
13
  import { readFileSync } from 'fs';
13
14
  import { homedir } from 'os';
14
15
  import { join } from 'path';
15
- import { makeApi, makeDispatch, validAuth } from './lib.mjs';
16
+ import { MDX_FORMAT_NOTE, makeApi, makeDispatch, validAuth } from './lib.mjs';
17
+ import { FEEDBACK_INPUT_SCHEMA, FEEDBACK_TOOL_DESCRIPTION } from './feedback.mjs';
16
18
  import {
17
19
  buildToolCallEvent,
18
20
  sendEvent,
@@ -42,7 +44,7 @@ const auth = loadAuth();
42
44
  const dispatch = (name, args) => {
43
45
  const current = loadAuth();
44
46
  const { api, apiPost } = makeApi({ auth: current ?? { api: '', token: '' } });
45
- return makeDispatch({ auth: current, api, apiPost, readFile: readFileSync })(name, args);
47
+ return makeDispatch({ auth: current, api, apiPost, readFile: readFileSync, clientInfo })(name, args);
46
48
  };
47
49
 
48
50
  /** The schema for a document argument. Every tool that names a document takes all three forms. */
@@ -66,7 +68,8 @@ const TOOLS = [
66
68
  {
67
69
  name: 'workover_read_doc',
68
70
  description:
69
- "Read the full text of a Workover document. Pass the document link the person pasted (workover.io/app/<workspace>/docs/<id>) as docId, as it is; a UUID or numeric id works too. The result also carries the workspace's style guide and, for a document with tabs, says which tab you are reading and what the others are.",
71
+ "Read the full text of a Workover document. Pass the document link the person pasted (workover.io/app/<workspace>/docs/<id>) as docId, as it is; a UUID or numeric id works too. The result also carries the workspace's style guide and, for a document with tabs, says which tab you are reading and what the others are. " +
72
+ MDX_FORMAT_NOTE,
70
73
  inputSchema: {
71
74
  type: 'object',
72
75
  properties: {
@@ -136,7 +139,7 @@ const TOOLS = [
136
139
  {
137
140
  name: 'workover_create_tab',
138
141
  description:
139
- "Add a new, EMPTY tab to a Workover document, then write its body with workover_edit_doc or workover_propose_edit passing the new tabId. Requires a token from `workover login --write`.",
142
+ "Add a new, EMPTY tab to a Workover document, then write its body with workover_edit_doc or workover_propose_edit passing the new tabId. Refused for a document in a Workover Docs project (one with a hosted docs site): a docs site publishes one body per page, so write in the document body or create another document instead. Requires a token from `workover login --write`.",
140
143
  inputSchema: {
141
144
  type: 'object',
142
145
  properties: {
@@ -159,7 +162,8 @@ const TOOLS = [
159
162
  {
160
163
  name: 'workover_create_doc',
161
164
  description:
162
- "Create a new document in a Workover project (find the projectId with workover_list_projects), with its content written straight in — a brand-new document has no prior text, so there is nothing to review the first body against. Later changes to it go through workover_propose_edit as suggestions. Nothing is published to WordPress. Returns the new document's id and URL.",
165
+ "Create a new document in a Workover project (find the projectId with workover_list_projects), with its content written straight in — a brand-new document has no prior text, so there is nothing to review the first body against. Later changes to it go through workover_propose_edit as suggestions. Nothing is published to WordPress. Returns the new document's id and URL. " +
166
+ MDX_FORMAT_NOTE,
163
167
  inputSchema: {
164
168
  type: 'object',
165
169
  properties: {
@@ -169,7 +173,11 @@ const TOOLS = [
169
173
  'The numeric id of the project to create the document in, as printed by workover_list_projects ("#7" → 7).',
170
174
  },
171
175
  title: { type: 'string', description: 'The document title.' },
172
- markdown: { type: 'string', description: 'The document body as markdown.' },
176
+ markdown: {
177
+ type: 'string',
178
+ description:
179
+ 'The document body: Mintlify MDX in a docs-site project, markdown elsewhere.',
180
+ },
173
181
  categories: {
174
182
  type: 'array',
175
183
  items: { type: 'string' },
@@ -188,7 +196,7 @@ const TOOLS = [
188
196
  type: 'object',
189
197
  properties: {
190
198
  docId: DOC_ARG,
191
- path: { type: 'string', description: 'Local file path to the image (png/jpg/webp).' },
199
+ path: { type: 'string', description: 'Local file path to the image (png/jpg/gif/webp, up to 5 MB).' },
192
200
  alt: { type: 'string', description: 'Alt text describing the image.' },
193
201
  },
194
202
  required: ['docId', 'path'],
@@ -236,10 +244,29 @@ const TOOLS = [
236
244
  required: ['docId', 'src'],
237
245
  },
238
246
  },
247
+ {
248
+ name: 'workover_doc_status',
249
+ description:
250
+ "Read or set a Workover document's WORKOVER status (Triage, In review, Published, or its workflow's own statuses). With no `status`, it returns the current status and every status in the document's workflow, each with whether you may move it there and, if not, why. With `status` (a key from that list), it sets it through the same rules as the browser: the person's project role (a Contributor can only submit for review; Published needs the publish right), the workflow's gates, and the approval a gated status opens. The answer says whether it changed, is now waiting on an approval, or was refused and why. Setting needs `workover login --write`, and `--publish` as well for a move into or out of Published. It does NOT publish to WordPress: the post's own status is separate, and goes live only from the document's WordPress tab.",
251
+ inputSchema: {
252
+ type: 'object',
253
+ properties: {
254
+ docId: DOC_ARG,
255
+ status: {
256
+ type: 'string',
257
+ description:
258
+ 'The status key to move the document to, e.g. "review" or "published". Omit to read the current status and the choices.',
259
+ },
260
+ },
261
+ required: ['docId'],
262
+ },
263
+ },
239
264
  {
240
265
  name: 'workover_edit_doc',
241
266
  description:
242
- "Edit a Workover document DIRECTLY, replacing its body with no suggestions for anyone to review. Use this ONLY when the person has asked for the change to be made — working together on a document they have open, 'just make that edit'. Otherwise use workover_propose_edit, which is the default and leaves them something to accept or reject. Read the document first (workover_read_doc) and provide the FULL revised document: this REPLACES the body, so anything omitted is deleted. Requires a token from `workover login --write`; without that scope this returns a permission error and proposing is the way through. Never publishes to WordPress.",
267
+ "Edit a Workover document DIRECTLY, replacing its body with no suggestions for anyone to review. Use this ONLY when the person has asked for the change to be made — working together on a document they have open, 'just make that edit'. Otherwise use workover_propose_edit, which is the default and leaves them something to accept or reject. Read the document first (workover_read_doc) and provide the FULL revised document: this REPLACES the body, so anything omitted is deleted. Requires a token from `workover login --write`; without that scope this returns a permission error and proposing is the way through. Never publishes to WordPress. " +
268
+ "To RENAME the document, pass `title`: a title with no `markdown` changes only the name and leaves the body exactly as it is, and both together write the body and then rename. A leading `# Heading` in the markdown never renames the document (one that repeats the title is dropped), so `title` is the only way to change it. Renaming does not change a linked WordPress post or its slug. " +
269
+ MDX_FORMAT_NOTE,
243
270
  inputSchema: {
244
271
  type: 'object',
245
272
  properties: {
@@ -247,7 +274,12 @@ const TOOLS = [
247
274
  markdown: {
248
275
  type: 'string',
249
276
  description:
250
- 'The complete document as markdown. It replaces the current body in full — anything left out is removed.',
277
+ 'The complete document as markdown. It replaces the current body in full — anything left out is removed. Omit it to rename only, with `title`.',
278
+ },
279
+ title: {
280
+ type: 'string',
281
+ description:
282
+ "The document's new name (up to 200 characters). Renames the whole document, not a tab. Omit it to keep the current name.",
251
283
  },
252
284
  note: {
253
285
  type: 'string',
@@ -258,14 +290,21 @@ const TOOLS = [
258
290
  description:
259
291
  'Which tab to replace, for a document with tabs (workover_list_tabs). Omit for the main body. The markdown replaces ONLY that tab.',
260
292
  },
293
+ allowBlockRemoval: {
294
+ type: 'boolean',
295
+ description:
296
+ 'Set true ONLY when deleting components, snippets, math or embeds is the point of the edit. Without it, an edit that would delete any is refused and nothing is written.',
297
+ },
261
298
  },
262
- required: ['docId', 'markdown'],
299
+ // `markdown` or `title` (or both); the tool says so when neither is given.
300
+ required: ['docId'],
263
301
  },
264
302
  },
265
303
  {
266
304
  name: 'workover_propose_edit',
267
305
  description:
268
- "Propose a revised version of a Workover document. You do NOT edit the document directly — the change appears as tracked-change SUGGESTIONS that the human reviews and accepts or rejects in Workover, and only they can publish. Read the document first (workover_read_doc), then provide the FULL revised document as markdown. Start from the markdown workover_read_doc returned and change only the words you mean to; leave every other line exactly as it was, so the person reviews your edit rather than a reformatting. Tables come back as HTML: edit the text inside the cells and do not convert them to markdown tables. Keep tasks as `- [x]` / `- [ ]` and code in ``` fences. Do not reflow paragraphs, renumber lists or change bullet markers.",
306
+ "Propose a revised version of a Workover document. You do NOT edit the document directly — the change appears as tracked-change SUGGESTIONS that the human reviews and accepts or rejects in Workover, and only they can publish. Read the document first (workover_read_doc), then provide the FULL revised document as markdown. Start from the markdown workover_read_doc returned and change only the words you mean to; leave every other line exactly as it was, so the person reviews your edit rather than a reformatting. Tables come back as HTML: edit the text inside the cells and do not convert them to markdown tables. Keep tasks as `- [x]` / `- [ ]` and code in ``` fences. Do not reflow paragraphs, renumber lists or change bullet markers. This cannot change the document's title: there are no suggestions for a title, and a leading `# Heading` never renames it. A rename is a direct edit, made with workover_edit_doc and `title` once the person has asked for it. " +
307
+ MDX_FORMAT_NOTE,
269
308
  inputSchema: {
270
309
  type: 'object',
271
310
  properties: {
@@ -292,13 +331,258 @@ const TOOLS = [
292
331
  required: ['docId', 'markdown'],
293
332
  },
294
333
  },
334
+ {
335
+ name: 'workover_report_feedback',
336
+ description: FEEDBACK_TOOL_DESCRIPTION,
337
+ inputSchema: FEEDBACK_INPUT_SCHEMA,
338
+ },
339
+ ];
340
+
341
+ /** The schema for a project argument of the Help Center tools. */
342
+ const PROJECT_ARG = {
343
+ type: 'number',
344
+ description: 'The project, as printed by workover_list_projects or workover_create_project ("#7" → 7).',
345
+ };
346
+
347
+ const SITE_SCOPE_NOTE =
348
+ ' Needs a token from `workover login --site` (the person approves "Set up and publish your Workover Help Center" in the browser); without it this returns a permission error naming that command.';
349
+
350
+ /**
351
+ * The Help Center tools, mirroring `workover project create` and `workover site ...` (site-setup.mjs
352
+ * holds the logic both share). Payment and the DNS records stay the person's.
353
+ */
354
+ const SITE_TOOLS = [
355
+ {
356
+ name: 'workover_create_project',
357
+ description:
358
+ 'Create a new project whose publish target is a hosted Workover Help Center: the project, its site at <address>.workover.site, and its first pages. Use start "empty" when the docs will be imported next with workover_import_site. Nothing is published.' +
359
+ SITE_SCOPE_NOTE,
360
+ inputSchema: {
361
+ type: 'object',
362
+ properties: {
363
+ name: { type: 'string', description: 'The project and Help Center name, e.g. "Acme Docs".' },
364
+ workspace: {
365
+ type: ['string', 'number'],
366
+ description: 'The workspace slug or id. Needed only when the account has more than one.',
367
+ },
368
+ address: {
369
+ type: 'string',
370
+ description: 'The <address>.workover.site name. Omit to make one from the name (a taken or reserved one gets a free alternative).',
371
+ },
372
+ start: {
373
+ type: 'string',
374
+ enum: ['blank', 'starter', 'empty'],
375
+ description: 'blank: one empty page (default); starter: the starter template; empty: no pages, for an import.',
376
+ },
377
+ },
378
+ required: ['name'],
379
+ },
380
+ },
381
+ {
382
+ name: 'workover_create_site',
383
+ description:
384
+ 'Give an existing project a hosted Workover Help Center at <address>.workover.site, or change its address. A project that already has one is left as it is. Refused for a project that syncs with WordPress, Webflow, Mintlify or Help Scout Docs: a project publishes one way.' +
385
+ SITE_SCOPE_NOTE,
386
+ inputSchema: {
387
+ type: 'object',
388
+ properties: {
389
+ projectId: PROJECT_ARG,
390
+ address: { type: 'string', description: 'The <address>.workover.site name. Omit to make one from the project name.' },
391
+ },
392
+ required: ['projectId'],
393
+ },
394
+ },
395
+ {
396
+ name: 'workover_import_site',
397
+ description:
398
+ "Import docs into the project's Help Center: a public docs site by url (read from its docs.json or mint.json, its llms.txt, Help Scout Docs, or its sitemap; up to 500 pages, with their navigation and images), or a docs folder on this machine by dir (Workover's _site.json with <tab>/<slug>.md pages, or a Mintlify docs.json), with its tabs, groups and order exactly as the config says. Pages the site already has are kept, so running it again adds only what is new. Waits up to about 50 seconds; a larger site is handed back as still running, and calling again with checkOnly reports its progress. Nothing goes live until workover_publish_site." +
399
+ SITE_SCOPE_NOTE,
400
+ inputSchema: {
401
+ type: 'object',
402
+ properties: {
403
+ projectId: PROJECT_ARG,
404
+ url: { type: 'string', description: 'The https address of the docs to import, e.g. https://docs.example.com.' },
405
+ dir: {
406
+ type: 'string',
407
+ description: 'Instead of url: the path of a docs folder (or its _site.json or docs.json) on this machine.',
408
+ },
409
+ checkOnly: { type: 'boolean', description: 'Only report the latest import of this project; start nothing.' },
410
+ },
411
+ required: ['projectId'],
412
+ },
413
+ },
414
+ {
415
+ name: 'workover_set_site_appearance',
416
+ description:
417
+ "Set the Help Center's appearance: its colors, header links, call to action and search prompt from a docs folder's config (from: _site.json or docs.json) and from the arguments here, which win, and its logo and favicon from image files on this machine (SVG, PNG, JPEG, WebP or ICO, under 2 MB), uploaded as the Customize tab uploads them. Settings not named are kept. It shows once the site is published." +
418
+ SITE_SCOPE_NOTE,
419
+ inputSchema: {
420
+ type: 'object',
421
+ properties: {
422
+ projectId: PROJECT_ARG,
423
+ from: { type: 'string', description: 'A docs folder, or its _site.json or docs.json, to read the appearance and logo files from.' },
424
+ primary: { type: 'string', description: 'The brand color, like #3e63dd.' },
425
+ primaryDark: { type: 'string', description: 'The brand color in dark mode.' },
426
+ searchPrompt: { type: 'string', description: 'The words in the search box.' },
427
+ logo: { type: 'string', description: 'Path of the logo image for light mode.' },
428
+ logoDark: { type: 'string', description: 'Path of the logo image for dark mode.' },
429
+ favicon: { type: 'string', description: 'Path of the favicon image.' },
430
+ faviconDark: { type: 'string', description: 'Path of the favicon image for dark mode.' },
431
+ },
432
+ required: ['projectId'],
433
+ },
434
+ },
435
+ {
436
+ name: 'workover_add_site_redirects',
437
+ description:
438
+ "Add a docs folder's redirects (its _site.json redirects and pages' redirect_from, or docs.json redirects) to the Help Center. Only adds: an address the site already redirects is left as it is, so running it again changes nothing." +
439
+ SITE_SCOPE_NOTE,
440
+ inputSchema: {
441
+ type: 'object',
442
+ properties: {
443
+ projectId: PROJECT_ARG,
444
+ from: { type: 'string', description: 'A docs folder, or its _site.json or docs.json.' },
445
+ },
446
+ required: ['projectId', 'from'],
447
+ },
448
+ },
449
+ {
450
+ name: 'workover_add_api_reference',
451
+ description:
452
+ "Add an API reference tab to the Help Center made from an OpenAPI (or Swagger) spec: one page per endpoint, grouped by tag, each with a Try it playground. Use it when the product has an OpenAPI spec. The site remembers the spec and keeps the tab in step with it (every hour, and on workover_sync_api_reference): new endpoints get a page, changed ones are rewritten, removed ones redirect to the tab's first page, and a spec that fails to load changes nothing. Those generated pages publish themselves once the site has been published; hand-written pages still wait for a person. Safe to run again." +
453
+ SITE_SCOPE_NOTE,
454
+ inputSchema: {
455
+ type: 'object',
456
+ properties: {
457
+ projectId: PROJECT_ARG,
458
+ spec: {
459
+ type: 'string',
460
+ description: 'The https URL of the OpenAPI spec (JSON or YAML), or {api}/openapi.json for the Workover API of the environment signed in to.',
461
+ },
462
+ tab: { type: 'string', description: 'The tab the pages go in. Default "API reference".' },
463
+ group: { type: 'string', description: 'Optional: a group inside that tab to hold the pages instead.' },
464
+ directory: { type: 'string', description: 'Optional: the address prefix of the pages. Default api-reference.' },
465
+ },
466
+ required: ['projectId', 'spec'],
467
+ },
468
+ },
469
+ {
470
+ name: 'workover_sync_api_reference',
471
+ description:
472
+ "\"The spec changed\": sync the Help Center's spec-backed API reference tabs now, and say what each sync added, updated, removed and published. checkOnly lists them with their last sync instead." +
473
+ SITE_SCOPE_NOTE,
474
+ inputSchema: {
475
+ type: 'object',
476
+ properties: {
477
+ projectId: PROJECT_ARG,
478
+ checkOnly: { type: 'boolean', description: 'List the references and how their last sync went, without syncing.' },
479
+ },
480
+ required: ['projectId'],
481
+ },
482
+ },
483
+ {
484
+ name: 'workover_set_domain',
485
+ description:
486
+ "Connect the Help Center to a custom domain (docs.example.com), or serve it under a path of the person's own website (example.com/docs), and return EVERY DNS record the person must add, TXT included, exactly as the app's Domain tab shows them (for a path, also the proxy setup the website needs). Hand those records to the person verbatim: adding them at their DNS provider is their step. Pass \"none\" to disconnect." +
487
+ SITE_SCOPE_NOTE,
488
+ inputSchema: {
489
+ type: 'object',
490
+ properties: {
491
+ projectId: PROJECT_ARG,
492
+ domain: { type: 'string', description: 'docs.example.com, example.com/docs, or "none" to disconnect.' },
493
+ preverify: {
494
+ type: 'boolean',
495
+ description: 'For a domain that is already live elsewhere: also return the TXT records that prove it and issue its certificate before its CNAME moves, so there is no gap.',
496
+ },
497
+ moveFrom: {
498
+ type: 'integer',
499
+ description:
500
+ "Move the domain from another Help Center in the same workspace (that project's id) in one step: it keeps its verification, the DNS records stay as they are, and neither site goes without it. Use this rather than disconnecting it there first.",
501
+ },
502
+ },
503
+ required: ['projectId', 'domain'],
504
+ },
505
+ },
506
+ {
507
+ name: 'workover_check_site',
508
+ description:
509
+ "Ask now where the Help Center's custom domain has got to: each DNS record found or still pending, the domain verified, the certificate issued, and for a site under a path, whether the live address serves it and lets search engines index it. Use it after the person says they added the records." +
510
+ SITE_SCOPE_NOTE,
511
+ inputSchema: { type: 'object', properties: { projectId: PROJECT_ARG }, required: ['projectId'] },
512
+ },
513
+ {
514
+ name: 'workover_publish_site',
515
+ description:
516
+ "Publish the project's Help Center: put its pages live at its workover.site address and its custom domain once that is connected. Waits up to about 50 seconds; call again with checkOnly for a larger site. Refused when the workspace's plan does not host a Help Center, which the person settles in Settings, Plan & billing." +
517
+ SITE_SCOPE_NOTE,
518
+ inputSchema: {
519
+ type: 'object',
520
+ properties: {
521
+ projectId: PROJECT_ARG,
522
+ checkOnly: { type: 'boolean', description: 'Only report the latest publish of this project; start nothing.' },
523
+ },
524
+ required: ['projectId'],
525
+ },
526
+ },
527
+ {
528
+ name: 'workover_proxy_setup',
529
+ description:
530
+ "For a Help Center served under a path of the person's own website (example.com/docs): the proxy setup that website needs, filled in with the site's values, for where it runs. Detected from the website's headers, or name it with platform. Covers a Cloudflare Worker, Vercel, Next.js, AWS CloudFront (console steps and OpenTofu/Terraform), AWS Amplify, Netlify, nginx, Caddy and Apache. If the website's code is in the repository you are working in, add it there; otherwise hand it to the person." +
531
+ SITE_SCOPE_NOTE,
532
+ inputSchema: {
533
+ type: 'object',
534
+ properties: {
535
+ projectId: PROJECT_ARG,
536
+ platform: {
537
+ type: 'string',
538
+ enum: ['cloudflare', 'vercel', 'nextjs', 'cloudfront', 'amplify', 'netlify', 'nginx', 'caddy', 'apache'],
539
+ description: 'Where the website runs. Leave it out to detect it from the website.',
540
+ },
541
+ },
542
+ required: ['projectId'],
543
+ },
544
+ },
545
+ {
546
+ name: 'workover_unpublish_site',
547
+ description:
548
+ "Take the project's Help Center offline until it is published again. Its pages, settings and domain are kept, and workover_publish_site restores it. Only when the person has asked for it, for example to free the plan's live Help Center for another one." +
549
+ SITE_SCOPE_NOTE,
550
+ inputSchema: { type: 'object', properties: { projectId: PROJECT_ARG }, required: ['projectId'] },
551
+ },
552
+ {
553
+ name: 'workover_set_site_indexing',
554
+ description:
555
+ 'Let search engines index the Help Center, or ask them not to: the Publish page\'s "Let search engines index this site". A new site starts not indexed. Ask the person before turning it on.' +
556
+ SITE_SCOPE_NOTE,
557
+ inputSchema: {
558
+ type: 'object',
559
+ properties: {
560
+ projectId: PROJECT_ARG,
561
+ index: { type: 'boolean', description: 'true: search engines may index it. false: ask them not to.' },
562
+ },
563
+ required: ['projectId', 'index'],
564
+ },
565
+ },
566
+ {
567
+ name: 'workover_site_status',
568
+ description:
569
+ "The project's Help Center: its address, whether it is published, its domain, the latest import and publish, and whether the plan hosts it. Without projectId, which projects have a Help Center." +
570
+ SITE_SCOPE_NOTE,
571
+ inputSchema: { type: 'object', properties: { projectId: PROJECT_ARG } },
572
+ },
295
573
  ];
296
574
 
297
575
  const telemetry = telemetryEnabled(process.env, { auth });
298
576
  // Keep in step with package.json. It is what every telemetry event is stamped with, so a stale
299
577
  // value here does not break anything — it quietly attributes this release's behaviour to an older
300
578
  // one, which is worse, because the numbers still look fine.
301
- const VERSION = '0.10.0';
579
+ const VERSION = '0.19.0';
580
+
581
+ /** This release and the connected client, stamped on a feedback report (see feedback.mjs). */
582
+ function clientInfo() {
583
+ const c = server.getClientVersion?.();
584
+ return { version: VERSION, client: c?.name ? `${c.name}${c.version ? ` ${c.version}` : ''}` : undefined };
585
+ }
302
586
 
303
587
  /**
304
588
  * What the client is told about this server before it calls anything.
@@ -331,17 +615,29 @@ alongside the document.
331
615
  Editing: workover_propose_edit is the default and leaves the person suggestions to accept.
332
616
  workover_edit_doc changes the document with no review, so use it only when they have asked for the
333
617
  change to be made. Both replace the FULL body of one tab, so read before you write, and on a
334
- document with tabs pass the tabId of the tab you mean — workover_list_tabs shows them.
618
+ document with tabs pass the tabId of the tab you mean — workover_list_tabs shows them. To rename a
619
+ document, pass \`title\` to workover_edit_doc (with no markdown it leaves the body alone); a
620
+ heading in the markdown never renames it.
335
621
 
336
622
  Nothing here publishes to WordPress. Whatever you write is recorded in the document's history as
337
- having been made through this connection.`;
623
+ having been made through this connection.
624
+
625
+ Help Center setup (workover_create_project, workover_create_site, workover_import_site,
626
+ workover_set_site_appearance, workover_add_site_redirects, workover_add_api_reference, workover_sync_api_reference, workover_set_domain, workover_check_site,
627
+ workover_publish_site, workover_unpublish_site, workover_proxy_setup, workover_set_site_indexing, workover_site_status) needs a token from \`workover login --site\`. When workover_set_domain returns
628
+ DNS records, give the person every one of them exactly as printed: adding them at the DNS provider
629
+ is their step, as payment is.
630
+
631
+ When a Workover tool here cannot do what the task needs, gets it wrong, or makes you work around
632
+ it, call workover_report_feedback with what you wanted and the fix you would make. It reaches the
633
+ Workover team as an issue. Never put the person's document text or any secret in it.`;
338
634
 
339
635
  const server = new Server(
340
636
  { name: 'workover', version: VERSION },
341
637
  { capabilities: { tools: {} }, instructions: INSTRUCTIONS },
342
638
  );
343
639
 
344
- server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
640
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [...TOOLS, ...SITE_TOOLS] }));
345
641
 
346
642
  /**
347
643
  * Which tools agents reach for, and where they fail.