promptlike-mcp 0.4.2 → 0.4.4

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,38 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.4 — 2026-10-13
4
+
5
+ - **Package metadata:** `repository` and `bugs` now point to the public plugin repository
6
+ (github.com/zeynepaslierhann/promptlike-plugin), which is where issues can be filed. No code change.
7
+ - **Docs (npm page):** the README no longer says MCP prompts show up in Cursor and Claude
8
+ Desktop: it says support varies by client and that the server was tested in Claude Code.
9
+ "Self-hosters" became a plain note about `PROMPTLIKE_API_URL`. Maintainer notes moved out
10
+ of the README into `DEVELOPMENT.md`, which is not part of the package.
11
+
12
+ ## 0.4.3 — 2026-10-12
13
+
14
+ - **Fix:** a network problem while the session is being refreshed (no DNS,
15
+ connection refused, a dropped connection) no longer reports "Session expired.
16
+ Run `ple login`". The tool error now says the server could not be reached:
17
+ check the connection and try the tool again. The saved login is kept. A
18
+ temporary server problem during the refresh (busy, rate limited, 5xx) says to
19
+ try the tool again in a moment and keeps the login; only if it keeps
20
+ happening does it suggest `ple login` in a terminal. Only a definite rejection
21
+ from the server (the refresh token expired, was revoked or was already used)
22
+ still asks for `ple login` right away. Nothing is retried automatically.
23
+ - **Fix:** tool calls no longer sit on a stuck server for about five minutes
24
+ (Node's built-in limit, which ended in a bare "fetch failed"). Reads
25
+ (`list_prompts`, `search_prompts`, `get_prompt`, `suggest_prompts`, ...) give
26
+ up after 15 s, writes (`save_prompt`, `update_prompt`, tags) after 30 s, with
27
+ a plain "No response from <url>" message. After a write times out the message
28
+ says the server may still have finished, so the agent checks before retrying.
29
+ - **Fix:** when the session refresh itself gets no answer within 30 s, the
30
+ message no longer says "the server may still have completed the request;
31
+ check before retrying" (that warning is for the agent's own writes and was
32
+ misleading on read tools). It now says the refresh did not finish: try the
33
+ tool again, and if it then reports an expired session, run `ple login` in a
34
+ terminal.
35
+
3
36
  ## 0.4.2 — 2026-10-12
4
37
 
5
38
  - **Security:** `@modelcontextprotocol/sdk` is now `^1.31.0` (was `^1.30.1`).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zeynep Aslı Erhan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -26,7 +26,7 @@ Any other MCP client: run `npx -y promptlike-mcp` over stdio.
26
26
  The server also implements the MCP **prompts** primitive (`prompts/list`, `prompts/get`), so clients that support it show your library as slash commands:
27
27
 
28
28
  - **Claude Code:** type `/` → `/mcp__promptlike__code-review`
29
- - **Cursor / Claude Desktop:** pick from the MCP prompt list
29
+ - **Other MCP clients:** support for MCP prompts varies by client. Tested in Claude Code; not yet tested in Cursor or Claude Desktop.
30
30
 
31
31
  | Your prompt | MCP prompt |
32
32
  |---|---|
@@ -68,17 +68,7 @@ The server never spends your AI tokens (no improve), and it does not use MCP sam
68
68
 
69
69
  - Ambiguous names return a candidate list (id + title) — call again with a more specific name or the id.
70
70
  - Rate limits surface as `Retry in Ns` messages so agents can back off.
71
- - Self-hosters: point at another deployment with `PROMPTLIKE_API_URL` (same env var the CLI honors).
71
+ - To point at another deployment of the web app (for example a local dev server), set `PROMPTLIKE_API_URL` (same env var the CLI honors).
72
72
  - Session store: `~/.config/promptlike/config.json` (written by `ple login`, file mode 0600).
73
73
 
74
- ## Publishing (maintainers)
75
-
76
- Same OIDC Trusted Publishing flow as the CLI — no npm token:
77
-
78
- ```bash
79
- npm --prefix mcp version patch --no-git-tag-version
80
- git add mcp/package.json mcp/package-lock.json && git commit -m "mcp: vX.Y.Z"
81
- git tag mcp-vX.Y.Z && git push origin main mcp-vX.Y.Z
82
- ```
83
-
84
- `.github/workflows/mcp-publish.yml` runs typecheck + tests + build, then publishes.
74
+ Website: <https://promptlikeengineer.com/?utm_source=npm&utm_medium=readme&utm_campaign=ple_dist>
package/dist/index.js CHANGED
@@ -3,8 +3,10 @@
3
3
  /**
4
4
  * promptlike-mcp — PromptLikeEngineer MCP server (stdio).
5
5
  *
6
- * AI agent'lara prompt kütüphanesine SALT-OKUNUR erişim verir (REV-4 v1
7
- * kapsamı: yazma/improve yok → agent'ın token yakma / veri bozma riski yok).
6
+ * AI agent'lara prompt kütüphanesine erişim verir: okuma araçları + yalnız-ekleme
7
+ * yazma araçları (save_prompt, update_prompt; silme aracı YOK, improve/AI harcaması
8
+ * YOK → agent'ın token yakma / veri silme riski yok). v0.1–0.3 salt-okunurdu; 0.4'ten
9
+ * beri yazabilir, "read-only" denmez.
8
10
  * Auth sıfır kurulum: CLI'ın `ple login` ile yazdığı
9
11
  * ~/.config/promptlike/config.json paylaşılır.
10
12
  *
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptlike-mcp",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
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": {
@@ -41,6 +41,13 @@
41
41
  },
42
42
  "license": "MIT",
43
43
  "homepage": "https://promptlikeengineer.com",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/zeynepaslierhann/promptlike-plugin.git"
47
+ },
48
+ "bugs": {
49
+ "url": "https://github.com/zeynepaslierhann/promptlike-plugin/issues"
50
+ },
44
51
  "publishConfig": {
45
52
  "access": "public"
46
53
  },