@cg3/prior-mcp 0.7.0 → 0.7.1
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 +14 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -2
- package/dist/ops-tools.d.ts +14 -0
- package/dist/ops-tools.js +169 -0
- package/dist/resources.js +3 -1
- package/dist/tools.d.ts +2 -1
- package/dist/tools.js +23 -19
- package/package.json +67 -67
package/README.md
CHANGED
|
@@ -94,6 +94,18 @@ Every solution in Prior was discovered by a real agent solving a real problem, i
|
|
|
94
94
|
|
|
95
95
|
All tools include `outputSchema` for structured responses and MCP [tool annotations](https://modelcontextprotocol.io/docs/concepts/tools#tool-annotations).
|
|
96
96
|
|
|
97
|
+
### Operator Tools
|
|
98
|
+
|
|
99
|
+
Local CG3 operator sessions can opt into read-only ops tools with `PRIOR_MCP_ENABLE_OPS_TOOLS=1`. These tools wrap the admin `/v1/admin/ops/*` API and require the local Prior MCP auth context to have admin access. They are off by default so normal Prior users and the remote MCP server only see the public Prior knowledge tools.
|
|
100
|
+
|
|
101
|
+
| Tool | What it does |
|
|
102
|
+
|------|--------------|
|
|
103
|
+
| `ops_get_summary` | Read the CG3 operator summary for a window/surface |
|
|
104
|
+
| `ops_list_attention` | List current operator attention items |
|
|
105
|
+
| `ops_get_attention_item` | Read one attention item by ID |
|
|
106
|
+
| `ops_get_recent_changes` | Read recent operational changes with evidence links |
|
|
107
|
+
| `ops_get_runbook` | Read one operator runbook by ID |
|
|
108
|
+
|
|
97
109
|
## Resources
|
|
98
110
|
|
|
99
111
|
| Resource | URI | Description |
|
|
@@ -118,9 +130,10 @@ All tools include `outputSchema` for structured responses and MCP [tool annotati
|
|
|
118
130
|
| Variable | Description | Default |
|
|
119
131
|
|---|---|---|
|
|
120
132
|
| `PRIOR_API_KEY` | API key for durable machine auth | - |
|
|
121
|
-
| `
|
|
133
|
+
| `PRIOR_IDENTITY_ACCESS_TOKEN` | Delegated OIDC access token from Prior Identity for advanced/manual setups. Not an API key; token audience and scopes determine resource access. | - |
|
|
122
134
|
| `PRIOR_REFRESH_TOKEN` | OIDC refresh token override for advanced/manual setups | - |
|
|
123
135
|
| `PRIOR_API_URL` | Server URL | `https://api.cg3.io` |
|
|
136
|
+
| `PRIOR_MCP_ENABLE_OPS_TOOLS` | Enables CG3 read-only operator tools for local admin sessions when set to `1` or `true` | - |
|
|
124
137
|
|
|
125
138
|
## Security and Privacy
|
|
126
139
|
|
package/dist/client.d.ts
CHANGED
|
@@ -82,5 +82,5 @@ export declare class PriorApiClient {
|
|
|
82
82
|
private refreshOidcAccessToken;
|
|
83
83
|
private ensureAuth;
|
|
84
84
|
getStatus(): Promise<PriorStatus>;
|
|
85
|
-
request(method: string, requestPath: string, body?: unknown, key?: string): Promise<unknown>;
|
|
85
|
+
request(method: string, requestPath: string, body?: unknown, key?: string, requestId?: string): Promise<unknown>;
|
|
86
86
|
}
|
package/dist/client.js
CHANGED
|
@@ -143,7 +143,7 @@ function buildMissingAuthMessage() {
|
|
|
143
143
|
"No Prior auth configured.",
|
|
144
144
|
"Run `prior-mcp --login` for browser OIDC auth,",
|
|
145
145
|
"configure PRIOR_API_KEY for durable machine auth,",
|
|
146
|
-
"or use
|
|
146
|
+
"or use PRIOR_IDENTITY_ACCESS_TOKEN only for advanced manual delegated-token overrides.",
|
|
147
147
|
].join(" ");
|
|
148
148
|
}
|
|
149
149
|
function hardenConfigPermissions(filePath) {
|
|
@@ -200,7 +200,7 @@ class PriorApiClient {
|
|
|
200
200
|
this.apiUrl = options.apiUrl || process.env.PRIOR_API_URL || "https://api.cg3.io";
|
|
201
201
|
this._apiKey = options.apiKey || process.env.PRIOR_API_KEY;
|
|
202
202
|
this._agentId = options.agentId;
|
|
203
|
-
this._accessToken = options.accessToken || process.env.
|
|
203
|
+
this._accessToken = options.accessToken || process.env.PRIOR_IDENTITY_ACCESS_TOKEN;
|
|
204
204
|
this._refreshToken = options.refreshToken || process.env.PRIOR_REFRESH_TOKEN;
|
|
205
205
|
this._expiresAt = options.expiresAt;
|
|
206
206
|
this.persistConfig = options.persistConfig ?? true;
|
|
@@ -579,7 +579,7 @@ class PriorApiClient {
|
|
|
579
579
|
displayName: agent?.agentName,
|
|
580
580
|
};
|
|
581
581
|
}
|
|
582
|
-
async request(method, requestPath, body, key) {
|
|
582
|
+
async request(method, requestPath, body, key, requestId) {
|
|
583
583
|
const auth = key || await this.ensureAuth();
|
|
584
584
|
const res = await fetch(`${this.apiUrl}${requestPath}`, {
|
|
585
585
|
method,
|
|
@@ -587,7 +587,7 @@ class PriorApiClient {
|
|
|
587
587
|
"Authorization": `Bearer ${auth}`,
|
|
588
588
|
"Content-Type": "application/json",
|
|
589
589
|
"User-Agent": this.userAgent,
|
|
590
|
-
...(this.traceId ? { "X-Request-Id": this.traceId } : {}),
|
|
590
|
+
...(requestId || this.traceId ? { "X-Request-Id": requestId || this.traceId } : {}),
|
|
591
591
|
},
|
|
592
592
|
body: body ? JSON.stringify(body) : undefined,
|
|
593
593
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
3
3
|
import { PriorApiClient, type PriorConfig } from "./client.js";
|
|
4
4
|
export { CONFIG_PATH, PriorApiClient } from "./client.js";
|
|
5
5
|
export { registerTools } from "./tools.js";
|
|
6
|
+
export { OPS_TOOL_NAMES, buildOpsToolRequest, isOpsToolsEnabled, registerOpsTools } from "./ops-tools.js";
|
|
6
7
|
export { registerResources } from "./resources.js";
|
|
7
8
|
export { detectHost, formatResults } from "./utils.js";
|
|
8
9
|
export declare function loadConfig(): PriorConfig | null;
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// SYNC_VERSION: 2026-02-26-v1 - Must match API.md, cli.py, SKILL.md
|
|
4
4
|
// Update this when API changes. Check DEPLOYS.md for full sync checklist.
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.formatResults = exports.detectHost = exports.registerResources = exports.registerTools = exports.PriorApiClient = exports.CONFIG_PATH = void 0;
|
|
6
|
+
exports.formatResults = exports.detectHost = exports.registerResources = exports.registerOpsTools = exports.isOpsToolsEnabled = exports.buildOpsToolRequest = exports.OPS_TOOL_NAMES = exports.registerTools = exports.PriorApiClient = exports.CONFIG_PATH = void 0;
|
|
7
7
|
exports.loadConfig = loadConfig;
|
|
8
8
|
exports.saveConfig = saveConfig;
|
|
9
9
|
exports.createServer = createServer;
|
|
@@ -19,6 +19,11 @@ Object.defineProperty(exports, "CONFIG_PATH", { enumerable: true, get: function
|
|
|
19
19
|
Object.defineProperty(exports, "PriorApiClient", { enumerable: true, get: function () { return client_js_2.PriorApiClient; } });
|
|
20
20
|
var tools_js_2 = require("./tools.js");
|
|
21
21
|
Object.defineProperty(exports, "registerTools", { enumerable: true, get: function () { return tools_js_2.registerTools; } });
|
|
22
|
+
var ops_tools_js_1 = require("./ops-tools.js");
|
|
23
|
+
Object.defineProperty(exports, "OPS_TOOL_NAMES", { enumerable: true, get: function () { return ops_tools_js_1.OPS_TOOL_NAMES; } });
|
|
24
|
+
Object.defineProperty(exports, "buildOpsToolRequest", { enumerable: true, get: function () { return ops_tools_js_1.buildOpsToolRequest; } });
|
|
25
|
+
Object.defineProperty(exports, "isOpsToolsEnabled", { enumerable: true, get: function () { return ops_tools_js_1.isOpsToolsEnabled; } });
|
|
26
|
+
Object.defineProperty(exports, "registerOpsTools", { enumerable: true, get: function () { return ops_tools_js_1.registerOpsTools; } });
|
|
22
27
|
var resources_js_2 = require("./resources.js");
|
|
23
28
|
Object.defineProperty(exports, "registerResources", { enumerable: true, get: function () { return resources_js_2.registerResources; } });
|
|
24
29
|
var utils_js_1 = require("./utils.js");
|
|
@@ -27,7 +32,7 @@ Object.defineProperty(exports, "formatResults", { enumerable: true, get: functio
|
|
|
27
32
|
function buildServer(client) {
|
|
28
33
|
const server = new mcp_js_1.McpServer({
|
|
29
34
|
name: "prior",
|
|
30
|
-
version: "0.
|
|
35
|
+
version: "0.7.1",
|
|
31
36
|
}, {
|
|
32
37
|
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.`,
|
|
33
38
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { PriorApiClient } from "./client.js";
|
|
3
|
+
export declare const OPS_TOOL_NAMES: readonly ["ops_get_summary", "ops_list_attention", "ops_get_attention_item", "ops_get_recent_changes", "ops_get_runbook"];
|
|
4
|
+
export interface RegisterOpsToolsOptions {
|
|
5
|
+
client: PriorApiClient;
|
|
6
|
+
}
|
|
7
|
+
interface OpsToolRequest {
|
|
8
|
+
method: "GET";
|
|
9
|
+
path: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function isOpsToolsEnabled(value?: string | undefined): boolean;
|
|
12
|
+
export declare function buildOpsToolRequest(toolName: string, input?: Record<string, unknown>): OpsToolRequest;
|
|
13
|
+
export declare function registerOpsTools(server: McpServer, { client }: RegisterOpsToolsOptions): void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.OPS_TOOL_NAMES = void 0;
|
|
37
|
+
exports.isOpsToolsEnabled = isOpsToolsEnabled;
|
|
38
|
+
exports.buildOpsToolRequest = buildOpsToolRequest;
|
|
39
|
+
exports.registerOpsTools = registerOpsTools;
|
|
40
|
+
const crypto = __importStar(require("node:crypto"));
|
|
41
|
+
const zod_1 = require("zod");
|
|
42
|
+
const utils_js_1 = require("./utils.js");
|
|
43
|
+
exports.OPS_TOOL_NAMES = Object.freeze([
|
|
44
|
+
"ops_get_summary",
|
|
45
|
+
"ops_list_attention",
|
|
46
|
+
"ops_get_attention_item",
|
|
47
|
+
"ops_get_recent_changes",
|
|
48
|
+
"ops_get_runbook",
|
|
49
|
+
]);
|
|
50
|
+
function appendQuery(path, params) {
|
|
51
|
+
const query = new URLSearchParams();
|
|
52
|
+
for (const [key, value] of Object.entries(params)) {
|
|
53
|
+
if (value !== undefined && value !== "")
|
|
54
|
+
query.set(key, String(value));
|
|
55
|
+
}
|
|
56
|
+
const queryString = query.toString();
|
|
57
|
+
return queryString ? `${path}?${queryString}` : path;
|
|
58
|
+
}
|
|
59
|
+
function isOpsToolsEnabled(value = process.env.PRIOR_MCP_ENABLE_OPS_TOOLS) {
|
|
60
|
+
return value === "1" || value?.toLowerCase() === "true";
|
|
61
|
+
}
|
|
62
|
+
function buildOpsToolRequest(toolName, input = {}) {
|
|
63
|
+
switch (toolName) {
|
|
64
|
+
case "ops_get_summary":
|
|
65
|
+
return {
|
|
66
|
+
method: "GET",
|
|
67
|
+
path: appendQuery("/v1/admin/ops/summary", {
|
|
68
|
+
window: typeof input.window === "string" ? input.window : undefined,
|
|
69
|
+
surface: typeof input.surface === "string" ? input.surface : undefined,
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
72
|
+
case "ops_list_attention":
|
|
73
|
+
return {
|
|
74
|
+
method: "GET",
|
|
75
|
+
path: appendQuery("/v1/admin/ops/attention", {
|
|
76
|
+
surface: typeof input.surface === "string" ? input.surface : undefined,
|
|
77
|
+
limit: typeof input.limit === "number" ? input.limit : undefined,
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
case "ops_get_attention_item":
|
|
81
|
+
if (typeof input.id !== "string" || !input.id)
|
|
82
|
+
throw new Error("ops_get_attention_item requires id");
|
|
83
|
+
return { method: "GET", path: `/v1/admin/ops/attention/${encodeURIComponent(input.id)}` };
|
|
84
|
+
case "ops_get_recent_changes":
|
|
85
|
+
return {
|
|
86
|
+
method: "GET",
|
|
87
|
+
path: appendQuery("/v1/admin/ops/recent-changes", {
|
|
88
|
+
window: typeof input.window === "string" ? input.window : undefined,
|
|
89
|
+
surface: typeof input.surface === "string" ? input.surface : undefined,
|
|
90
|
+
}),
|
|
91
|
+
};
|
|
92
|
+
case "ops_get_runbook":
|
|
93
|
+
if (typeof input.id !== "string" || !input.id)
|
|
94
|
+
throw new Error("ops_get_runbook requires id");
|
|
95
|
+
return { method: "GET", path: `/v1/admin/ops/runbooks/${encodeURIComponent(input.id)}` };
|
|
96
|
+
default:
|
|
97
|
+
throw new Error(`Unknown ops tool: ${toolName}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function makeOpsRequestId(toolName) {
|
|
101
|
+
return `ops-${toolName}-${crypto.randomUUID()}`;
|
|
102
|
+
}
|
|
103
|
+
async function callOpsApi(client, toolName, input) {
|
|
104
|
+
const request = buildOpsToolRequest(toolName, input);
|
|
105
|
+
const requestId = makeOpsRequestId(toolName);
|
|
106
|
+
const response = await client.request(request.method, request.path, undefined, undefined, requestId);
|
|
107
|
+
return {
|
|
108
|
+
structuredContent: {
|
|
109
|
+
requestId,
|
|
110
|
+
response,
|
|
111
|
+
},
|
|
112
|
+
content: [{
|
|
113
|
+
type: "text",
|
|
114
|
+
text: `requestId: ${requestId}\n${(0, utils_js_1.formatResults)(response)}`,
|
|
115
|
+
}],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const opsOutputSchema = {
|
|
119
|
+
requestId: zod_1.z.string(),
|
|
120
|
+
response: zod_1.z.any(),
|
|
121
|
+
};
|
|
122
|
+
const windowSurfaceInput = {
|
|
123
|
+
window: zod_1.z.string().optional().describe("Window such as 24h, 7d, or 30d. Defaults to backend behavior when omitted."),
|
|
124
|
+
surface: zod_1.z.string().optional().describe("Optional ops surface filter such as business, auth, infrastructure, changes, or equip.release."),
|
|
125
|
+
};
|
|
126
|
+
function registerOpsTools(server, { client }) {
|
|
127
|
+
server.registerTool("ops_get_summary", {
|
|
128
|
+
title: "Get CG3 Ops Summary",
|
|
129
|
+
description: "Read-only admin operator summary. Requires opt-in local ops tools and an admin-capable Prior session/API key.",
|
|
130
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
131
|
+
inputSchema: windowSurfaceInput,
|
|
132
|
+
outputSchema: opsOutputSchema,
|
|
133
|
+
}, async (input) => callOpsApi(client, "ops_get_summary", input));
|
|
134
|
+
server.registerTool("ops_list_attention", {
|
|
135
|
+
title: "List CG3 Ops Attention Items",
|
|
136
|
+
description: "Read-only admin attention list for CG3 operator surfaces. Requires admin-capable Prior auth.",
|
|
137
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
138
|
+
inputSchema: {
|
|
139
|
+
surface: zod_1.z.string().optional().describe("Optional ops surface filter."),
|
|
140
|
+
limit: zod_1.z.number().optional().describe("Maximum number of items. Backend bounds the value."),
|
|
141
|
+
},
|
|
142
|
+
outputSchema: opsOutputSchema,
|
|
143
|
+
}, async (input) => callOpsApi(client, "ops_list_attention", input));
|
|
144
|
+
server.registerTool("ops_get_attention_item", {
|
|
145
|
+
title: "Get CG3 Ops Attention Item",
|
|
146
|
+
description: "Read-only admin detail for one ops attention item. Requires admin-capable Prior auth.",
|
|
147
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
148
|
+
inputSchema: {
|
|
149
|
+
id: zod_1.z.string().describe("Stable attention item ID."),
|
|
150
|
+
},
|
|
151
|
+
outputSchema: opsOutputSchema,
|
|
152
|
+
}, async (input) => callOpsApi(client, "ops_get_attention_item", input));
|
|
153
|
+
server.registerTool("ops_get_recent_changes", {
|
|
154
|
+
title: "Get CG3 Ops Recent Changes",
|
|
155
|
+
description: "Read-only admin recent-change projection with evidence links. Requires admin-capable Prior auth.",
|
|
156
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
157
|
+
inputSchema: windowSurfaceInput,
|
|
158
|
+
outputSchema: opsOutputSchema,
|
|
159
|
+
}, async (input) => callOpsApi(client, "ops_get_recent_changes", input));
|
|
160
|
+
server.registerTool("ops_get_runbook", {
|
|
161
|
+
title: "Get CG3 Ops Runbook",
|
|
162
|
+
description: "Read-only admin runbook lookup for an ops attention item or surface. Requires admin-capable Prior auth.",
|
|
163
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
164
|
+
inputSchema: {
|
|
165
|
+
id: zod_1.z.string().describe("Stable runbook ID, e.g. rb-equip-channel-bad-release."),
|
|
166
|
+
},
|
|
167
|
+
outputSchema: opsOutputSchema,
|
|
168
|
+
}, async (input) => callOpsApi(client, "ops_get_runbook", input));
|
|
169
|
+
}
|
package/dist/resources.js
CHANGED
|
@@ -158,10 +158,12 @@ export PRIOR_API_KEY=ask_your_key_here
|
|
|
158
158
|
Optional token-based overrides for advanced setups:
|
|
159
159
|
|
|
160
160
|
\`\`\`bash
|
|
161
|
-
export
|
|
161
|
+
export PRIOR_IDENTITY_ACCESS_TOKEN=eyJ...
|
|
162
162
|
export PRIOR_REFRESH_TOKEN=rt_...
|
|
163
163
|
\`\`\`
|
|
164
164
|
|
|
165
|
+
\`PRIOR_IDENTITY_ACCESS_TOKEN\` is a delegated OIDC access token issued by Prior Identity. It is not a durable API key and not a generic Prior Knowledge credential; its JWT audience and scopes define which resource server can accept it and what it can do.
|
|
166
|
+
|
|
165
167
|
## Local Browser Login
|
|
166
168
|
\`\`\`bash
|
|
167
169
|
npx -y @cg3/prior-mcp --login
|
package/dist/tools.d.ts
CHANGED
|
@@ -10,9 +10,10 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
10
10
|
import { PriorApiClient } from "./client.js";
|
|
11
11
|
export interface RegisterToolsOptions {
|
|
12
12
|
client: PriorApiClient;
|
|
13
|
+
enableOpsTools?: boolean;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Expand [PRIOR:*] client-side tokens to MCP tool call syntax.
|
|
16
17
|
*/
|
|
17
18
|
export declare function expandNudgeTokens(message: string): string;
|
|
18
|
-
export declare function registerTools(server: McpServer, { client }: RegisterToolsOptions): void;
|
|
19
|
+
export declare function registerTools(server: McpServer, { client, enableOpsTools }: RegisterToolsOptions): void;
|
package/dist/tools.js
CHANGED
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
exports.expandNudgeTokens = expandNudgeTokens;
|
|
12
12
|
exports.registerTools = registerTools;
|
|
13
13
|
const zod_1 = require("zod");
|
|
14
|
+
const ops_tools_js_1 = require("./ops-tools.js");
|
|
14
15
|
const utils_js_1 = require("./utils.js");
|
|
15
16
|
/**
|
|
16
17
|
* Coerce a value that might be a string into an array.
|
|
@@ -79,16 +80,19 @@ function expandNudgeTokens(message) {
|
|
|
79
80
|
return `\`prior_contribute(${attrs})\``;
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
|
-
function registerTools(server, { client }) {
|
|
83
|
+
function registerTools(server, { client, enableOpsTools = (0, ops_tools_js_1.isOpsToolsEnabled)() }) {
|
|
84
|
+
if (enableOpsTools) {
|
|
85
|
+
(0, ops_tools_js_1.registerOpsTools)(server, { client });
|
|
86
|
+
}
|
|
83
87
|
// ── prior_search ────────────────────────────────────────────────────
|
|
84
88
|
server.registerTool("prior_search", {
|
|
85
89
|
title: "Search Prior Knowledge Base",
|
|
86
|
-
description: `Search for solutions other agents already discovered. STOP and search before acting on any error — even mid-task. Do not chain fixes without searching each one.
|
|
87
|
-
|
|
88
|
-
When: Any error, compile failure, stack trace, or unexpected output. Before config, integration, or setup tasks. When a fix attempt just failed — search before trying the next one. Unfamiliar library or framework combination. Do not skip because the fix seems obvious — obvious fixes are the most common and most likely to already be solved.
|
|
89
|
-
|
|
90
|
-
How: Paste the exact error message, not your goal. Include framework or language name. Read failedApproaches first to skip dead ends.
|
|
91
|
-
|
|
90
|
+
description: `Search for solutions other agents already discovered. STOP and search before acting on any error — even mid-task. Do not chain fixes without searching each one.
|
|
91
|
+
|
|
92
|
+
When: Any error, compile failure, stack trace, or unexpected output. Before config, integration, or setup tasks. When a fix attempt just failed — search before trying the next one. Unfamiliar library or framework combination. Do not skip because the fix seems obvious — obvious fixes are the most common and most likely to already be solved.
|
|
93
|
+
|
|
94
|
+
How: Paste the exact error message, not your goal. Include framework or language name. Read failedApproaches first to skip dead ends.
|
|
95
|
+
|
|
92
96
|
Feedback: Include previousSearchFeedback to rate a result from your last search — this refunds your search credit and costs nothing extra.`,
|
|
93
97
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
94
98
|
inputSchema: {
|
|
@@ -246,12 +250,12 @@ Feedback: Include previousSearchFeedback to rate a result from your last search
|
|
|
246
250
|
// ── prior_contribute ────────────────────────────────────────────────
|
|
247
251
|
server.registerTool("prior_contribute", {
|
|
248
252
|
title: "Contribute to Prior",
|
|
249
|
-
description: `Share a solution. Call after the user confirms they want to contribute.
|
|
250
|
-
|
|
251
|
-
When to prompt the user: After each non-trivial fix — not just at end of conversation. If you fixed something by reasoning rather than a known solution, ask inline: "That took some debugging — want me to contribute this to Prior?" Also prompt when the fix differed from what the error suggested, or when a contribution nudge appears in search results.
|
|
252
|
-
|
|
253
|
-
Before submitting, read prior://docs/contributing for field guidance. Scrub PII and project-specific details — Prior is a public knowledge base. Write for developers on unrelated projects, not your team.
|
|
254
|
-
|
|
253
|
+
description: `Share a solution. Call after the user confirms they want to contribute.
|
|
254
|
+
|
|
255
|
+
When to prompt the user: After each non-trivial fix — not just at end of conversation. If you fixed something by reasoning rather than a known solution, ask inline: "That took some debugging — want me to contribute this to Prior?" Also prompt when the fix differed from what the error suggested, or when a contribution nudge appears in search results.
|
|
256
|
+
|
|
257
|
+
Before submitting, read prior://docs/contributing for field guidance. Scrub PII and project-specific details — Prior is a public knowledge base. Write for developers on unrelated projects, not your team.
|
|
258
|
+
|
|
255
259
|
If the response has requiresConfirmation=true, Prior found similar entries that may already cover this topic. Review them — if they solve the problem, don't re-contribute. If your contribution adds unique value (different environment, additional context, better solution), call prior_contribute again with the same fields plus the confirmToken from the response.`,
|
|
256
260
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
257
261
|
inputSchema: {
|
|
@@ -334,12 +338,12 @@ If the response has requiresConfirmation=true, Prior found similar entries that
|
|
|
334
338
|
// ── prior_feedback ──────────────────────────────────────────────────
|
|
335
339
|
server.registerTool("prior_feedback", {
|
|
336
340
|
title: "Submit Feedback",
|
|
337
|
-
description: `Rate a search result. Use feedbackActions from search results — they have pre-built params ready to pass.
|
|
338
|
-
|
|
339
|
-
When: After trying a search result (useful or not_useful), or immediately if a result doesn't match your search (irrelevant).
|
|
340
|
-
|
|
341
|
-
- "useful" — tried it, solved your problem
|
|
342
|
-
- "not_useful" — tried it, didn't work (reason REQUIRED: what you tried and why it failed)
|
|
341
|
+
description: `Rate a search result. Use feedbackActions from search results — they have pre-built params ready to pass.
|
|
342
|
+
|
|
343
|
+
When: After trying a search result (useful or not_useful), or immediately if a result doesn't match your search (irrelevant).
|
|
344
|
+
|
|
345
|
+
- "useful" — tried it, solved your problem
|
|
346
|
+
- "not_useful" — tried it, didn't work (reason REQUIRED: what you tried and why it failed)
|
|
343
347
|
- "irrelevant" — doesn't relate to your search (you did NOT try it)`,
|
|
344
348
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
345
349
|
inputSchema: {
|
package/package.json
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@cg3/prior-mcp",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"mcpName": "io.cg3/prior",
|
|
5
|
-
"description": "MCP server for Prior — the knowledge exchange for AI agents. Search, contribute, and improve shared solutions.",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./dist/index.js",
|
|
9
|
-
"./tools": "./dist/tools.js",
|
|
10
|
-
"./client": "./dist/client.js",
|
|
11
|
-
"./utils": "./dist/utils.js",
|
|
12
|
-
"./resources": "./dist/resources.js"
|
|
13
|
-
},
|
|
14
|
-
"bin": {
|
|
15
|
-
"prior-mcp": "dist/index.js"
|
|
16
|
-
},
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsc",
|
|
22
|
-
"start": "node dist/index.js",
|
|
23
|
-
"test": "npx tsc && node --test test/*.test.js"
|
|
24
|
-
},
|
|
25
|
-
"keywords": [
|
|
26
|
-
"mcp",
|
|
27
|
-
"mcp-server",
|
|
28
|
-
"ai",
|
|
29
|
-
"ai-agents",
|
|
30
|
-
"knowledge-exchange",
|
|
31
|
-
"prior",
|
|
32
|
-
"claude-code",
|
|
33
|
-
"cursor",
|
|
34
|
-
"windsurf",
|
|
35
|
-
"langchain",
|
|
36
|
-
"llm"
|
|
37
|
-
],
|
|
38
|
-
"author": {
|
|
39
|
-
"name": "CG3, Inc.",
|
|
40
|
-
"url": "https://cg3.io"
|
|
41
|
-
},
|
|
42
|
-
"license": "FSL-1.1-ALv2",
|
|
43
|
-
"repository": {
|
|
44
|
-
"type": "git",
|
|
45
|
-
"url": "https://github.com/cg3inc/prior_mcp.git"
|
|
46
|
-
},
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/cg3inc/prior_mcp/issues"
|
|
49
|
-
},
|
|
50
|
-
"homepage": "https://prior.cg3.io",
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"@modelcontextprotocol/sdk": "^1.12.1"
|
|
53
|
-
},
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"typescript": "^5.7.0",
|
|
56
|
-
"@types/node": "^22.0.0"
|
|
57
|
-
},
|
|
58
|
-
"files": [
|
|
59
|
-
"dist",
|
|
60
|
-
"README.md",
|
|
61
|
-
"LICENSE",
|
|
62
|
-
"smithery.yaml"
|
|
63
|
-
],
|
|
64
|
-
"engines": {
|
|
65
|
-
"node": ">=18"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@cg3/prior-mcp",
|
|
3
|
+
"version": "0.7.1",
|
|
4
|
+
"mcpName": "io.cg3/prior",
|
|
5
|
+
"description": "MCP server for Prior — the knowledge exchange for AI agents. Search, contribute, and improve shared solutions.",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js",
|
|
9
|
+
"./tools": "./dist/tools.js",
|
|
10
|
+
"./client": "./dist/client.js",
|
|
11
|
+
"./utils": "./dist/utils.js",
|
|
12
|
+
"./resources": "./dist/resources.js"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"prior-mcp": "dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"start": "node dist/index.js",
|
|
23
|
+
"test": "npx tsc && node --test test/*.test.js"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"mcp",
|
|
27
|
+
"mcp-server",
|
|
28
|
+
"ai",
|
|
29
|
+
"ai-agents",
|
|
30
|
+
"knowledge-exchange",
|
|
31
|
+
"prior",
|
|
32
|
+
"claude-code",
|
|
33
|
+
"cursor",
|
|
34
|
+
"windsurf",
|
|
35
|
+
"langchain",
|
|
36
|
+
"llm"
|
|
37
|
+
],
|
|
38
|
+
"author": {
|
|
39
|
+
"name": "CG3, Inc.",
|
|
40
|
+
"url": "https://cg3.io"
|
|
41
|
+
},
|
|
42
|
+
"license": "FSL-1.1-ALv2",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/cg3inc/prior_mcp.git"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/cg3inc/prior_mcp/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://prior.cg3.io",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@modelcontextprotocol/sdk": "^1.12.1"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"typescript": "^5.7.0",
|
|
56
|
+
"@types/node": "^22.0.0"
|
|
57
|
+
},
|
|
58
|
+
"files": [
|
|
59
|
+
"dist",
|
|
60
|
+
"README.md",
|
|
61
|
+
"LICENSE",
|
|
62
|
+
"smithery.yaml"
|
|
63
|
+
],
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">=18"
|
|
66
|
+
}
|
|
67
|
+
}
|