@klority/mcp-server 0.0.0-stage → 1.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/README.md +110 -2
- package/dist/client.d.ts +281 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +245 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +4 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +97 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/index.d.ts +4 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +86 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/tools/crm.d.ts +4 -0
- package/dist/tools/crm.d.ts.map +1 -0
- package/dist/tools/crm.js +250 -0
- package/dist/tools/crm.js.map +1 -0
- package/dist/tools/qa.d.ts +4 -0
- package/dist/tools/qa.d.ts.map +1 -0
- package/dist/tools/qa.js +102 -0
- package/dist/tools/qa.js.map +1 -0
- package/dist/tools/tasks.d.ts +4 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +172 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/tools/wiki.d.ts +4 -0
- package/dist/tools/wiki.d.ts.map +1 -0
- package/dist/tools/wiki.js +152 -0
- package/dist/tools/wiki.js.map +1 -0
- package/package.json +43 -4
package/dist/tools/qa.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerQATools(server, client) {
|
|
3
|
+
// 1. Get QA Test Cases and Acceptance Criteria
|
|
4
|
+
server.tool("klority_get_qa_criteria", "Fetch QA test cases, acceptance criteria, preconditions, and execution steps to generate matching test suites (Jest, Playwright, Vitest).", {
|
|
5
|
+
query: z.string().optional().describe("Search term, module name, or task reference"),
|
|
6
|
+
projectId: z.string().optional().describe("Filter by Project UUID")
|
|
7
|
+
}, async ({ query, projectId }) => {
|
|
8
|
+
try {
|
|
9
|
+
const res = await client.getQACriteria({ query, projectId });
|
|
10
|
+
if (!res.testCases || res.testCases.length === 0) {
|
|
11
|
+
return {
|
|
12
|
+
content: [{ type: "text", text: `No test cases found${query ? ` matching "${query}"` : ""}.` }]
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const casesFormatted = res.testCases.map(tc => {
|
|
16
|
+
const key = tc.customId || tc.id.slice(0, 8);
|
|
17
|
+
let stepsText = "";
|
|
18
|
+
if (Array.isArray(tc.steps) && tc.steps.length > 0) {
|
|
19
|
+
stepsText = "\n *Steps*:\n" + tc.steps.map((s, idx) => ` ${idx + 1}. ${s.step || s.action} ➔ Expected: ${s.expected || s.result}`).join("\n");
|
|
20
|
+
}
|
|
21
|
+
return `- **[${key}] ${tc.title}**\n *Status*: \`${tc.status}\` | *Priority*: ${tc.priority} | *Validation*: ${tc.validationType || "Functional"}\n *ID*: \`${tc.id}\`${tc.preconditions ? `\n *Preconditions*: ${tc.preconditions}` : ""}${stepsText}${tc.expectedResult ? `\n *Overall Expected*: ${tc.expectedResult}` : ""}`;
|
|
22
|
+
}).join("\n\n");
|
|
23
|
+
return {
|
|
24
|
+
content: [
|
|
25
|
+
{
|
|
26
|
+
type: "text",
|
|
27
|
+
text: `### Found ${res.testCases.length} Test Case(s):\n\n${casesFormatted}`
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
return {
|
|
34
|
+
isError: true,
|
|
35
|
+
content: [{ type: "text", text: `Error fetching QA criteria: ${err.message}` }]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
// 2. Create Test Case
|
|
40
|
+
server.tool("klority_create_test_case", "Define a formal test case in the Klority QA repository with preconditions, execution steps, and expected results.", {
|
|
41
|
+
projectId: z.string().describe("Project UUID"),
|
|
42
|
+
moduleId: z.string().optional().describe("Module UUID within the QA repository"),
|
|
43
|
+
title: z.string().min(1).describe("Test case title"),
|
|
44
|
+
description: z.string().optional().describe("Objective and scope of the test case"),
|
|
45
|
+
priority: z.enum(["Low", "Medium", "High", "Critical"]).default("Medium"),
|
|
46
|
+
preconditions: z.string().optional().describe("System state or environment setup required before testing"),
|
|
47
|
+
steps: z.array(z.object({
|
|
48
|
+
step: z.string().describe("Action to perform"),
|
|
49
|
+
expected: z.string().describe("Expected outcome of this step")
|
|
50
|
+
})).optional().describe("Ordered array of step-by-step instructions")
|
|
51
|
+
}, async (args) => {
|
|
52
|
+
try {
|
|
53
|
+
const created = await client.createTestCase(args);
|
|
54
|
+
const key = created.customId || created.id;
|
|
55
|
+
return {
|
|
56
|
+
content: [
|
|
57
|
+
{
|
|
58
|
+
type: "text",
|
|
59
|
+
text: `✅ **Test Case Created!**\n- **Key**: ${key}\n- **Title**: ${created.title}\n- **ID**: \`${created.id}\``
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
return {
|
|
66
|
+
isError: true,
|
|
67
|
+
content: [{ type: "text", text: `Error creating test case: ${err.message}` }]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
// 3. Record Test Execution Runs
|
|
72
|
+
server.tool("klority_record_test_runs", "Ingest automated or manual test execution results (Passed, Failed, Blocked) directly into Klority QA test cycles.", {
|
|
73
|
+
projectId: z.string().describe("Project UUID"),
|
|
74
|
+
testCycleName: z.string().default("MCP Automated Run").describe("Name for the test cycle in Klority"),
|
|
75
|
+
testCycleId: z.string().optional().describe("Existing Test Cycle UUID to append runs to"),
|
|
76
|
+
results: z.array(z.object({
|
|
77
|
+
testCaseId: z.string().describe("Test Case UUID"),
|
|
78
|
+
status: z.enum(["Passed", "Failed", "Blocked"]).describe("Test outcome"),
|
|
79
|
+
executionTimeMs: z.number().optional().describe("Execution duration in milliseconds"),
|
|
80
|
+
comment: z.string().optional().describe("Execution log or failure stack trace")
|
|
81
|
+
})).min(1).describe("Array of test results to record")
|
|
82
|
+
}, async (args) => {
|
|
83
|
+
try {
|
|
84
|
+
const res = await client.recordTestRuns(args);
|
|
85
|
+
return {
|
|
86
|
+
content: [
|
|
87
|
+
{
|
|
88
|
+
type: "text",
|
|
89
|
+
text: `✅ **Recorded ${res.runsRecorded} Test Run(s) in Klority!**\n- **Cycle ID**: \`${res.testCycleId}\``
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
return {
|
|
96
|
+
isError: true,
|
|
97
|
+
content: [{ type: "text", text: `Error recording test runs: ${err.message}` }]
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=qa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa.js","sourceRoot":"","sources":["../../src/tools/qa.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,eAAe,CAAC,MAAiB,EAAE,MAAqB;IACtE,+CAA+C;IAC/C,MAAM,CAAC,IAAI,CACT,yBAAyB,EACzB,2IAA2I,EAC3I;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;QACpF,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;KACpE,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;QAC7B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YAC7D,IAAI,CAAC,G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CAAyC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,QA6MzE"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerTaskTools(server, client) {
|
|
3
|
+
// 1. Search Tasks
|
|
4
|
+
server.tool("klority_search_tasks", "Search and filter Agile tasks, user stories, and bugs in Klority by keyword, project, or sprint.", {
|
|
5
|
+
query: z.string().optional().describe("Search keywords for task title or description"),
|
|
6
|
+
projectId: z.string().optional().describe("Filter by specific Project ID or UUID"),
|
|
7
|
+
sprintId: z.string().optional().describe("Filter by Sprint ID (e.g., active sprint)"),
|
|
8
|
+
limit: z.number().min(1).max(100).default(25).describe("Maximum number of tasks to return (default: 25)")
|
|
9
|
+
}, async ({ query, projectId, sprintId, limit }) => {
|
|
10
|
+
try {
|
|
11
|
+
const res = await client.searchTasks({ query, projectId, sprintId, limit });
|
|
12
|
+
if (!res.tasks || res.tasks.length === 0) {
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: "No matching tasks found." }]
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const taskSummaries = res.tasks.map(t => {
|
|
18
|
+
const key = t.customId || t.id.slice(0, 8);
|
|
19
|
+
return `- **[${key}]** ${t.title}\n *Type*: ${t.type || "Task"} | *Priority*: ${t.priority || "Medium"} | *ID*: \`${t.id}\``;
|
|
20
|
+
}).join("\n\n");
|
|
21
|
+
return {
|
|
22
|
+
content: [
|
|
23
|
+
{
|
|
24
|
+
type: "text",
|
|
25
|
+
text: `### Found ${res.tasks.length} task(s):\n\n${taskSummaries}`
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
return {
|
|
32
|
+
isError: true,
|
|
33
|
+
content: [{ type: "text", text: `Error searching tasks: ${err.message}` }]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
// 2. Get Task Details
|
|
38
|
+
server.tool("klority_get_task", "Get full details, description, acceptance criteria, comments, and status for a specific Klority task by ID or custom key (e.g. KLOR-104).", {
|
|
39
|
+
taskId: z.string().describe("Task UUID or custom ticket identifier (e.g. KLOR-104)")
|
|
40
|
+
}, async ({ taskId }) => {
|
|
41
|
+
try {
|
|
42
|
+
const task = await client.getTask(taskId);
|
|
43
|
+
const key = task.customId || task.id;
|
|
44
|
+
const details = [
|
|
45
|
+
`# [${key}] ${task.title}`,
|
|
46
|
+
`**Type**: ${task.type || "Task"} | **Priority**: ${task.priority || "Normal"} | **Sprint**: ${task.sprintId || "Backlog"}`,
|
|
47
|
+
`**ID**: \`${task.id}\``,
|
|
48
|
+
`\n### Description`,
|
|
49
|
+
task.description || "*(No description provided)*",
|
|
50
|
+
task.labels && task.labels.length > 0 ? `\n**Labels**: ${task.labels.join(", ")}` : "",
|
|
51
|
+
task.comments && task.comments.length > 0
|
|
52
|
+
? `\n### Recent Comments (${task.comments.length})\n` + task.comments.map(c => `> **${c.authorName || "User"}** (${new Date(c.createdAt).toLocaleDateString()}):\n> ${c.content}`).join("\n\n")
|
|
53
|
+
: ""
|
|
54
|
+
].filter(Boolean).join("\n");
|
|
55
|
+
return {
|
|
56
|
+
content: [{ type: "text", text: details }]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
return {
|
|
61
|
+
isError: true,
|
|
62
|
+
content: [{ type: "text", text: `Error retrieving task ${taskId}: ${err.message}` }]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
// 3. Create Task
|
|
67
|
+
server.tool("klority_create_task", "Create a new task, story, or bug in Klority directly on the project backlog or current sprint.", {
|
|
68
|
+
projectId: z.string().describe("Project UUID or project key where task should be created"),
|
|
69
|
+
title: z.string().min(1).describe("Task title / summary"),
|
|
70
|
+
description: z.string().describe("Detailed description, markdown content, or acceptance criteria"),
|
|
71
|
+
type: z.enum(["Story", "Task", "Bug", "Epic"]).default("Task").describe("Issue type"),
|
|
72
|
+
priority: z.enum(["Low", "Normal", "High", "Urgent"]).default("Normal").describe("Task priority"),
|
|
73
|
+
sprintId: z.string().optional().describe("Sprint UUID to assign directly into a sprint"),
|
|
74
|
+
labels: z.array(z.string()).optional().describe("Tags / labels for the task")
|
|
75
|
+
}, async (args) => {
|
|
76
|
+
try {
|
|
77
|
+
const created = await client.createTask(args);
|
|
78
|
+
const key = created.customId || created.id;
|
|
79
|
+
return {
|
|
80
|
+
content: [
|
|
81
|
+
{
|
|
82
|
+
type: "text",
|
|
83
|
+
text: `✅ **Task Created Successfully!**\n- **Key**: ${key}\n- **Title**: ${created.title}\n- **ID**: \`${created.id}\`\n- **Type**: ${created.type}`
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
return {
|
|
90
|
+
isError: true,
|
|
91
|
+
content: [{ type: "text", text: `Error creating task: ${err.message}` }]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
// 4. Update Task Status
|
|
96
|
+
server.tool("klority_update_task_status", "Transition a task to another board column (e.g., In Progress, Review, Done) and optionally post an explanation comment.", {
|
|
97
|
+
taskId: z.string().describe("Task UUID or custom identifier"),
|
|
98
|
+
columnId: z.string().optional().describe("Destination Column UUID"),
|
|
99
|
+
comment: z.string().optional().describe("Optional note explaining the status change or agent progress")
|
|
100
|
+
}, async ({ taskId, columnId, comment }) => {
|
|
101
|
+
try {
|
|
102
|
+
await client.updateTaskStatus(taskId, columnId, comment);
|
|
103
|
+
return {
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: "text",
|
|
107
|
+
text: `✅ **Task Updated Successfully** (ID: \`${taskId}\`)${comment ? `\n> Comment added: "${comment}"` : ""}`
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
return {
|
|
114
|
+
isError: true,
|
|
115
|
+
content: [{ type: "text", text: `Error updating task status: ${err.message}` }]
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
// 5. Add Task Comment
|
|
120
|
+
server.tool("klority_add_task_comment", "Add a comment or discussion reply to a Klority task thread.", {
|
|
121
|
+
taskId: z.string().describe("Task UUID or custom identifier"),
|
|
122
|
+
content: z.string().min(1).describe("Comment content in Markdown format")
|
|
123
|
+
}, async ({ taskId, content }) => {
|
|
124
|
+
try {
|
|
125
|
+
const res = await client.addTaskComment(taskId, content);
|
|
126
|
+
return {
|
|
127
|
+
content: [
|
|
128
|
+
{
|
|
129
|
+
type: "text",
|
|
130
|
+
text: `✅ **Comment Posted to Task ${taskId}**`
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
return {
|
|
137
|
+
isError: true,
|
|
138
|
+
content: [{ type: "text", text: `Error adding comment: ${err.message}` }]
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
// 6. List Sprints
|
|
143
|
+
server.tool("klority_list_sprints", "List sprints for a given project, including status (active, future, closed) and dates.", {
|
|
144
|
+
projectId: z.string().describe("Project UUID"),
|
|
145
|
+
state: z.enum(["active", "future", "closed"]).optional().describe("Filter by sprint status")
|
|
146
|
+
}, async ({ projectId, state }) => {
|
|
147
|
+
try {
|
|
148
|
+
const res = await client.listSprints(projectId, state);
|
|
149
|
+
if (!res.sprints || res.sprints.length === 0) {
|
|
150
|
+
return {
|
|
151
|
+
content: [{ type: "text", text: `No ${state || ""} sprints found for project ${projectId}.` }]
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const sprintList = res.sprints.map((s) => `- **${s.name}** [Status: \`${s.status}\`]\n *ID*: \`${s.id}\`${s.startDate ? ` | *Dates*: ${new Date(s.startDate).toLocaleDateString()} -> ${new Date(s.endDate).toLocaleDateString()}` : ""}${s.goal ? `\n *Goal*: ${s.goal}` : ""}`).join("\n\n");
|
|
155
|
+
return {
|
|
156
|
+
content: [
|
|
157
|
+
{
|
|
158
|
+
type: "text",
|
|
159
|
+
text: `### Sprints for Project:\n\n${sprintList}`
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
return {
|
|
166
|
+
isError: true,
|
|
167
|
+
content: [{ type: "text", text: `Error listing sprints: ${err.message}` }]
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../src/tools/tasks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,MAAqB;IACxE,kBAAkB;IAClB,MAAM,CAAC,IAAI,CACT,sBAAsB,EACtB,kGAAkG,EAClG;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;QACtF,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;QAClF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;QACrF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,iDAAiD,CAAC;KAC1G,EACD,KAAK,EAAE,E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AC,IAAI,CAAC,MAAM,CAAC,CAAC;YAEf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,+BAA+B,UAAU,EAAE;qBAClD;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,0BAA0B,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;aAC3E,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiki.d.ts","sourceRoot":"","sources":["../../src/tools/wiki.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,QAqLzE"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function registerWikiTools(server, client) {
|
|
3
|
+
// 1. Search Wiki PRDs & Documentation
|
|
4
|
+
server.tool("klority_search_wiki", "Search documentation, PRDs, architecture specifications, and technical guides in Klority Wiki.", {
|
|
5
|
+
query: z.string().describe("Search query, feature name, or technical concept"),
|
|
6
|
+
projectId: z.string().optional().describe("Filter by specific Project UUID")
|
|
7
|
+
}, async ({ query, projectId }) => {
|
|
8
|
+
try {
|
|
9
|
+
const res = await client.searchPages({ query, projectId });
|
|
10
|
+
if (!res.pages || res.pages.length === 0) {
|
|
11
|
+
return {
|
|
12
|
+
content: [{ type: "text", text: `No wiki documentation found matching query "${query}".` }]
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const pageList = res.pages.map(p => `- **${p.title}** (ID: \`${p.id}\`)\n *Updated*: ${new Date(p.updatedAt).toLocaleDateString()}\n ${p.content ? p.content.slice(0, 180) + "..." : "*(empty content)*"}`).join("\n\n");
|
|
16
|
+
return {
|
|
17
|
+
content: [
|
|
18
|
+
{
|
|
19
|
+
type: "text",
|
|
20
|
+
text: `### Found ${res.pages.length} Wiki Page(s):\n\n${pageList}`
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
return {
|
|
27
|
+
isError: true,
|
|
28
|
+
content: [{ type: "text", text: `Error searching wiki: ${err.message}` }]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
// 2. Get Full Page Details
|
|
33
|
+
server.tool("klority_get_page", "Retrieve full Markdown content, Mermaid diagrams, and requirements for a specific Klority Wiki document.", {
|
|
34
|
+
pageId: z.string().describe("Page UUID or slug identifier")
|
|
35
|
+
}, async ({ pageId }) => {
|
|
36
|
+
try {
|
|
37
|
+
const page = await client.getPage(pageId);
|
|
38
|
+
const text = [
|
|
39
|
+
`# ${page.title}`,
|
|
40
|
+
`*Page ID*: \`${page.id}\` | *Updated*: ${new Date(page.updatedAt).toLocaleDateString()}`,
|
|
41
|
+
`\n---`,
|
|
42
|
+
page.content || "*(No document content)*"
|
|
43
|
+
].join("\n");
|
|
44
|
+
return {
|
|
45
|
+
content: [{ type: "text", text }]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
return {
|
|
50
|
+
isError: true,
|
|
51
|
+
content: [{ type: "text", text: `Error retrieving wiki page ${pageId}: ${err.message}` }]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
// 3. Create or Update Page (Unified)
|
|
56
|
+
server.tool("klority_create_or_update_page", "Create a new documentation page or update an existing page in Klority Wiki (e.g. for PRDs, ADR decision records, or team notes).", {
|
|
57
|
+
title: z.string().min(1).describe("Document title"),
|
|
58
|
+
content: z.string().describe("Markdown content of the document"),
|
|
59
|
+
projectId: z.string().optional().describe("Project UUID or space (optional: defaults to workspace project)"),
|
|
60
|
+
pageId: z.string().optional().describe("Existing Page UUID to update (leave empty to create new)"),
|
|
61
|
+
parentPageId: z.string().optional().describe("Parent folder/page UUID for hierarchical organization"),
|
|
62
|
+
isFolder: z.boolean().optional().describe("Set true if creating a folder category")
|
|
63
|
+
}, async ({ projectId, title, content, pageId, parentPageId, isFolder }) => {
|
|
64
|
+
try {
|
|
65
|
+
const result = await client.createOrUpdatePage({
|
|
66
|
+
projectId,
|
|
67
|
+
title,
|
|
68
|
+
content,
|
|
69
|
+
pageId,
|
|
70
|
+
parentPageId,
|
|
71
|
+
isFolder
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
content: [
|
|
75
|
+
{
|
|
76
|
+
type: "text",
|
|
77
|
+
text: `✅ **Wiki Page ${pageId ? "Updated" : "Created"} Successfully!**\n- **Title**: ${result.title}\n- **ID**: \`${result.id}\`${result.parentId ? `\n- **Parent ID**: \`${result.parentId}\`` : ""}`
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
return {
|
|
84
|
+
isError: true,
|
|
85
|
+
content: [{ type: "text", text: `Error saving wiki page: ${err.message}` }]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
// 4. Create Wiki Page
|
|
90
|
+
server.tool("klority_create_wiki_page", "Create a new documentation page, architectural decision record (ADR), or guide in Klority Wiki.", {
|
|
91
|
+
title: z.string().min(1).describe("Document title"),
|
|
92
|
+
content: z.string().describe("Markdown content of the document"),
|
|
93
|
+
projectId: z.string().optional().describe("Project UUID or space (optional)"),
|
|
94
|
+
parentPageId: z.string().optional().describe("Parent folder/page UUID (e.g. Decision Records folder)"),
|
|
95
|
+
isFolder: z.boolean().optional().describe("Set true if creating a folder category")
|
|
96
|
+
}, async ({ projectId, title, content, parentPageId, isFolder }) => {
|
|
97
|
+
try {
|
|
98
|
+
const result = await client.createOrUpdatePage({
|
|
99
|
+
projectId,
|
|
100
|
+
title,
|
|
101
|
+
content,
|
|
102
|
+
parentPageId,
|
|
103
|
+
isFolder
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
content: [
|
|
107
|
+
{
|
|
108
|
+
type: "text",
|
|
109
|
+
text: `✅ **Wiki Page Created Successfully!**\n- **Title**: ${result.title}\n- **ID**: \`${result.id}\`${result.parentId ? `\n- **Parent ID**: \`${result.parentId}\`` : ""}`
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
return {
|
|
116
|
+
isError: true,
|
|
117
|
+
content: [{ type: "text", text: `Error creating wiki page: ${err.message}` }]
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
// 5. Update Wiki Page
|
|
122
|
+
server.tool("klority_update_wiki_page", "Update the title or content of an existing document in Klority Wiki.", {
|
|
123
|
+
pageId: z.string().describe("Page UUID to update"),
|
|
124
|
+
title: z.string().optional().describe("New document title"),
|
|
125
|
+
content: z.string().optional().describe("New Markdown content"),
|
|
126
|
+
parentPageId: z.string().optional().describe("New parent folder or document UUID")
|
|
127
|
+
}, async ({ pageId, title, content, parentPageId }) => {
|
|
128
|
+
try {
|
|
129
|
+
const result = await client.createOrUpdatePage({
|
|
130
|
+
pageId,
|
|
131
|
+
title: title || "",
|
|
132
|
+
content: content || "",
|
|
133
|
+
parentPageId
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
content: [
|
|
137
|
+
{
|
|
138
|
+
type: "text",
|
|
139
|
+
text: `✅ **Wiki Page Updated Successfully!**\n- **Title**: ${result.title}\n- **ID**: \`${result.id}\``
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
return {
|
|
146
|
+
isError: true,
|
|
147
|
+
content: [{ type: "text", text: `Error updating wiki page: ${err.message}` }]
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=wiki.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiki.js","sourceRoot":"","sources":["../../src/tools/wiki.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,MAAqB;IACxE,sCAAsC;IACtC,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,gGAAgG,EAChG;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;QAC9E,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;KAC7E,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;QAC7B,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzC,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,+CAA+C,KAAK,IAAI,EAAE,CAAC;iBAC5F,CAAC;YACJ,CAAC;YAED,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CACjC,OAAO,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,EAAE,qBAAqB,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,OAAO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AO,EAAE,OAAO,IAAI,EAAE;gBACtB,YAAY;aACb,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,uDAAuD,MAAM,CAAC,KAAK,iBAAiB,MAAM,CAAC,EAAE,IAAI;qBACxG;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,6BAA6B,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;aAC9E,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@klority/mcp-server",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Official Model Context Protocol (MCP) server for Klority — Tasks, Wiki PRDs, Test Management, and CRM",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"klority-mcp": "dist/index.js",
|
|
8
|
+
"mcp-server": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"dev": "tsc -w",
|
|
22
|
+
"start": "node dist/index.js",
|
|
23
|
+
"prepublishOnly": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"klority",
|
|
27
|
+
"mcp",
|
|
28
|
+
"model-context-protocol",
|
|
29
|
+
"anthropic",
|
|
30
|
+
"claude",
|
|
31
|
+
"cursor",
|
|
32
|
+
"sdlc",
|
|
33
|
+
"ai-agent"
|
|
34
|
+
],
|
|
35
|
+
"author": "Klority <support@klority.com>",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
39
|
+
"zod": "^3.22.4"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^20.11.0",
|
|
43
|
+
"typescript": "^5.3.3"
|
|
44
|
+
}
|
|
45
|
+
}
|