This MCP server integrates with Gmail to enable sending, removing, reading, drafting, and responding to emails.
Note: This server enables an MCP client to read, remove, and send emails. However, the client prompts the user before conducting such activities.
https://github.com/user-attachments/assets/5794cd16-00d2-45a2-884a-8ba0c3a90c90
send-email
recipient_id
(string): Email address of addresseesubject
(string): Email subjectmessage
(string): Email contenttrash-email
email_id
(string): Auto-generated ID of emailmark-email-as-read
email_id
(string): Auto-generated ID of emailget-unread-emails
read-email
email_id
(string): Auto-generated ID of emailopen-email
email_id
(string): Auto-generated ID of emailhttps://www.googleapis.com/auth/gmail/modify
--creds-file-path
when the server is started.When the server is started, an authentication flow will be launched in your system browser.
Token credentials will be subsequently saved (and later retrieved) in the absolute file path passed to parameter --token-path
.
For example, you may use a dot directory in your home folder, replacing [your-home-folder]
.:
Parameter | Example |
---|---|
--creds-file-path | /[your-home-folder]/.google/client_creds.json |
--token-path | /[your-home-folder]/.google/app_tokens.json |
Using uv is recommended.
To integrate this server with Claude Desktop as the MCP Client, add the following to your app's server configuration. By default, this is stored as ~/Library/Application\ Support/Claude/claude_desktop_config.json
.
{
"mcpServers": {
"gdrive": {
"command": "uv",
"args": [
"--directory",
"[absolute-path-to-git-repo]",
"run",
"gmail",
"--creds-file-path",
"[absolute-path-to-credentials-file]",
"--token-path",
"[absolute-path-to-access-tokens-file]"
]
}
}
}
The following parameters must be set
Parameter | Example |
---|---|
--directory | Absolute path to gmail directory containing server |
--creds-file-path | Absolute path to credentials file created in Gmail API Setup. |
--token-path | Absolute path to store and retrieve access and refresh tokens for application. |
To test the server, use MCP Inspector. From the git repo, run the below changing the parameter arguments accordingly.
npx @modelcontextprotocol/inspector uv run [absolute-path-to-git-repo]/src/gmail/server.py --creds-file-path [absolute-path-to-credentials-file] --token-path [absolute-path-to-access-tokens-file]
{
"mcpServers": {
"gdrive": {
"env": {},
"args": [
"--directory",
"[absolute-path-to-git-repo]",
"run",
"gmail",
"--creds-file-path",
"[absolute-path-to-credentials-file]",
"--token-path",
"[absolute-path-to-access-tokens-file]"
],
"command": "uv"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.