@gwdn/nexus-mcp 0.7.0 → 0.8.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/dist/server.d.ts +7 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +19 -1
- package/dist/server.js.map +1 -1
- package/dist/tools/directives.d.ts +135 -0
- package/dist/tools/directives.d.ts.map +1 -0
- package/dist/tools/directives.js +231 -0
- package/dist/tools/directives.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/server.test.ts +2 -2
- package/src/server.ts +77 -1
- package/src/tools/directives.ts +303 -0
package/dist/server.d.ts
CHANGED
|
@@ -38,6 +38,13 @@
|
|
|
38
38
|
* - sk_assign: Assign a skill to a project
|
|
39
39
|
* - sk_unassign: Remove a skill assignment from a project
|
|
40
40
|
* - sk_export: Export all skill assignments for a project
|
|
41
|
+
* - pd_list: List project directives
|
|
42
|
+
* - pd_get: Get a specific directive
|
|
43
|
+
* - pd_create: Create a new directive
|
|
44
|
+
* - pd_update: Update an existing directive
|
|
45
|
+
* - pd_delete: Delete a directive
|
|
46
|
+
* - pd_toggle: Toggle directive enabled/disabled
|
|
47
|
+
* - directive_export: Export enabled directives (CLI format)
|
|
41
48
|
* - doc_ingest: Push text/markdown content into project knowledge base
|
|
42
49
|
* - doc_list: List ingested documents for a project
|
|
43
50
|
* - session_append: Append to a session (write-isolated)
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG"}
|
package/dist/server.js
CHANGED
|
@@ -38,6 +38,13 @@
|
|
|
38
38
|
* - sk_assign: Assign a skill to a project
|
|
39
39
|
* - sk_unassign: Remove a skill assignment from a project
|
|
40
40
|
* - sk_export: Export all skill assignments for a project
|
|
41
|
+
* - pd_list: List project directives
|
|
42
|
+
* - pd_get: Get a specific directive
|
|
43
|
+
* - pd_create: Create a new directive
|
|
44
|
+
* - pd_update: Update an existing directive
|
|
45
|
+
* - pd_delete: Delete a directive
|
|
46
|
+
* - pd_toggle: Toggle directive enabled/disabled
|
|
47
|
+
* - directive_export: Export enabled directives (CLI format)
|
|
41
48
|
* - doc_ingest: Push text/markdown content into project knowledge base
|
|
42
49
|
* - doc_list: List ingested documents for a project
|
|
43
50
|
* - session_append: Append to a session (write-isolated)
|
|
@@ -85,6 +92,7 @@ import { listTasks, listTasksSchema } from './tools/list-tasks.js';
|
|
|
85
92
|
import { closeSession, closeSessionSchema, createSession, createSessionSchema, listOpenSessions, listOpenSessionsSchema, } from './tools/sessions.js';
|
|
86
93
|
import { skActivate, skActivateSchema, skCreate, skCreateSchema, skGet, skGetSchema, skList, skListSchema, skUpdate, skUpdateSchema, } from './tools/skills.js';
|
|
87
94
|
import { skAssign, skAssignSchema, skExport, skExportSchema, skUnassign, skUnassignSchema, } from './tools/skill-assign.js';
|
|
95
|
+
import { pdList, pdListSchema, pdGet, pdGetSchema, pdCreate, pdCreateSchema, pdUpdate, pdUpdateSchema, pdDelete, pdDeleteSchema, pdToggle, pdToggleSchema, directiveExport, directiveExportSchema, } from './tools/directives.js';
|
|
88
96
|
import { updateTaskStatus, updateTaskStatusSchema, } from './tools/update-task-status.js';
|
|
89
97
|
// Layer 3: Governance
|
|
90
98
|
import { createAdrDraft, createAdrDraftSchema, recordAdrDecision, recordAdrDecisionSchema, submitAdrReview, submitAdrReviewSchema, } from './tools/governance.js';
|
|
@@ -110,7 +118,7 @@ function withIdentity(handler) {
|
|
|
110
118
|
// ---------------------------------------------------------------------------
|
|
111
119
|
const server = new McpServer({
|
|
112
120
|
name: 'nexus-mcp',
|
|
113
|
-
version: '0.
|
|
121
|
+
version: '0.8.0',
|
|
114
122
|
}, {
|
|
115
123
|
capabilities: {
|
|
116
124
|
tools: {},
|
|
@@ -159,6 +167,16 @@ server.tool('sk_assign', 'Assign a skill to a project. Optionally pin to a speci
|
|
|
159
167
|
server.tool('sk_unassign', 'Remove a skill assignment from a project.', skUnassignSchema, withIdentity(skUnassign));
|
|
160
168
|
server.tool('sk_export', 'Export all skill assignments for a project. Returns the full assignment list with pinned versions and enabled states.', skExportSchema, withIdentity(skExport));
|
|
161
169
|
// ---------------------------------------------------------------------------
|
|
170
|
+
// Layer 2 (continued): Project Directives tools
|
|
171
|
+
// ---------------------------------------------------------------------------
|
|
172
|
+
server.tool('pd_list', 'List project directives with optional enabled filter. Returns directives ordered by priority and creation date.', pdListSchema, withIdentity(pdList));
|
|
173
|
+
server.tool('pd_get', 'Get a specific project directive by UUID. Returns full directive details.', pdGetSchema, withIdentity(pdGet));
|
|
174
|
+
server.tool('pd_create', 'Create a new project directive. Directives are project-scoped rules/policies that guide agent behavior.', pdCreateSchema, withIdentity(pdCreate));
|
|
175
|
+
server.tool('pd_update', 'Update an existing project directive. Supports partial updates for title, body, category, priority, and enabled state.', pdUpdateSchema, withIdentity(pdUpdate));
|
|
176
|
+
server.tool('pd_delete', 'Delete a project directive by UUID.', pdDeleteSchema, withIdentity(pdDelete));
|
|
177
|
+
server.tool('pd_toggle', 'Toggle a project directive enabled/disabled. Omit enabled parameter to invert current state.', pdToggleSchema, withIdentity(pdToggle));
|
|
178
|
+
server.tool('directive_export', 'Export all enabled directives for a project in CLI-compatible format.', directiveExportSchema, withIdentity(directiveExport));
|
|
179
|
+
// ---------------------------------------------------------------------------
|
|
162
180
|
// Layer 3: Governance tools
|
|
163
181
|
// ---------------------------------------------------------------------------
|
|
164
182
|
server.tool('adr_create', 'Create a new ADR (Architecture Decision Record) in draft state. Auto-assigns the next ADR number for the project. Optionally links to a superseded ADR.', createAdrDraftSchema, withIdentity(createAdrDraft));
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAEhF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAErD,4BAA4B;AAC5B,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EACL,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,eAAe,EACf,qBAAqB,GACtB,MAAM,6BAA6B,CAAA;AAEpC,wBAAwB;AACxB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACzE,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,cAAc,EACd,oBAAoB,GACrB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,UAAU,EACV,gBAAgB,GACjB,MAAM,yBAAy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AAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pd_list + pd_get + pd_create + pd_update + pd_delete + pd_toggle + directive_export
|
|
3
|
+
*
|
|
4
|
+
* Project Directives management tools for the Nexus platform.
|
|
5
|
+
* Directives are project-scoped rules/policies that guide agent behavior.
|
|
6
|
+
* Delegates to POST /api/mcp/directives.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
export declare const pdListSchema: {
|
|
10
|
+
project_id: z.ZodString;
|
|
11
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
13
|
+
};
|
|
14
|
+
type PdListArgs = {
|
|
15
|
+
project_id: string;
|
|
16
|
+
enabled?: boolean;
|
|
17
|
+
limit?: number;
|
|
18
|
+
user_id: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function pdList(args: PdListArgs): Promise<{
|
|
21
|
+
content: {
|
|
22
|
+
type: "text";
|
|
23
|
+
text: string;
|
|
24
|
+
}[];
|
|
25
|
+
}>;
|
|
26
|
+
export declare const pdGetSchema: {
|
|
27
|
+
directive_id: z.ZodString;
|
|
28
|
+
};
|
|
29
|
+
type PdGetArgs = {
|
|
30
|
+
directive_id: string;
|
|
31
|
+
user_id: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function pdGet(args: PdGetArgs): Promise<{
|
|
34
|
+
content: {
|
|
35
|
+
type: "text";
|
|
36
|
+
text: string;
|
|
37
|
+
}[];
|
|
38
|
+
}>;
|
|
39
|
+
export declare const pdCreateSchema: {
|
|
40
|
+
project_id: z.ZodString;
|
|
41
|
+
title: z.ZodString;
|
|
42
|
+
body: z.ZodOptional<z.ZodString>;
|
|
43
|
+
category: z.ZodDefault<z.ZodString>;
|
|
44
|
+
priority: z.ZodDefault<z.ZodEnum<{
|
|
45
|
+
low: "low";
|
|
46
|
+
high: "high";
|
|
47
|
+
medium: "medium";
|
|
48
|
+
}>>;
|
|
49
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
50
|
+
};
|
|
51
|
+
type PdCreateArgs = {
|
|
52
|
+
project_id: string;
|
|
53
|
+
title: string;
|
|
54
|
+
body?: string;
|
|
55
|
+
category?: string;
|
|
56
|
+
priority?: string;
|
|
57
|
+
enabled?: boolean;
|
|
58
|
+
user_id: string;
|
|
59
|
+
};
|
|
60
|
+
export declare function pdCreate(args: PdCreateArgs): Promise<{
|
|
61
|
+
content: {
|
|
62
|
+
type: "text";
|
|
63
|
+
text: string;
|
|
64
|
+
}[];
|
|
65
|
+
}>;
|
|
66
|
+
export declare const pdUpdateSchema: {
|
|
67
|
+
directive_id: z.ZodString;
|
|
68
|
+
title: z.ZodOptional<z.ZodString>;
|
|
69
|
+
body: z.ZodOptional<z.ZodString>;
|
|
70
|
+
category: z.ZodOptional<z.ZodString>;
|
|
71
|
+
priority: z.ZodOptional<z.ZodEnum<{
|
|
72
|
+
low: "low";
|
|
73
|
+
high: "high";
|
|
74
|
+
medium: "medium";
|
|
75
|
+
}>>;
|
|
76
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
};
|
|
78
|
+
type PdUpdateArgs = {
|
|
79
|
+
directive_id: string;
|
|
80
|
+
title?: string;
|
|
81
|
+
body?: string;
|
|
82
|
+
category?: string;
|
|
83
|
+
priority?: string;
|
|
84
|
+
enabled?: boolean;
|
|
85
|
+
user_id: string;
|
|
86
|
+
};
|
|
87
|
+
export declare function pdUpdate(args: PdUpdateArgs): Promise<{
|
|
88
|
+
content: {
|
|
89
|
+
type: "text";
|
|
90
|
+
text: string;
|
|
91
|
+
}[];
|
|
92
|
+
}>;
|
|
93
|
+
export declare const pdDeleteSchema: {
|
|
94
|
+
directive_id: z.ZodString;
|
|
95
|
+
};
|
|
96
|
+
type PdDeleteArgs = {
|
|
97
|
+
directive_id: string;
|
|
98
|
+
user_id: string;
|
|
99
|
+
};
|
|
100
|
+
export declare function pdDelete(args: PdDeleteArgs): Promise<{
|
|
101
|
+
content: {
|
|
102
|
+
type: "text";
|
|
103
|
+
text: string;
|
|
104
|
+
}[];
|
|
105
|
+
}>;
|
|
106
|
+
export declare const pdToggleSchema: {
|
|
107
|
+
directive_id: z.ZodString;
|
|
108
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
109
|
+
};
|
|
110
|
+
type PdToggleArgs = {
|
|
111
|
+
directive_id: string;
|
|
112
|
+
enabled?: boolean;
|
|
113
|
+
user_id: string;
|
|
114
|
+
};
|
|
115
|
+
export declare function pdToggle(args: PdToggleArgs): Promise<{
|
|
116
|
+
content: {
|
|
117
|
+
type: "text";
|
|
118
|
+
text: string;
|
|
119
|
+
}[];
|
|
120
|
+
}>;
|
|
121
|
+
export declare const directiveExportSchema: {
|
|
122
|
+
project_id: z.ZodString;
|
|
123
|
+
};
|
|
124
|
+
type DirectiveExportArgs = {
|
|
125
|
+
project_id: string;
|
|
126
|
+
user_id: string;
|
|
127
|
+
};
|
|
128
|
+
export declare function directiveExport(args: DirectiveExportArgs): Promise<{
|
|
129
|
+
content: {
|
|
130
|
+
type: "text";
|
|
131
|
+
text: string;
|
|
132
|
+
}[];
|
|
133
|
+
}>;
|
|
134
|
+
export {};
|
|
135
|
+
//# sourceMappingURL=directives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["../../src/tools/directives.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAiCvB,eAAO,MAAM,YAAY;;;;CAexB,CAAA;AAED,KAAK,UAAU,GAAG;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED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KAAK,YAAY,GAAG;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,YAAY;;;;;GAShD;AAMD,eAAO,MAAM,qBAAqB;;CAKjC,CAAA;AAED,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB;;;;;GAQ9D"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pd_list + pd_get + pd_create + pd_update + pd_delete + pd_toggle + directive_export
|
|
3
|
+
*
|
|
4
|
+
* Project Directives management tools for the Nexus platform.
|
|
5
|
+
* Directives are project-scoped rules/policies that guide agent behavior.
|
|
6
|
+
* Delegates to POST /api/mcp/directives.
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { nexusPost } from '../nexus-api.js';
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Shared helpers
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
function errorResult(result) {
|
|
15
|
+
return {
|
|
16
|
+
content: [
|
|
17
|
+
{
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: JSON.stringify({ error: result.error }, null, 2),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
isError: true,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
+
function okResult(data) {
|
|
27
|
+
return {
|
|
28
|
+
content: [
|
|
29
|
+
{ type: 'text', text: JSON.stringify(data, null, 2) },
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// pd_list
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
export const pdListSchema = {
|
|
37
|
+
project_id: z
|
|
38
|
+
.string()
|
|
39
|
+
.uuid()
|
|
40
|
+
.describe('Project UUID'),
|
|
41
|
+
enabled: z
|
|
42
|
+
.boolean()
|
|
43
|
+
.optional()
|
|
44
|
+
.describe('Filter by enabled status'),
|
|
45
|
+
limit: z
|
|
46
|
+
.number()
|
|
47
|
+
.min(1)
|
|
48
|
+
.max(100)
|
|
49
|
+
.default(50)
|
|
50
|
+
.describe('Maximum results to return'),
|
|
51
|
+
};
|
|
52
|
+
export async function pdList(args) {
|
|
53
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
54
|
+
action: 'pd_list',
|
|
55
|
+
project_id: args.project_id,
|
|
56
|
+
enabled: args.enabled,
|
|
57
|
+
limit: args.limit ?? 50,
|
|
58
|
+
});
|
|
59
|
+
if (!result.ok)
|
|
60
|
+
return errorResult(result);
|
|
61
|
+
return okResult(result.data);
|
|
62
|
+
}
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
// pd_get
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
export const pdGetSchema = {
|
|
67
|
+
directive_id: z
|
|
68
|
+
.string()
|
|
69
|
+
.uuid()
|
|
70
|
+
.describe('Directive UUID'),
|
|
71
|
+
};
|
|
72
|
+
export async function pdGet(args) {
|
|
73
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
74
|
+
action: 'pd_get',
|
|
75
|
+
directive_id: args.directive_id,
|
|
76
|
+
});
|
|
77
|
+
if (!result.ok)
|
|
78
|
+
return errorResult(result);
|
|
79
|
+
return okResult(result.data);
|
|
80
|
+
}
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// pd_create
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
export const pdCreateSchema = {
|
|
85
|
+
project_id: z
|
|
86
|
+
.string()
|
|
87
|
+
.uuid()
|
|
88
|
+
.describe('Project UUID'),
|
|
89
|
+
title: z
|
|
90
|
+
.string()
|
|
91
|
+
.max(500)
|
|
92
|
+
.describe('Directive title'),
|
|
93
|
+
body: z
|
|
94
|
+
.string()
|
|
95
|
+
.max(10000)
|
|
96
|
+
.optional()
|
|
97
|
+
.describe('Directive body (markdown)'),
|
|
98
|
+
category: z
|
|
99
|
+
.string()
|
|
100
|
+
.max(100)
|
|
101
|
+
.default('general')
|
|
102
|
+
.describe('Directive category (e.g. general, security, deployment)'),
|
|
103
|
+
priority: z
|
|
104
|
+
.enum(['low', 'medium', 'high'])
|
|
105
|
+
.default('medium')
|
|
106
|
+
.describe('Directive priority'),
|
|
107
|
+
enabled: z
|
|
108
|
+
.boolean()
|
|
109
|
+
.default(true)
|
|
110
|
+
.describe('Whether the directive is enabled'),
|
|
111
|
+
};
|
|
112
|
+
export async function pdCreate(args) {
|
|
113
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
114
|
+
action: 'pd_create',
|
|
115
|
+
project_id: args.project_id,
|
|
116
|
+
title: args.title,
|
|
117
|
+
body: args.body,
|
|
118
|
+
category: args.category ?? 'general',
|
|
119
|
+
priority: args.priority ?? 'medium',
|
|
120
|
+
enabled: args.enabled !== false,
|
|
121
|
+
});
|
|
122
|
+
if (!result.ok)
|
|
123
|
+
return errorResult(result);
|
|
124
|
+
return okResult(result.data);
|
|
125
|
+
}
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
// pd_update
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
export const pdUpdateSchema = {
|
|
130
|
+
directive_id: z
|
|
131
|
+
.string()
|
|
132
|
+
.uuid()
|
|
133
|
+
.describe('Directive UUID'),
|
|
134
|
+
title: z
|
|
135
|
+
.string()
|
|
136
|
+
.max(500)
|
|
137
|
+
.optional()
|
|
138
|
+
.describe('Updated title'),
|
|
139
|
+
body: z
|
|
140
|
+
.string()
|
|
141
|
+
.max(10000)
|
|
142
|
+
.optional()
|
|
143
|
+
.describe('Updated body (markdown)'),
|
|
144
|
+
category: z
|
|
145
|
+
.string()
|
|
146
|
+
.max(100)
|
|
147
|
+
.optional()
|
|
148
|
+
.describe('Updated category'),
|
|
149
|
+
priority: z
|
|
150
|
+
.enum(['low', 'medium', 'high'])
|
|
151
|
+
.optional()
|
|
152
|
+
.describe('Updated priority'),
|
|
153
|
+
enabled: z
|
|
154
|
+
.boolean()
|
|
155
|
+
.optional()
|
|
156
|
+
.describe('Updated enabled state'),
|
|
157
|
+
};
|
|
158
|
+
export async function pdUpdate(args) {
|
|
159
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
160
|
+
action: 'pd_update',
|
|
161
|
+
directive_id: args.directive_id,
|
|
162
|
+
title: args.title,
|
|
163
|
+
body: args.body,
|
|
164
|
+
category: args.category,
|
|
165
|
+
priority: args.priority,
|
|
166
|
+
enabled: args.enabled,
|
|
167
|
+
});
|
|
168
|
+
if (!result.ok)
|
|
169
|
+
return errorResult(result);
|
|
170
|
+
return okResult(result.data);
|
|
171
|
+
}
|
|
172
|
+
// ---------------------------------------------------------------------------
|
|
173
|
+
// pd_delete
|
|
174
|
+
// ---------------------------------------------------------------------------
|
|
175
|
+
export const pdDeleteSchema = {
|
|
176
|
+
directive_id: z
|
|
177
|
+
.string()
|
|
178
|
+
.uuid()
|
|
179
|
+
.describe('Directive UUID to delete'),
|
|
180
|
+
};
|
|
181
|
+
export async function pdDelete(args) {
|
|
182
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
183
|
+
action: 'pd_delete',
|
|
184
|
+
directive_id: args.directive_id,
|
|
185
|
+
});
|
|
186
|
+
if (!result.ok)
|
|
187
|
+
return errorResult(result);
|
|
188
|
+
return okResult(result.data);
|
|
189
|
+
}
|
|
190
|
+
// ---------------------------------------------------------------------------
|
|
191
|
+
// pd_toggle
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
export const pdToggleSchema = {
|
|
194
|
+
directive_id: z
|
|
195
|
+
.string()
|
|
196
|
+
.uuid()
|
|
197
|
+
.describe('Directive UUID to toggle'),
|
|
198
|
+
enabled: z
|
|
199
|
+
.boolean()
|
|
200
|
+
.optional()
|
|
201
|
+
.describe('Explicit enabled state (omit to invert current)'),
|
|
202
|
+
};
|
|
203
|
+
export async function pdToggle(args) {
|
|
204
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
205
|
+
action: 'pd_toggle',
|
|
206
|
+
directive_id: args.directive_id,
|
|
207
|
+
enabled: args.enabled,
|
|
208
|
+
});
|
|
209
|
+
if (!result.ok)
|
|
210
|
+
return errorResult(result);
|
|
211
|
+
return okResult(result.data);
|
|
212
|
+
}
|
|
213
|
+
// ---------------------------------------------------------------------------
|
|
214
|
+
// directive_export
|
|
215
|
+
// ---------------------------------------------------------------------------
|
|
216
|
+
export const directiveExportSchema = {
|
|
217
|
+
project_id: z
|
|
218
|
+
.string()
|
|
219
|
+
.uuid()
|
|
220
|
+
.describe('Project UUID'),
|
|
221
|
+
};
|
|
222
|
+
export async function directiveExport(args) {
|
|
223
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
224
|
+
action: 'directive_export',
|
|
225
|
+
project_id: args.project_id,
|
|
226
|
+
});
|
|
227
|
+
if (!result.ok)
|
|
228
|
+
return errorResult(result);
|
|
229
|
+
return okResult(result.data);
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=directives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../../src/tools/directives.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,8DAA8D;AAC9D,SAAS,WAAW,CAAC,MAAgC;IACnD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EA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dentity wrapper', () => {
|
|
|
78
78
|
})
|
|
79
79
|
|
|
80
80
|
describe('MCP Server: Schema exports', () => {
|
|
81
|
-
const EXPECTED_TOOL_COUNT =
|
|
81
|
+
const EXPECTED_TOOL_COUNT = 45
|
|
82
82
|
|
|
83
|
-
it('should register exactly
|
|
83
|
+
it('should register exactly 45 tools in server.ts', () => {
|
|
84
84
|
// Static analysis: count server.tool( calls in server.ts as a regression guard.
|
|
85
85
|
// If you add or remove a tool, update EXPECTED_TOOL_COUNT above.
|
|
86
86
|
const serverSource = readFileSync(
|
package/src/server.ts
CHANGED
|
@@ -38,6 +38,13 @@
|
|
|
38
38
|
* - sk_assign: Assign a skill to a project
|
|
39
39
|
* - sk_unassign: Remove a skill assignment from a project
|
|
40
40
|
* - sk_export: Export all skill assignments for a project
|
|
41
|
+
* - pd_list: List project directives
|
|
42
|
+
* - pd_get: Get a specific directive
|
|
43
|
+
* - pd_create: Create a new directive
|
|
44
|
+
* - pd_update: Update an existing directive
|
|
45
|
+
* - pd_delete: Delete a directive
|
|
46
|
+
* - pd_toggle: Toggle directive enabled/disabled
|
|
47
|
+
* - directive_export: Export enabled directives (CLI format)
|
|
41
48
|
* - doc_ingest: Push text/markdown content into project knowledge base
|
|
42
49
|
* - doc_list: List ingested documents for a project
|
|
43
50
|
* - session_append: Append to a session (write-isolated)
|
|
@@ -149,6 +156,22 @@ import {
|
|
|
149
156
|
skUnassign,
|
|
150
157
|
skUnassignSchema,
|
|
151
158
|
} from './tools/skill-assign.js'
|
|
159
|
+
import {
|
|
160
|
+
pdList,
|
|
161
|
+
pdListSchema,
|
|
162
|
+
pdGet,
|
|
163
|
+
pdGetSchema,
|
|
164
|
+
pdCreate,
|
|
165
|
+
pdCreateSchema,
|
|
166
|
+
pdUpdate,
|
|
167
|
+
pdUpdateSchema,
|
|
168
|
+
pdDelete,
|
|
169
|
+
pdDeleteSchema,
|
|
170
|
+
pdToggle,
|
|
171
|
+
pdToggleSchema,
|
|
172
|
+
directiveExport,
|
|
173
|
+
directiveExportSchema,
|
|
174
|
+
} from './tools/directives.js'
|
|
152
175
|
import {
|
|
153
176
|
updateTaskStatus,
|
|
154
177
|
updateTaskStatusSchema,
|
|
@@ -202,7 +225,7 @@ function withIdentity(handler: (args: any) => Promise<any>) {
|
|
|
202
225
|
const server = new McpServer(
|
|
203
226
|
{
|
|
204
227
|
name: 'nexus-mcp',
|
|
205
|
-
version: '0.
|
|
228
|
+
version: '0.8.0',
|
|
206
229
|
},
|
|
207
230
|
{
|
|
208
231
|
capabilities: {
|
|
@@ -437,6 +460,59 @@ server.tool(
|
|
|
437
460
|
withIdentity(skExport),
|
|
438
461
|
)
|
|
439
462
|
|
|
463
|
+
// ---------------------------------------------------------------------------
|
|
464
|
+
// Layer 2 (continued): Project Directives tools
|
|
465
|
+
// ---------------------------------------------------------------------------
|
|
466
|
+
|
|
467
|
+
server.tool(
|
|
468
|
+
'pd_list',
|
|
469
|
+
'List project directives with optional enabled filter. Returns directives ordered by priority and creation date.',
|
|
470
|
+
pdListSchema,
|
|
471
|
+
withIdentity(pdList),
|
|
472
|
+
)
|
|
473
|
+
|
|
474
|
+
server.tool(
|
|
475
|
+
'pd_get',
|
|
476
|
+
'Get a specific project directive by UUID. Returns full directive details.',
|
|
477
|
+
pdGetSchema,
|
|
478
|
+
withIdentity(pdGet),
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
server.tool(
|
|
482
|
+
'pd_create',
|
|
483
|
+
'Create a new project directive. Directives are project-scoped rules/policies that guide agent behavior.',
|
|
484
|
+
pdCreateSchema,
|
|
485
|
+
withIdentity(pdCreate),
|
|
486
|
+
)
|
|
487
|
+
|
|
488
|
+
server.tool(
|
|
489
|
+
'pd_update',
|
|
490
|
+
'Update an existing project directive. Supports partial updates for title, body, category, priority, and enabled state.',
|
|
491
|
+
pdUpdateSchema,
|
|
492
|
+
withIdentity(pdUpdate),
|
|
493
|
+
)
|
|
494
|
+
|
|
495
|
+
server.tool(
|
|
496
|
+
'pd_delete',
|
|
497
|
+
'Delete a project directive by UUID.',
|
|
498
|
+
pdDeleteSchema,
|
|
499
|
+
withIdentity(pdDelete),
|
|
500
|
+
)
|
|
501
|
+
|
|
502
|
+
server.tool(
|
|
503
|
+
'pd_toggle',
|
|
504
|
+
'Toggle a project directive enabled/disabled. Omit enabled parameter to invert current state.',
|
|
505
|
+
pdToggleSchema,
|
|
506
|
+
withIdentity(pdToggle),
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
server.tool(
|
|
510
|
+
'directive_export',
|
|
511
|
+
'Export all enabled directives for a project in CLI-compatible format.',
|
|
512
|
+
directiveExportSchema,
|
|
513
|
+
withIdentity(directiveExport),
|
|
514
|
+
)
|
|
515
|
+
|
|
440
516
|
// ---------------------------------------------------------------------------
|
|
441
517
|
// Layer 3: Governance tools
|
|
442
518
|
// ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pd_list + pd_get + pd_create + pd_update + pd_delete + pd_toggle + directive_export
|
|
3
|
+
*
|
|
4
|
+
* Project Directives management tools for the Nexus platform.
|
|
5
|
+
* Directives are project-scoped rules/policies that guide agent behavior.
|
|
6
|
+
* Delegates to POST /api/mcp/directives.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { z } from 'zod'
|
|
10
|
+
import { nexusPost } from '../nexus-api.js'
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Shared helpers
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
function errorResult(result: { error: string | null }) {
|
|
18
|
+
return {
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: 'text' as const,
|
|
22
|
+
text: JSON.stringify({ error: result.error }, null, 2),
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
isError: true,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
function okResult(data: any) {
|
|
31
|
+
return {
|
|
32
|
+
content: [
|
|
33
|
+
{ type: 'text' as const, text: JSON.stringify(data, null, 2) },
|
|
34
|
+
],
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// pd_list
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
export const pdListSchema = {
|
|
43
|
+
project_id: z
|
|
44
|
+
.string()
|
|
45
|
+
.uuid()
|
|
46
|
+
.describe('Project UUID'),
|
|
47
|
+
enabled: z
|
|
48
|
+
.boolean()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('Filter by enabled status'),
|
|
51
|
+
limit: z
|
|
52
|
+
.number()
|
|
53
|
+
.min(1)
|
|
54
|
+
.max(100)
|
|
55
|
+
.default(50)
|
|
56
|
+
.describe('Maximum results to return'),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type PdListArgs = {
|
|
60
|
+
project_id: string
|
|
61
|
+
enabled?: boolean
|
|
62
|
+
limit?: number
|
|
63
|
+
user_id: string
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export async function pdList(args: PdListArgs) {
|
|
67
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
68
|
+
action: 'pd_list',
|
|
69
|
+
project_id: args.project_id,
|
|
70
|
+
enabled: args.enabled,
|
|
71
|
+
limit: args.limit ?? 50,
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
if (!result.ok) return errorResult(result)
|
|
75
|
+
return okResult(result.data)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
// pd_get
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
export const pdGetSchema = {
|
|
83
|
+
directive_id: z
|
|
84
|
+
.string()
|
|
85
|
+
.uuid()
|
|
86
|
+
.describe('Directive UUID'),
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type PdGetArgs = {
|
|
90
|
+
directive_id: string
|
|
91
|
+
user_id: string
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export async function pdGet(args: PdGetArgs) {
|
|
95
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
96
|
+
action: 'pd_get',
|
|
97
|
+
directive_id: args.directive_id,
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
if (!result.ok) return errorResult(result)
|
|
101
|
+
return okResult(result.data)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
// pd_create
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
export const pdCreateSchema = {
|
|
109
|
+
project_id: z
|
|
110
|
+
.string()
|
|
111
|
+
.uuid()
|
|
112
|
+
.describe('Project UUID'),
|
|
113
|
+
title: z
|
|
114
|
+
.string()
|
|
115
|
+
.max(500)
|
|
116
|
+
.describe('Directive title'),
|
|
117
|
+
body: z
|
|
118
|
+
.string()
|
|
119
|
+
.max(10000)
|
|
120
|
+
.optional()
|
|
121
|
+
.describe('Directive body (markdown)'),
|
|
122
|
+
category: z
|
|
123
|
+
.string()
|
|
124
|
+
.max(100)
|
|
125
|
+
.default('general')
|
|
126
|
+
.describe('Directive category (e.g. general, security, deployment)'),
|
|
127
|
+
priority: z
|
|
128
|
+
.enum(['low', 'medium', 'high'])
|
|
129
|
+
.default('medium')
|
|
130
|
+
.describe('Directive priority'),
|
|
131
|
+
enabled: z
|
|
132
|
+
.boolean()
|
|
133
|
+
.default(true)
|
|
134
|
+
.describe('Whether the directive is enabled'),
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
type PdCreateArgs = {
|
|
138
|
+
project_id: string
|
|
139
|
+
title: string
|
|
140
|
+
body?: string
|
|
141
|
+
category?: string
|
|
142
|
+
priority?: string
|
|
143
|
+
enabled?: boolean
|
|
144
|
+
user_id: string
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export async function pdCreate(args: PdCreateArgs) {
|
|
148
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
149
|
+
action: 'pd_create',
|
|
150
|
+
project_id: args.project_id,
|
|
151
|
+
title: args.title,
|
|
152
|
+
body: args.body,
|
|
153
|
+
category: args.category ?? 'general',
|
|
154
|
+
priority: args.priority ?? 'medium',
|
|
155
|
+
enabled: args.enabled !== false,
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
if (!result.ok) return errorResult(result)
|
|
159
|
+
return okResult(result.data)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
// pd_update
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
|
|
166
|
+
export const pdUpdateSchema = {
|
|
167
|
+
directive_id: z
|
|
168
|
+
.string()
|
|
169
|
+
.uuid()
|
|
170
|
+
.describe('Directive UUID'),
|
|
171
|
+
title: z
|
|
172
|
+
.string()
|
|
173
|
+
.max(500)
|
|
174
|
+
.optional()
|
|
175
|
+
.describe('Updated title'),
|
|
176
|
+
body: z
|
|
177
|
+
.string()
|
|
178
|
+
.max(10000)
|
|
179
|
+
.optional()
|
|
180
|
+
.describe('Updated body (markdown)'),
|
|
181
|
+
category: z
|
|
182
|
+
.string()
|
|
183
|
+
.max(100)
|
|
184
|
+
.optional()
|
|
185
|
+
.describe('Updated category'),
|
|
186
|
+
priority: z
|
|
187
|
+
.enum(['low', 'medium', 'high'])
|
|
188
|
+
.optional()
|
|
189
|
+
.describe('Updated priority'),
|
|
190
|
+
enabled: z
|
|
191
|
+
.boolean()
|
|
192
|
+
.optional()
|
|
193
|
+
.describe('Updated enabled state'),
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
type PdUpdateArgs = {
|
|
197
|
+
directive_id: string
|
|
198
|
+
title?: string
|
|
199
|
+
body?: string
|
|
200
|
+
category?: string
|
|
201
|
+
priority?: string
|
|
202
|
+
enabled?: boolean
|
|
203
|
+
user_id: string
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export async function pdUpdate(args: PdUpdateArgs) {
|
|
207
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
208
|
+
action: 'pd_update',
|
|
209
|
+
directive_id: args.directive_id,
|
|
210
|
+
title: args.title,
|
|
211
|
+
body: args.body,
|
|
212
|
+
category: args.category,
|
|
213
|
+
priority: args.priority,
|
|
214
|
+
enabled: args.enabled,
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
if (!result.ok) return errorResult(result)
|
|
218
|
+
return okResult(result.data)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// ---------------------------------------------------------------------------
|
|
222
|
+
// pd_delete
|
|
223
|
+
// ---------------------------------------------------------------------------
|
|
224
|
+
|
|
225
|
+
export const pdDeleteSchema = {
|
|
226
|
+
directive_id: z
|
|
227
|
+
.string()
|
|
228
|
+
.uuid()
|
|
229
|
+
.describe('Directive UUID to delete'),
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
type PdDeleteArgs = {
|
|
233
|
+
directive_id: string
|
|
234
|
+
user_id: string
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export async function pdDelete(args: PdDeleteArgs) {
|
|
238
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
239
|
+
action: 'pd_delete',
|
|
240
|
+
directive_id: args.directive_id,
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
if (!result.ok) return errorResult(result)
|
|
244
|
+
return okResult(result.data)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// ---------------------------------------------------------------------------
|
|
248
|
+
// pd_toggle
|
|
249
|
+
// ---------------------------------------------------------------------------
|
|
250
|
+
|
|
251
|
+
export const pdToggleSchema = {
|
|
252
|
+
directive_id: z
|
|
253
|
+
.string()
|
|
254
|
+
.uuid()
|
|
255
|
+
.describe('Directive UUID to toggle'),
|
|
256
|
+
enabled: z
|
|
257
|
+
.boolean()
|
|
258
|
+
.optional()
|
|
259
|
+
.describe('Explicit enabled state (omit to invert current)'),
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
type PdToggleArgs = {
|
|
263
|
+
directive_id: string
|
|
264
|
+
enabled?: boolean
|
|
265
|
+
user_id: string
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export async function pdToggle(args: PdToggleArgs) {
|
|
269
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
270
|
+
action: 'pd_toggle',
|
|
271
|
+
directive_id: args.directive_id,
|
|
272
|
+
enabled: args.enabled,
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
if (!result.ok) return errorResult(result)
|
|
276
|
+
return okResult(result.data)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// ---------------------------------------------------------------------------
|
|
280
|
+
// directive_export
|
|
281
|
+
// ---------------------------------------------------------------------------
|
|
282
|
+
|
|
283
|
+
export const directiveExportSchema = {
|
|
284
|
+
project_id: z
|
|
285
|
+
.string()
|
|
286
|
+
.uuid()
|
|
287
|
+
.describe('Project UUID'),
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
type DirectiveExportArgs = {
|
|
291
|
+
project_id: string
|
|
292
|
+
user_id: string
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export async function directiveExport(args: DirectiveExportArgs) {
|
|
296
|
+
const result = await nexusPost('/api/mcp/directives', {
|
|
297
|
+
action: 'directive_export',
|
|
298
|
+
project_id: args.project_id,
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
if (!result.ok) return errorResult(result)
|
|
302
|
+
return okResult(result.data)
|
|
303
|
+
}
|