promptlike-mcp 0.4.1 → 0.4.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2 — 2026-10-12
4
+
5
+ - **Security:** `@modelcontextprotocol/sdk` is now `^1.31.0` (was `^1.30.1`).
6
+ Versions 1.12.0 to 1.30.1 had an OAuth client that could send stored
7
+ credentials to an authorization server named by the MCP server
8
+ (GHSA-6qxp-vccf-f47h). This server runs over stdio and does not use the
9
+ SDK's OAuth client, so it was not exposed in practice; the floor now makes
10
+ sure no install resolves a vulnerable SDK. The transitive `proxy-addr`
11
+ (IP spoofing under `trust proxy`, GHSA-jqcg-44mw-7w3h) and the dev-only
12
+ `source-map-js` are patched in the lock file as well. `npm audit` reports
13
+ 0 vulnerabilities.
14
+ - **Changed:** `list_prompts` and `search_prompts` are paged. New optional
15
+ `page` (1-based); `limit` is now per page. The reply keeps `total` and
16
+ `prompts` and adds `page`, `total_pages` and `has_more`. `total` is the real
17
+ result count; before, it was the length of the returned page, so a library of
18
+ 120 prompts reported `total: 50`. If the extra request that finds the real
19
+ total fails (rate limit, network), the page is still returned: `total` is
20
+ then a lower bound and the reply carries `total_exact: false`.
21
+ - **Fix:** short-id lookups (`get_prompt`, `fill_variables`, ...) no longer stop
22
+ at the newest 100 prompts; they walk the pages (up to 2000 prompts) and stop
23
+ at the first page with a match.
24
+
3
25
  ## 0.4.1 — 2026-09-28
4
26
 
5
27
  - Official MCP Registry name is now `io.github.zeynepaslierhan/promptlike-mcp` (user namespace; the org namespace cannot be verified by the registry). No code changes.
package/README.md CHANGED
@@ -46,8 +46,8 @@ Every prompt is also a resource, `promptlike://<repo>/<prompt>` (`text/markdown`
46
46
 
47
47
  | Tool | What it does |
48
48
  |---|---|
49
- | `list_prompts` | List your prompts (optional `tag` filter). Includes each prompt's `{{variable}}` names. |
50
- | `search_prompts` | Search by title/description. |
49
+ | `list_prompts` | List your prompts (optional `tag` filter). Includes each prompt's `{{variable}}` names. Paged: `limit` + `page`; the reply carries the real `total`, `total_pages` and `has_more`. |
50
+ | `search_prompts` | Search by title/description. Same paging as `list_prompts`. |
51
51
  | `get_prompt` | Full content by name/id/short-id, optional `version` pin. `via: "suggestion"` when fetching a suggested prompt. |
52
52
  | `fill_variables` | Fetch + substitute `{{variables}}`, returns ready-to-use text (unfilled ones reported in `missing_variables`). |
53
53
  | `suggest_prompts` | Up to 3 prompts from your own library that fit a task (call once at the start of a non-trivial task). |
@@ -12,6 +12,13 @@ exports.resolvePromptByName = resolvePromptByName;
12
12
  const api_client_1 = require("./api-client");
13
13
  const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
14
14
  const SHORT_ID_RE = /^[0-9a-f]{8,}$/i;
15
+ /** Server cap per page (GET /api/prompts maxLimit). */
16
+ const PAGE_LIMIT = 100;
17
+ /**
18
+ * Upper bound for the short-id walk: 20 pages x 100 = 2000 prompts (newest first). Keeps a
19
+ * worst-case lookup at 20 requests, well inside the per-minute read budget.
20
+ */
21
+ const MAX_ID_PAGES = 20;
15
22
  function toCandidates(rows) {
16
23
  // Aday listesinde repo adını da ver (F-analiz): agent aynı başlıklı iki
17
24
  // prompt'u ayırt edip project ile daraltabilsin.
@@ -48,6 +55,31 @@ async function hydrate(row) {
48
55
  return { status: 'not_found' };
49
56
  return { status: 'found', prompt: detail };
50
57
  }
58
+ /**
59
+ * Walks GET /api/prompts page by page (updated_at desc, stable id tie-break) and returns the
60
+ * prompts whose id starts with `prefix`. Stops at the first page that has a hit (that page's
61
+ * hits are all returned, so same-page ambiguity is still reported), at the server's last page
62
+ * (`totalPages`), after MAX_ID_PAGES, or if the server ignores `page` and repeats the first page.
63
+ * Before this, only the first 100 prompts were looked at, so a user with 100+ prompts got
64
+ * not_found (or a wrong title-search fallback) for any older prompt's short id.
65
+ */
66
+ async function findByShortId(prefix, projectId) {
67
+ const lower = prefix.toLowerCase();
68
+ let firstId;
69
+ for (let page = 1; page <= MAX_ID_PAGES; page++) {
70
+ const { prompts, totalPages } = await (0, api_client_1.listPromptsPage)({ limit: PAGE_LIMIT, page, projectId });
71
+ const matches = prompts.filter((p) => p.id.toLowerCase().startsWith(lower));
72
+ if (matches.length > 0)
73
+ return matches;
74
+ if (prompts.length < PAGE_LIMIT || page >= totalPages)
75
+ break; // last page
76
+ if (page === 1)
77
+ firstId = prompts[0]?.id;
78
+ else if (prompts[0]?.id === firstId)
79
+ break; // server ignored `page` → same rows again
80
+ }
81
+ return [];
82
+ }
51
83
  async function resolvePromptByName(name, scope = {}) {
52
84
  const trimmed = name.trim();
53
85
  if (!trimmed) {
@@ -65,11 +97,9 @@ async function resolvePromptByName(name, scope = {}) {
65
97
  }
66
98
  // Not found by id — fall through to a title search.
67
99
  }
68
- // 2) Short-id prefix (hex, 8+ chars, not a full UUID) → match a page.
100
+ // 2) Short-id prefix (hex, 8+ chars, not a full UUID) → walk the pages.
69
101
  if (!UUID_RE.test(trimmed) && SHORT_ID_RE.test(trimmed)) {
70
- const page = await (0, api_client_1.listPrompts)({ limit: 100, projectId });
71
- const lower = trimmed.toLowerCase();
72
- const matches = page.filter((p) => p.id.toLowerCase().startsWith(lower));
102
+ const matches = await findByShortId(trimmed, projectId);
73
103
  if (matches.length === 1)
74
104
  return hydrate(matches[0]);
75
105
  if (matches.length > 1)
package/dist/server.js CHANGED
@@ -74,6 +74,48 @@ function summarize(p) {
74
74
  variables: (0, promptVariables_1.extractVariables)((0, promptText_1.versionText)(p.current_version)),
75
75
  };
76
76
  }
77
+ /**
78
+ * list_prompts / search_prompts için bir sayfa + GERÇEK toplam.
79
+ *
80
+ * Eskiden yanıttaki `total` sayfanın uzunluğuydu (`prompts.length`): 120 prompt'u olan kullanıcıda
81
+ * agent "total: 50" görüp kütüphanenin bu kadar olduğunu sanıyordu. Sunucu `totalPages` döndürür;
82
+ * `total` = (totalPages - 1) * limit + son sayfanın uzunluğu. Son sayfa zaten bu sayfaysa ek istek
83
+ * yok (tek sayfalık kütüphanede her zaman böyle); değilse son sayfa için tek ek istek atılır.
84
+ * api-client korumalı yol olduğundan sunucunun `total` alanı yerine bu türetme kullanılıyor.
85
+ *
86
+ * Toplamı bulan ek istek başarısız olursa (429, ağ kesintisi) elimizdeki sayfa yine döner: sayfa
87
+ * zaten alınmıştı, toplam yalnız bilgi amaçlı. `total` o durumda alt sınırdır (son sayfada en az 1
88
+ * öğe vardır) ve yanıta `total_exact: false` eklenir; tam olduğunda alan hiç yazılmaz.
89
+ */
90
+ async function fetchPromptPage(q) {
91
+ const { prompts, totalPages } = await (0, api_client_1.listPromptsPage)(q);
92
+ let total = 0;
93
+ let exact = true;
94
+ if (totalPages > 0) {
95
+ let lastLength;
96
+ if (q.page === totalPages) {
97
+ lastLength = prompts.length;
98
+ }
99
+ else {
100
+ try {
101
+ lastLength = (await (0, api_client_1.listPromptsPage)({ ...q, page: totalPages })).prompts.length;
102
+ }
103
+ catch {
104
+ lastLength = 1;
105
+ exact = false;
106
+ }
107
+ }
108
+ total = (totalPages - 1) * q.limit + lastLength;
109
+ }
110
+ return {
111
+ total,
112
+ ...(exact ? {} : { total_exact: false }),
113
+ page: q.page,
114
+ total_pages: totalPages,
115
+ has_more: q.page < totalPages,
116
+ prompts: prompts.map(summarize),
117
+ };
118
+ }
77
119
  // ---------------------------------------------------------------------------
78
120
  // Prompt catalog (prompts/list + prompts/get)
79
121
  // ---------------------------------------------------------------------------
@@ -295,29 +337,26 @@ function createServer(options = {}) {
295
337
  title: 'List prompts',
296
338
  description: "List the user's saved prompts from their PromptLikeEngineer library. " +
297
339
  'Optionally filter by tag. Returns id, title, description, updated_at and ' +
298
- 'the {{variable}} names each prompt expects.',
340
+ 'the {{variable}} names each prompt expects. Paged: `total` is the full count, ' +
341
+ 'and when `has_more` is true call again with `page` + 1.',
299
342
  inputSchema: {
300
343
  tag: zod_1.z.string().optional().describe('Filter by tag name'),
301
- limit: zod_1.z.number().int().min(1).max(100).optional().describe('Max results (default 50)'),
344
+ limit: zod_1.z.number().int().min(1).max(100).optional().describe('Results per page (default 50)'),
345
+ page: zod_1.z.number().int().min(1).optional().describe('Page number, 1-based (default 1)'),
302
346
  },
303
347
  annotations: READ_ONLY,
304
- }, async ({ tag, limit }) => guarded(async () => {
305
- const prompts = await (0, api_client_1.listPrompts)({ tag, limit: limit ?? 50 });
306
- return ok({ total: prompts.length, prompts: prompts.map(summarize) });
307
- }));
348
+ }, async ({ tag, limit, page }) => guarded(async () => ok(await fetchPromptPage({ tag, limit: limit ?? 50, page: page ?? 1 }))));
308
349
  server.registerTool('search_prompts', {
309
350
  title: 'Search prompts',
310
351
  description: "Search the user's prompt library by title and description. " +
311
- 'Returns the same shape as list_prompts.',
352
+ 'Returns the same (paged) shape as list_prompts.',
312
353
  inputSchema: {
313
354
  query: zod_1.z.string().min(1).describe('Search text (matched against title + description)'),
314
- limit: zod_1.z.number().int().min(1).max(100).optional().describe('Max results (default 20)'),
355
+ limit: zod_1.z.number().int().min(1).max(100).optional().describe('Results per page (default 20)'),
356
+ page: zod_1.z.number().int().min(1).optional().describe('Page number, 1-based (default 1)'),
315
357
  },
316
358
  annotations: READ_ONLY,
317
- }, async ({ query, limit }) => guarded(async () => {
318
- const prompts = await (0, api_client_1.listPrompts)({ search: query, limit: limit ?? 20 });
319
- return ok({ total: prompts.length, prompts: prompts.map(summarize) });
320
- }));
359
+ }, async ({ query, limit, page }) => guarded(async () => ok(await fetchPromptPage({ search: query, limit: limit ?? 20, page: page ?? 1 }))));
321
360
  server.registerTool('get_prompt', {
322
361
  title: 'Get prompt content',
323
362
  description: 'Fetch the full content of one prompt by name, title, id or short-id. ' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptlike-mcp",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "mcpName": "io.github.zeynepaslierhan/promptlike-mcp",
5
5
  "description": "MCP server for PromptLikeEngineer - your prompt library as MCP tools, slash-command prompts and @-resources: list, search, get, fill {{variables}}, suggest, and save new prompts/versions (add-only).",
6
6
  "bin": {
@@ -48,7 +48,7 @@
48
48
  "node": ">=18"
49
49
  },
50
50
  "dependencies": {
51
- "@modelcontextprotocol/sdk": "^1.30.1",
51
+ "@modelcontextprotocol/sdk": "^1.31.0",
52
52
  "zod": "^3.25.76"
53
53
  },
54
54
  "devDependencies": {