workos-gmail-mcp-server 2.0.0__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.
Files changed (23) hide show
  1. workos_gmail_mcp_server-2.0.0/LICENSE +21 -0
  2. workos_gmail_mcp_server-2.0.0/PKG-INFO +212 -0
  3. workos_gmail_mcp_server-2.0.0/README.md +185 -0
  4. workos_gmail_mcp_server-2.0.0/pyproject.toml +50 -0
  5. workos_gmail_mcp_server-2.0.0/setup.cfg +4 -0
  6. workos_gmail_mcp_server-2.0.0/src/gmail_mcp_server/__init__.py +29 -0
  7. workos_gmail_mcp_server-2.0.0/src/gmail_mcp_server/__main__.py +4 -0
  8. workos_gmail_mcp_server-2.0.0/src/gmail_mcp_server/client.py +511 -0
  9. workos_gmail_mcp_server-2.0.0/src/gmail_mcp_server/config.py +61 -0
  10. workos_gmail_mcp_server-2.0.0/src/gmail_mcp_server/server.py +56 -0
  11. workos_gmail_mcp_server-2.0.0/src/gmail_mcp_server/tools/__init__.py +1 -0
  12. workos_gmail_mcp_server-2.0.0/src/gmail_mcp_server/tools/drafts.py +71 -0
  13. workos_gmail_mcp_server-2.0.0/src/gmail_mcp_server/tools/labels.py +69 -0
  14. workos_gmail_mcp_server-2.0.0/src/gmail_mcp_server/tools/messages.py +184 -0
  15. workos_gmail_mcp_server-2.0.0/src/gmail_mcp_server/tools/threads.py +28 -0
  16. workos_gmail_mcp_server-2.0.0/src/workos_gmail_mcp_server.egg-info/PKG-INFO +212 -0
  17. workos_gmail_mcp_server-2.0.0/src/workos_gmail_mcp_server.egg-info/SOURCES.txt +21 -0
  18. workos_gmail_mcp_server-2.0.0/src/workos_gmail_mcp_server.egg-info/dependency_links.txt +1 -0
  19. workos_gmail_mcp_server-2.0.0/src/workos_gmail_mcp_server.egg-info/entry_points.txt +2 -0
  20. workos_gmail_mcp_server-2.0.0/src/workos_gmail_mcp_server.egg-info/requires.txt +3 -0
  21. workos_gmail_mcp_server-2.0.0/src/workos_gmail_mcp_server.egg-info/top_level.txt +1 -0
  22. workos_gmail_mcp_server-2.0.0/tests/test_client.py +185 -0
  23. workos_gmail_mcp_server-2.0.0/tests/test_messages.py +28 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WorkOS Contributors
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,212 @@
1
+ Metadata-Version: 2.4
2
+ Name: workos-gmail-mcp-server
3
+ Version: 2.0.0
4
+ Summary: MCP server for Gmail โ€” send, search, read emails, manage drafts and labels via Google OAuth2.
5
+ Author: WorkOS Contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/workos/workos-gmail-mcp-server
8
+ Project-URL: Repository, https://github.com/workos/workos-gmail-mcp-server
9
+ Project-URL: Issues, https://github.com/workos/workos-gmail-mcp-server/issues
10
+ Keywords: mcp,gmail,model-context-protocol,ai-tools,email
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Classifier: Topic :: Communications :: Email
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: fastmcp>=2.0.0
24
+ Requires-Dist: google-auth>=2.0.0
25
+ Requires-Dist: google-api-python-client>=2.0.0
26
+ Dynamic: license-file
27
+
28
+ <!-- mcp-name: io.github.workos/gmail-mcp-server -->
29
+
30
+ # Gmail MCP Server
31
+
32
+ Production-quality [Model Context Protocol](https://modelcontextprotocol.io/) server for Gmail.
33
+
34
+ ๐Ÿ“ง **Send emails** โ€” compose and send with CC support
35
+ ๐Ÿ“ฅ **Read emails** โ€” fetch from any label (INBOX, SENT, etc.)
36
+ ๐Ÿ” **Search emails** โ€” full Gmail query syntax
37
+ ๐Ÿ“ **Manage drafts** โ€” create and send drafts
38
+ ๐Ÿท๏ธ **Organize labels** โ€” list, add, remove labels
39
+ ๐Ÿงต **View threads** โ€” get full conversation threads
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install workos-gmail-mcp-server
45
+ ```
46
+
47
+ Or install from source:
48
+
49
+ ```bash
50
+ cd gmail_mcp_server
51
+ pip install -e .
52
+ ```
53
+
54
+ ## Quick Start
55
+
56
+ ```bash
57
+ export GOOGLE_CREDENTIALS_PATH=/path/to/credentials.json
58
+ export GOOGLE_TOKEN_PATH=/path/to/token.json
59
+ gmail-mcp-server
60
+ ```
61
+
62
+ ## Configuration
63
+
64
+ | Variable | Required | Description |
65
+ |----------|----------|-------------|
66
+ | `GOOGLE_CREDENTIALS_PATH` | โœ… | Path to OAuth2 `credentials.json` from Google Cloud Console |
67
+ | `GOOGLE_TOKEN_PATH` | โœ… | Path to `token.json` (generated after first OAuth consent) |
68
+
69
+ ## OAuth Setup Guide
70
+
71
+ ### 1. Create a Google Cloud Project
72
+
73
+ 1. Go to [Google Cloud Console](https://console.cloud.google.com/)
74
+ 2. Create a new project (or select existing)
75
+ 3. Enable the **Gmail API** under APIs & Services โ†’ Library
76
+
77
+ ### 2. Configure OAuth Consent Screen
78
+
79
+ 1. Go to APIs & Services โ†’ OAuth consent screen
80
+ 2. Choose **External** user type
81
+ 3. Fill in app name and email
82
+ 4. Add scope: `https://www.googleapis.com/auth/gmail.modify`
83
+
84
+ ### 3. Create OAuth2 Credentials
85
+
86
+ 1. Go to APIs & Services โ†’ Credentials
87
+ 2. Click **Create Credentials** โ†’ **OAuth client ID**
88
+ 3. Application type: **Desktop app**
89
+ 4. Download the JSON file as `credentials.json`
90
+
91
+ ### 4. Generate token.json
92
+
93
+ Run this one-time script to authorize and generate `token.json`:
94
+
95
+ ```python
96
+ from google_auth_oauthlib.flow import InstalledAppFlow
97
+
98
+ SCOPES = ["https://www.googleapis.com/auth/gmail.modify"]
99
+
100
+ flow = InstalledAppFlow.from_client_secrets_file("credentials.json", SCOPES)
101
+ creds = flow.run_local_server(port=0)
102
+
103
+ with open("token.json", "w") as f:
104
+ f.write(creds.to_json())
105
+
106
+ print("token.json created successfully!")
107
+ ```
108
+
109
+ ### 5. Set Environment Variables
110
+
111
+ ```bash
112
+ export GOOGLE_CREDENTIALS_PATH=/absolute/path/to/credentials.json
113
+ export GOOGLE_TOKEN_PATH=/absolute/path/to/token.json
114
+ ```
115
+
116
+ ## Connecting to AI Agents
117
+
118
+ ### Claude Desktop
119
+
120
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
121
+
122
+ ```json
123
+ {
124
+ "mcpServers": {
125
+ "gmail": {
126
+ "command": "gmail-mcp-server",
127
+ "env": {
128
+ "GOOGLE_CREDENTIALS_PATH": "/path/to/credentials.json",
129
+ "GOOGLE_TOKEN_PATH": "/path/to/token.json"
130
+ }
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ ### Cursor / VS Code
137
+
138
+ Add to `.mcp.json` in your project root:
139
+
140
+ ```json
141
+ {
142
+ "mcpServers": {
143
+ "gmail": {
144
+ "command": "gmail-mcp-server",
145
+ "env": {
146
+ "GOOGLE_CREDENTIALS_PATH": "/path/to/credentials.json",
147
+ "GOOGLE_TOKEN_PATH": "/path/to/token.json"
148
+ }
149
+ }
150
+ }
151
+ }
152
+ ```
153
+
154
+ ## Available Tools
155
+
156
+ | # | Tool | Description |
157
+ |---|------|-------------|
158
+ | 1 | `gmail_send_email` | Send an email (to, subject, body, optional cc) |
159
+ | 2 | `gmail_read_emails` | Read recent emails from a label |
160
+ | 3 | `gmail_get_email` | Get a single email by message ID |
161
+ | 4 | `gmail_search_emails` | Search emails using Gmail query syntax |
162
+ | 5 | `gmail_mark_read` | Mark an email as read |
163
+ | 6 | `gmail_mark_unread` | Mark an email as unread |
164
+ | 7 | `gmail_create_draft` | Create a draft email |
165
+ | 8 | `gmail_send_draft` | Send an existing draft |
166
+ | 9 | `gmail_list_labels` | List all Gmail labels |
167
+ | 10 | `gmail_add_label` | Add a label to a message |
168
+ | 11 | `gmail_remove_label` | Remove a label from a message |
169
+ | 12 | `gmail_get_thread` | Get a full email thread |
170
+
171
+ ## Development
172
+
173
+ ```bash
174
+ # Install in development mode
175
+ pip install -e .
176
+
177
+ # Run tests
178
+ pytest tests/ -v
179
+
180
+ # Run the server
181
+ gmail-mcp-server
182
+ ```
183
+
184
+ ## Project Structure
185
+
186
+ ```
187
+ gmail_mcp_server/
188
+ โ”œโ”€โ”€ pyproject.toml
189
+ โ”œโ”€โ”€ LICENSE
190
+ โ”œโ”€โ”€ README.md
191
+ โ”œโ”€โ”€ server.json
192
+ โ”œโ”€โ”€ src/gmail_mcp_server/
193
+ โ”‚ โ”œโ”€โ”€ __init__.py
194
+ โ”‚ โ”œโ”€โ”€ __main__.py
195
+ โ”‚ โ”œโ”€โ”€ config.py
196
+ โ”‚ โ”œโ”€โ”€ client.py
197
+ โ”‚ โ”œโ”€โ”€ server.py
198
+ โ”‚ โ””โ”€โ”€ tools/
199
+ โ”‚ โ”œโ”€โ”€ __init__.py
200
+ โ”‚ โ”œโ”€โ”€ messages.py
201
+ โ”‚ โ”œโ”€โ”€ drafts.py
202
+ โ”‚ โ”œโ”€โ”€ labels.py
203
+ โ”‚ โ””โ”€โ”€ threads.py
204
+ โ””โ”€โ”€ tests/
205
+ โ”œโ”€โ”€ conftest.py
206
+ โ”œโ”€โ”€ test_client.py
207
+ โ””โ”€โ”€ test_messages.py
208
+ ```
209
+
210
+ ## License
211
+
212
+ MIT
@@ -0,0 +1,185 @@
1
+ <!-- mcp-name: io.github.workos/gmail-mcp-server -->
2
+
3
+ # Gmail MCP Server
4
+
5
+ Production-quality [Model Context Protocol](https://modelcontextprotocol.io/) server for Gmail.
6
+
7
+ ๐Ÿ“ง **Send emails** โ€” compose and send with CC support
8
+ ๐Ÿ“ฅ **Read emails** โ€” fetch from any label (INBOX, SENT, etc.)
9
+ ๐Ÿ” **Search emails** โ€” full Gmail query syntax
10
+ ๐Ÿ“ **Manage drafts** โ€” create and send drafts
11
+ ๐Ÿท๏ธ **Organize labels** โ€” list, add, remove labels
12
+ ๐Ÿงต **View threads** โ€” get full conversation threads
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pip install workos-gmail-mcp-server
18
+ ```
19
+
20
+ Or install from source:
21
+
22
+ ```bash
23
+ cd gmail_mcp_server
24
+ pip install -e .
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ```bash
30
+ export GOOGLE_CREDENTIALS_PATH=/path/to/credentials.json
31
+ export GOOGLE_TOKEN_PATH=/path/to/token.json
32
+ gmail-mcp-server
33
+ ```
34
+
35
+ ## Configuration
36
+
37
+ | Variable | Required | Description |
38
+ |----------|----------|-------------|
39
+ | `GOOGLE_CREDENTIALS_PATH` | โœ… | Path to OAuth2 `credentials.json` from Google Cloud Console |
40
+ | `GOOGLE_TOKEN_PATH` | โœ… | Path to `token.json` (generated after first OAuth consent) |
41
+
42
+ ## OAuth Setup Guide
43
+
44
+ ### 1. Create a Google Cloud Project
45
+
46
+ 1. Go to [Google Cloud Console](https://console.cloud.google.com/)
47
+ 2. Create a new project (or select existing)
48
+ 3. Enable the **Gmail API** under APIs & Services โ†’ Library
49
+
50
+ ### 2. Configure OAuth Consent Screen
51
+
52
+ 1. Go to APIs & Services โ†’ OAuth consent screen
53
+ 2. Choose **External** user type
54
+ 3. Fill in app name and email
55
+ 4. Add scope: `https://www.googleapis.com/auth/gmail.modify`
56
+
57
+ ### 3. Create OAuth2 Credentials
58
+
59
+ 1. Go to APIs & Services โ†’ Credentials
60
+ 2. Click **Create Credentials** โ†’ **OAuth client ID**
61
+ 3. Application type: **Desktop app**
62
+ 4. Download the JSON file as `credentials.json`
63
+
64
+ ### 4. Generate token.json
65
+
66
+ Run this one-time script to authorize and generate `token.json`:
67
+
68
+ ```python
69
+ from google_auth_oauthlib.flow import InstalledAppFlow
70
+
71
+ SCOPES = ["https://www.googleapis.com/auth/gmail.modify"]
72
+
73
+ flow = InstalledAppFlow.from_client_secrets_file("credentials.json", SCOPES)
74
+ creds = flow.run_local_server(port=0)
75
+
76
+ with open("token.json", "w") as f:
77
+ f.write(creds.to_json())
78
+
79
+ print("token.json created successfully!")
80
+ ```
81
+
82
+ ### 5. Set Environment Variables
83
+
84
+ ```bash
85
+ export GOOGLE_CREDENTIALS_PATH=/absolute/path/to/credentials.json
86
+ export GOOGLE_TOKEN_PATH=/absolute/path/to/token.json
87
+ ```
88
+
89
+ ## Connecting to AI Agents
90
+
91
+ ### Claude Desktop
92
+
93
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
94
+
95
+ ```json
96
+ {
97
+ "mcpServers": {
98
+ "gmail": {
99
+ "command": "gmail-mcp-server",
100
+ "env": {
101
+ "GOOGLE_CREDENTIALS_PATH": "/path/to/credentials.json",
102
+ "GOOGLE_TOKEN_PATH": "/path/to/token.json"
103
+ }
104
+ }
105
+ }
106
+ }
107
+ ```
108
+
109
+ ### Cursor / VS Code
110
+
111
+ Add to `.mcp.json` in your project root:
112
+
113
+ ```json
114
+ {
115
+ "mcpServers": {
116
+ "gmail": {
117
+ "command": "gmail-mcp-server",
118
+ "env": {
119
+ "GOOGLE_CREDENTIALS_PATH": "/path/to/credentials.json",
120
+ "GOOGLE_TOKEN_PATH": "/path/to/token.json"
121
+ }
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ ## Available Tools
128
+
129
+ | # | Tool | Description |
130
+ |---|------|-------------|
131
+ | 1 | `gmail_send_email` | Send an email (to, subject, body, optional cc) |
132
+ | 2 | `gmail_read_emails` | Read recent emails from a label |
133
+ | 3 | `gmail_get_email` | Get a single email by message ID |
134
+ | 4 | `gmail_search_emails` | Search emails using Gmail query syntax |
135
+ | 5 | `gmail_mark_read` | Mark an email as read |
136
+ | 6 | `gmail_mark_unread` | Mark an email as unread |
137
+ | 7 | `gmail_create_draft` | Create a draft email |
138
+ | 8 | `gmail_send_draft` | Send an existing draft |
139
+ | 9 | `gmail_list_labels` | List all Gmail labels |
140
+ | 10 | `gmail_add_label` | Add a label to a message |
141
+ | 11 | `gmail_remove_label` | Remove a label from a message |
142
+ | 12 | `gmail_get_thread` | Get a full email thread |
143
+
144
+ ## Development
145
+
146
+ ```bash
147
+ # Install in development mode
148
+ pip install -e .
149
+
150
+ # Run tests
151
+ pytest tests/ -v
152
+
153
+ # Run the server
154
+ gmail-mcp-server
155
+ ```
156
+
157
+ ## Project Structure
158
+
159
+ ```
160
+ gmail_mcp_server/
161
+ โ”œโ”€โ”€ pyproject.toml
162
+ โ”œโ”€โ”€ LICENSE
163
+ โ”œโ”€โ”€ README.md
164
+ โ”œโ”€โ”€ server.json
165
+ โ”œโ”€โ”€ src/gmail_mcp_server/
166
+ โ”‚ โ”œโ”€โ”€ __init__.py
167
+ โ”‚ โ”œโ”€โ”€ __main__.py
168
+ โ”‚ โ”œโ”€โ”€ config.py
169
+ โ”‚ โ”œโ”€โ”€ client.py
170
+ โ”‚ โ”œโ”€โ”€ server.py
171
+ โ”‚ โ””โ”€โ”€ tools/
172
+ โ”‚ โ”œโ”€โ”€ __init__.py
173
+ โ”‚ โ”œโ”€โ”€ messages.py
174
+ โ”‚ โ”œโ”€โ”€ drafts.py
175
+ โ”‚ โ”œโ”€โ”€ labels.py
176
+ โ”‚ โ””โ”€โ”€ threads.py
177
+ โ””โ”€โ”€ tests/
178
+ โ”œโ”€โ”€ conftest.py
179
+ โ”œโ”€โ”€ test_client.py
180
+ โ””โ”€โ”€ test_messages.py
181
+ ```
182
+
183
+ ## License
184
+
185
+ MIT
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "workos-gmail-mcp-server"
7
+ version = "2.0.0"
8
+ description = "MCP server for Gmail โ€” send, search, read emails, manage drafts and labels via Google OAuth2."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "WorkOS Contributors" }
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Topic :: Software Development :: Libraries",
24
+ "Topic :: Communications :: Email",
25
+ ]
26
+ keywords = ["mcp", "gmail", "model-context-protocol", "ai-tools", "email"]
27
+
28
+ dependencies = [
29
+ "fastmcp>=2.0.0",
30
+ "google-auth>=2.0.0",
31
+ "google-api-python-client>=2.0.0",
32
+ ]
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/workos/workos-gmail-mcp-server"
36
+ Repository = "https://github.com/workos/workos-gmail-mcp-server"
37
+ Issues = "https://github.com/workos/workos-gmail-mcp-server/issues"
38
+
39
+ [project.scripts]
40
+ gmail-mcp-server = "gmail_mcp_server:main"
41
+
42
+ [tool.setuptools.packages.find]
43
+ where = ["src"]
44
+
45
+ [tool.setuptools.package-dir]
46
+ "" = "src"
47
+
48
+ [tool.pytest.ini_options]
49
+ testpaths = ["tests"]
50
+ asyncio_mode = "auto"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,29 @@
1
+ """
2
+ Gmail MCP Server โ€” Model Context Protocol server for Gmail operations.
3
+
4
+ An independent, generalized MCP server that can connect to any AI agent
5
+ supporting the Model Context Protocol. Not tied to any specific project.
6
+
7
+ Quick start:
8
+ pip install workos-gmail-mcp-server
9
+ GOOGLE_CLIENT_ID=... \
10
+ GOOGLE_CLIENT_SECRET=... \
11
+ GOOGLE_REFRESH_TOKEN=... \
12
+ gmail-mcp-server
13
+
14
+ Or run as a module:
15
+ python -m gmail_mcp_server
16
+ """
17
+
18
+ __version__ = "2.0.0"
19
+
20
+ from gmail_mcp_server.server import create_server
21
+
22
+
23
+ def main():
24
+ """Entry point for the gmail-mcp-server CLI command."""
25
+ server = create_server()
26
+ server.run()
27
+
28
+
29
+ __all__ = ["main", "create_server", "__version__"]
@@ -0,0 +1,4 @@
1
+ """Allow running as: python -m gmail_mcp_server"""
2
+ from gmail_mcp_server import main
3
+
4
+ main()