@topgunbuild/mcp-server 0.12.0 → 2.0.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.
package/dist/index.d.mts CHANGED
@@ -137,7 +137,6 @@ interface MutateToolArgs {
137
137
  interface SearchToolArgs {
138
138
  map: string;
139
139
  query: string;
140
- methods?: Array<'exact' | 'fulltext' | 'range'>;
141
140
  limit?: number;
142
141
  minScore?: number;
143
142
  }
package/dist/index.d.ts CHANGED
@@ -137,7 +137,6 @@ interface MutateToolArgs {
137
137
  interface SearchToolArgs {
138
138
  map: string;
139
139
  query: string;
140
- methods?: Array<'exact' | 'fulltext' | 'range'>;
141
140
  limit?: number;
142
141
  minScore?: number;
143
142
  }
package/dist/index.js CHANGED
@@ -23,7 +23,8 @@ var QueryArgsSchema = zod.z.object({
23
23
  order: zod.z.enum(["asc", "desc"]).describe("Sort order: ascending or descending")
24
24
  }).optional().describe("Sort configuration"),
25
25
  limit: zod.z.number().optional().default(10).describe("Maximum number of results to return"),
26
- cursor: zod.z.string().optional().describe("Opaque cursor for pagination (from previous response nextCursor)")
26
+ cursor: zod.z.string().optional().describe("Opaque cursor for pagination (from previous response nextCursor)"),
27
+ fields: zod.z.array(zod.z.string()).optional().describe("Field names to return (projection). If omitted, all fields are returned.")
27
28
  });
28
29
  var MutateArgsSchema = zod.z.object({
29
30
  map: zod.z.string().describe("Name of the map to modify (e.g., 'tasks', 'users')"),
@@ -34,7 +35,6 @@ var MutateArgsSchema = zod.z.object({
34
35
  var SearchArgsSchema = zod.z.object({
35
36
  map: zod.z.string().describe("Name of the map to search (e.g., 'articles', 'documents', 'tasks')"),
36
37
  query: zod.z.string().describe("Search query (keywords or phrases to find)"),
37
- methods: zod.z.array(zod.z.enum(["exact", "fulltext", "range"])).optional().default(["exact", "fulltext"]).describe('Search methods to use. Default: ["exact", "fulltext"]'),
38
38
  limit: zod.z.number().optional().default(10).describe("Maximum number of results to return"),
39
39
  minScore: zod.z.number().optional().default(0).describe("Minimum relevance score (0-1) for results")
40
40
  });
@@ -77,7 +77,12 @@ var toolSchemas = {
77
77
  description: "Sort configuration"
78
78
  },
79
79
  limit: { type: "number", description: "Maximum number of results to return", default: 10 },
80
- cursor: { type: "string", description: "Opaque cursor for pagination (from previous response nextCursor)" }
80
+ cursor: { type: "string", description: "Opaque cursor for pagination (from previous response nextCursor)" },
81
+ fields: {
82
+ type: "array",
83
+ items: { type: "string" },
84
+ description: "Field names to return (projection). If omitted, all fields are returned."
85
+ }
81
86
  },
82
87
  required: ["map"]
83
88
  },
@@ -104,12 +109,6 @@ var toolSchemas = {
104
109
  properties: {
105
110
  map: { type: "string", description: "Name of the map to search (e.g., 'articles', 'documents', 'tasks')" },
106
111
  query: { type: "string", description: "Search query (keywords or phrases to find)" },
107
- methods: {
108
- type: "array",
109
- items: { type: "string", enum: ["exact", "fulltext", "range"] },
110
- description: 'Search methods to use. Default: ["exact", "fulltext"]',
111
- default: ["exact", "fulltext"]
112
- },
113
112
  limit: { type: "number", description: "Maximum number of results to return", default: 10 },
114
113
  minScore: { type: "number", description: "Minimum relevance score (0-1) for results", default: 0 }
115
114
  },
@@ -179,7 +178,7 @@ async function handleQuery(rawArgs, ctx) {
179
178
  isError: true
180
179
  };
181
180
  }
182
- const { map, filter, sort, limit, cursor } = parseResult.data;
181
+ const { map, filter, sort, limit, cursor, fields } = parseResult.data;
183
182
  if (ctx.config.allowedMaps && !ctx.config.allowedMaps.includes(map)) {
184
183
  return {
185
184
  content: [
@@ -203,14 +202,34 @@ async function handleQuery(rawArgs, ctx) {
203
202
  if (cursor) {
204
203
  queryFilter.cursor = cursor;
205
204
  }
205
+ if (fields && fields.length > 0) {
206
+ queryFilter.fields = fields;
207
+ }
206
208
  const handle = ctx.client.query(map, queryFilter);
209
+ let unsubscribe;
207
210
  const results = await new Promise((resolve) => {
208
- const unsubscribe = handle.subscribe((data) => {
209
- unsubscribe();
211
+ unsubscribe = handle.subscribe((data) => {
210
212
  resolve(data);
211
213
  });
212
214
  });
213
- const paginationInfo = handle.getPaginationInfo();
215
+ let unsubPagination;
216
+ const paginationInfo = await Promise.race([
217
+ new Promise((resolve) => {
218
+ unsubPagination = handle.onPaginationChange((info) => {
219
+ if (info.cursorStatus !== "none" || info.hasMore) {
220
+ Promise.resolve().then(() => unsubPagination?.());
221
+ resolve(info);
222
+ }
223
+ });
224
+ }),
225
+ new Promise(
226
+ (resolve) => setTimeout(() => {
227
+ unsubPagination?.();
228
+ resolve(handle.getPaginationInfo());
229
+ }, 500)
230
+ )
231
+ ]);
232
+ unsubscribe?.();
214
233
  if (results.length === 0) {
215
234
  return {
216
235
  content: [
@@ -1196,7 +1215,7 @@ var TopGunMCPServer = class {
1196
1215
  if (!this.isStarted) return;
1197
1216
  await this.server.close();
1198
1217
  if (!this.externalClient) {
1199
- this.client.close();
1218
+ await this.client.close();
1200
1219
  }
1201
1220
  this.isStarted = false;
1202
1221
  this.logger.info("TopGun MCP Server stopped");