@spacelr/mcp 0.0.10 → 0.0.12

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.mjs CHANGED
@@ -1448,6 +1448,40 @@ function registerDatabaseTools(server, api) {
1448
1448
  }
1449
1449
  }
1450
1450
  );
1451
+ server.registerTool(
1452
+ "database_documents_search",
1453
+ {
1454
+ description: "Server-side substring search across named fields of a collection. The query is regex-escaped and case-insensitive. Uses unanchored MongoDB $regex per field \u2014 consider adding a filter to narrow the scan on large collections. Max 10 fields, max 100 results. Runs with admin privileges (bypasses .read rules); use the SDK search() for tenant-scoped rule-gated search.",
1455
+ inputSchema: {
1456
+ projectId: z4.string(),
1457
+ collectionName: z4.string(),
1458
+ query: z4.string().min(1).max(200),
1459
+ fields: z4.array(z4.string().regex(/^[a-zA-Z0-9_.]+$/).max(64)).min(1).max(10),
1460
+ filter: z4.record(z4.string(), z4.unknown()).optional(),
1461
+ sort: z4.record(z4.string(), z4.union([z4.literal(1), z4.literal(-1)])).optional(),
1462
+ limit: z4.number().int().min(1).max(100).optional(),
1463
+ offset: z4.number().int().min(0).optional(),
1464
+ select: z4.array(z4.string()).optional()
1465
+ }
1466
+ },
1467
+ async ({ projectId, collectionName, ...body }) => {
1468
+ try {
1469
+ const result = await api.post(
1470
+ `/databases/${encodeURIComponent(projectId)}/collections/${encodeURIComponent(collectionName)}/documents/search`,
1471
+ { body }
1472
+ );
1473
+ return {
1474
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1475
+ };
1476
+ } catch (error) {
1477
+ const message = error instanceof Error ? error.message : String(error);
1478
+ return {
1479
+ content: [{ type: "text", text: `Failed to search documents: ${message}` }],
1480
+ isError: true
1481
+ };
1482
+ }
1483
+ }
1484
+ );
1451
1485
  server.registerTool(
1452
1486
  "database_documents_insert",
1453
1487
  {
@@ -2394,7 +2428,10 @@ function registerFunctionTools(server, api) {
2394
2428
  cronTimezone: z7.string().optional(),
2395
2429
  timeout: z7.number().int().min(1e3).max(12e4).optional(),
2396
2430
  memoryLimitMb: z7.number().int().min(16).max(512).optional(),
2397
- enabled: z7.boolean().optional()
2431
+ enabled: z7.boolean().optional(),
2432
+ invokeMode: z7.enum(["webhook", "authenticated", "public", "hybrid"]).optional().describe(
2433
+ "Controls which credentials the public invoke endpoint accepts. webhook: X-Webhook-Secret only (default). authenticated: JWT only. public: no auth. hybrid: either; JWT wins on conflict."
2434
+ )
2398
2435
  }
2399
2436
  },
2400
2437
  async ({ projectId, ...body }) => {
@@ -2429,7 +2466,10 @@ function registerFunctionTools(server, api) {
2429
2466
  cronTimezone: z7.string().optional(),
2430
2467
  timeout: z7.number().int().min(1e3).max(12e4).optional(),
2431
2468
  memoryLimitMb: z7.number().int().min(16).max(512).optional(),
2432
- enabled: z7.boolean().optional()
2469
+ enabled: z7.boolean().optional(),
2470
+ invokeMode: z7.enum(["webhook", "authenticated", "public", "hybrid"]).optional().describe(
2471
+ "Controls which credentials the public invoke endpoint accepts. webhook: X-Webhook-Secret only. authenticated: JWT only. public: no auth. hybrid: either; JWT wins on conflict."
2472
+ )
2433
2473
  }
2434
2474
  },
2435
2475
  async ({ projectId, functionId, ...body }) => {