@k-system/tickr-mcp 1.1.0 → 1.1.1

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.
Files changed (2) hide show
  1. package/dist/server.js +5 -63
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -96,83 +96,25 @@ export async function startServer() {
96
96
  name: "tickr",
97
97
  version: "0.1.5",
98
98
  });
99
- // Dedup cache pro create operace eliminuje race condition z double dispatch (1-4ms gap)
100
- const MUTATING_PREFIXES = ["create_", "add_", "triage_accept", "triage_reject"];
101
- const dedupCache = new Map();
102
- const pendingOps = new Map();
103
- const DEDUP_TTL_MS = 30_000; // 30 sekund
104
- // Obalení server.tool — dedup cache (vždy) + debug logging (volitelné)
99
+ // Debug logging wrapperdedup řeší API server (Serializable transakce)
105
100
  {
106
101
  const debug = isDebugEnabled();
107
102
  const originalTool = server.tool.bind(server);
108
103
  const wrappedTool = function (...args) {
104
+ if (!debug)
105
+ return originalTool.apply(server, args);
109
106
  const handlerIndex = args.length - 1;
110
107
  const name = args[0];
111
108
  const originalHandler = args[handlerIndex];
112
- const isMutating = MUTATING_PREFIXES.some((p) => name.startsWith(p));
113
109
  args[handlerIndex] = async (params, extra) => {
114
- // Dedup pro mutující operace
115
- if (isMutating) {
116
- const hash = name + ":" + JSON.stringify(params);
117
- // 1. Check completed cache
118
- const cached = dedupCache.get(hash);
119
- if (cached && Date.now() - cached.timestamp < DEDUP_TTL_MS) {
120
- if (debug)
121
- debugLog(name, (params ?? {}), "dedup-cached", 0);
122
- return cached.result;
123
- }
124
- // 2. Check if another call with same params is already in-flight
125
- const pending = pendingOps.get(hash);
126
- if (pending) {
127
- if (debug)
128
- debugLog(name, (params ?? {}), "dedup-pending", 0);
129
- return pending;
130
- }
131
- // 3. Mark as pending BEFORE starting async work — prevents race condition
132
- const promise = (async () => {
133
- const start = Date.now();
134
- try {
135
- const result = await originalHandler(params, extra);
136
- // Cache úspěšné mutující výsledky
137
- if (!result.isError) {
138
- dedupCache.set(hash, { result, timestamp: Date.now() });
139
- if (dedupCache.size > 100) {
140
- const now = Date.now();
141
- for (const [k, v] of dedupCache) {
142
- if (now - v.timestamp > DEDUP_TTL_MS)
143
- dedupCache.delete(k);
144
- }
145
- }
146
- }
147
- if (debug)
148
- debugLog(name, (params ?? {}), result.isError ? "error" : "ok", Date.now() - start);
149
- return result;
150
- }
151
- catch (err) {
152
- if (debug)
153
- debugLog(name, (params ?? {}), "error", Date.now() - start);
154
- throw err;
155
- }
156
- })();
157
- pendingOps.set(hash, promise);
158
- try {
159
- return await promise;
160
- }
161
- finally {
162
- pendingOps.delete(hash);
163
- }
164
- }
165
- // Non-mutating operace — bez dedup
166
110
  const start = Date.now();
167
111
  try {
168
112
  const result = await originalHandler(params, extra);
169
- if (debug)
170
- debugLog(name, (params ?? {}), result.isError ? "error" : "ok", Date.now() - start);
113
+ debugLog(name, (params ?? {}), result.isError ? "error" : "ok", Date.now() - start);
171
114
  return result;
172
115
  }
173
116
  catch (err) {
174
- if (debug)
175
- debugLog(name, (params ?? {}), "error", Date.now() - start);
117
+ debugLog(name, (params ?? {}), "error", Date.now() - start);
176
118
  throw err;
177
119
  }
178
120
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k-system/tickr-mcp",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "MCP server for Tickr project management — 56 tools + setup CLI wizard",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",