promptgraph-mcp 2.9.13 → 2.9.15
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/index.js +42 -2
- package/package.json +2 -3
- package/opencode-plugin.js +0 -14
package/index.js
CHANGED
|
@@ -106,7 +106,7 @@ if (COMMAND_MAP[args[0]]) {
|
|
|
106
106
|
// ── MCP server mode (no CLI command) ──
|
|
107
107
|
const { Server } = await import('@modelcontextprotocol/sdk/server/index.js');
|
|
108
108
|
const { StdioServerTransport } = await import('@modelcontextprotocol/sdk/server/stdio.js');
|
|
109
|
-
const { CallToolRequestSchema, ListToolsRequestSchema } = await import('@modelcontextprotocol/sdk/types.js');
|
|
109
|
+
const { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema } = await import('@modelcontextprotocol/sdk/types.js');
|
|
110
110
|
const { search, getContext, getCallers, getCallees, getImpact, listAll } = await import('./search.js');
|
|
111
111
|
const { loadConfig: _loadConfig, saveConfig: _saveConfig } = await import('./config.js');
|
|
112
112
|
const { startWatcher } = await import('./watcher.js');
|
|
@@ -116,7 +116,7 @@ const { createRequire } = await import('module');
|
|
|
116
116
|
const pkg = createRequire(import.meta.url)('./package.json');
|
|
117
117
|
const server = new Server(
|
|
118
118
|
{ name: 'promptgraph', version: pkg.version },
|
|
119
|
-
{ capabilities: { tools: {} } }
|
|
119
|
+
{ capabilities: { tools: {}, prompts: {} } }
|
|
120
120
|
);
|
|
121
121
|
|
|
122
122
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
@@ -332,6 +332,46 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
332
332
|
}
|
|
333
333
|
});
|
|
334
334
|
|
|
335
|
+
server.setRequestHandler(ListPromptsRequestSchema, async () => ({
|
|
336
|
+
prompts: [
|
|
337
|
+
{
|
|
338
|
+
name: 'pg',
|
|
339
|
+
description: 'Search skills and load the best match for your task',
|
|
340
|
+
arguments: [{ name: 'query', description: 'What you want to do', required: true }],
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: 'pg-list',
|
|
344
|
+
description: 'List all indexed skills',
|
|
345
|
+
arguments: [],
|
|
346
|
+
},
|
|
347
|
+
],
|
|
348
|
+
}));
|
|
349
|
+
|
|
350
|
+
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
351
|
+
const { name, arguments: args } = request.params;
|
|
352
|
+
if (name === 'pg') {
|
|
353
|
+
const query = args?.query || '';
|
|
354
|
+
const results = await search(query, 3);
|
|
355
|
+
if (!results.length) return { messages: [{ role: 'user', content: { type: 'text', text: `No skills found for: ${query}` } }] };
|
|
356
|
+
const top = results[0];
|
|
357
|
+
const fs = await import('fs');
|
|
358
|
+
let content = '';
|
|
359
|
+
try { content = fs.readFileSync(top.path, 'utf8'); } catch {}
|
|
360
|
+
return {
|
|
361
|
+
messages: [{
|
|
362
|
+
role: 'user',
|
|
363
|
+
content: { type: 'text', text: `# Skill: ${top.name} (score: ${top.score?.toFixed(2)})\n\n${content}` },
|
|
364
|
+
}],
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
if (name === 'pg-list') {
|
|
368
|
+
const skills = await listAll();
|
|
369
|
+
const text = skills.map(s => `- **${s.name}** — ${s.description || ''}`).join('\n');
|
|
370
|
+
return { messages: [{ role: 'user', content: { type: 'text', text: text || 'No skills indexed.' } }] };
|
|
371
|
+
}
|
|
372
|
+
throw new Error(`Unknown prompt: ${name}`);
|
|
373
|
+
});
|
|
374
|
+
|
|
335
375
|
startWatcher();
|
|
336
376
|
|
|
337
377
|
const transport = new StdioServerTransport();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "promptgraph-mcp",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.15",
|
|
4
4
|
"files": [
|
|
5
5
|
"*.js",
|
|
6
6
|
"commands/",
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"main": "index.js",
|
|
13
13
|
"exports": {
|
|
14
|
-
".": "./index.js"
|
|
15
|
-
"./plugin": "./opencode-plugin.js"
|
|
14
|
+
".": "./index.js"
|
|
16
15
|
},
|
|
17
16
|
"type": "module",
|
|
18
17
|
"bin": {
|
package/opencode-plugin.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const PromptGraph = async () => {
|
|
2
|
-
return {
|
|
3
|
-
config: async (config) => {
|
|
4
|
-
config.mcp = config.mcp || {};
|
|
5
|
-
config.mcp.promptgraph = {
|
|
6
|
-
type: 'local',
|
|
7
|
-
command: ['npx', 'promptgraph-mcp'],
|
|
8
|
-
enabled: true,
|
|
9
|
-
};
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default PromptGraph;
|