The Gmail MCP server enables Claude to access and search your Gmail inbox, allowing it to retrieve your email content when needed. This integration connects Claude with your Gmail account through Google's secure API protocols.
credentials.json
in your project directoryRun the authorization command to generate your authentication token:
uv run gmail-mcp auth --creds-path credentials.json --token-path token.json
This opens a browser window where you'll need to log in to your Google account and grant the necessary permissions. After successful authorization, a token.json
file will be created in your project directory.
Add the Gmail MCP server to your Claude configuration file:
{
"mcpServers": {
"gmail": {
"args": [
"--from",
"git+https://github.com/vinayak-mehta/gmail-mcp",
"gmail-mcp"
],
"command": "/Users/username/.local/bin/uvx",
"env": {
"GMAIL_CREDS_PATH": "/Users/username/path/to/gmail-mcp/credentials.json",
"GMAIL_TOKEN_PATH": "/Users/username/path/to/gmail-mcp/token.json"
}
}
}
}
Important: Be sure to:
/Users/username/path/to/gmail-mcp
with your actual project pathcommand
path to your installed uvx
executable locationcredentials.json
and token.json
filesAfter configuration, Claude gains access to these Gmail tools:
Find specific emails in your Gmail account.
Example prompt: "Search for all emails from [email protected]"
Retrieve the full content of a specific email.
Example prompt: "Show me the full content of the email with the subject 'Meeting Tomorrow'"
View recent messages from your Gmail inbox.
Example prompt: "List my 5 most recent emails"
You can configure credential paths using environment variables:
GMAIL_CREDS_PATH
: Path to your credentials.json fileGMAIL_TOKEN_PATH
: Path to your token.json fileFor convenience, create a .env
file in the project root with these variables.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.