@alanse/mcp-server-google-workspace 0.2.0 → 0.2.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/LICENSE CHANGED
@@ -1,21 +1,95 @@
1
- MIT License
1
+ Elastic License 2.0
2
+
3
+ URL: https://www.elastic.co/licensing/elastic-license
2
4
 
3
5
  Copyright (c) 2026 Alanse inc.
4
6
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
7
+ ## Acceptance
8
+
9
+ By using the software, you agree to all of the terms and conditions below.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
14
+ non-sublicensable, non-transferable license to use, copy, distribute, make
15
+ available, and prepare derivative works of the software, in each case subject to
16
+ the limitations and conditions below.
17
+
18
+ ## Limitations
19
+
20
+ You may not provide the software to third parties as a hosted or managed
21
+ service, where the service provides users with access to any substantial set of
22
+ the features or functionality of the software.
23
+
24
+ You may not move, change, disable, or circumvent the license key functionality
25
+ in the software, and you may not remove or obscure any functionality in the
26
+ software that is protected by the license key.
27
+
28
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
29
+ of the licensor in the software. Any use of the licensor's trademarks is subject
30
+ to applicable law.
31
+
32
+ ## Patents
33
+
34
+ The licensor grants you a license, under any patent claims the licensor can
35
+ license, or becomes able to license, to make, have made, use, sell, offer for
36
+ sale, import and have imported the software, in each case subject to the
37
+ limitations and conditions in this license. This license does not cover any
38
+ patent claims that you cause to be infringed by modifications or additions to
39
+ the software. If you or your company make any written claim that the software
40
+ infringes or contributes to infringement of any patent, your patent license for
41
+ the software granted under these terms ends immediately. If your company makes
42
+ such a claim, your patent license ends immediately for work on behalf of your
43
+ company.
44
+
45
+ ## Notices
46
+
47
+ You must ensure that anyone who gets a copy of any part of the software from you
48
+ also gets a copy of these terms.
49
+
50
+ If you modify the software, you must include in any modified copies of the
51
+ software prominent notices stating that you have modified the software.
52
+
53
+ ## No Other Rights
54
+
55
+ These terms do not imply any licenses other than those expressly granted in
56
+ these terms.
57
+
58
+ ## Termination
59
+
60
+ If you use the software in violation of these terms, such use is not licensed,
61
+ and your licenses will automatically terminate. If the licensor provides you
62
+ with a notice of your violation, and you cease all violation of this license no
63
+ later than 30 days after you receive that notice, your licenses will be
64
+ reinstated retroactively. However, if you violate these terms after such
65
+ reinstatement, any additional violation of these terms will cause your licenses
66
+ to terminate automatically and permanently.
67
+
68
+ ## No Liability
69
+
70
+ *As far as the law allows, the software comes as is, without any warranty or
71
+ condition, and the licensor will not be liable to you for any damages arising
72
+ out of these terms or the use or nature of the software, under any kind of
73
+ legal claim.*
74
+
75
+ ## Definitions
76
+
77
+ The **licensor** is the entity offering these terms, and the **software** is the
78
+ software the licensor makes available under these terms, including any portion
79
+ of it.
80
+
81
+ **you** refers to the individual or entity agreeing to these terms.
82
+
83
+ **your company** is any legal entity, sole proprietorship, or other kind of
84
+ organization that you work for, plus all organizations that have control over,
85
+ are under the control of, or are under common control with that
86
+ organization. **control** means ownership of substantially all the assets of an
87
+ entity, or the power to direct its management and policies by vote, contract, or
88
+ otherwise. Control can be direct or indirect.
89
+
90
+ **your licenses** are all the licenses granted to you for the software under
91
+ these terms.
92
+
93
+ **use** means anything you do with the software requiring one of your licenses.
94
+
95
+ **trademark** means trademarks, service marks, and similar rights.
package/README.md CHANGED
@@ -5,16 +5,9 @@
5
5
  🚀 **Current Status**: 59 tools (Drive: 2, Sheets: 57)
6
6
  📅 **Roadmap**: Google Docs, Calendar, Forms, Gmail, Slides
7
7
 
8
- This is an extended version of [@isaacphi/mcp-gdrive](https://github.com/isaacphi/mcp-gdrive), adding **53 additional Google Sheets API tools** for complete spreadsheet management and preparing for comprehensive Google Workspace coverage.
8
+ Extended implementation by Alanse inc.
9
9
 
10
- ## Credits
11
-
12
- This project is based on:
13
- - Original code by **Anthropic, PBC** from [MCP Servers](https://github.com/modelcontextprotocol/servers/tree/main/src/gdrive) (MIT License)
14
- - Enhanced by **Phil Isaac** in [@isaacphi/mcp-gdrive](https://github.com/isaacphi/mcp-gdrive) (MIT License)
15
- - **Extended implementation** by **Alanse株式会社 / Daichi Okazaki** (2026)
16
-
17
- All contributions are licensed under the MIT License.
10
+ ---
18
11
 
19
12
  ## 🚀 Features
20
13
 
@@ -65,7 +58,7 @@ For complete tool documentation, see [docs/api-comparison.md](./docs/api-compari
65
58
 
66
59
  The server provides access to Google Drive files:
67
60
 
68
- - **Files** (`gdrive:///<file_id>`)
61
+ - **Files** (`gworkspace:///<file_id>`)
69
62
  - Supports all file types
70
63
  - Google Workspace files are automatically exported:
71
64
  - Docs → Markdown
@@ -83,12 +76,12 @@ The server provides access to Google Drive files:
83
76
  5. In order to allow interaction with sheets and docs you will also need to enable the [Google Sheets API](https://console.cloud.google.com/apis/api/sheets.googleapis.com/) and [Google Docs API](https://console.cloud.google.com/marketplace/product/google/docs.googleapis.com) in your workspaces Enabled API and Services section.
84
77
  6. [Create an OAuth Client ID](https://console.cloud.google.com/apis/credentials/oauthclient) for application type "Desktop App"
85
78
  7. Download the JSON file of your client's OAuth keys
86
- 8. Rename the key file to `gcp-oauth.keys.json` and place into the path you specify with `GDRIVE_CREDS_DIR` (i.e. `/Users/username/.config/mcp-gdrive`)
79
+ 8. Rename the key file to `gcp-oauth.keys.json` and place into the path you specify with `GWORKSPACE_CREDS_DIR` (i.e. `/Users/username/.config/mcp-google-workspace`)
87
80
  9. Note your OAuth Client ID and Client Secret. They must be provided as environment variables along with your configuration directory.
88
81
  10. You will also need to setup a .env file within the project with the following fields. You can find the Client ID and Client Secret in the Credentials section of the Google Cloud Console.
89
82
 
90
- ```
91
- GDRIVE_CREDS_DIR=/path/to/config/directory
83
+ ```bash
84
+ GWORKSPACE_CREDS_DIR=/path/to/config/directory
92
85
  CLIENT_ID=<CLIENT_ID>
93
86
  CLIENT_SECRET=<CLIENT_SECRET>
94
87
  ```
@@ -101,9 +94,7 @@ Next you will need to run `node ./dist/index.js` to trigger the authentication s
101
94
 
102
95
  You will be prompted to authenticate with your browser. You must authenticate with an account in the same organization as your Google Cloud project.
103
96
 
104
- Your OAuth token is saved in the directory specified by the `GDRIVE_CREDS_DIR` environment variable.
105
-
106
- ![Authentication Prompt](https://i.imgur.com/TbyV6Yq.png)
97
+ Your OAuth token is saved in the directory specified by the `GWORKSPACE_CREDS_DIR` environment variable.
107
98
 
108
99
  ### Usage with Desktop App
109
100
 
@@ -118,13 +109,28 @@ To integrate this server with the desktop app, add the following to your app's s
118
109
  "env": {
119
110
  "CLIENT_ID": "<CLIENT_ID>",
120
111
  "CLIENT_SECRET": "<CLIENT_SECRET>",
121
- "GDRIVE_CREDS_DIR": "/path/to/config/directory"
112
+ "GWORKSPACE_CREDS_DIR": "/path/to/config/directory"
122
113
  }
123
114
  }
124
115
  }
125
116
  }
126
117
  ```
127
118
 
119
+ ### Usage with Claude Code CLI
120
+
121
+ To add this server to Claude Code CLI, use the following command:
122
+
123
+ ```bash
124
+ claude mcp add google-workspace \
125
+ -e CLIENT_ID=<YOUR_CLIENT_ID> \
126
+ -e CLIENT_SECRET=<YOUR_CLIENT_SECRET> \
127
+ -e GWORKSPACE_CREDS_DIR=/path/to/config/directory \
128
+ -- npx -y @alanse/mcp-server-google-workspace \
129
+ -s user
130
+ ```
131
+
132
+ Replace `<YOUR_CLIENT_ID>`, `<YOUR_CLIENT_SECRET>`, and `/path/to/config/directory` with your actual values.
133
+
128
134
  ## 📈 Project Status
129
135
 
130
136
  ✅ **Phase 1-12 Complete** (2026-01-06)
@@ -151,23 +157,12 @@ To integrate this server with the desktop app, add the following to your app's s
151
157
 
152
158
  ## 📄 License
153
159
 
154
- This project is licensed under the **MIT License**.
155
-
156
- ### Copyright Notices
157
-
158
- - Original code: © 2024 Anthropic, PBC
159
- - Base implementation: © 2024 Phil Isaac
160
- - Extended implementation: © 2026 Alanse株式会社 / Daichi Okazaki
161
-
162
- You are free to use, modify, and distribute this software under the terms of the MIT License. See the [LICENSE](./LICENSE) file for details.
163
-
164
- ## 🙏 Acknowledgments
160
+ This project is licensed under the **Elastic License 2.0**.
165
161
 
166
- Special thanks to:
167
- - **Anthropic, PBC** for the original MCP server implementation
168
- - **Phil Isaac** for the enhanced Google Drive & Sheets integration
169
- - The **Model Context Protocol** team for the excellent framework
162
+ Copyright © 2026 Alanse inc.
170
163
 
171
- ## 📚 Related Documentation
164
+ See the [LICENSE](./LICENSE) file for details.
172
165
 
173
- - [docs/api-comparison.md](./docs/api-comparison.md) - MCP vs Google Sheets API comparison
166
+ **Key restrictions**:
167
+ - You may not provide the software to third parties as a hosted or managed service where the service provides users with access to any substantial set of the features or functionality of the software.
168
+ - You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software.
package/dist/auth.js CHANGED
@@ -7,7 +7,7 @@ export const SCOPES = [
7
7
  "https://www.googleapis.com/auth/spreadsheets",
8
8
  ];
9
9
  // Get credentials directory from environment variable or use default
10
- const CREDS_DIR = process.env.GDRIVE_CREDS_DIR ||
10
+ const CREDS_DIR = process.env.GWORKSPACE_CREDS_DIR ||
11
11
  path.join(path.dirname(new URL(import.meta.url).pathname), "../../../");
12
12
  // Ensure the credentials directory exists
13
13
  function ensureCredsDirectory() {
@@ -20,7 +20,7 @@ function ensureCredsDirectory() {
20
20
  throw error;
21
21
  }
22
22
  }
23
- const credentialsPath = path.join(CREDS_DIR, ".gdrive-server-credentials.json");
23
+ const credentialsPath = path.join(CREDS_DIR, ".gworkspace-credentials.json");
24
24
  async function authenticateWithTimeout(keyfilePath, SCOPES, timeoutMs = 30000) {
25
25
  const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error("Authentication timed out")), timeoutMs));
26
26
  const authPromise = authenticate({
package/dist/index.js CHANGED
@@ -8,12 +8,12 @@ import { getValidCredentials, setupTokenRefresh, loadCredentialsQuietly, } from
8
8
  import { tools } from "./tools/index.js";
9
9
  const drive = google.drive("v3");
10
10
  const server = new Server({
11
- name: "example-servers/gdrive",
12
- version: "0.1.0",
11
+ name: "@alanse/mcp-server-google-workspace",
12
+ version: "0.2.1",
13
13
  }, {
14
14
  capabilities: {
15
15
  resources: {
16
- schemes: ["gdrive"], // Declare that we handle gdrive:/// URIs
16
+ schemes: ["gworkspace"], // Declare that we handle gworkspace:/// URIs
17
17
  listable: true, // Support listing available resources
18
18
  readable: true, // Support reading resource contents
19
19
  },
@@ -47,7 +47,7 @@ server.setRequestHandler(ListResourcesRequestSchema, async (request) => {
47
47
  const files = res.data.files;
48
48
  return {
49
49
  resources: files.map((file) => ({
50
- uri: `gdrive:///${file.id}`,
50
+ uri: `gworkspace:///${file.id}`,
51
51
  mimeType: file.mimeType,
52
52
  name: file.name,
53
53
  })),
@@ -56,8 +56,8 @@ server.setRequestHandler(ListResourcesRequestSchema, async (request) => {
56
56
  });
57
57
  server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
58
58
  await ensureAuthQuietly();
59
- const fileId = request.params.uri.replace("gdrive:///", "");
60
- const readFileTool = tools[1]; // gdrive_read_file is the second tool
59
+ const fileId = request.params.uri.replace("gworkspace:///", "");
60
+ const readFileTool = tools[1]; // drive_read_file is the second tool
61
61
  const result = await readFileTool.handler({ fileId });
62
62
  // Extract the file contents from the tool response
63
63
  const fileContents = result.content[0].text.split("\n\n")[1]; // Skip the "Contents of file:" prefix
@@ -0,0 +1,77 @@
1
+ import { google } from "googleapis";
2
+ export const schema = {
3
+ name: "drive_read_file",
4
+ description: "Read contents of a file from Google Drive",
5
+ inputSchema: {
6
+ type: "object",
7
+ properties: {
8
+ fileId: {
9
+ type: "string",
10
+ description: "ID of the file to read",
11
+ },
12
+ },
13
+ required: ["fileId"],
14
+ },
15
+ };
16
+ const drive = google.drive("v3");
17
+ export async function readFile(args) {
18
+ const result = await readGoogleDriveFile(args.fileId);
19
+ return {
20
+ content: [
21
+ {
22
+ type: "text",
23
+ text: `Contents of ${result.name}:\n\n${result.contents.text || result.contents.blob}`,
24
+ },
25
+ ],
26
+ isError: false,
27
+ };
28
+ }
29
+ async function readGoogleDriveFile(fileId) {
30
+ // First get file metadata to check mime type
31
+ const file = await drive.files.get({
32
+ fileId,
33
+ fields: "mimeType,name",
34
+ });
35
+ // For Google Docs/Sheets/etc we need to export
36
+ if (file.data.mimeType?.startsWith("application/vnd.google-apps")) {
37
+ let exportMimeType;
38
+ switch (file.data.mimeType) {
39
+ case "application/vnd.google-apps.document":
40
+ exportMimeType = "text/markdown";
41
+ break;
42
+ case "application/vnd.google-apps.spreadsheet":
43
+ exportMimeType = "text/csv";
44
+ break;
45
+ case "application/vnd.google-apps.presentation":
46
+ exportMimeType = "text/plain";
47
+ break;
48
+ case "application/vnd.google-apps.drawing":
49
+ exportMimeType = "image/png";
50
+ break;
51
+ default:
52
+ exportMimeType = "text/plain";
53
+ }
54
+ const res = await drive.files.export({ fileId, mimeType: exportMimeType }, { responseType: "text" });
55
+ return {
56
+ name: file.data.name || fileId,
57
+ contents: {
58
+ mimeType: exportMimeType,
59
+ text: res.data,
60
+ },
61
+ };
62
+ }
63
+ // For regular files download content
64
+ const res = await drive.files.get({ fileId, alt: "media" }, { responseType: "arraybuffer" });
65
+ const mimeType = file.data.mimeType || "application/octet-stream";
66
+ const isText = mimeType.startsWith("text/") || mimeType === "application/json";
67
+ const content = Buffer.from(res.data);
68
+ return {
69
+ name: file.data.name || fileId,
70
+ contents: {
71
+ mimeType,
72
+ ...(isText
73
+ ? { text: content.toString("utf-8") }
74
+ : { blob: content.toString("base64") }),
75
+ },
76
+ };
77
+ }
@@ -0,0 +1,71 @@
1
+ import { google } from "googleapis";
2
+ export const schema = {
3
+ name: "drive_search",
4
+ description: "Search for files in Google Drive",
5
+ inputSchema: {
6
+ type: "object",
7
+ properties: {
8
+ query: {
9
+ type: "string",
10
+ description: "Search query",
11
+ },
12
+ pageToken: {
13
+ type: "string",
14
+ description: "Token for the next page of results",
15
+ optional: true,
16
+ },
17
+ pageSize: {
18
+ type: "number",
19
+ description: "Number of results per page (max 100)",
20
+ optional: true,
21
+ },
22
+ },
23
+ required: ["query"],
24
+ },
25
+ };
26
+ export async function search(args) {
27
+ const drive = google.drive("v3");
28
+ const userQuery = args.query.trim();
29
+ let searchQuery = "";
30
+ // If query is empty, list all files
31
+ if (!userQuery) {
32
+ searchQuery = "trashed = false";
33
+ }
34
+ else {
35
+ // Escape special characters in the query
36
+ const escapedQuery = userQuery.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
37
+ // Build search query with multiple conditions
38
+ const conditions = [];
39
+ // Search in title
40
+ conditions.push(`name contains '${escapedQuery}'`);
41
+ // If specific file type is mentioned in query, add mimeType condition
42
+ if (userQuery.toLowerCase().includes("sheet")) {
43
+ conditions.push("mimeType = 'application/vnd.google-sheets.spreadsheet'");
44
+ }
45
+ searchQuery = `(${conditions.join(" or ")}) and trashed = false`;
46
+ }
47
+ const res = await drive.files.list({
48
+ q: searchQuery,
49
+ pageSize: args.pageSize || 10,
50
+ pageToken: args.pageToken,
51
+ orderBy: "modifiedTime desc",
52
+ fields: "nextPageToken, files(id, name, mimeType, modifiedTime, size)",
53
+ });
54
+ const fileList = res.data.files
55
+ ?.map((file) => `${file.id} ${file.name} (${file.mimeType})`)
56
+ .join("\n");
57
+ let response = `Found ${res.data.files?.length ?? 0} files:\n${fileList}`;
58
+ // Add pagination info if there are more results
59
+ if (res.data.nextPageToken) {
60
+ response += `\n\nMore results available. Use pageToken: ${res.data.nextPageToken}`;
61
+ }
62
+ return {
63
+ content: [
64
+ {
65
+ type: "text",
66
+ text: response,
67
+ },
68
+ ],
69
+ isError: false,
70
+ };
71
+ }
@@ -1,6 +1,6 @@
1
- // GDrive operations
2
- import { schema as gdriveSearchSchema, search } from './gdrive/gdrive_search.js';
3
- import { schema as gdriveReadFileSchema, readFile } from './gdrive/gdrive_read_file.js';
1
+ // Drive operations
2
+ import { schema as driveSearchSchema, search } from './drive/drive_search.js';
3
+ import { schema as driveReadFileSchema, readFile } from './drive/drive_read_file.js';
4
4
  // Basic operations
5
5
  import { schema as gsheetsReadSchema, readSheet } from './sheets/basic/gsheets_read.js';
6
6
  import { schema as gsheetsListSheetsSchema, listSheets } from './sheets/basic/gsheets_list_sheets.js';
@@ -64,11 +64,11 @@ import { schema as gsheetsUpdateDeveloperMetadataSchema, updateDeveloperMetadata
64
64
  import { schema as gsheetsDeleteDeveloperMetadataSchema, deleteDeveloperMetadata } from './sheets/advanced/gsheets_delete_developer_metadata.js';
65
65
  export const tools = [
66
66
  {
67
- ...gdriveSearchSchema,
67
+ ...driveSearchSchema,
68
68
  handler: search,
69
69
  },
70
70
  {
71
- ...gdriveReadFileSchema,
71
+ ...driveReadFileSchema,
72
72
  handler: readFile,
73
73
  },
74
74
  {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@alanse/mcp-server-google-workspace",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "The most comprehensive MCP server for Google Workspace - Complete integration for Sheets (57 tools), Drive, and future Docs, Calendar, Forms support",
5
- "license": "MIT",
6
- "author": "Alanse inc. / Daichi Okazaki",
5
+ "license": "Elastic-2.0",
6
+ "author": "Alanse inc",
7
7
  "homepage": "https://github.com/alanse-inc/mcp-server-google-workspace",
8
8
  "bugs": "https://github.com/alanse-inc/mcp-server-google-workspace/issues",
9
9
  "type": "module",