iflow-mcp_mcp-gsuite 0.4.1__tar.gz
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.
- iflow_mcp_mcp_gsuite-0.4.1/.gitignore +15 -0
- iflow_mcp_mcp_gsuite-0.4.1/.python-version +1 -0
- iflow_mcp_mcp_gsuite-0.4.1/Dockerfile +38 -0
- iflow_mcp_mcp_gsuite-0.4.1/LICENSE +21 -0
- iflow_mcp_mcp_gsuite-0.4.1/PKG-INFO +272 -0
- iflow_mcp_mcp_gsuite-0.4.1/README.md +255 -0
- iflow_mcp_mcp_gsuite-0.4.1/gmail-api-openapi-spec.yaml +1630 -0
- iflow_mcp_mcp_gsuite-0.4.1/gmail.v1.json +4444 -0
- iflow_mcp_mcp_gsuite-0.4.1/google-calendar-api-openapi-spec.yaml +1412 -0
- iflow_mcp_mcp_gsuite-0.4.1/pyproject.toml +34 -0
- iflow_mcp_mcp_gsuite-0.4.1/smithery.yaml +24 -0
- iflow_mcp_mcp_gsuite-0.4.1/src/mcp_gsuite/__init__.py +9 -0
- iflow_mcp_mcp_gsuite-0.4.1/src/mcp_gsuite/calendar.py +192 -0
- iflow_mcp_mcp_gsuite-0.4.1/src/mcp_gsuite/gauth.py +259 -0
- iflow_mcp_mcp_gsuite-0.4.1/src/mcp_gsuite/gmail.py +404 -0
- iflow_mcp_mcp_gsuite-0.4.1/src/mcp_gsuite/server.py +173 -0
- iflow_mcp_mcp_gsuite-0.4.1/src/mcp_gsuite/toolhandler.py +36 -0
- iflow_mcp_mcp_gsuite-0.4.1/src/mcp_gsuite/tools_calendar.py +253 -0
- iflow_mcp_mcp_gsuite-0.4.1/src/mcp_gsuite/tools_gmail.py +553 -0
- iflow_mcp_mcp_gsuite-0.4.1/uv.lock +576 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
|
|
2
|
+
# Use a Python image with uv pre-installed
|
|
3
|
+
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS uv
|
|
4
|
+
|
|
5
|
+
# Set the working directory
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
# Copy necessary configuration files
|
|
9
|
+
COPY . .
|
|
10
|
+
|
|
11
|
+
# Enable bytecode compilation
|
|
12
|
+
ENV UV_COMPILE_BYTECODE=1
|
|
13
|
+
|
|
14
|
+
# Use the copy link mode for mount points
|
|
15
|
+
ENV UV_LINK_MODE=copy
|
|
16
|
+
|
|
17
|
+
# Sync dependencies and build the project
|
|
18
|
+
RUN --mount=type=cache,target=/root/.cache/uv --mount=type=bind,source=uv.lock,target=uv.lock --mount=type=bind,source=pyproject.toml,target=pyproject.toml uv sync --frozen --no-install-project --no-dev --no-editable
|
|
19
|
+
|
|
20
|
+
# Install the project
|
|
21
|
+
RUN --mount=type=cache,target=/root/.cache/uv uv sync --frozen --no-dev --no-editable
|
|
22
|
+
|
|
23
|
+
# Final stage: running the application
|
|
24
|
+
FROM python:3.13-slim-bookworm
|
|
25
|
+
|
|
26
|
+
WORKDIR /app
|
|
27
|
+
|
|
28
|
+
COPY --from=uv /root/.local /root/.local
|
|
29
|
+
COPY --from=uv --chown=app:app /app/.venv /app/.venv
|
|
30
|
+
|
|
31
|
+
# Place executables in the environment at the front of the path
|
|
32
|
+
ENV PATH="/app/.venv/bin:$PATH"
|
|
33
|
+
|
|
34
|
+
# Expose necessary ports
|
|
35
|
+
EXPOSE 4100
|
|
36
|
+
|
|
37
|
+
# Specify the entrypoint command
|
|
38
|
+
ENTRYPOINT ["uv", "run", "mcp-gsuite"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Markus Pfundstein
|
|
4
|
+
|
|
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.
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iflow-mcp_mcp-gsuite
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: MCP Server to connect to Google G-Suite
|
|
5
|
+
Author-email: Markus Pfundstein <markus@life-electronic.nl>
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.13
|
|
8
|
+
Requires-Dist: beautifulsoup4>=4.12.3
|
|
9
|
+
Requires-Dist: google-api-python-client>=2.154.0
|
|
10
|
+
Requires-Dist: httplib2>=0.22.0
|
|
11
|
+
Requires-Dist: mcp>=1.3.0
|
|
12
|
+
Requires-Dist: oauth2client==4.1.3
|
|
13
|
+
Requires-Dist: python-dotenv>=1.0.1
|
|
14
|
+
Requires-Dist: pytz>=2024.2
|
|
15
|
+
Requires-Dist: requests>=2.32.3
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# mcp-gsuite MCP server
|
|
19
|
+
|
|
20
|
+
[](https://smithery.ai/server/mcp-gsuite)
|
|
21
|
+
MCP server to interact with Google products.
|
|
22
|
+
|
|
23
|
+
## Example prompts
|
|
24
|
+
|
|
25
|
+
Right now, this MCP server supports Gmail and Calendar integration with the following capabilities:
|
|
26
|
+
|
|
27
|
+
1. General
|
|
28
|
+
* Multiple google accounts
|
|
29
|
+
|
|
30
|
+
2. Gmail
|
|
31
|
+
* Get your Gmail user information
|
|
32
|
+
* Query emails with flexible search (e.g., unread, from specific senders, date ranges, with attachments)
|
|
33
|
+
* Retrieve complete email content by ID
|
|
34
|
+
* Create new draft emails with recipients, subject, body and CC options
|
|
35
|
+
* Delete draft emails
|
|
36
|
+
* Reply to existing emails (can either send immediately or save as draft)
|
|
37
|
+
* Retrieve multiple emails at once by their IDs.
|
|
38
|
+
* Save multiple attachments from emails to your local system.
|
|
39
|
+
|
|
40
|
+
3. Calendar
|
|
41
|
+
* Manage multiple calendars
|
|
42
|
+
* Get calendar events within specified time ranges
|
|
43
|
+
* Create calendar events with:
|
|
44
|
+
+ Title, start/end times
|
|
45
|
+
+ Optional location and description
|
|
46
|
+
+ Optional attendees
|
|
47
|
+
+ Custom timezone support
|
|
48
|
+
+ Notification preferences
|
|
49
|
+
* Delete calendar events
|
|
50
|
+
|
|
51
|
+
Example prompts you can try:
|
|
52
|
+
|
|
53
|
+
* Retrieve my latest unread messages
|
|
54
|
+
* Search my emails from the Scrum Master
|
|
55
|
+
* Retrieve all emails from accounting
|
|
56
|
+
* Take the email about ABC and summarize it
|
|
57
|
+
* Write a nice response to Alice's last email and upload a draft.
|
|
58
|
+
* Reply to Bob's email with a Thank you note. Store it as draft
|
|
59
|
+
|
|
60
|
+
* What do I have on my agenda tomorrow?
|
|
61
|
+
* Check my private account's Family agenda for next week
|
|
62
|
+
* I need to plan an event with Tim for 2hrs next week. Suggest some time slots.
|
|
63
|
+
|
|
64
|
+
## Quickstart
|
|
65
|
+
|
|
66
|
+
### Install
|
|
67
|
+
|
|
68
|
+
### Installing via Smithery
|
|
69
|
+
|
|
70
|
+
To install mcp-gsuite for Claude Desktop automatically via [Smithery](https://smithery.ai/server/mcp-gsuite):
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx -y @smithery/cli install mcp-gsuite --client claude
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### Oauth 2
|
|
77
|
+
|
|
78
|
+
Google Workspace (G Suite) APIs require OAuth2 authorization. Follow these steps to set up authentication:
|
|
79
|
+
|
|
80
|
+
1. Create OAuth2 Credentials:
|
|
81
|
+
- Go to the [Google Cloud Console](https://console.cloud.google.com/)
|
|
82
|
+
- Create a new project or select an existing one
|
|
83
|
+
- Enable the Gmail API and Google Calendar API for your project
|
|
84
|
+
- Go to "Credentials" → "Create Credentials" → "OAuth client ID"
|
|
85
|
+
- Select "Desktop app" or "Web application" as the application type
|
|
86
|
+
- Configure the OAuth consent screen with required information
|
|
87
|
+
- Add authorized redirect URIs (include `http://localhost:4100/code` for local development)
|
|
88
|
+
|
|
89
|
+
2. Required OAuth2 Scopes:
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
[
|
|
94
|
+
"openid",
|
|
95
|
+
"https://mail.google.com/",
|
|
96
|
+
"https://www.googleapis.com/auth/calendar",
|
|
97
|
+
"https://www.googleapis.com/auth/userinfo.email"
|
|
98
|
+
]
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
3. Then create a `.gauth.json` in your working directory with client
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"web": {
|
|
106
|
+
"client_id": "$your_client_id",
|
|
107
|
+
"client_secret": "$your_client_secret",
|
|
108
|
+
"redirect_uris": ["http://localhost:4100/code"],
|
|
109
|
+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
110
|
+
"token_uri": "https://oauth2.googleapis.com/token"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
4. Create a `.accounts.json` file with account information
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"accounts": [
|
|
120
|
+
{
|
|
121
|
+
"email": "alice@bob.com",
|
|
122
|
+
"account_type": "personal",
|
|
123
|
+
"extra_info": "Additional info that you want to tell Claude: E.g. 'Contains Family Calendar'"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
You can specifiy multiple accounts. Make sure they have access in your Google Auth app. The `extra_info` field is especially interesting as you can add info here that you want to tell the AI about the account (e.g. whether it has a specific agenda)
|
|
130
|
+
|
|
131
|
+
Note: When you first execute one of the tools for a specific account, a browser will open, redirect you to Google and ask for your credentials, scope, etc. After a successful login, it stores the credentials in a local file called `.oauth.{email}.json` . Once you are authorized, the refresh token will be used.
|
|
132
|
+
|
|
133
|
+
#### Claude Desktop
|
|
134
|
+
|
|
135
|
+
On MacOS: `~/Library/Application\ Support/Claude/claude_desktop_config.json`
|
|
136
|
+
|
|
137
|
+
On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
|
|
138
|
+
|
|
139
|
+
<details>
|
|
140
|
+
<summary>Development/Unpublished Servers Configuration</summary>
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"mcpServers": {
|
|
146
|
+
"mcp-gsuite": {
|
|
147
|
+
"command": "uv",
|
|
148
|
+
"args": [
|
|
149
|
+
"--directory",
|
|
150
|
+
"<dir_to>/mcp-gsuite",
|
|
151
|
+
"run",
|
|
152
|
+
"mcp-gsuite"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
Note: You can also use the `uv run mcp-gsuite --accounts-file /path/to/custom/.accounts.json` to specify a different accounts file or `--credentials-dir /path/to/custom/credentials` to specify a different credentials directory.
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"mcpServers": {
|
|
165
|
+
"mcp-gsuite": {
|
|
166
|
+
"command": "uv",
|
|
167
|
+
"args": [
|
|
168
|
+
"--directory",
|
|
169
|
+
"<dir_to>/mcp-gsuite",
|
|
170
|
+
"run",
|
|
171
|
+
"mcp-gsuite",
|
|
172
|
+
"--accounts-file",
|
|
173
|
+
"/path/to/custom/.accounts.json",
|
|
174
|
+
"--credentials-dir",
|
|
175
|
+
"/path/to/custom/credentials"
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
</details>
|
|
183
|
+
|
|
184
|
+
<details>
|
|
185
|
+
<summary>Published Servers Configuration</summary>
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"mcpServers": {
|
|
191
|
+
"mcp-gsuite": {
|
|
192
|
+
"command": "uvx",
|
|
193
|
+
"args": [
|
|
194
|
+
"mcp-gsuite",
|
|
195
|
+
"--accounts-file",
|
|
196
|
+
"/path/to/custom/.accounts.json",
|
|
197
|
+
"--credentials-dir",
|
|
198
|
+
"/path/to/custom/credentials"
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
</details>
|
|
206
|
+
|
|
207
|
+
### Configuration Options
|
|
208
|
+
|
|
209
|
+
The MCP server can be configured with several command-line options to specify custom paths for authentication and account information:
|
|
210
|
+
|
|
211
|
+
* `--gauth-file`: Specifies the path to the `.gauth.json` file containing OAuth2 client configuration. Default is `./.gauth.json`.
|
|
212
|
+
* `--accounts-file`: Specifies the path to the `.accounts.json` file containing information about the Google accounts. Default is `./.accounts.json`.
|
|
213
|
+
* `--credentials-dir`: Specifies the directory where OAuth credentials are stored after successful authentication. Default is the current working directory with a subdirectory for each account as `.oauth.{email}.json`.
|
|
214
|
+
|
|
215
|
+
These options allow for flexibility in managing different environments or multiple sets of credentials and accounts, especially useful in development and testing scenarios.
|
|
216
|
+
|
|
217
|
+
Example usage:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
uv run mcp-gsuite --gauth-file /path/to/custom/.gauth.json --accounts-file /path/to/custom/.accounts.json --credentials-dir /path/to/custom/credentials
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
This configuration is particularly useful when you have multiple instances of the server running with different configurations or when deploying to environments where the default paths are not suitable.
|
|
224
|
+
|
|
225
|
+
## Development
|
|
226
|
+
|
|
227
|
+
### Building and Publishing
|
|
228
|
+
|
|
229
|
+
To prepare the package for distribution:
|
|
230
|
+
|
|
231
|
+
1. Sync dependencies and update lockfile:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
uv sync
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
2. Build package distributions:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
uv build
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
This will create source and wheel distributions in the `dist/` directory.
|
|
244
|
+
|
|
245
|
+
3. Publish to PyPI:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
uv publish
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Note: You'll need to set PyPI credentials via environment variables or command flags:
|
|
252
|
+
* Token: `--token` or `UV_PUBLISH_TOKEN`
|
|
253
|
+
* Or username/password: `--username`/`UV_PUBLISH_USERNAME` and `--password`/`UV_PUBLISH_PASSWORD`
|
|
254
|
+
|
|
255
|
+
### Debugging
|
|
256
|
+
|
|
257
|
+
Since MCP servers run over stdio, debugging can be challenging. For the best debugging
|
|
258
|
+
experience, we strongly recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector).
|
|
259
|
+
|
|
260
|
+
You can launch the MCP Inspector via [ `npm` ](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) with this command:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-gsuite run mcp-gsuite
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
|
|
267
|
+
|
|
268
|
+
You can also watch the server logs with this command:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
tail -n 20 -f ~/Library/Logs/Claude/mcp-server-mcp-gsuite.log
|
|
272
|
+
```
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# mcp-gsuite MCP server
|
|
2
|
+
|
|
3
|
+
[](https://smithery.ai/server/mcp-gsuite)
|
|
4
|
+
MCP server to interact with Google products.
|
|
5
|
+
|
|
6
|
+
## Example prompts
|
|
7
|
+
|
|
8
|
+
Right now, this MCP server supports Gmail and Calendar integration with the following capabilities:
|
|
9
|
+
|
|
10
|
+
1. General
|
|
11
|
+
* Multiple google accounts
|
|
12
|
+
|
|
13
|
+
2. Gmail
|
|
14
|
+
* Get your Gmail user information
|
|
15
|
+
* Query emails with flexible search (e.g., unread, from specific senders, date ranges, with attachments)
|
|
16
|
+
* Retrieve complete email content by ID
|
|
17
|
+
* Create new draft emails with recipients, subject, body and CC options
|
|
18
|
+
* Delete draft emails
|
|
19
|
+
* Reply to existing emails (can either send immediately or save as draft)
|
|
20
|
+
* Retrieve multiple emails at once by their IDs.
|
|
21
|
+
* Save multiple attachments from emails to your local system.
|
|
22
|
+
|
|
23
|
+
3. Calendar
|
|
24
|
+
* Manage multiple calendars
|
|
25
|
+
* Get calendar events within specified time ranges
|
|
26
|
+
* Create calendar events with:
|
|
27
|
+
+ Title, start/end times
|
|
28
|
+
+ Optional location and description
|
|
29
|
+
+ Optional attendees
|
|
30
|
+
+ Custom timezone support
|
|
31
|
+
+ Notification preferences
|
|
32
|
+
* Delete calendar events
|
|
33
|
+
|
|
34
|
+
Example prompts you can try:
|
|
35
|
+
|
|
36
|
+
* Retrieve my latest unread messages
|
|
37
|
+
* Search my emails from the Scrum Master
|
|
38
|
+
* Retrieve all emails from accounting
|
|
39
|
+
* Take the email about ABC and summarize it
|
|
40
|
+
* Write a nice response to Alice's last email and upload a draft.
|
|
41
|
+
* Reply to Bob's email with a Thank you note. Store it as draft
|
|
42
|
+
|
|
43
|
+
* What do I have on my agenda tomorrow?
|
|
44
|
+
* Check my private account's Family agenda for next week
|
|
45
|
+
* I need to plan an event with Tim for 2hrs next week. Suggest some time slots.
|
|
46
|
+
|
|
47
|
+
## Quickstart
|
|
48
|
+
|
|
49
|
+
### Install
|
|
50
|
+
|
|
51
|
+
### Installing via Smithery
|
|
52
|
+
|
|
53
|
+
To install mcp-gsuite for Claude Desktop automatically via [Smithery](https://smithery.ai/server/mcp-gsuite):
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx -y @smithery/cli install mcp-gsuite --client claude
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Oauth 2
|
|
60
|
+
|
|
61
|
+
Google Workspace (G Suite) APIs require OAuth2 authorization. Follow these steps to set up authentication:
|
|
62
|
+
|
|
63
|
+
1. Create OAuth2 Credentials:
|
|
64
|
+
- Go to the [Google Cloud Console](https://console.cloud.google.com/)
|
|
65
|
+
- Create a new project or select an existing one
|
|
66
|
+
- Enable the Gmail API and Google Calendar API for your project
|
|
67
|
+
- Go to "Credentials" → "Create Credentials" → "OAuth client ID"
|
|
68
|
+
- Select "Desktop app" or "Web application" as the application type
|
|
69
|
+
- Configure the OAuth consent screen with required information
|
|
70
|
+
- Add authorized redirect URIs (include `http://localhost:4100/code` for local development)
|
|
71
|
+
|
|
72
|
+
2. Required OAuth2 Scopes:
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
[
|
|
77
|
+
"openid",
|
|
78
|
+
"https://mail.google.com/",
|
|
79
|
+
"https://www.googleapis.com/auth/calendar",
|
|
80
|
+
"https://www.googleapis.com/auth/userinfo.email"
|
|
81
|
+
]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
3. Then create a `.gauth.json` in your working directory with client
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"web": {
|
|
89
|
+
"client_id": "$your_client_id",
|
|
90
|
+
"client_secret": "$your_client_secret",
|
|
91
|
+
"redirect_uris": ["http://localhost:4100/code"],
|
|
92
|
+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
|
93
|
+
"token_uri": "https://oauth2.googleapis.com/token"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
4. Create a `.accounts.json` file with account information
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"accounts": [
|
|
103
|
+
{
|
|
104
|
+
"email": "alice@bob.com",
|
|
105
|
+
"account_type": "personal",
|
|
106
|
+
"extra_info": "Additional info that you want to tell Claude: E.g. 'Contains Family Calendar'"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
You can specifiy multiple accounts. Make sure they have access in your Google Auth app. The `extra_info` field is especially interesting as you can add info here that you want to tell the AI about the account (e.g. whether it has a specific agenda)
|
|
113
|
+
|
|
114
|
+
Note: When you first execute one of the tools for a specific account, a browser will open, redirect you to Google and ask for your credentials, scope, etc. After a successful login, it stores the credentials in a local file called `.oauth.{email}.json` . Once you are authorized, the refresh token will be used.
|
|
115
|
+
|
|
116
|
+
#### Claude Desktop
|
|
117
|
+
|
|
118
|
+
On MacOS: `~/Library/Application\ Support/Claude/claude_desktop_config.json`
|
|
119
|
+
|
|
120
|
+
On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
|
|
121
|
+
|
|
122
|
+
<details>
|
|
123
|
+
<summary>Development/Unpublished Servers Configuration</summary>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"mcp-gsuite": {
|
|
130
|
+
"command": "uv",
|
|
131
|
+
"args": [
|
|
132
|
+
"--directory",
|
|
133
|
+
"<dir_to>/mcp-gsuite",
|
|
134
|
+
"run",
|
|
135
|
+
"mcp-gsuite"
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
Note: You can also use the `uv run mcp-gsuite --accounts-file /path/to/custom/.accounts.json` to specify a different accounts file or `--credentials-dir /path/to/custom/credentials` to specify a different credentials directory.
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"mcpServers": {
|
|
148
|
+
"mcp-gsuite": {
|
|
149
|
+
"command": "uv",
|
|
150
|
+
"args": [
|
|
151
|
+
"--directory",
|
|
152
|
+
"<dir_to>/mcp-gsuite",
|
|
153
|
+
"run",
|
|
154
|
+
"mcp-gsuite",
|
|
155
|
+
"--accounts-file",
|
|
156
|
+
"/path/to/custom/.accounts.json",
|
|
157
|
+
"--credentials-dir",
|
|
158
|
+
"/path/to/custom/credentials"
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
</details>
|
|
166
|
+
|
|
167
|
+
<details>
|
|
168
|
+
<summary>Published Servers Configuration</summary>
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"mcpServers": {
|
|
174
|
+
"mcp-gsuite": {
|
|
175
|
+
"command": "uvx",
|
|
176
|
+
"args": [
|
|
177
|
+
"mcp-gsuite",
|
|
178
|
+
"--accounts-file",
|
|
179
|
+
"/path/to/custom/.accounts.json",
|
|
180
|
+
"--credentials-dir",
|
|
181
|
+
"/path/to/custom/credentials"
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
</details>
|
|
189
|
+
|
|
190
|
+
### Configuration Options
|
|
191
|
+
|
|
192
|
+
The MCP server can be configured with several command-line options to specify custom paths for authentication and account information:
|
|
193
|
+
|
|
194
|
+
* `--gauth-file`: Specifies the path to the `.gauth.json` file containing OAuth2 client configuration. Default is `./.gauth.json`.
|
|
195
|
+
* `--accounts-file`: Specifies the path to the `.accounts.json` file containing information about the Google accounts. Default is `./.accounts.json`.
|
|
196
|
+
* `--credentials-dir`: Specifies the directory where OAuth credentials are stored after successful authentication. Default is the current working directory with a subdirectory for each account as `.oauth.{email}.json`.
|
|
197
|
+
|
|
198
|
+
These options allow for flexibility in managing different environments or multiple sets of credentials and accounts, especially useful in development and testing scenarios.
|
|
199
|
+
|
|
200
|
+
Example usage:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
uv run mcp-gsuite --gauth-file /path/to/custom/.gauth.json --accounts-file /path/to/custom/.accounts.json --credentials-dir /path/to/custom/credentials
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
This configuration is particularly useful when you have multiple instances of the server running with different configurations or when deploying to environments where the default paths are not suitable.
|
|
207
|
+
|
|
208
|
+
## Development
|
|
209
|
+
|
|
210
|
+
### Building and Publishing
|
|
211
|
+
|
|
212
|
+
To prepare the package for distribution:
|
|
213
|
+
|
|
214
|
+
1. Sync dependencies and update lockfile:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
uv sync
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
2. Build package distributions:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
uv build
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
This will create source and wheel distributions in the `dist/` directory.
|
|
227
|
+
|
|
228
|
+
3. Publish to PyPI:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
uv publish
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Note: You'll need to set PyPI credentials via environment variables or command flags:
|
|
235
|
+
* Token: `--token` or `UV_PUBLISH_TOKEN`
|
|
236
|
+
* Or username/password: `--username`/`UV_PUBLISH_USERNAME` and `--password`/`UV_PUBLISH_PASSWORD`
|
|
237
|
+
|
|
238
|
+
### Debugging
|
|
239
|
+
|
|
240
|
+
Since MCP servers run over stdio, debugging can be challenging. For the best debugging
|
|
241
|
+
experience, we strongly recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector).
|
|
242
|
+
|
|
243
|
+
You can launch the MCP Inspector via [ `npm` ](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) with this command:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-gsuite run mcp-gsuite
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
|
|
250
|
+
|
|
251
|
+
You can also watch the server logs with this command:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
tail -n 20 -f ~/Library/Logs/Claude/mcp-server-mcp-gsuite.log
|
|
255
|
+
```
|