@cg3/prior-mcp 0.5.2 → 0.5.4
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/client.js +2 -2
- package/dist/index.js +1 -1
- package/dist/tools.js +41 -6
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -68,8 +68,8 @@ class PriorApiClient {
|
|
|
68
68
|
// Require an API key — no more auto-registration
|
|
69
69
|
if (!this._apiKey) {
|
|
70
70
|
throw new Error("No Prior API key configured. " +
|
|
71
|
-
"Get your key at https://prior.cg3.io/
|
|
72
|
-
"or add it to ~/.prior/config.json
|
|
71
|
+
"Get your key at https://prior.cg3.io/getkey then set PRIOR_API_KEY in your environment, " +
|
|
72
|
+
"or add it to ~/.prior/config.json as {\"apiKey\": \"...\"}.");
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
get apiKey() { return this._apiKey; }
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ function saveConfig(config) { return client.saveConfig(config); }
|
|
|
30
30
|
const client = new client_js_1.PriorApiClient();
|
|
31
31
|
const server = new mcp_js_1.McpServer({
|
|
32
32
|
name: "prior",
|
|
33
|
-
version: "0.5.
|
|
33
|
+
version: "0.5.3",
|
|
34
34
|
}, {
|
|
35
35
|
instructions: `Prior is a knowledge base of agent-discovered solutions to technical problems and research questions — including debugging, troubleshooting, configuration, integration, migration, architecture decisions, and more. Search Prior before investigating errors or starting multi-step research. Tool responses handle feedback and contribution prompts. See prior://docs/agent-guide for usage patterns.`,
|
|
36
36
|
});
|
package/dist/tools.js
CHANGED
|
@@ -12,6 +12,41 @@ exports.expandNudgeTokens = expandNudgeTokens;
|
|
|
12
12
|
exports.registerTools = registerTools;
|
|
13
13
|
const zod_1 = require("zod");
|
|
14
14
|
const utils_js_1 = require("./utils.js");
|
|
15
|
+
/**
|
|
16
|
+
* Flexible array schema that accepts:
|
|
17
|
+
* - An actual array: ["a", "b"]
|
|
18
|
+
* - A JSON string: '["a", "b"]'
|
|
19
|
+
* - A comma-separated string: "a, b"
|
|
20
|
+
* Works around MCP clients that serialize arrays as strings.
|
|
21
|
+
*/
|
|
22
|
+
const flexArray = (desc) => zod_1.z.union([
|
|
23
|
+
zod_1.z.array(zod_1.z.string()),
|
|
24
|
+
zod_1.z.string().transform((s) => {
|
|
25
|
+
s = s.trim();
|
|
26
|
+
if (s.startsWith("[")) {
|
|
27
|
+
try {
|
|
28
|
+
const parsed = JSON.parse(s);
|
|
29
|
+
return Array.isArray(parsed) ? parsed.map(String) : [s];
|
|
30
|
+
}
|
|
31
|
+
catch { /* fall through */ }
|
|
32
|
+
}
|
|
33
|
+
return s.split(",").map((t) => t.trim()).filter(Boolean);
|
|
34
|
+
}),
|
|
35
|
+
]).describe(desc);
|
|
36
|
+
const flexArrayOptional = (desc) => zod_1.z.union([
|
|
37
|
+
zod_1.z.array(zod_1.z.string()),
|
|
38
|
+
zod_1.z.string().transform((s) => {
|
|
39
|
+
s = s.trim();
|
|
40
|
+
if (s.startsWith("[")) {
|
|
41
|
+
try {
|
|
42
|
+
const parsed = JSON.parse(s);
|
|
43
|
+
return Array.isArray(parsed) ? parsed.map(String) : [s];
|
|
44
|
+
}
|
|
45
|
+
catch { /* fall through */ }
|
|
46
|
+
}
|
|
47
|
+
return s.split(",").map((t) => t.trim()).filter(Boolean);
|
|
48
|
+
}),
|
|
49
|
+
]).optional().describe(desc);
|
|
15
50
|
/**
|
|
16
51
|
* Expand [PRIOR:*] client-side tokens to MCP tool call syntax.
|
|
17
52
|
*/
|
|
@@ -56,7 +91,7 @@ function registerTools(server, { client }) {
|
|
|
56
91
|
id: zod_1.z.string(),
|
|
57
92
|
title: zod_1.z.string(),
|
|
58
93
|
content: zod_1.z.string(),
|
|
59
|
-
tags:
|
|
94
|
+
tags: flexArrayOptional("Filter by tags").nullable(),
|
|
60
95
|
qualityScore: zod_1.z.number().nullable().optional(),
|
|
61
96
|
relevanceScore: zod_1.z.number().nullable().optional(),
|
|
62
97
|
errorMessages: zod_1.z.array(zod_1.z.string()).nullable().optional(),
|
|
@@ -175,12 +210,12 @@ function registerTools(server, { client }) {
|
|
|
175
210
|
inputSchema: {
|
|
176
211
|
title: zod_1.z.string().describe("Concise title (<200 chars) describing the SYMPTOM, not the diagnosis"),
|
|
177
212
|
content: zod_1.z.string().describe("Full description with context and solution (100-10000 chars, markdown)"),
|
|
178
|
-
tags:
|
|
213
|
+
tags: flexArray("1-10 lowercase tags (e.g. ['kotlin', 'exposed', 'workaround'])"),
|
|
179
214
|
model: zod_1.z.string().optional().describe("AI model that discovered this (e.g. 'claude-sonnet', 'gpt-4o'). Defaults to 'unknown' if omitted."),
|
|
180
215
|
problem: zod_1.z.string().optional().describe("The symptom or unexpected behavior observed"),
|
|
181
216
|
solution: zod_1.z.string().optional().describe("What actually fixed it"),
|
|
182
|
-
errorMessages:
|
|
183
|
-
failedApproaches:
|
|
217
|
+
errorMessages: flexArrayOptional("Exact error text, or describe the symptom if there was no error message"),
|
|
218
|
+
failedApproaches: flexArrayOptional("What you tried that didn't work — saves others from dead ends"),
|
|
184
219
|
environment: zod_1.z.object({
|
|
185
220
|
language: zod_1.z.string().optional(),
|
|
186
221
|
languageVersion: zod_1.z.string().optional(),
|
|
@@ -189,7 +224,7 @@ function registerTools(server, { client }) {
|
|
|
189
224
|
runtime: zod_1.z.string().optional(),
|
|
190
225
|
runtimeVersion: zod_1.z.string().optional(),
|
|
191
226
|
os: zod_1.z.string().optional(),
|
|
192
|
-
tools:
|
|
227
|
+
tools: flexArrayOptional("Tools used"),
|
|
193
228
|
}).optional().describe("Version/platform context"),
|
|
194
229
|
effort: zod_1.z.object({
|
|
195
230
|
tokensUsed: zod_1.z.number().optional(),
|
|
@@ -250,7 +285,7 @@ Use the feedbackActions from your search results — they have pre-built params
|
|
|
250
285
|
correction: zod_1.z.object({
|
|
251
286
|
content: zod_1.z.string().describe("Corrected content (100-10000 chars)"),
|
|
252
287
|
title: zod_1.z.string().optional(),
|
|
253
|
-
tags:
|
|
288
|
+
tags: flexArrayOptional("Updated tags for the correction"),
|
|
254
289
|
}).optional().describe("Submit a correction if you found the real fix"),
|
|
255
290
|
},
|
|
256
291
|
outputSchema: {
|
package/package.json
CHANGED