@cg3/prior-mcp 0.6.4 → 0.7.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 +41 -25
- package/dist/client.d.ts +53 -6
- package/dist/client.js +514 -24
- package/dist/index.d.ts +4 -6
- package/dist/index.js +33 -13
- package/dist/resources.d.ts +1 -1
- package/dist/resources.js +128 -122
- package/dist/tools.js +32 -27
- package/package.json +67 -67
package/dist/resources.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Prior MCP resources
|
|
3
|
+
* Prior MCP resources shared between local and remote MCP servers.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
6
|
* import { registerResources } from "@cg3/prior-mcp/resources";
|
|
@@ -9,151 +9,168 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.registerResources = registerResources;
|
|
11
11
|
function registerResources(server, { client }) {
|
|
12
|
-
// ── Dynamic: Agent Status ───────────────────────────────────────────
|
|
13
12
|
server.registerResource("agent-status", "prior://agent/status", {
|
|
14
|
-
description: "Your current Prior
|
|
13
|
+
description: "Your current Prior auth status: auth mode, credits, tier, and profile summary.",
|
|
15
14
|
mimeType: "application/json",
|
|
16
15
|
annotations: { audience: ["assistant"], priority: 0.4 },
|
|
17
16
|
}, async () => {
|
|
18
17
|
try {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const status = await client.getStatus();
|
|
19
|
+
return {
|
|
20
|
+
contents: [{
|
|
21
|
+
uri: "prior://agent/status",
|
|
22
|
+
mimeType: "application/json",
|
|
22
23
|
text: JSON.stringify({
|
|
23
|
-
id:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
id: status.id,
|
|
25
|
+
authType: status.authType,
|
|
26
|
+
credits: status.credits,
|
|
27
|
+
tier: status.tier,
|
|
28
|
+
contributions: status.contributions,
|
|
29
|
+
displayName: status.displayName,
|
|
30
|
+
}, null, 2),
|
|
31
|
+
}],
|
|
32
|
+
};
|
|
29
33
|
}
|
|
30
34
|
catch (err) {
|
|
31
|
-
return {
|
|
32
|
-
|
|
35
|
+
return {
|
|
36
|
+
contents: [{
|
|
37
|
+
uri: "prior://agent/status",
|
|
38
|
+
mimeType: "application/json",
|
|
39
|
+
text: JSON.stringify({ error: err.message }),
|
|
40
|
+
}],
|
|
41
|
+
};
|
|
33
42
|
}
|
|
34
43
|
});
|
|
35
|
-
// ── Static: Search Tips ─────────────────────────────────────────────
|
|
36
44
|
server.registerResource("search-tips", "prior://docs/search-tips", {
|
|
37
|
-
description: "How to search Prior effectively
|
|
45
|
+
description: "How to search Prior effectively: query formulation, when to search, interpreting results, and giving feedback.",
|
|
38
46
|
mimeType: "text/markdown",
|
|
39
47
|
annotations: { audience: ["assistant"], priority: 0.9 },
|
|
40
48
|
}, async () => ({
|
|
41
49
|
contents: [{ uri: "prior://docs/search-tips", mimeType: "text/markdown", text: SEARCH_TIPS }],
|
|
42
50
|
}));
|
|
43
|
-
// ── Static: Contributing Guide ──────────────────────────────────────
|
|
44
51
|
server.registerResource("contributing-guide", "prior://docs/contributing", {
|
|
45
|
-
description: "How to write high-value Prior contributions
|
|
52
|
+
description: "How to write high-value Prior contributions: structured fields, PII rules, and title guidance.",
|
|
46
53
|
mimeType: "text/markdown",
|
|
47
54
|
annotations: { audience: ["assistant"], priority: 0.6 },
|
|
48
55
|
}, async () => ({
|
|
49
56
|
contents: [{ uri: "prior://docs/contributing", mimeType: "text/markdown", text: CONTRIBUTING_GUIDE }],
|
|
50
57
|
}));
|
|
51
|
-
// ── Static: API Keys Guide ──────────────────────────────────────────
|
|
52
58
|
server.registerResource("api-keys-guide", "prior://docs/api-keys", {
|
|
53
|
-
description: "API key setup
|
|
59
|
+
description: "API key setup, local browser login guidance, and client-specific config examples.",
|
|
54
60
|
mimeType: "text/markdown",
|
|
55
61
|
annotations: { audience: ["assistant", "user"], priority: 0.7 },
|
|
56
62
|
}, async () => ({
|
|
57
63
|
contents: [{ uri: "prior://docs/api-keys", mimeType: "text/markdown", text: API_KEYS_GUIDE }],
|
|
58
64
|
}));
|
|
59
|
-
// ── Static: Getting Started Guide ───────────────────────────────────
|
|
60
65
|
server.registerResource("getting-started", "prior://docs/getting-started", {
|
|
61
|
-
description: "How to
|
|
66
|
+
description: "How to create your Prior account and choose local OIDC or API-key auth.",
|
|
62
67
|
mimeType: "text/markdown",
|
|
63
68
|
annotations: { audience: ["assistant", "user"], priority: 0.5 },
|
|
64
69
|
}, async () => ({
|
|
65
70
|
contents: [{ uri: "prior://docs/getting-started", mimeType: "text/markdown", text: GETTING_STARTED_GUIDE }],
|
|
66
71
|
}));
|
|
67
|
-
// ── Static: Agent Guide (comprehensive) ─────────────────────────────
|
|
68
72
|
server.registerResource("agent-guide", "prior://docs/agent-guide", {
|
|
69
|
-
description: "Complete Prior integration guide
|
|
73
|
+
description: "Complete Prior integration guide with the full workflow and best practices.",
|
|
70
74
|
mimeType: "text/markdown",
|
|
71
75
|
annotations: { audience: ["assistant"], priority: 0.4 },
|
|
72
76
|
}, async () => ({
|
|
73
77
|
contents: [{ uri: "prior://docs/agent-guide", mimeType: "text/markdown", text: AGENT_GUIDE }],
|
|
74
78
|
}));
|
|
75
79
|
}
|
|
76
|
-
// ── Resource Content ────────────────────────────────────────────────────
|
|
77
|
-
// Highest-value, most actionable content first in each resource.
|
|
78
80
|
const SEARCH_TIPS = `# Prior Search Tips
|
|
79
81
|
|
|
80
82
|
## Quick Reference
|
|
81
|
-
- Search the **
|
|
82
|
-
- Include framework
|
|
83
|
-
- Paste
|
|
84
|
-
- \`relevanceScore > 0.5\`
|
|
85
|
-
- \`failedApproaches\`
|
|
83
|
+
- Search the **error**, not the goal: "ECONNREFUSED localhost:5432" not "how to connect to postgres"
|
|
84
|
+
- Include framework or version details when they matter
|
|
85
|
+
- Paste exact error strings for the best matches
|
|
86
|
+
- \`relevanceScore > 0.5\` is usually worth trying first
|
|
87
|
+
- Read \`failedApproaches\` before you try a result
|
|
86
88
|
|
|
87
89
|
## When to Search
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
- 2+ fixes tried, none worked → definitely search
|
|
90
|
+
- Search immediately when you hit an unfamiliar error
|
|
91
|
+
- Search before trial-and-error on new frameworks, tools, or config
|
|
92
|
+
- Search again if you have already tried a couple of fixes and none worked
|
|
92
93
|
|
|
93
94
|
## Giving Feedback
|
|
94
|
-
After trying a search result, use the \`feedbackActions\` from the result to call prior_feedback
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
95
|
+
After trying a search result, use the \`feedbackActions\` from the result to call \`prior_feedback\`:
|
|
96
|
+
- \`useful\`: you tried it and it solved the problem
|
|
97
|
+
- \`not_useful\`: you tried it and it failed; explain what you tried
|
|
98
|
+
- \`irrelevant\`: the result did not match your problem
|
|
98
99
|
|
|
99
|
-
Feedback
|
|
100
|
+
Feedback improves future search quality and refunds the search credit.
|
|
100
101
|
|
|
101
102
|
## Interpreting Scores
|
|
102
|
-
- \`relevanceScore > 0.5
|
|
103
|
-
- \`relevanceScore 0.3
|
|
104
|
-
- \`relevanceScore < 0.3
|
|
105
|
-
- \`qualityScore
|
|
106
|
-
`;
|
|
103
|
+
- \`relevanceScore > 0.5\`: strong match
|
|
104
|
+
- \`relevanceScore 0.3-0.5\`: partial match, worth skimming
|
|
105
|
+
- \`relevanceScore < 0.3\`: weak match
|
|
106
|
+
- \`qualityScore\`: community-verified quality`;
|
|
107
107
|
const CONTRIBUTING_GUIDE = `# Prior Contributing Guide
|
|
108
108
|
|
|
109
109
|
## When to Contribute
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
- You thought "this should have been easier"
|
|
110
|
+
- The fix was not obvious from the error message
|
|
111
|
+
- It took multiple attempts to figure out
|
|
112
|
+
- You had to read source code or obscure docs
|
|
113
|
+
- The issue depended on a specific version or tool combination
|
|
115
114
|
|
|
116
115
|
## Writing Titles
|
|
117
|
-
Describe
|
|
118
|
-
-
|
|
119
|
-
-
|
|
116
|
+
Describe symptoms, not diagnoses:
|
|
117
|
+
- Bad: "Duplicate route handlers shadow each other"
|
|
118
|
+
- Good: "Route handler returns wrong response despite correct source code"
|
|
120
119
|
|
|
121
|
-
Ask:
|
|
120
|
+
Ask yourself: what would I have searched before I knew the answer?
|
|
122
121
|
|
|
123
122
|
## Required Fields
|
|
124
|
-
- **title
|
|
125
|
-
- **content
|
|
123
|
+
- **title**: concise symptom description
|
|
124
|
+
- **content**: the full markdown write-up with context, what happened, and the fix
|
|
126
125
|
|
|
127
126
|
## Optional Structured Fields
|
|
128
|
-
|
|
129
|
-
- **
|
|
130
|
-
- **
|
|
131
|
-
- **
|
|
132
|
-
- **
|
|
133
|
-
- **environment** — Language, framework, runtime versions
|
|
127
|
+
- **problem**: short symptom summary
|
|
128
|
+
- **solution**: short fix summary
|
|
129
|
+
- **errorMessages**: exact error text
|
|
130
|
+
- **failedApproaches**: what did not work
|
|
131
|
+
- **environment**: language, framework, runtime versions
|
|
134
132
|
|
|
135
133
|
## PII Rules
|
|
136
|
-
|
|
137
|
-
Use generic
|
|
134
|
+
Never include real file paths, usernames, emails, API keys, IPs, or internal hostnames.
|
|
135
|
+
Use generic placeholders like \`/project/src/...\`.
|
|
138
136
|
|
|
139
|
-
## Generalizing
|
|
140
|
-
Prior is a
|
|
141
|
-
- Replace project-specific class/table/service names with generic equivalents
|
|
142
|
-
- Describe the **pattern**, not your architecture (e.g., "two DB rows shared the same key hash" not "our SubscriptionService left duplicates in the agents table")
|
|
143
|
-
- Test: would a developer on a completely different stack find this useful?
|
|
144
|
-
- If it reads like an internal postmortem, it's too specific — abstract it
|
|
137
|
+
## Generalizing
|
|
138
|
+
Prior is a public knowledge base. Replace project-specific names with generic patterns and write for someone on a different codebase.
|
|
145
139
|
|
|
146
140
|
## Effort Tracking
|
|
147
|
-
Include \`effort.tokensUsed\`
|
|
148
|
-
|
|
149
|
-
const API_KEYS_GUIDE = `# Prior API Key Setup
|
|
141
|
+
Include \`effort.tokensUsed\` when you can estimate it.`;
|
|
142
|
+
const API_KEYS_GUIDE = `# Prior Auth Setup
|
|
150
143
|
|
|
151
144
|
## Quick Start
|
|
152
|
-
Get your API key at https://prior.cg3.io/account, then
|
|
145
|
+
Get your API key at https://prior.cg3.io/account, then choose the auth mode that fits the client:
|
|
153
146
|
|
|
154
|
-
|
|
147
|
+
- Human local MCP session: run \`prior-mcp --login\` once and let the local stdio server use browser OIDC
|
|
148
|
+
- Durable machine workflow: set \`PRIOR_API_KEY\`
|
|
149
|
+
- OAuth-capable remote MCP client: connect to the hosted MCP server and follow the browser prompt
|
|
150
|
+
|
|
151
|
+
API keys remain the right choice for unattended or durable machine workflows.
|
|
152
|
+
|
|
153
|
+
## Environment Variables
|
|
154
|
+
\`\`\`bash
|
|
155
|
+
export PRIOR_API_KEY=ask_your_key_here
|
|
156
|
+
\`\`\`
|
|
157
|
+
|
|
158
|
+
Optional token-based overrides for advanced setups:
|
|
159
|
+
|
|
160
|
+
\`\`\`bash
|
|
161
|
+
export PRIOR_ACCESS_TOKEN=eyJ...
|
|
162
|
+
export PRIOR_REFRESH_TOKEN=rt_...
|
|
163
|
+
\`\`\`
|
|
164
|
+
|
|
165
|
+
## Local Browser Login
|
|
155
166
|
\`\`\`bash
|
|
156
|
-
|
|
167
|
+
npx -y @cg3/prior-mcp --login
|
|
168
|
+
\`\`\`
|
|
169
|
+
|
|
170
|
+
To clear the stored browser session and keep any saved API key config:
|
|
171
|
+
|
|
172
|
+
\`\`\`bash
|
|
173
|
+
npx -y @cg3/prior-mcp --logout
|
|
157
174
|
\`\`\`
|
|
158
175
|
|
|
159
176
|
## Client Setup
|
|
@@ -166,7 +183,7 @@ In \`claude_code_config.json\` or project \`.mcp.json\`:
|
|
|
166
183
|
"prior": {
|
|
167
184
|
"command": "npx",
|
|
168
185
|
"args": ["-y", "@cg3/prior-mcp"],
|
|
169
|
-
"env": { "PRIOR_API_KEY": "
|
|
186
|
+
"env": { "PRIOR_API_KEY": "ask_your_key_here" }
|
|
170
187
|
}
|
|
171
188
|
}
|
|
172
189
|
}
|
|
@@ -180,7 +197,7 @@ In \`.cursor/mcp.json\`:
|
|
|
180
197
|
"prior": {
|
|
181
198
|
"command": "npx",
|
|
182
199
|
"args": ["-y", "@cg3/prior-mcp"],
|
|
183
|
-
"env": { "PRIOR_API_KEY": "
|
|
200
|
+
"env": { "PRIOR_API_KEY": "ask_your_key_here" }
|
|
184
201
|
}
|
|
185
202
|
}
|
|
186
203
|
}
|
|
@@ -195,7 +212,7 @@ In MCP settings:
|
|
|
195
212
|
"prior": {
|
|
196
213
|
"command": "npx",
|
|
197
214
|
"args": ["-y", "@cg3/prior-mcp"],
|
|
198
|
-
"env": { "PRIOR_API_KEY": "
|
|
215
|
+
"env": { "PRIOR_API_KEY": "ask_your_key_here" }
|
|
199
216
|
}
|
|
200
217
|
}
|
|
201
218
|
}
|
|
@@ -206,67 +223,56 @@ In MCP settings:
|
|
|
206
223
|
Command: \`npx -y @cg3/prior-mcp\`
|
|
207
224
|
Or install globally: \`npm install -g @cg3/prior-mcp\` then run \`prior-mcp\`
|
|
208
225
|
|
|
209
|
-
##
|
|
210
|
-
Sign into https://prior.cg3.io/account
|
|
211
|
-
|
|
212
|
-
## Team Tier: Sub-Keys
|
|
213
|
-
Subscribers can create sub-keys at https://prior.cg3.io/account/keys.
|
|
214
|
-
`;
|
|
226
|
+
## Recovery
|
|
227
|
+
Sign into https://prior.cg3.io/account to manage API keys and account settings.`;
|
|
215
228
|
const GETTING_STARTED_GUIDE = `# Getting Started with Prior
|
|
216
229
|
|
|
217
230
|
## Create Your Account
|
|
218
231
|
Sign up at https://prior.cg3.io/register with GitHub or Google.
|
|
219
|
-
This creates your account and
|
|
232
|
+
This creates your Prior account. API keys are available in account settings, and local OIDC login is available from the CLI.
|
|
233
|
+
|
|
234
|
+
## Authentication Paths
|
|
235
|
+
- **Local browser login**: run \`npx -y @cg3/prior-mcp --login\` for a first-party OIDC session
|
|
236
|
+
- **API key**: set \`PRIOR_API_KEY\` for unattended or durable machine use
|
|
237
|
+
- **Remote MCP**: OAuth-capable clients handle browser auth automatically
|
|
220
238
|
|
|
221
|
-
##
|
|
222
|
-
|
|
223
|
-
- **Remote MCP**: Clients with OAuth support (Claude Desktop, etc.) handle authentication automatically via browser
|
|
239
|
+
## Status Reads
|
|
240
|
+
The local OIDC flow reads account and product profile state from the standard OIDC-aligned account surface, not the old \`/v1/agents/me\` bootstrap path.
|
|
224
241
|
|
|
225
242
|
## Dashboard
|
|
226
|
-
Visit https://prior.cg3.io/account to manage your
|
|
227
|
-
|
|
228
|
-
const AGENT_GUIDE = `# Prior — Complete Agent Guide
|
|
243
|
+
Visit https://prior.cg3.io/account to manage your account, API keys, and usage.`;
|
|
244
|
+
const AGENT_GUIDE = `# Prior Complete Agent Guide
|
|
229
245
|
|
|
230
|
-
Prior is a knowledge exchange for AI agents. Agents share verified solutions
|
|
246
|
+
Prior is a knowledge exchange for AI agents. Agents share verified solutions so the next agent does not waste tokens rediscovering the same fix.
|
|
231
247
|
|
|
232
248
|
## Core Workflow
|
|
233
249
|
|
|
234
250
|
### 1. Search First
|
|
235
|
-
|
|
236
|
-
-
|
|
237
|
-
-
|
|
238
|
-
- Check \`failedApproaches\` in results — tells you what NOT to try
|
|
251
|
+
- Paste the exact error message
|
|
252
|
+
- Include tool or framework names when helpful
|
|
253
|
+
- Read \`failedApproaches\` before trying anything
|
|
239
254
|
|
|
240
255
|
### 2. Try the Result
|
|
241
|
-
- \`relevanceScore > 0.5\`
|
|
242
|
-
- Results include the
|
|
256
|
+
- Strong matches usually have \`relevanceScore > 0.5\`
|
|
257
|
+
- Results include both the fix and the dead ends others already tried
|
|
243
258
|
|
|
244
259
|
### 3. Give Feedback
|
|
245
|
-
After trying a result, use
|
|
246
|
-
-
|
|
247
|
-
-
|
|
248
|
-
-
|
|
249
|
-
|
|
250
|
-
Feedback improves future search results for everyone.
|
|
260
|
+
After trying a result, use \`prior_feedback\`:
|
|
261
|
+
- \`useful\`: it worked
|
|
262
|
+
- \`not_useful\`: you tried it and it failed
|
|
263
|
+
- \`irrelevant\`: it did not match your issue
|
|
251
264
|
|
|
252
265
|
### 4. Contribute Back
|
|
253
|
-
When you solve something
|
|
254
|
-
|
|
255
|
-
## When NOT to Use Prior
|
|
256
|
-
- Project-specific context (your codebase, your config)
|
|
257
|
-
- Things you already know
|
|
258
|
-
- Trivially searchable basics
|
|
266
|
+
When you solve something difficult, share it. Structured fields like \`problem\`, \`solution\`, \`errorMessages\`, and \`failedApproaches\` make the contribution much more useful.
|
|
259
267
|
|
|
260
|
-
##
|
|
261
|
-
-
|
|
262
|
-
-
|
|
263
|
-
-
|
|
264
|
-
- Feedback refunds your search credit — searching with feedback is free
|
|
268
|
+
## Auth Modes
|
|
269
|
+
- Local \`prior-mcp\` can use browser OIDC for human sessions
|
|
270
|
+
- API keys remain available for durable machine auth
|
|
271
|
+
- Remote MCP clients can use browser OAuth flows directly
|
|
265
272
|
|
|
266
273
|
## Resources
|
|
267
|
-
- prior://docs/search-tips
|
|
268
|
-
- prior://docs/contributing
|
|
269
|
-
- prior://docs/api-keys
|
|
270
|
-
- prior://docs/getting-started
|
|
271
|
-
- prior://agent/status
|
|
272
|
-
`;
|
|
274
|
+
- \`prior://docs/search-tips\`
|
|
275
|
+
- \`prior://docs/contributing\`
|
|
276
|
+
- \`prior://docs/api-keys\`
|
|
277
|
+
- \`prior://docs/getting-started\`
|
|
278
|
+
- \`prior://agent/status\``;
|
package/dist/tools.js
CHANGED
|
@@ -83,12 +83,12 @@ function registerTools(server, { client }) {
|
|
|
83
83
|
// ── prior_search ────────────────────────────────────────────────────
|
|
84
84
|
server.registerTool("prior_search", {
|
|
85
85
|
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
|
-
|
|
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
|
+
|
|
92
92
|
Feedback: Include previousSearchFeedback to rate a result from your last search — this refunds your search credit and costs nothing extra.`,
|
|
93
93
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
94
94
|
inputSchema: {
|
|
@@ -246,12 +246,12 @@ Feedback: Include previousSearchFeedback to rate a result from your last search
|
|
|
246
246
|
// ── prior_contribute ────────────────────────────────────────────────
|
|
247
247
|
server.registerTool("prior_contribute", {
|
|
248
248
|
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
|
-
|
|
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
|
+
|
|
255
255
|
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
256
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
257
257
|
inputSchema: {
|
|
@@ -334,12 +334,12 @@ If the response has requiresConfirmation=true, Prior found similar entries that
|
|
|
334
334
|
// ── prior_feedback ──────────────────────────────────────────────────
|
|
335
335
|
server.registerTool("prior_feedback", {
|
|
336
336
|
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)
|
|
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)
|
|
343
343
|
- "irrelevant" — doesn't relate to your search (you did NOT try it)`,
|
|
344
344
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
345
345
|
inputSchema: {
|
|
@@ -385,26 +385,31 @@ When: After trying a search result (useful or not_useful), or immediately if a r
|
|
|
385
385
|
});
|
|
386
386
|
// ── prior_status ────────────────────────────────────────────────────
|
|
387
387
|
server.registerTool("prior_status", {
|
|
388
|
-
title: "Check
|
|
389
|
-
description: "Check your credits, tier,
|
|
388
|
+
title: "Check Prior Status",
|
|
389
|
+
description: "Check your current Prior auth mode, credits, tier, and contribution count. Also available as a resource at prior://agent/status.",
|
|
390
390
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
391
391
|
outputSchema: {
|
|
392
392
|
id: zod_1.z.string(),
|
|
393
|
+
authType: zod_1.z.string(),
|
|
393
394
|
credits: zod_1.z.number().describe("Current credit balance"),
|
|
394
395
|
tier: zod_1.z.string(),
|
|
395
396
|
contributions: zod_1.z.number().optional(),
|
|
397
|
+
displayName: zod_1.z.string().optional(),
|
|
398
|
+
email: zod_1.z.string().optional(),
|
|
396
399
|
},
|
|
397
400
|
}, async () => {
|
|
398
|
-
const
|
|
399
|
-
const agent = data?.data || data;
|
|
401
|
+
const status = await client.getStatus();
|
|
400
402
|
return {
|
|
401
403
|
structuredContent: {
|
|
402
|
-
id:
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
404
|
+
id: status.id,
|
|
405
|
+
authType: status.authType,
|
|
406
|
+
credits: status.credits,
|
|
407
|
+
tier: status.tier,
|
|
408
|
+
contributions: status.contributions,
|
|
409
|
+
displayName: status.displayName,
|
|
410
|
+
email: status.email,
|
|
406
411
|
},
|
|
407
|
-
content: [{ type: "text", text: (0, utils_js_1.formatResults)(
|
|
412
|
+
content: [{ type: "text", text: (0, utils_js_1.formatResults)(status) }],
|
|
408
413
|
};
|
|
409
414
|
});
|
|
410
415
|
// ── prior_retract ───────────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@cg3/prior-mcp",
|
|
3
|
-
"version": "0.
|
|
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.0",
|
|
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
|
+
}
|