@doclift/workflows-mcp 0.1.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/LICENSE +21 -0
- package/README.md +114 -0
- package/dist/client.d.ts +30 -0
- package/dist/client.js +92 -0
- package/dist/guidance.d.ts +5 -0
- package/dist/guidance.js +219 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +143 -0
- package/dist/tools/capabilities.d.ts +3 -0
- package/dist/tools/capabilities.js +13 -0
- package/dist/tools/checks.d.ts +3 -0
- package/dist/tools/checks.js +233 -0
- package/dist/tools/datasets.d.ts +3 -0
- package/dist/tools/datasets.js +37 -0
- package/dist/tools/documents.d.ts +3 -0
- package/dist/tools/documents.js +23 -0
- package/dist/tools/images.d.ts +3 -0
- package/dist/tools/images.js +24 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +28 -0
- package/dist/tools/publication.d.ts +3 -0
- package/dist/tools/publication.js +17 -0
- package/dist/tools/render.d.ts +3 -0
- package/dist/tools/render.js +25 -0
- package/dist/tools/sections.d.ts +3 -0
- package/dist/tools/sections.js +118 -0
- package/dist/tools/shared.d.ts +20 -0
- package/dist/tools/shared.js +38 -0
- package/dist/tools/theme.d.ts +3 -0
- package/dist/tools/theme.js +27 -0
- package/dist/tools/variables.d.ts +3 -0
- package/dist/tools/variables.js +53 -0
- package/dist/tools/workflows.d.ts +3 -0
- package/dist/tools/workflows.js +56 -0
- package/package.json +44 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { respond, templateId } from './shared.js';
|
|
3
|
+
export const registerVariables = (server, api, base) => {
|
|
4
|
+
// ----------------------------------------------------------- the variables
|
|
5
|
+
server.registerTool('variable_list', {
|
|
6
|
+
title: 'List the variables',
|
|
7
|
+
description: 'Every variable of the workflow, with its type, whether it is required, and its allowed values.',
|
|
8
|
+
inputSchema: { template_id: templateId },
|
|
9
|
+
annotations: { readOnlyHint: true },
|
|
10
|
+
}, async ({ template_id }) => respond(await api.get(`${base}/templates/${template_id}/variables`)));
|
|
11
|
+
server.registerTool('variable_create', {
|
|
12
|
+
title: 'Declare a variable',
|
|
13
|
+
description: 'Create every variable BEFORE writing content that cites one. A citation is a string, not a ' +
|
|
14
|
+
'foreign key, so content written first saves cleanly and leaves a broken reference behind. ' +
|
|
15
|
+
'Names are alphanumeric plus underscore, lowercased; a name that breaks the rule is refused, ' +
|
|
16
|
+
'not rewritten.',
|
|
17
|
+
inputSchema: {
|
|
18
|
+
template_id: templateId,
|
|
19
|
+
name: z.string().min(1),
|
|
20
|
+
field_type: z.string().describe('See capabilities.variable.field_types.'),
|
|
21
|
+
description: z.string().min(1).describe('Required. What the variable holds, for whoever fills it in.'),
|
|
22
|
+
required: z.boolean().optional(),
|
|
23
|
+
seed_value: z.string().optional().describe('What the preview shows in its place.'),
|
|
24
|
+
allowed_values: z.array(z.string()).optional().describe('select and radio only.'),
|
|
25
|
+
fields: z.array(z.record(z.unknown())).optional().describe('The row columns of a collection.'),
|
|
26
|
+
},
|
|
27
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
28
|
+
}, async ({ template_id, ...variable }) => respond(await api.post(`${base}/templates/${template_id}/variables`, { variable })));
|
|
29
|
+
server.registerTool('variable_update', {
|
|
30
|
+
title: 'Change a variable',
|
|
31
|
+
description: 'Renaming a variable does NOT rewrite the tokens and conditions that cite it — they keep the ' +
|
|
32
|
+
'old name and become broken references. Run workflow_validate after a rename.',
|
|
33
|
+
inputSchema: {
|
|
34
|
+
template_id: templateId,
|
|
35
|
+
id: z.number().int(),
|
|
36
|
+
name: z.string().min(1).optional(),
|
|
37
|
+
field_type: z.string().optional(),
|
|
38
|
+
description: z.string().optional(),
|
|
39
|
+
required: z.boolean().optional(),
|
|
40
|
+
seed_value: z.string().optional(),
|
|
41
|
+
allowed_values: z.array(z.string()).optional(),
|
|
42
|
+
fields: z.array(z.record(z.unknown())).optional(),
|
|
43
|
+
},
|
|
44
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
45
|
+
}, async ({ template_id, id, ...variable }) => respond(await api.patch(`${base}/templates/${template_id}/variables/${id}`, { variable })));
|
|
46
|
+
server.registerTool('variable_delete', {
|
|
47
|
+
title: 'Delete a variable',
|
|
48
|
+
description: 'Succeeds even when tokens and conditions still cite it: the citations survive, broken, so that ' +
|
|
49
|
+
'they can be reported rather than silently cascaded away. Run workflow_validate afterwards.',
|
|
50
|
+
inputSchema: { template_id: templateId, id: z.number().int() },
|
|
51
|
+
annotations: { readOnlyHint: false, destructiveHint: true },
|
|
52
|
+
}, async ({ template_id, id }) => respond(await api.delete(`${base}/templates/${template_id}/variables/${id}`)));
|
|
53
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { respond, templateId } from './shared.js';
|
|
3
|
+
export const registerWorkflows = (server, api, base) => {
|
|
4
|
+
// ---------------------------------------------------------------- workflows
|
|
5
|
+
server.registerTool('workflow_list', {
|
|
6
|
+
title: 'List workflows',
|
|
7
|
+
description: 'The organization\'s workflows, most recently changed first. Archived ones are not listed.',
|
|
8
|
+
inputSchema: { page: z.number().int().positive().optional() },
|
|
9
|
+
annotations: { readOnlyHint: true },
|
|
10
|
+
}, async ({ page }) => respond(await api.get(`${base}/templates`, { page })));
|
|
11
|
+
server.registerTool('workflow_get', {
|
|
12
|
+
title: 'Read one workflow',
|
|
13
|
+
description: 'Title, description, page setup, counters, and whether a human currently holds it in the ' +
|
|
14
|
+
'builder. While `being_edited` is true, every write to this workflow is refused with 409.',
|
|
15
|
+
inputSchema: { id: templateId },
|
|
16
|
+
annotations: { readOnlyHint: true },
|
|
17
|
+
}, async ({ id }) => respond(await api.get(`${base}/templates/${id}`)));
|
|
18
|
+
server.registerTool('workflow_create', {
|
|
19
|
+
title: 'Create a workflow',
|
|
20
|
+
description: 'Creates an empty workflow. It carries no content of its own — everything lives in its ' +
|
|
21
|
+
'sections. Title and description are both required.',
|
|
22
|
+
inputSchema: {
|
|
23
|
+
title: z.string().min(1),
|
|
24
|
+
description: z.string().min(1),
|
|
25
|
+
orientation: z.string().optional().describe('portrait or landscape — see capabilities.page.'),
|
|
26
|
+
margin_top: z.number().optional().describe('In millimetres, like the other three.'),
|
|
27
|
+
margin_right: z.number().optional(),
|
|
28
|
+
margin_bottom: z.number().optional(),
|
|
29
|
+
margin_left: z.number().optional(),
|
|
30
|
+
},
|
|
31
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
32
|
+
}, async (attributes) => respond(await api.post(`${base}/templates`, { template: attributes })));
|
|
33
|
+
server.registerTool('workflow_update', {
|
|
34
|
+
title: 'Update a workflow',
|
|
35
|
+
description: 'Title, description, orientation and the four margins, which are in millimetres. The tree is ' +
|
|
36
|
+
'edited through the section tools.',
|
|
37
|
+
inputSchema: {
|
|
38
|
+
id: templateId,
|
|
39
|
+
title: z.string().min(1).optional(),
|
|
40
|
+
description: z.string().min(1).optional(),
|
|
41
|
+
orientation: z.string().optional(),
|
|
42
|
+
margin_top: z.number().optional(),
|
|
43
|
+
margin_right: z.number().optional(),
|
|
44
|
+
margin_bottom: z.number().optional(),
|
|
45
|
+
margin_left: z.number().optional(),
|
|
46
|
+
},
|
|
47
|
+
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
48
|
+
}, async ({ id, ...attributes }) => respond(await api.patch(`${base}/templates/${id}`, { template: attributes })));
|
|
49
|
+
server.registerTool('workflow_delete', {
|
|
50
|
+
title: 'Archive a workflow',
|
|
51
|
+
description: 'Archives rather than deletes: documents already generated keep pointing at the workflow that ' +
|
|
52
|
+
'produced them. An archived workflow stops being listed and stops being reachable.',
|
|
53
|
+
inputSchema: { id: templateId },
|
|
54
|
+
annotations: { readOnlyHint: false, destructiveHint: true },
|
|
55
|
+
}, async ({ id }) => respond(await api.delete(`${base}/templates/${id}`)));
|
|
56
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@doclift/workflows-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server over the Doclift workflow authoring API",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://www.doclift.io/docs/getting-started",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"mcp",
|
|
9
|
+
"model-context-protocol",
|
|
10
|
+
"doclift",
|
|
11
|
+
"workflow",
|
|
12
|
+
"pdf",
|
|
13
|
+
"document-generation"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"bin": {
|
|
17
|
+
"doclift-workflows-mcp": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc -p tsconfig.build.json",
|
|
27
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"start": "node dist/index.js",
|
|
30
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
34
|
+
"zod": "^3.25.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^22.10.0",
|
|
38
|
+
"typescript": "^5.7.0",
|
|
39
|
+
"vitest": "^3.0.0"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20"
|
|
43
|
+
}
|
|
44
|
+
}
|