@mindstone/mcp-server-google-workspace 0.2.0 → 0.3.0

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 (69) hide show
  1. package/README.md +14 -8
  2. package/dist/modules/chat/index.d.ts +12 -0
  3. package/dist/modules/chat/index.js +18 -0
  4. package/dist/modules/chat/scopes.d.ts +14 -0
  5. package/dist/modules/chat/scopes.js +32 -0
  6. package/dist/modules/chat/types.d.ts +88 -0
  7. package/dist/modules/chat/types.js +14 -0
  8. package/dist/modules/comments/service.js +21 -1
  9. package/dist/modules/contacts/scopes.d.ts +1 -0
  10. package/dist/modules/contacts/scopes.js +2 -2
  11. package/dist/modules/contacts/types.d.ts +34 -0
  12. package/dist/modules/docs/service.js +29 -1
  13. package/dist/modules/drive/activity-service.d.ts +45 -0
  14. package/dist/modules/drive/activity-service.js +114 -0
  15. package/dist/modules/drive/index.d.ts +4 -0
  16. package/dist/modules/drive/index.js +12 -0
  17. package/dist/modules/drive/scopes.d.ts +1 -0
  18. package/dist/modules/drive/scopes.js +3 -0
  19. package/dist/modules/forms/service.js +13 -1
  20. package/dist/modules/gmail/services/base.d.ts +5 -1
  21. package/dist/modules/gmail/services/base.js +8 -0
  22. package/dist/modules/gmail/services/settings.d.ts +14 -1
  23. package/dist/modules/gmail/services/settings.js +94 -0
  24. package/dist/modules/gmail/types.d.ts +36 -0
  25. package/dist/modules/meet/index.d.ts +12 -0
  26. package/dist/modules/meet/index.js +18 -0
  27. package/dist/modules/meet/scopes.d.ts +9 -0
  28. package/dist/modules/meet/scopes.js +25 -0
  29. package/dist/modules/meet/types.d.ts +97 -0
  30. package/dist/modules/meet/types.js +14 -0
  31. package/dist/modules/sheets/service.js +49 -0
  32. package/dist/modules/slides/service.js +25 -1
  33. package/dist/modules/tasks/service.js +25 -1
  34. package/dist/services/base/BaseGoogleService.d.ts +9 -1
  35. package/dist/services/base/BaseGoogleService.js +26 -1
  36. package/dist/services/chat/index.d.ts +34 -0
  37. package/dist/services/chat/index.js +120 -0
  38. package/dist/services/contacts/index.d.ts +19 -1
  39. package/dist/services/contacts/index.js +124 -0
  40. package/dist/services/meet/index.d.ts +35 -0
  41. package/dist/services/meet/index.js +116 -0
  42. package/dist/tools/chat-handlers.d.ts +14 -0
  43. package/dist/tools/chat-handlers.js +126 -0
  44. package/dist/tools/contacts-handlers.d.ts +31 -0
  45. package/dist/tools/contacts-handlers.js +88 -0
  46. package/dist/tools/definitions/chat.d.ts +3 -0
  47. package/dist/tools/definitions/chat.js +137 -0
  48. package/dist/tools/definitions/contacts.js +82 -0
  49. package/dist/tools/definitions/destructive-overrides.json +11 -0
  50. package/dist/tools/definitions/drive.js +48 -0
  51. package/dist/tools/definitions/gmail.js +94 -0
  52. package/dist/tools/definitions/index.d.ts +2 -0
  53. package/dist/tools/definitions/index.js +6 -0
  54. package/dist/tools/definitions/meet.d.ts +3 -0
  55. package/dist/tools/definitions/meet.js +149 -0
  56. package/dist/tools/definitions/open-world-overrides.json +11 -0
  57. package/dist/tools/drive-handlers.d.ts +17 -0
  58. package/dist/tools/drive-handlers.js +49 -1
  59. package/dist/tools/gmail-handlers.d.ts +24 -0
  60. package/dist/tools/gmail-handlers.js +129 -11
  61. package/dist/tools/meet-handlers.d.ts +42 -0
  62. package/dist/tools/meet-handlers.js +144 -0
  63. package/dist/tools/server.js +53 -3
  64. package/dist/utils/apiError.js +5 -2
  65. package/dist/utils/scope-hierarchy.js +10 -0
  66. package/dist/utils/service-initializer.js +9 -0
  67. package/dist/utils/untrusted-content.d.ts +37 -1
  68. package/dist/utils/untrusted-content.js +61 -6
  69. package/package.json +1 -1
@@ -1,10 +1,59 @@
1
- export function wrapUntrustedContent(content, source) {
2
- const safe = content.replaceAll('</untrusted-content>', '<&#47;untrusted-content>');
3
- return `<untrusted-content source="${escapeAttr(source)}">${safe}</untrusted-content>`;
1
+ /**
2
+ * AGENTS.md security invariant #6 — content fetched from an external system
3
+ * MUST be wrapped in an `<untrusted-content source="…">…</untrusted-content>`
4
+ * envelope (with close-tag breakout escaping) before it is returned to the
5
+ * LLM, so the model treats third-party / attacker-controllable text as DATA,
6
+ * not as instructions.
7
+ *
8
+ * This is the canonical implementation a new connector ships with. It is a
9
+ * VENDORED copy of the shared reference in `test-harness/src/untrusted-content.ts`
10
+ * — connectors cannot `import` the test-harness at runtime (it is a
11
+ * test/dev-only `file:` dependency that is never published into a connector's
12
+ * `dist/`), so the helper lives in the connector's own runtime source. Keep
13
+ * this byte-for-byte in sync with the shared reference; do NOT weaken the
14
+ * escaping back to a simple `replaceAll` (that family misses whitespace / case
15
+ * close-tag variants like `</untrusted-content >` / `</UNTRUSTED-CONTENT>`).
16
+ *
17
+ * `scripts/check-untrusted-coverage.mjs` greps for a reference to
18
+ * `untrusted-content` in any connector that talks to an external system; this
19
+ * file (and the call sites that import from it) is what satisfies that gate.
20
+ */
21
+ const UNTRUSTED_CLOSE_TAG_VARIANT = /<\/untrusted-content\s*>/gi;
22
+ const ESCAPED_UNTRUSTED_CLOSE_TAG = '<\\/untrusted-content>';
23
+ function escapeAttr(s) {
24
+ return s.replaceAll('&', '&amp;').replaceAll('"', '&quot;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
4
25
  }
26
+ function escapeCloseTagSentinels(s) {
27
+ return s.replace(UNTRUSTED_CLOSE_TAG_VARIANT, ESCAPED_UNTRUSTED_CLOSE_TAG);
28
+ }
29
+ /**
30
+ * Wrap a single untrusted string in an `<untrusted-content source="…">`
31
+ * envelope, escaping any embedded close-tag variant so the envelope cannot be
32
+ * broken out of. `undefined` passes through untouched. Idempotent for the same
33
+ * `source`.
34
+ */
35
+ export function wrapUntrusted(text, source) {
36
+ if (text === undefined)
37
+ return undefined;
38
+ const open = `<untrusted-content source="${escapeAttr(source)}">`;
39
+ const close = '</untrusted-content>';
40
+ if (text.startsWith(open) && text.endsWith(close) && text.length >= open.length + close.length) {
41
+ const inner = text.slice(open.length, text.length - close.length);
42
+ if (!UNTRUSTED_CLOSE_TAG_VARIANT.test(inner)) {
43
+ UNTRUSTED_CLOSE_TAG_VARIANT.lastIndex = 0;
44
+ return text;
45
+ }
46
+ UNTRUSTED_CLOSE_TAG_VARIANT.lastIndex = 0;
47
+ }
48
+ return `${open}${escapeCloseTagSentinels(text)}${close}`;
49
+ }
50
+ /**
51
+ * Recursively wrap every string value reachable inside `value`. Object keys are
52
+ * structural and NOT wrapped; non-string leaves pass through unchanged.
53
+ */
5
54
  export function wrapUntrustedJsonStrings(value, source) {
6
55
  if (typeof value === 'string') {
7
- return wrapUntrustedContent(value, source);
56
+ return wrapUntrusted(value, source);
8
57
  }
9
58
  if (Array.isArray(value)) {
10
59
  return value.map((item) => wrapUntrustedJsonStrings(item, source));
@@ -14,7 +63,13 @@ export function wrapUntrustedJsonStrings(value, source) {
14
63
  }
15
64
  return value;
16
65
  }
17
- function escapeAttr(s) {
18
- return s.replaceAll('"', '&quot;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
66
+ /**
67
+ * Connector-local alias for `wrapUntrusted` under the name the existing call
68
+ * sites were written against. `content` is required (never `undefined`), so
69
+ * the result is always a string.
70
+ */
71
+ export function wrapUntrustedContent(content, source) {
72
+ // wrapUntrusted returns undefined only for undefined input.
73
+ return wrapUntrusted(content, source);
19
74
  }
20
75
  //# sourceMappingURL=untrusted-content.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstone/mcp-server-google-workspace",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "mcpName": "io.github.mindstone/mcp-server-google-workspace",
5
5
  "description": "Google Workspace MCP server for Gmail, Calendar, Drive, Docs, Sheets, Slides, Contacts, Tasks, and Forms",
6
6
  "license": "FSL-1.1-MIT",