google-mcp-suite 1.4.1 → 1.5.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 (113) hide show
  1. package/README.md +14 -9
  2. package/dist/docs/capabilities.d.ts +3 -0
  3. package/dist/docs/capabilities.d.ts.map +1 -0
  4. package/dist/docs/capabilities.js +15 -0
  5. package/dist/docs/capabilities.js.map +1 -0
  6. package/dist/docs/entities/BatchUpdateReceipt.d.ts +14 -0
  7. package/dist/docs/entities/BatchUpdateReceipt.d.ts.map +1 -0
  8. package/dist/docs/entities/BatchUpdateReceipt.js +16 -0
  9. package/dist/docs/entities/BatchUpdateReceipt.js.map +1 -0
  10. package/dist/docs/entities/Document.d.ts +31 -0
  11. package/dist/docs/entities/Document.d.ts.map +1 -0
  12. package/dist/docs/entities/Document.js +25 -0
  13. package/dist/docs/entities/Document.js.map +1 -0
  14. package/dist/docs/entities/Range.d.ts +14 -0
  15. package/dist/docs/entities/Range.d.ts.map +1 -0
  16. package/dist/docs/entities/Range.js +21 -0
  17. package/dist/docs/entities/Range.js.map +1 -0
  18. package/dist/docs/entities/StructuralElement.d.ts +25 -0
  19. package/dist/docs/entities/StructuralElement.d.ts.map +1 -0
  20. package/dist/docs/entities/StructuralElement.js +37 -0
  21. package/dist/docs/entities/StructuralElement.js.map +1 -0
  22. package/dist/docs/entities/SubstringMatchCriteria.d.ts +13 -0
  23. package/dist/docs/entities/SubstringMatchCriteria.d.ts.map +1 -0
  24. package/dist/docs/entities/SubstringMatchCriteria.js +15 -0
  25. package/dist/docs/entities/SubstringMatchCriteria.js.map +1 -0
  26. package/dist/docs/index.d.ts +3 -0
  27. package/dist/docs/index.d.ts.map +1 -0
  28. package/dist/docs/index.js +26 -0
  29. package/dist/docs/index.js.map +1 -0
  30. package/dist/docs/instructions.d.ts +2 -0
  31. package/dist/docs/instructions.d.ts.map +1 -0
  32. package/dist/docs/instructions.js +23 -0
  33. package/dist/docs/instructions.js.map +1 -0
  34. package/dist/docs/lib/batch.d.ts +16 -0
  35. package/dist/docs/lib/batch.d.ts.map +1 -0
  36. package/dist/docs/lib/batch.js +21 -0
  37. package/dist/docs/lib/batch.js.map +1 -0
  38. package/dist/docs/lib/document.d.ts +13 -0
  39. package/dist/docs/lib/document.d.ts.map +1 -0
  40. package/dist/docs/lib/document.js +58 -0
  41. package/dist/docs/lib/document.js.map +1 -0
  42. package/dist/docs/methods/create_document/handler.d.ts +5 -0
  43. package/dist/docs/methods/create_document/handler.d.ts.map +1 -0
  44. package/dist/docs/methods/create_document/handler.js +6 -0
  45. package/dist/docs/methods/create_document/handler.js.map +1 -0
  46. package/dist/docs/methods/create_document/index.d.ts +26 -0
  47. package/dist/docs/methods/create_document/index.d.ts.map +1 -0
  48. package/dist/docs/methods/create_document/index.js +21 -0
  49. package/dist/docs/methods/create_document/index.js.map +1 -0
  50. package/dist/docs/methods/create_document/schema.d.ts +30 -0
  51. package/dist/docs/methods/create_document/schema.d.ts.map +1 -0
  52. package/dist/docs/methods/create_document/schema.js +16 -0
  53. package/dist/docs/methods/create_document/schema.js.map +1 -0
  54. package/dist/docs/methods/delete_content_range/handler.d.ts +5 -0
  55. package/dist/docs/methods/delete_content_range/handler.d.ts.map +1 -0
  56. package/dist/docs/methods/delete_content_range/handler.js +8 -0
  57. package/dist/docs/methods/delete_content_range/handler.js.map +1 -0
  58. package/dist/docs/methods/delete_content_range/index.d.ts +17 -0
  59. package/dist/docs/methods/delete_content_range/index.d.ts.map +1 -0
  60. package/dist/docs/methods/delete_content_range/index.js +22 -0
  61. package/dist/docs/methods/delete_content_range/index.js.map +1 -0
  62. package/dist/docs/methods/delete_content_range/schema.d.ts +15 -0
  63. package/dist/docs/methods/delete_content_range/schema.d.ts.map +1 -0
  64. package/dist/docs/methods/delete_content_range/schema.js +11 -0
  65. package/dist/docs/methods/delete_content_range/schema.js.map +1 -0
  66. package/dist/docs/methods/get_document/handler.d.ts +5 -0
  67. package/dist/docs/methods/get_document/handler.d.ts.map +1 -0
  68. package/dist/docs/methods/get_document/handler.js +6 -0
  69. package/dist/docs/methods/get_document/handler.js.map +1 -0
  70. package/dist/docs/methods/get_document/index.d.ts +27 -0
  71. package/dist/docs/methods/get_document/index.d.ts.map +1 -0
  72. package/dist/docs/methods/get_document/index.js +22 -0
  73. package/dist/docs/methods/get_document/index.js.map +1 -0
  74. package/dist/docs/methods/get_document/schema.d.ts +25 -0
  75. package/dist/docs/methods/get_document/schema.d.ts.map +1 -0
  76. package/dist/docs/methods/get_document/schema.js +9 -0
  77. package/dist/docs/methods/get_document/schema.js.map +1 -0
  78. package/dist/docs/methods/insert_text/handler.d.ts +5 -0
  79. package/dist/docs/methods/insert_text/handler.d.ts.map +1 -0
  80. package/dist/docs/methods/insert_text/handler.js +8 -0
  81. package/dist/docs/methods/insert_text/handler.js.map +1 -0
  82. package/dist/docs/methods/insert_text/index.d.ts +10 -0
  83. package/dist/docs/methods/insert_text/index.d.ts.map +1 -0
  84. package/dist/docs/methods/insert_text/index.js +17 -0
  85. package/dist/docs/methods/insert_text/index.js.map +1 -0
  86. package/dist/docs/methods/insert_text/schema.d.ts +13 -0
  87. package/dist/docs/methods/insert_text/schema.d.ts.map +1 -0
  88. package/dist/docs/methods/insert_text/schema.js +19 -0
  89. package/dist/docs/methods/insert_text/schema.js.map +1 -0
  90. package/dist/docs/methods/registry.d.ts +82 -0
  91. package/dist/docs/methods/registry.d.ts.map +1 -0
  92. package/dist/docs/methods/registry.js +23 -0
  93. package/dist/docs/methods/registry.js.map +1 -0
  94. package/dist/docs/methods/replace_all_text/handler.d.ts +5 -0
  95. package/dist/docs/methods/replace_all_text/handler.d.ts.map +1 -0
  96. package/dist/docs/methods/replace_all_text/handler.js +16 -0
  97. package/dist/docs/methods/replace_all_text/handler.js.map +1 -0
  98. package/dist/docs/methods/replace_all_text/index.d.ts +20 -0
  99. package/dist/docs/methods/replace_all_text/index.d.ts.map +1 -0
  100. package/dist/docs/methods/replace_all_text/index.js +23 -0
  101. package/dist/docs/methods/replace_all_text/index.js.map +1 -0
  102. package/dist/docs/methods/replace_all_text/schema.d.ts +17 -0
  103. package/dist/docs/methods/replace_all_text/schema.d.ts.map +1 -0
  104. package/dist/docs/methods/replace_all_text/schema.js +19 -0
  105. package/dist/docs/methods/replace_all_text/schema.js.map +1 -0
  106. package/dist/docs/operation.d.ts +12 -0
  107. package/dist/docs/operation.d.ts.map +1 -0
  108. package/dist/docs/operation.js +10 -0
  109. package/dist/docs/operation.js.map +1 -0
  110. package/dist/doctor/services.d.ts.map +1 -1
  111. package/dist/doctor/services.js +32 -1
  112. package/dist/doctor/services.js.map +1 -1
  113. package/package.json +8 -3
package/README.md CHANGED
@@ -24,18 +24,18 @@
24
24
     
25
25
  <img src=".github/assets/sheets.svg" height="44" alt="Sheets" title="Sheets" />
26
26
  &nbsp;&nbsp;&nbsp;
27
- <img src=".github/assets/drive.svg" height="44" alt="Drive (planned)" title="Drive (planned)" />
27
+ <img src=".github/assets/docs.svg" height="44" alt="Docs" title="Docs" />
28
28
  &nbsp;&nbsp;&nbsp;
29
- <img src=".github/assets/docs.svg" height="44" alt="Docs (planned)" title="Docs (planned)" />
29
+ <img src=".github/assets/drive.svg" height="44" alt="Drive (planned)" title="Drive (planned)" />
30
30
  </p>
31
31
 
32
32
  <p align="center">
33
- <sub><strong>Gmail</strong> (<a href="./src/gmail/CAPABILITIES.md">33 operations</a>), <strong>Calendar</strong> (<a href="./src/calendar/CAPABILITIES.md">25 operations</a>), and <strong>Sheets</strong> (<a href="./src/sheets/CAPABILITIES.md">15 operations</a>) ship today; Drive and Docs are on the way (shown dimmed).</sub>
33
+ <sub><strong>Gmail</strong> (<a href="./src/gmail/CAPABILITIES.md">33 operations</a>), <strong>Calendar</strong> (<a href="./src/calendar/CAPABILITIES.md">25 operations</a>), <strong>Sheets</strong> (<a href="./src/sheets/CAPABILITIES.md">15 operations</a>), and <strong>Docs</strong> (<a href="./src/docs/CAPABILITIES.md">5 operations</a>) ship today; Drive is on the way (shown dimmed).</sub>
34
34
  </p>
35
35
 
36
36
  ## What it does
37
37
 
38
- Point an AI agent at your Google accounts and let it do the work: triage and send mail, run your calendars, and read and write your spreadsheets today; manage files and edit documents as those services land. The end goal is an agent that operates your accounts and hands you results.
38
+ Point an AI agent at your Google accounts and let it do the work: triage and send mail, run your calendars, read and write your spreadsheets, and draft and edit documents today; manage files as Drive lands. The end goal is an agent that operates your accounts and hands you results.
39
39
 
40
40
  The design has two internal concepts and nothing else:
41
41
 
@@ -44,7 +44,7 @@ The design has two internal concepts and nothing else:
44
44
 
45
45
  That is the whole surface. Read one operation folder and you understand all of them.
46
46
 
47
- - **REST plus MCP in one surface.** Each server exposes the curated MCP toolset *and* the broader REST method set of its Google API, so an agent gets far more than a thin slice. Gmail ships with [33 operations](./src/gmail/CAPABILITIES.md) (10 curated MCP tools plus 23 REST methods), Calendar with [25](./src/calendar/CAPABILITIES.md) (8 plus 17), and Sheets with [15](./src/sheets/CAPABILITIES.md) (Google publishes no Sheets MCP toolset, so all 15 are REST-sourced); the split is explained in [MCP, and then some](#mcp-and-then-some).
47
+ - **REST plus MCP in one surface.** Each server exposes the curated MCP toolset *and* the broader REST method set of its Google API, so an agent gets far more than a thin slice. Gmail ships with [33 operations](./src/gmail/CAPABILITIES.md) (10 curated MCP tools plus 23 REST methods), Calendar with [25](./src/calendar/CAPABILITIES.md) (8 plus 17), Sheets with [15](./src/sheets/CAPABILITIES.md), and Docs with [5](./src/docs/CAPABILITIES.md) (Google publishes no MCP toolset for Sheets or Docs, so those are REST-sourced throughout); the split is explained in [MCP, and then some](#mcp-and-then-some).
48
48
  - **The folder tree mirrors Google's docs.** A Google tools-list reference page becomes a `tools/` folder; a Google REST method reference page becomes a `methods/` folder. If you can find the operation in Google's docs, you can find it in this repo.
49
49
 
50
50
  | Google's reference page | This repo's folder |
@@ -56,7 +56,7 @@ That is the whole surface. Read one operation folder and you understand all of t
56
56
  - **Siloed by design.** Each service runs as its own independent server in its own lane; the orchestrating agent is the single thing that coordinates them.
57
57
  - **Strict by construction.** Input and output schemas are validated on every call, vocabulary is sourced from Google's own docs, types are strict (NodeNext ESM, `verbatimModuleSyntax`, `noUncheckedIndexedAccess`), and coverage is pinned at 100% in `bunfig.toml`.
58
58
 
59
- One package, one version: everything compiles into `google-mcp-suite`, which ships a bin per service (`google-mcp-gmail`, `google-mcp-calendar`, and `google-mcp-sheets` today) plus the `google-mcp-doctor` setup CLI.
59
+ One package, one version: everything compiles into `google-mcp-suite`, which ships a bin per service (`google-mcp-gmail`, `google-mcp-calendar`, `google-mcp-sheets`, and `google-mcp-docs` today) plus the `google-mcp-doctor` setup CLI.
60
60
 
61
61
  ## MCP, and then some
62
62
 
@@ -65,7 +65,7 @@ This is an MCP server, and deliberately more than one. Google publishes an MCP t
65
65
  - **`tools/`** mirrors Google's **MCP toolset** reference, verbatim.
66
66
  - **`methods/`** covers the broader **REST** reference, the operations the MCP toolset omits.
67
67
 
68
- The split is Google's own (its MCP reference and its REST reference are separate trees); we keep it on disk on purpose and unify it operationally (one `Operation` type, one merged wire surface where everything is an MCP tool). The breadth of [the operation list](./src/gmail/CAPABILITIES.md) is the evidence that MCP alone is not enough for real work. Sheets is the limit case: Google publishes no Sheets MCP toolset at all, so its server is methods-only, [15 operations](./src/sheets/CAPABILITIES.md) sourced entirely from the REST reference. Keeping the two sourced surfaces separate also makes each new operation a bounded, documentation-driven unit of work; the recipe is in [EXTENDING.md](./EXTENDING.md).
68
+ The split is Google's own (its MCP reference and its REST reference are separate trees); we keep it on disk on purpose and unify it operationally (one `Operation` type, one merged wire surface where everything is an MCP tool). The breadth of [the operation list](./src/gmail/CAPABILITIES.md) is the evidence that MCP alone is not enough for real work. Sheets and Docs are the limit case: Google publishes no MCP toolset for either, so those servers are methods-only ([15](./src/sheets/CAPABILITIES.md) and [5](./src/docs/CAPABILITIES.md) operations sourced entirely from the REST reference). Keeping the two sourced surfaces separate also makes each new operation a bounded, documentation-driven unit of work; the recipe is in [EXTENDING.md](./EXTENDING.md).
69
69
 
70
70
  ## Quickstart
71
71
 
@@ -103,6 +103,10 @@ Then point your MCP client at the servers, one instance per service per account:
103
103
  "sheets-work": {
104
104
  "command": "google-mcp-sheets",
105
105
  "env": { "GOOGLE_MCP_ACCOUNT": "work@example.com" }
106
+ },
107
+ "docs-work": {
108
+ "command": "google-mcp-docs",
109
+ "env": { "GOOGLE_MCP_ACCOUNT": "work@example.com" }
106
110
  }
107
111
  }
108
112
  }
@@ -122,6 +126,7 @@ src/
122
126
  gmail/ # the Gmail server (reference/canary); new services mirror its shape
123
127
  calendar/ # the Calendar server; same shape
124
128
  sheets/ # the Sheets server; same shape, methods-only (no Google MCP toolset)
129
+ docs/ # the Docs server; same shape, methods-only
125
130
  ```
126
131
 
127
132
  One package, one version. `auth`, `lib`, `doctor`, and each service are folders in one `src/` and compile to a single published package.
@@ -168,10 +173,10 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md) for the full task list, [AGENTS.md](./A
168
173
  | **Gmail** | ✅ Implemented | [33 operations](./src/gmail/CAPABILITIES.md): threads, messages, drafts, labels, filters, attachments |
169
174
  | **Calendar** | ✅ Implemented | [25 operations](./src/calendar/CAPABILITIES.md): events, calendars, free/busy, and meeting-time suggestions |
170
175
  | **Sheets** | ✅ Implemented | [15 operations](./src/sheets/CAPABILITIES.md): spreadsheets, values, batch and data-filter reads/writes, developer metadata |
176
+ | **Docs** | ✅ Implemented | [5 operations](./src/docs/CAPABILITIES.md): document reads and creation, curated text editing |
171
177
  | Drive | 🔜 Planned | files, folders, sharing, revisions |
172
- | Docs | 🔜 Planned | documents, structured content |
173
178
 
174
- Gmail is the reference (canary) implementation; Calendar is its first replication; Sheets is the first methods-only service (Google publishes no Sheets MCP toolset); each new service mirrors the same shape.
179
+ Gmail is the reference (canary) implementation; Calendar is its first replication; Sheets and Docs are methods-only (Google publishes no MCP toolset for them); each new service mirrors the same shape.
175
180
 
176
181
  ---
177
182
 
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/docs/capabilities.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ // Regenerate CAPABILITIES.md from the live method registry: `bun run
3
+ // capabilities`. The doc is derived from the same registry the server lists
4
+ // and dispatches, so it cannot drift from the code. Agents that speak MCP should
5
+ // discover the live, fully-schema'd surface via the server's `tools/list`.
6
+ import { writeFileSync } from 'node:fs';
7
+ import { fileURLToPath } from 'node:url';
8
+ import { renderCapabilities } from '../lib/server.js';
9
+ import { methods } from './methods/registry.js';
10
+ if (import.meta.main) {
11
+ const out = fileURLToPath(new URL('./CAPABILITIES.md', import.meta.url));
12
+ writeFileSync(out, renderCapabilities('Docs capabilities', [{ kind: 'REST Method', operations: methods }]));
13
+ console.error(`Wrote CAPABILITIES.md (${Object.keys(methods).length} operations)`);
14
+ }
15
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/docs/capabilities.ts"],"names":[],"mappings":";AACA,qEAAqE;AACrE,4EAA4E;AAC5E,iFAAiF;AACjF,2EAA2E;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,MAAM,GAAG,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACzE,aAAa,CACX,GAAG,EACH,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CACxF,CAAC;IACF,OAAO,CAAC,KAAK,CAAC,0BAA0B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,cAAc,CAAC,CAAC;AACrF,CAAC","sourcesContent":["#!/usr/bin/env node\n// Regenerate CAPABILITIES.md from the live method registry: `bun run\n// capabilities`. The doc is derived from the same registry the server lists\n// and dispatches, so it cannot drift from the code. Agents that speak MCP should\n// discover the live, fully-schema'd surface via the server's `tools/list`.\nimport { writeFileSync } from 'node:fs';\nimport { fileURLToPath } from 'node:url';\nimport { renderCapabilities } from '../lib/server.js';\nimport { methods } from './methods/registry.js';\n\nif (import.meta.main) {\n const out = fileURLToPath(new URL('./CAPABILITIES.md', import.meta.url));\n writeFileSync(\n out,\n renderCapabilities('Docs capabilities', [{ kind: 'REST Method', operations: methods }]),\n );\n console.error(`Wrote CAPABILITIES.md (${Object.keys(methods).length} operations)`);\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * What every curated write reports: the document the update was applied to
4
+ * and, when Google supplies one, the post-write revision. A projection of the
5
+ * REST BatchUpdateDocumentResponse, produced by `lib/batch.ts`.
6
+ *
7
+ * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate#response-body
8
+ */
9
+ export declare const BatchUpdateReceipt: z.ZodObject<{
10
+ documentId: z.ZodString;
11
+ revisionId: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ export type BatchUpdateReceipt = z.infer<typeof BatchUpdateReceipt>;
14
+ //# sourceMappingURL=BatchUpdateReceipt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BatchUpdateReceipt.d.ts","sourceRoot":"","sources":["../../../src/docs/entities/BatchUpdateReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;iBAM7B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * What every curated write reports: the document the update was applied to
4
+ * and, when Google supplies one, the post-write revision. A projection of the
5
+ * REST BatchUpdateDocumentResponse, produced by `lib/batch.ts`.
6
+ *
7
+ * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate#response-body
8
+ */
9
+ export const BatchUpdateReceipt = z.object({
10
+ documentId: z.string().describe('The document the update was applied to.'),
11
+ revisionId: z
12
+ .string()
13
+ .optional()
14
+ .describe('The revision of the document after the write, when Google reports one.'),
15
+ });
16
+ //# sourceMappingURL=BatchUpdateReceipt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BatchUpdateReceipt.js","sourceRoot":"","sources":["../../../src/docs/entities/BatchUpdateReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IAC1E,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,wEAAwE,CAAC;CACtF,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * What every curated write reports: the document the update was applied to\n * and, when Google supplies one, the post-write revision. A projection of the\n * REST BatchUpdateDocumentResponse, produced by `lib/batch.ts`.\n *\n * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate#response-body\n */\nexport const BatchUpdateReceipt = z.object({\n documentId: z.string().describe('The document the update was applied to.'),\n revisionId: z\n .string()\n .optional()\n .describe('The revision of the document after the write, when Google reports one.'),\n});\n\nexport type BatchUpdateReceipt = z.infer<typeof BatchUpdateReceipt>;\n"]}
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * A document: identity, title, revision, and the body's blocks as text with
4
+ * UTF-16 index ranges. This projection is what an agent needs to read a
5
+ * document and to target edits; the recursive REST tree (tabs, table cells,
6
+ * styles, objects, suggestions) is deferred (issue #36), and the body is the
7
+ * legacy single-tab view.
8
+ *
9
+ * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents#Document
10
+ * @see https://developers.google.com/workspace/docs/api/concepts/structure
11
+ */
12
+ export declare const Document: z.ZodObject<{
13
+ documentId: z.ZodString;
14
+ title: z.ZodOptional<z.ZodString>;
15
+ revisionId: z.ZodOptional<z.ZodString>;
16
+ content: z.ZodOptional<z.ZodArray<z.ZodObject<{
17
+ startIndex: z.ZodOptional<z.ZodNumber>;
18
+ endIndex: z.ZodOptional<z.ZodNumber>;
19
+ type: z.ZodOptional<z.ZodEnum<{
20
+ paragraph: "paragraph";
21
+ sectionBreak: "sectionBreak";
22
+ table: "table";
23
+ tableOfContents: "tableOfContents";
24
+ }>>;
25
+ text: z.ZodOptional<z.ZodString>;
26
+ rows: z.ZodOptional<z.ZodNumber>;
27
+ columns: z.ZodOptional<z.ZodNumber>;
28
+ }, z.core.$strip>>>;
29
+ }, z.core.$strip>;
30
+ export type Document = z.infer<typeof Document>;
31
+ //# sourceMappingURL=Document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Document.d.ts","sourceRoot":"","sources":["../../../src/docs/entities/Document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;iBAWnB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ import { StructuralElement } from './StructuralElement.js';
3
+ /**
4
+ * A document: identity, title, revision, and the body's blocks as text with
5
+ * UTF-16 index ranges. This projection is what an agent needs to read a
6
+ * document and to target edits; the recursive REST tree (tabs, table cells,
7
+ * styles, objects, suggestions) is deferred (issue #36), and the body is the
8
+ * legacy single-tab view.
9
+ *
10
+ * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents#Document
11
+ * @see https://developers.google.com/workspace/docs/api/concepts/structure
12
+ */
13
+ export const Document = z.object({
14
+ documentId: z.string().describe('The ID of the document.'),
15
+ title: z.string().optional().describe('The title of the document.'),
16
+ revisionId: z
17
+ .string()
18
+ .optional()
19
+ .describe('The revision ID of the document; changes with every edit.'),
20
+ content: z
21
+ .array(StructuralElement)
22
+ .optional()
23
+ .describe("The body's structural elements, in document order."),
24
+ });
25
+ //# sourceMappingURL=Document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Document.js","sourceRoot":"","sources":["../../../src/docs/entities/Document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAC1D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IACnE,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,2DAA2D,CAAC;IACxE,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,iBAAiB,CAAC;SACxB,QAAQ,EAAE;SACV,QAAQ,CAAC,oDAAoD,CAAC;CAClE,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { StructuralElement } from './StructuralElement.js';\n\n/**\n * A document: identity, title, revision, and the body's blocks as text with\n * UTF-16 index ranges. This projection is what an agent needs to read a\n * document and to target edits; the recursive REST tree (tabs, table cells,\n * styles, objects, suggestions) is deferred (issue #36), and the body is the\n * legacy single-tab view.\n *\n * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents#Document\n * @see https://developers.google.com/workspace/docs/api/concepts/structure\n */\nexport const Document = z.object({\n documentId: z.string().describe('The ID of the document.'),\n title: z.string().optional().describe('The title of the document.'),\n revisionId: z\n .string()\n .optional()\n .describe('The revision ID of the document; changes with every edit.'),\n content: z\n .array(StructuralElement)\n .optional()\n .describe(\"The body's structural elements, in document order.\"),\n});\n\nexport type Document = z.infer<typeof Document>;\n"]}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * A contiguous span of document body content, in zero-based UTF-16 code
4
+ * units, end-exclusive. The REST Range's `segmentId` and `tabId` are not
5
+ * exposed (issue #36): ranges address the body of the first tab.
6
+ *
7
+ * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents#Range
8
+ */
9
+ export declare const Range: z.ZodObject<{
10
+ startIndex: z.ZodNumber;
11
+ endIndex: z.ZodNumber;
12
+ }, z.core.$strip>;
13
+ export type Range = z.infer<typeof Range>;
14
+ //# sourceMappingURL=Range.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["../../../src/docs/entities/Range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,eAAO,MAAM,KAAK;;;iBAehB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * A contiguous span of document body content, in zero-based UTF-16 code
4
+ * units, end-exclusive. The REST Range's `segmentId` and `tabId` are not
5
+ * exposed (issue #36): ranges address the body of the first tab.
6
+ *
7
+ * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents#Range
8
+ */
9
+ export const Range = z.object({
10
+ startIndex: z
11
+ .number()
12
+ .int()
13
+ .min(1)
14
+ .describe('The zero-based start index of the range, inclusive, in UTF-16 code units. Body content starts at index 1 (index 0 is the initial section break). Indices shift on every edit; re-read the document before computing ranges.'),
15
+ endIndex: z
16
+ .number()
17
+ .int()
18
+ .min(2)
19
+ .describe('The zero-based end index of the range, exclusive, in UTF-16 code units; must be greater than startIndex.'),
20
+ });
21
+ //# sourceMappingURL=Range.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Range.js","sourceRoot":"","sources":["../../../src/docs/entities/Range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,6NAA6N,CAC9N;IACH,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,0GAA0G,CAC3G;CACJ,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * A contiguous span of document body content, in zero-based UTF-16 code\n * units, end-exclusive. The REST Range's `segmentId` and `tabId` are not\n * exposed (issue #36): ranges address the body of the first tab.\n *\n * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents#Range\n */\nexport const Range = z.object({\n startIndex: z\n .number()\n .int()\n .min(1)\n .describe(\n 'The zero-based start index of the range, inclusive, in UTF-16 code units. Body content starts at index 1 (index 0 is the initial section break). Indices shift on every edit; re-read the document before computing ranges.',\n ),\n endIndex: z\n .number()\n .int()\n .min(2)\n .describe(\n 'The zero-based end index of the range, exclusive, in UTF-16 code units; must be greater than startIndex.',\n ),\n});\n\nexport type Range = z.infer<typeof Range>;\n"]}
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * One block of a document body, in document order: a paragraph, section
4
+ * break, table, or table of contents, addressed by its UTF-16 index range.
5
+ * A projection of the REST StructuralElement: paragraphs flatten to their
6
+ * concatenated run text, tables to their dimensions; the full recursive
7
+ * trees (cells, styles, inline objects, suggestions) are deferred (issue #36).
8
+ *
9
+ * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents#StructuralElement
10
+ */
11
+ export declare const StructuralElement: z.ZodObject<{
12
+ startIndex: z.ZodOptional<z.ZodNumber>;
13
+ endIndex: z.ZodOptional<z.ZodNumber>;
14
+ type: z.ZodOptional<z.ZodEnum<{
15
+ paragraph: "paragraph";
16
+ sectionBreak: "sectionBreak";
17
+ table: "table";
18
+ tableOfContents: "tableOfContents";
19
+ }>>;
20
+ text: z.ZodOptional<z.ZodString>;
21
+ rows: z.ZodOptional<z.ZodNumber>;
22
+ columns: z.ZodOptional<z.ZodNumber>;
23
+ }, z.core.$strip>;
24
+ export type StructuralElement = z.infer<typeof StructuralElement>;
25
+ //# sourceMappingURL=StructuralElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StructuralElement.d.ts","sourceRoot":"","sources":["../../../src/docs/entities/StructuralElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;iBA+B5B,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * One block of a document body, in document order: a paragraph, section
4
+ * break, table, or table of contents, addressed by its UTF-16 index range.
5
+ * A projection of the REST StructuralElement: paragraphs flatten to their
6
+ * concatenated run text, tables to their dimensions; the full recursive
7
+ * trees (cells, styles, inline objects, suggestions) are deferred (issue #36).
8
+ *
9
+ * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents#StructuralElement
10
+ */
11
+ export const StructuralElement = z.object({
12
+ startIndex: z
13
+ .number()
14
+ .int()
15
+ .optional()
16
+ .describe('The zero-based start index of this element, in UTF-16 code units. Indices shift on every edit; re-read the document before computing new ranges.'),
17
+ endIndex: z
18
+ .number()
19
+ .int()
20
+ .optional()
21
+ .describe('The zero-based end index of this element, exclusive, in UTF-16 code units.'),
22
+ type: z
23
+ .enum(['paragraph', 'sectionBreak', 'table', 'tableOfContents'])
24
+ .optional()
25
+ .describe('Which kind of block this is; absent for a structural kind this server does not know (the indices still address it).'),
26
+ text: z
27
+ .string()
28
+ .optional()
29
+ .describe("A paragraph's text: its runs concatenated, newline-terminated; absent for non-paragraph elements. Non-text elements (images, footnote references, chips) appear as one U+FFFC placeholder per UTF-16 unit they occupy, so the text length always equals endIndex - startIndex."),
30
+ rows: z.number().int().optional().describe("A table's row count; absent for non-table elements."),
31
+ columns: z
32
+ .number()
33
+ .int()
34
+ .optional()
35
+ .describe("A table's column count; absent for non-table elements."),
36
+ });
37
+ //# sourceMappingURL=StructuralElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StructuralElement.js","sourceRoot":"","sources":["../../../src/docs/entities/StructuralElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CACP,kJAAkJ,CACnJ;IACH,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CAAC,4EAA4E,CAAC;IACzF,IAAI,EAAE,CAAC;SACJ,IAAI,CAAC,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;SAC/D,QAAQ,EAAE;SACV,QAAQ,CACP,qHAAqH,CACtH;IACH,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,gRAAgR,CACjR;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;IACjG,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CAAC,wDAAwD,CAAC;CACtE,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * One block of a document body, in document order: a paragraph, section\n * break, table, or table of contents, addressed by its UTF-16 index range.\n * A projection of the REST StructuralElement: paragraphs flatten to their\n * concatenated run text, tables to their dimensions; the full recursive\n * trees (cells, styles, inline objects, suggestions) are deferred (issue #36).\n *\n * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents#StructuralElement\n */\nexport const StructuralElement = z.object({\n startIndex: z\n .number()\n .int()\n .optional()\n .describe(\n 'The zero-based start index of this element, in UTF-16 code units. Indices shift on every edit; re-read the document before computing new ranges.',\n ),\n endIndex: z\n .number()\n .int()\n .optional()\n .describe('The zero-based end index of this element, exclusive, in UTF-16 code units.'),\n type: z\n .enum(['paragraph', 'sectionBreak', 'table', 'tableOfContents'])\n .optional()\n .describe(\n 'Which kind of block this is; absent for a structural kind this server does not know (the indices still address it).',\n ),\n text: z\n .string()\n .optional()\n .describe(\n \"A paragraph's text: its runs concatenated, newline-terminated; absent for non-paragraph elements. Non-text elements (images, footnote references, chips) appear as one U+FFFC placeholder per UTF-16 unit they occupy, so the text length always equals endIndex - startIndex.\",\n ),\n rows: z.number().int().optional().describe(\"A table's row count; absent for non-table elements.\"),\n columns: z\n .number()\n .int()\n .optional()\n .describe(\"A table's column count; absent for non-table elements.\"),\n});\n\nexport type StructuralElement = z.infer<typeof StructuralElement>;\n"]}
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * What text to find in the document: a plain substring with optional case
4
+ * sensitivity. The REST criteria's `searchByRegex` is not exposed (issue #35).
5
+ *
6
+ * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#SubstringMatchCriteria
7
+ */
8
+ export declare const SubstringMatchCriteria: z.ZodObject<{
9
+ text: z.ZodString;
10
+ matchCase: z.ZodOptional<z.ZodBoolean>;
11
+ }, z.core.$strip>;
12
+ export type SubstringMatchCriteria = z.infer<typeof SubstringMatchCriteria>;
13
+ //# sourceMappingURL=SubstringMatchCriteria.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubstringMatchCriteria.d.ts","sourceRoot":"","sources":["../../../src/docs/entities/SubstringMatchCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;iBAMjC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * What text to find in the document: a plain substring with optional case
4
+ * sensitivity. The REST criteria's `searchByRegex` is not exposed (issue #35).
5
+ *
6
+ * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#SubstringMatchCriteria
7
+ */
8
+ export const SubstringMatchCriteria = z.object({
9
+ text: z.string().min(1).describe('The text to search for in the document.'),
10
+ matchCase: z
11
+ .boolean()
12
+ .optional()
13
+ .describe('Whether the search respects case. Defaults to false (case-insensitive).'),
14
+ });
15
+ //# sourceMappingURL=SubstringMatchCriteria.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubstringMatchCriteria.js","sourceRoot":"","sources":["../../../src/docs/entities/SubstringMatchCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IAC3E,SAAS,EAAE,CAAC;SACT,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,yEAAyE,CAAC;CACvF,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\n\n/**\n * What text to find in the document: a plain substring with optional case\n * sensitivity. The REST criteria's `searchByRegex` is not exposed (issue #35).\n *\n * @see https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#SubstringMatchCriteria\n */\nexport const SubstringMatchCriteria = z.object({\n text: z.string().min(1).describe('The text to search for in the document.'),\n matchCase: z\n .boolean()\n .optional()\n .describe('Whether the search respects case. Defaults to false (case-insensitive).'),\n});\n\nexport type SubstringMatchCriteria = z.infer<typeof SubstringMatchCriteria>;\n"]}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/docs/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ import { docs } from '@googleapis/docs';
3
+ import { authorizedClient, runAuthFlow } from '../auth/oauth.js';
4
+ import { mergeOperations } from '../lib/operation.js';
5
+ import { server } from '../lib/server.js';
6
+ import { instructions } from './instructions.js';
7
+ import { methods } from './methods/registry.js';
8
+ // Cloning this for a new service? Add that service's OAuth scopes to `SCOPES` in
9
+ // src/auth/config.ts BEFORE the first auth. The scope union is front-loaded so each
10
+ // account consents once, and Google only re-issues a refresh token on a fresh grant;
11
+ // adding a scope later forces re-consent of every account. Nothing in this file
12
+ // references scopes, which is exactly why it is easy to miss.
13
+ //
14
+ // Docs is methods-only: Google publishes no MCP toolset for Docs (its
15
+ // MCP-supported products are Gmail, Drive, Calendar, Chat, and People), so there
16
+ // is no tools/ folder and the REST-sourced methods are the whole surface.
17
+ await server({
18
+ name: 'docs',
19
+ title: 'Google Docs (google-mcp-suite)',
20
+ description: 'Per-account Google Docs MCP server: document reads and creation plus curated text editing.',
21
+ instructions,
22
+ operations: mergeOperations(methods),
23
+ client: async (account) => docs({ version: 'v1', auth: await authorizedClient(account) }),
24
+ runAuth: runAuthFlow,
25
+ });
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/docs/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,iFAAiF;AACjF,oFAAoF;AACpF,qFAAqF;AACrF,gFAAgF;AAChF,8DAA8D;AAC9D,EAAE;AACF,sEAAsE;AACtE,iFAAiF;AACjF,0EAA0E;AAC1E,MAAM,MAAM,CAAC;IACX,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,gCAAgC;IACvC,WAAW,EACT,4FAA4F;IAC9F,YAAY;IACZ,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC;IACpC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;IACzF,OAAO,EAAE,WAAW;CACrB,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { docs } from '@googleapis/docs';\nimport { authorizedClient, runAuthFlow } from '../auth/oauth.js';\nimport { mergeOperations } from '../lib/operation.js';\nimport { server } from '../lib/server.js';\nimport { instructions } from './instructions.js';\nimport { methods } from './methods/registry.js';\n\n// Cloning this for a new service? Add that service's OAuth scopes to `SCOPES` in\n// src/auth/config.ts BEFORE the first auth. The scope union is front-loaded so each\n// account consents once, and Google only re-issues a refresh token on a fresh grant;\n// adding a scope later forces re-consent of every account. Nothing in this file\n// references scopes, which is exactly why it is easy to miss.\n//\n// Docs is methods-only: Google publishes no MCP toolset for Docs (its\n// MCP-supported products are Gmail, Drive, Calendar, Chat, and People), so there\n// is no tools/ folder and the REST-sourced methods are the whole surface.\nawait server({\n name: 'docs',\n title: 'Google Docs (google-mcp-suite)',\n description:\n 'Per-account Google Docs MCP server: document reads and creation plus curated text editing.',\n instructions,\n operations: mergeOperations(methods),\n client: async (account) => docs({ version: 'v1', auth: await authorizedClient(account) }),\n runAuth: runAuthFlow,\n});\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const instructions: string;
2
+ //# sourceMappingURL=instructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/docs/instructions.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY,QAekC,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Served in the MCP initialize result; see `ServerOptions.instructions` in
3
+ * src/lib/server.ts. A standalone module so tests can pin the content without
4
+ * booting the server (index.ts's import side effect is `await server()`).
5
+ */
6
+ import { SOURCE_META_KEY } from '../lib/operation.js';
7
+ import { identityInstructions } from '../lib/server.js';
8
+ export const instructions = identityInstructions('Google account') +
9
+ 'Google publishes no MCP toolset for Docs, so every operation transcribes ' +
10
+ 'the REST reference; each tools/list entry links its source page under ' +
11
+ `_meta['${SOURCE_META_KEY}'] and carries the four MCP behavior hints. ` +
12
+ 'get_document returns the body as text blocks with zero-based UTF-16 index ' +
13
+ 'ranges; those ranges are what insert_text and delete_content_range ' +
14
+ 'target, and they shift on every edit, so re-read the document before ' +
15
+ 'computing new ranges. Non-text elements appear as U+FFFC placeholders, one ' +
16
+ 'per UTF-16 unit, so block text length always equals its index span; an ' +
17
+ 'emoji is two units, and ranges must not split a surrogate pair. ' +
18
+ 'insert_text with no index appends at the end of the ' +
19
+ 'body, and body content starts at index 1. replace_all_text and ' +
20
+ 'delete_content_range destroy the matched or ranged text irreversibly. ' +
21
+ "The Docs API has no delete or list; removing a document is Drive's " +
22
+ 'files.delete, and document creation takes only a title.';
23
+ //# sourceMappingURL=instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/docs/instructions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,CAAC,MAAM,YAAY,GACvB,oBAAoB,CAAC,gBAAgB,CAAC;IACtC,2EAA2E;IAC3E,wEAAwE;IACxE,UAAU,eAAe,8CAA8C;IACvE,4EAA4E;IAC5E,qEAAqE;IACrE,uEAAuE;IACvE,6EAA6E;IAC7E,yEAAyE;IACzE,kEAAkE;IAClE,sDAAsD;IACtD,iEAAiE;IACjE,wEAAwE;IACxE,qEAAqE;IACrE,yDAAyD,CAAC","sourcesContent":["/**\n * Served in the MCP initialize result; see `ServerOptions.instructions` in\n * src/lib/server.ts. A standalone module so tests can pin the content without\n * booting the server (index.ts's import side effect is `await server()`).\n */\nimport { SOURCE_META_KEY } from '../lib/operation.js';\nimport { identityInstructions } from '../lib/server.js';\n\nexport const instructions =\n identityInstructions('Google account') +\n 'Google publishes no MCP toolset for Docs, so every operation transcribes ' +\n 'the REST reference; each tools/list entry links its source page under ' +\n `_meta['${SOURCE_META_KEY}'] and carries the four MCP behavior hints. ` +\n 'get_document returns the body as text blocks with zero-based UTF-16 index ' +\n 'ranges; those ranges are what insert_text and delete_content_range ' +\n 'target, and they shift on every edit, so re-read the document before ' +\n 'computing new ranges. Non-text elements appear as U+FFFC placeholders, one ' +\n 'per UTF-16 unit, so block text length always equals its index span; an ' +\n 'emoji is two units, and ranges must not split a surrogate pair. ' +\n 'insert_text with no index appends at the end of the ' +\n 'body, and body content starts at index 1. replace_all_text and ' +\n 'delete_content_range destroy the matched or ranged text irreversibly. ' +\n \"The Docs API has no delete or list; removing a document is Drive's \" +\n 'files.delete, and document creation takes only a title.';\n"]}
@@ -0,0 +1,16 @@
1
+ import type { docs_v1 } from '@googleapis/docs';
2
+ /**
3
+ * Apply exactly one update request via `documents.batchUpdate`: the shared
4
+ * wrapper behind the curated text-editing operations (the rest of the
5
+ * 40-variant request union is issue #35). Replies map 1:1 with requests, so
6
+ * exactly one request means exactly one reply; surfacing it here keeps the
7
+ * `[0]` next to the invariant it depends on. Also returns the identity every
8
+ * write reports: the document id and, when Google supplies one, the
9
+ * post-write revision.
10
+ */
11
+ export declare function applyUpdate(docs: docs_v1.Docs, documentId: string, request: docs_v1.Schema$Request): Promise<{
12
+ reply: docs_v1.Schema$Response | undefined;
13
+ documentId: string;
14
+ revisionId: string | undefined;
15
+ }>;
16
+ //# sourceMappingURL=batch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../../src/docs/lib/batch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,CAAC,cAAc,GAC9B,OAAO,CAAC;IACT,KAAK,EAAE,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC,CAUD"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Apply exactly one update request via `documents.batchUpdate`: the shared
3
+ * wrapper behind the curated text-editing operations (the rest of the
4
+ * 40-variant request union is issue #35). Replies map 1:1 with requests, so
5
+ * exactly one request means exactly one reply; surfacing it here keeps the
6
+ * `[0]` next to the invariant it depends on. Also returns the identity every
7
+ * write reports: the document id and, when Google supplies one, the
8
+ * post-write revision.
9
+ */
10
+ export async function applyUpdate(docs, documentId, request) {
11
+ const { data } = await docs.documents.batchUpdate({
12
+ documentId,
13
+ requestBody: { requests: [request] },
14
+ });
15
+ return {
16
+ reply: data.replies?.[0],
17
+ documentId: data.documentId ?? documentId,
18
+ revisionId: data.writeControl?.requiredRevisionId ?? undefined,
19
+ };
20
+ }
21
+ //# sourceMappingURL=batch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch.js","sourceRoot":"","sources":["../../../src/docs/lib/batch.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAkB,EAClB,UAAkB,EAClB,OAA+B;IAM/B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;QAChD,UAAU;QACV,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE;KACrC,CAAC,CAAC;IACH,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACxB,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,UAAU;QACzC,UAAU,EAAE,IAAI,CAAC,YAAY,EAAE,kBAAkB,IAAI,SAAS;KAC/D,CAAC;AACJ,CAAC","sourcesContent":["import type { docs_v1 } from '@googleapis/docs';\n\n/**\n * Apply exactly one update request via `documents.batchUpdate`: the shared\n * wrapper behind the curated text-editing operations (the rest of the\n * 40-variant request union is issue #35). Replies map 1:1 with requests, so\n * exactly one request means exactly one reply; surfacing it here keeps the\n * `[0]` next to the invariant it depends on. Also returns the identity every\n * write reports: the document id and, when Google supplies one, the\n * post-write revision.\n */\nexport async function applyUpdate(\n docs: docs_v1.Docs,\n documentId: string,\n request: docs_v1.Schema$Request,\n): Promise<{\n reply: docs_v1.Schema$Response | undefined;\n documentId: string;\n revisionId: string | undefined;\n}> {\n const { data } = await docs.documents.batchUpdate({\n documentId,\n requestBody: { requests: [request] },\n });\n return {\n reply: data.replies?.[0],\n documentId: data.documentId ?? documentId,\n revisionId: data.writeControl?.requiredRevisionId ?? undefined,\n };\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { docs_v1 } from '@googleapis/docs';
2
+ import type { Document } from '../entities/Document.js';
3
+ import type { StructuralElement } from '../entities/StructuralElement.js';
4
+ /**
5
+ * Project one REST structural element: indices plus kind, paragraph text, and
6
+ * table dimensions. An element of a kind this server does not know keeps its
7
+ * indices and drops the rest (the enum-or-drop policy applied to a
8
+ * discriminator), so edits can still be targeted around it.
9
+ */
10
+ export declare function projectStructuralElement(element: docs_v1.Schema$StructuralElement): StructuralElement;
11
+ /** Project a REST document onto the text-with-indices Document shape, cleaning nulls. */
12
+ export declare function projectDocument(data: docs_v1.Schema$Document): Document;
13
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/docs/lib/document.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAqB1E;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,CAAC,wBAAwB,GACxC,iBAAiB,CAuBnB;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,GAAG,QAAQ,CAOvE"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Concatenate a paragraph's elements into index-faithful text: text runs
3
+ * verbatim, and every non-text element (inline object, footnote reference,
4
+ * chip, rule, ...) as one U+FFFC placeholder per UTF-16 unit it occupies, so
5
+ * `text.length` always equals `endIndex - startIndex` and offsets into the
6
+ * text can be added to `startIndex` to target edits.
7
+ */
8
+ function paragraphText(paragraph) {
9
+ return (paragraph.elements ?? [])
10
+ .map((element) => {
11
+ if (element.textRun) {
12
+ return element.textRun.content ?? '';
13
+ }
14
+ const span = (element.endIndex ?? 0) - (element.startIndex ?? 0);
15
+ return span > 0 ? '\uFFFC'.repeat(span) : '';
16
+ })
17
+ .join('');
18
+ }
19
+ /**
20
+ * Project one REST structural element: indices plus kind, paragraph text, and
21
+ * table dimensions. An element of a kind this server does not know keeps its
22
+ * indices and drops the rest (the enum-or-drop policy applied to a
23
+ * discriminator), so edits can still be targeted around it.
24
+ */
25
+ export function projectStructuralElement(element) {
26
+ const base = {
27
+ startIndex: element.startIndex ?? undefined,
28
+ endIndex: element.endIndex ?? undefined,
29
+ };
30
+ if (element.paragraph) {
31
+ return { ...base, type: 'paragraph', text: paragraphText(element.paragraph) };
32
+ }
33
+ if (element.table) {
34
+ return {
35
+ ...base,
36
+ type: 'table',
37
+ rows: element.table.rows ?? undefined,
38
+ columns: element.table.columns ?? undefined,
39
+ };
40
+ }
41
+ if (element.sectionBreak) {
42
+ return { ...base, type: 'sectionBreak' };
43
+ }
44
+ if (element.tableOfContents) {
45
+ return { ...base, type: 'tableOfContents' };
46
+ }
47
+ return base;
48
+ }
49
+ /** Project a REST document onto the text-with-indices Document shape, cleaning nulls. */
50
+ export function projectDocument(data) {
51
+ return {
52
+ documentId: data.documentId ?? '',
53
+ title: data.title ?? undefined,
54
+ revisionId: data.revisionId ?? undefined,
55
+ content: data.body?.content ? data.body.content.map(projectStructuralElement) : undefined,
56
+ };
57
+ }
58
+ //# sourceMappingURL=document.js.map