promptlike-mcp 0.4.1 → 0.4.3

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,51 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.3 — 2026-10-12
4
+
5
+ - **Fix:** a network problem while the session is being refreshed (no DNS,
6
+ connection refused, a dropped connection) no longer reports "Session expired.
7
+ Run `ple login`". The tool error now says the server could not be reached:
8
+ check the connection and try the tool again. The saved login is kept. A
9
+ temporary server problem during the refresh (busy, rate limited, 5xx) says to
10
+ try the tool again in a moment and keeps the login; only if it keeps
11
+ happening does it suggest `ple login` in a terminal. Only a definite rejection
12
+ from the server (the refresh token expired, was revoked or was already used)
13
+ still asks for `ple login` right away. Nothing is retried automatically.
14
+ - **Fix:** tool calls no longer sit on a stuck server for about five minutes
15
+ (Node's built-in limit, which ended in a bare "fetch failed"). Reads
16
+ (`list_prompts`, `search_prompts`, `get_prompt`, `suggest_prompts`, ...) give
17
+ up after 15 s, writes (`save_prompt`, `update_prompt`, tags) after 30 s, with
18
+ a plain "No response from <url>" message. After a write times out the message
19
+ says the server may still have finished, so the agent checks before retrying.
20
+ - **Fix:** when the session refresh itself gets no answer within 30 s, the
21
+ message no longer says "the server may still have completed the request;
22
+ check before retrying" (that warning is for the agent's own writes and was
23
+ misleading on read tools). It now says the refresh did not finish: try the
24
+ tool again, and if it then reports an expired session, run `ple login` in a
25
+ terminal.
26
+
27
+ ## 0.4.2 — 2026-10-12
28
+
29
+ - **Security:** `@modelcontextprotocol/sdk` is now `^1.31.0` (was `^1.30.1`).
30
+ Versions 1.12.0 to 1.30.1 had an OAuth client that could send stored
31
+ credentials to an authorization server named by the MCP server
32
+ (GHSA-6qxp-vccf-f47h). This server runs over stdio and does not use the
33
+ SDK's OAuth client, so it was not exposed in practice; the floor now makes
34
+ sure no install resolves a vulnerable SDK. The transitive `proxy-addr`
35
+ (IP spoofing under `trust proxy`, GHSA-jqcg-44mw-7w3h) and the dev-only
36
+ `source-map-js` are patched in the lock file as well. `npm audit` reports
37
+ 0 vulnerabilities.
38
+ - **Changed:** `list_prompts` and `search_prompts` are paged. New optional
39
+ `page` (1-based); `limit` is now per page. The reply keeps `total` and
40
+ `prompts` and adds `page`, `total_pages` and `has_more`. `total` is the real
41
+ result count; before, it was the length of the returned page, so a library of
42
+ 120 prompts reported `total: 50`. If the extra request that finds the real
43
+ total fails (rate limit, network), the page is still returned: `total` is
44
+ then a lower bound and the reply carries `total_exact: false`.
45
+ - **Fix:** short-id lookups (`get_prompt`, `fill_variables`, ...) no longer stop
46
+ at the newest 100 prompts; they walk the pages (up to 2000 prompts) and stop
47
+ at the first page with a match.
48
+
3
49
  ## 0.4.1 — 2026-09-28
4
50
 
5
51
  - 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). |
@@ -9,10 +9,14 @@
9
9
  * - X-Client-Version header'ı `mcp/<sürüm>` gönderir.
10
10
  *
11
11
  * Sorumluluklar: bearer token ekleme, proaktif + reaktif (401→tek retry)
12
- * refresh, 429/hata gövdelerini temiz mesajlara map'leme.
12
+ * refresh, 429/hata gövdelerini temiz mesajlara map'leme, her isteği zaman
13
+ * aşımıyla sınırlama (O5 / PLE-03: asılı sunucu araç çağrısını sonsuza dek
14
+ * bekletmesin), yenilemede yalnız kesin reddi "oturum bitti" sayma (O11: ağ
15
+ * hatası ya da geçici sunucu hatası kayıtlı girişi korur).
13
16
  */
14
17
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.ApiError = exports.NOT_LOGGED_IN = void 0;
18
+ exports.ApiError = exports.NetworkError = exports.DEFINITIVE_REFRESH_CODES = exports.REFRESH_UNAVAILABLE_LAST_RESORT = exports.REFRESH_NETWORK_ADVICE = exports.REFRESH_TIMEOUT_ADVICE = exports.RequestTimeoutError = exports.USE_EVENT_TIMEOUT_MS = exports.WRITE_TIMEOUT_MS = exports.READ_TIMEOUT_MS = exports.NOT_LOGGED_IN = void 0;
19
+ exports.refreshUnavailableMessage = refreshUnavailableMessage;
16
20
  exports.ensureAuthed = ensureAuthed;
17
21
  exports.listPromptsPage = listPromptsPage;
18
22
  exports.listPrompts = listPrompts;
@@ -29,6 +33,94 @@ const constants_1 = require("./constants");
29
33
  const config_1 = require("./config");
30
34
  exports.NOT_LOGGED_IN = 'Not logged in. Run `ple login` in a terminal first (install: npm i -g promptlike).';
31
35
  const SESSION_EXPIRED = 'Session expired. Run `ple login` in a terminal to sign in again.';
36
+ /**
37
+ * İstek zaman aşımları (O5 / PLE-03; CLI ile aynı değerler). Süre gövde
38
+ * okumasını da kapsar. Otomatik tekrar deneme YOK: zaman aşımına uğrayan bir
39
+ * yazma sunucuda tamamlanmış olabilir; ileti ajana "önce kontrol et" der.
40
+ */
41
+ /** GET istekleri (liste, detay, öneri): hafif okumalar. */
42
+ exports.READ_TIMEOUT_MS = 15000;
43
+ /** GET dışı istekler (save_prompt, update_prompt, etiket, yenileme). */
44
+ exports.WRITE_TIMEOUT_MS = 30000;
45
+ /** Kullanım kaydı (fire-and-forget). */
46
+ exports.USE_EVENT_TIMEOUT_MS = 5000;
47
+ /** Zaman aşımı hatası — `refreshSession` bunu "oturum bitti"ye çevirmesin diye ayrı sınıf. */
48
+ class RequestTimeoutError extends Error {
49
+ constructor(timeoutMs, method, advice) {
50
+ const defaultAdvice = method === 'GET'
51
+ ? 'Check the connection and try again.'
52
+ : 'The server may still have completed the request; check before retrying.';
53
+ super(`No response from ${constants_1.API_BASE_URL} within ${Math.round(timeoutMs / 1000)}s. ${advice ?? defaultAdvice}`);
54
+ this.timeoutMs = timeoutMs;
55
+ this.name = 'RequestTimeoutError';
56
+ }
57
+ }
58
+ exports.RequestTimeoutError = RequestTimeoutError;
59
+ /**
60
+ * Oturum yenileme zaman aşımına uğradığında ajana söylenecek şey. Yenileme
61
+ * araç çağrısının kendisi değil, arka plandaki bir POST'tur; "yazma sunucuda
62
+ * tamamlanmış olabilir, önce kontrol et" uyarısı okuma araçlarında bile çıkıp
63
+ * yanıltırdı. Sunucu yenilemeyi tamamlamış ama yeni token yerelde saklanmamış
64
+ * olabilir; bu durumda bir sonraki çağrı "Session expired" der.
65
+ */
66
+ exports.REFRESH_TIMEOUT_ADVICE = 'Session refresh did not finish. Try the tool again; if it then reports an expired session, run `ple login` in a terminal.';
67
+ /**
68
+ * Yenileme isteği sunucuya hiç ulaşamadığında (DNS, bağlantı reddi, kopma; O11).
69
+ * Ağ hatası oturumun bittiğini göstermez: paylaşılan yerel oturum silinmez,
70
+ * ajan kullanıcıyı gereksiz yere `ple login`'e yönlendirmez.
71
+ */
72
+ exports.REFRESH_NETWORK_ADVICE = 'Could not refresh the session: check the connection and try the tool again. The saved login is kept.';
73
+ /**
74
+ * Sunucu yenilemeyi kesin reddetmedi ama tamamlayamadı (503 + Retry-After, 429,
75
+ * 5xx, tanınmayan yanıt; O11). Web `/api/auth/cli/refresh` sözleşmesi: geçici,
76
+ * oturum korunur. Otomatik tekrar YOK.
77
+ * Son çare cümlesi: web tanınmayan üst servis hatasını (kodsuz 401/403, yeni bir
78
+ * GoTrue kodu) da 503 geçici sayar; refresh token gerçekten iptal edilmişse ajan
79
+ * kullanıcıyı sonsuz "tekrar dene"de bırakmasın.
80
+ */
81
+ exports.REFRESH_UNAVAILABLE_LAST_RESORT = 'If this keeps happening, run `ple login` in a terminal.';
82
+ function refreshUnavailableMessage(detail) {
83
+ return `Could not refresh the session right now (${detail}). Try the tool again in a moment; the saved login is kept. ${exports.REFRESH_UNAVAILABLE_LAST_RESORT}`;
84
+ }
85
+ /**
86
+ * Sunucunun yenilemeyi KESİN reddettiğini gösteren yanıt kodları (O11). Web
87
+ * `src/app/api/auth/cli/refresh/_handlers/classify.ts` DEFINITIVE_CODES (GoTrue
88
+ * `error_code`) ile aynı liste + rotanın kendi `SESSION_EXPIRED` kodu; tutarlılık
89
+ * `api-client.refresh.test.ts` ile kilitli (CLI kopyasıyla da aynı).
90
+ */
91
+ exports.DEFINITIVE_REFRESH_CODES = new Set([
92
+ 'SESSION_EXPIRED',
93
+ 'refresh_token_not_found',
94
+ 'refresh_token_already_used',
95
+ 'session_expired',
96
+ 'session_not_found',
97
+ 'invalid_grant',
98
+ 'user_not_found',
99
+ 'user_banned',
100
+ 'validation_failed',
101
+ ]);
102
+ /** İstek sunucuya ulaşamadı (DNS, bağlantı reddi, kopma). Varsayılan ileti eskisiyle aynı. */
103
+ class NetworkError extends Error {
104
+ constructor(detail, advice = 'Check your connection.') {
105
+ super(`Cannot reach ${constants_1.API_BASE_URL}. ${advice} (${detail})`);
106
+ this.detail = detail;
107
+ this.name = 'NetworkError';
108
+ }
109
+ }
110
+ exports.NetworkError = NetworkError;
111
+ /**
112
+ * Hata süre aşımından mı geldi? Önce sinyalin kendisine bakılır: eski Node /
113
+ * undici sürümlerinde gövde okuması yarıda kesilince hata `TimeoutError` yerine
114
+ * `TypeError: terminated` gibi başka biçimde gelebilir; sinyal `aborted` ise
115
+ * sebep süre dolmasıdır, hatanın biçimi önemsizdir. Ad kontrolü yedektir
116
+ * (AbortSignal.timeout → `TimeoutError`, iptal → `AbortError`).
117
+ */
118
+ function isTimeout(err, signal) {
119
+ if (signal.aborted)
120
+ return true;
121
+ const name = err?.name;
122
+ return name === 'TimeoutError' || name === 'AbortError';
123
+ }
32
124
  /**
33
125
  * HTTP error with the status kept, so write tools can tell a plan limit
34
126
  * (403 + upgradeUrl / 429 LIMIT_EXCEEDED) from a real failure.
@@ -47,6 +139,18 @@ class ApiError extends Error {
47
139
  }
48
140
  }
49
141
  exports.ApiError = ApiError;
142
+ /**
143
+ * Yenileme yanıtı oturumun gerçekten bittiğini mi söylüyor? Web sözleşmesi:
144
+ * 401 SESSION_EXPIRED (kesin ret) ve 400 (refresh_token eksik: yerel oturum
145
+ * kaydı bozuk) kesindir; 503 / 429 / 5xx / ağ / zaman aşımı geçicidir.
146
+ */
147
+ function isDefinitiveRefreshRejection(err) {
148
+ if (!(err instanceof ApiError))
149
+ return false;
150
+ if (err.status === 401 || err.status === 400)
151
+ return true;
152
+ return err.code !== undefined && exports.DEFINITIVE_REFRESH_CODES.has(err.code);
153
+ }
50
154
  function buildUrl(path, query) {
51
155
  const u = new URL(constants_1.API_BASE_URL + path);
52
156
  if (query) {
@@ -99,13 +203,26 @@ async function refreshSession() {
99
203
  auth: false,
100
204
  });
101
205
  }
102
- catch {
103
- throw new Error(SESSION_EXPIRED);
206
+ catch (err) {
207
+ // Asılı sunucu "oturumun bitti, yeniden giriş yap" demek değildir.
208
+ if (err instanceof RequestTimeoutError) {
209
+ throw new RequestTimeoutError(err.timeoutMs, 'POST', exports.REFRESH_TIMEOUT_ADVICE);
210
+ }
211
+ // Yalnız sunucunun kesin reddi oturumu bitirir (O11).
212
+ if (isDefinitiveRefreshRejection(err))
213
+ throw new Error(SESSION_EXPIRED);
214
+ // Ağ hatası (DNS, bağlantı reddi): sunucuya ulaşılamadı, oturum hakkında bilgi yok.
215
+ if (err instanceof NetworkError)
216
+ throw new NetworkError(err.detail, exports.REFRESH_NETWORK_ADVICE);
217
+ // 503 / 429 / 5xx / tanınmayan yanıt: geçici; yerel oturum korunur.
218
+ throw new Error(refreshUnavailableMessage(err instanceof Error ? err.message : String(err)));
104
219
  }
105
220
  persist(data);
106
221
  }
107
222
  async function apiFetch(path, opts = {}) {
108
223
  const { method = 'GET', body, query, auth = true } = opts;
224
+ const timeoutMs = opts.timeoutMs ?? (method === 'GET' ? exports.READ_TIMEOUT_MS : exports.WRITE_TIMEOUT_MS);
225
+ const signal = AbortSignal.timeout(timeoutMs);
109
226
  const headers = {
110
227
  'Content-Type': 'application/json',
111
228
  'X-Client-Version': `mcp/${constants_1.MCP_VERSION}`,
@@ -119,10 +236,14 @@ async function apiFetch(path, opts = {}) {
119
236
  method,
120
237
  headers,
121
238
  body: body === undefined ? undefined : JSON.stringify(body),
239
+ // Süre başlıkla sınırlı değil: gövde okuması da aynı sinyalle kesilir.
240
+ signal,
122
241
  });
123
242
  }
124
243
  catch (err) {
125
- throw new Error(`Cannot reach ${constants_1.API_BASE_URL}. Check your connection. (${err instanceof Error ? err.message : String(err)})`);
244
+ if (isTimeout(err, signal))
245
+ throw new RequestTimeoutError(timeoutMs, method);
246
+ throw new NetworkError(err instanceof Error ? err.message : String(err));
126
247
  }
127
248
  if (res.status === 401 && auth) {
128
249
  if (opts._retried)
@@ -146,7 +267,15 @@ async function apiFetch(path, opts = {}) {
146
267
  if (!res.ok) {
147
268
  throw await toError(res);
148
269
  }
149
- return (await res.json());
270
+ try {
271
+ return (await res.json());
272
+ }
273
+ catch (err) {
274
+ // Başlıklar geldi, gövde yarıda kaldı ve süre doldu.
275
+ if (isTimeout(err, signal))
276
+ throw new RequestTimeoutError(timeoutMs, method);
277
+ throw err;
278
+ }
150
279
  }
151
280
  // ---------------------------------------------------------------------------
152
281
  // Public surface used by the tools / resolver
@@ -224,7 +353,11 @@ function sanitizeClientName(v) {
224
353
  * istemciyi ve `via`yı taşır (W1-1 olay defteri). Hata YUTULUR.
225
354
  */
226
355
  function recordPromptUse(promptId, opts = { surface: 'mcp_tool' }) {
227
- apiFetch(`/api/prompts/${promptId}/use`, { method: 'POST', body: buildUseEventBody(opts) }).catch(() => {
356
+ apiFetch(`/api/prompts/${promptId}/use`, {
357
+ method: 'POST',
358
+ body: buildUseEventBody(opts),
359
+ timeoutMs: exports.USE_EVENT_TIMEOUT_MS,
360
+ }).catch(() => {
228
361
  /* sessiz — telemetri */
229
362
  });
230
363
  }
@@ -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.3",
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": {