Configuration instructions for the Gmail MCP server.
{
"mcpServers": {
"gmail": {
"command": "node",
"args": ["/absolute/path/to/gmail-mcp/dist/index.js"]
}
}
}Replace /absolute/path/to/gmail-mcp with your project path.
- Create or edit
.cursor/mcp.jsonin project root - Add configuration above
- Update paths
- Restart Cursor
Location: .cursor/mcp.json
- Edit configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
- Add Gmail server to
mcpServers - Restart Claude Desktop
- Locate Gemini MCP configuration (varies by integration)
- Add Gmail server configuration
- Restart integration
If installed globally:
{
"mcpServers": {
"gmail": {
"command": "gmail-mcp"
}
}
}If installed locally with npx:
{
"mcpServers": {
"gmail": {
"command": "npx",
"args": ["-y", "gmail-mcp"]
}
}
}gcp-oauth.keys.json- OAuth credentials from Google Cloud Console- Place in current directory or
~/.gmail-mcp/
- Place in current directory or
~/.gmail-mcp/credentials.json- Created after authentication (npm run auth)
Before using the server, authenticate:
npm run authOr with custom callback URL (for cloud environments):
npm run auth https://your-domain.com/oauth2callbackOptional environment variables:
GMAIL_OAUTH_PATH: Path to OAuth keys file (default:~/.gmail-mcp/gcp-oauth.keys.json)GMAIL_CREDENTIALS_PATH: Path to credentials file (default:~/.gmail-mcp/credentials.json)
- Restart IDE/AI assistant
- Gmail server should appear in available MCP servers
- Test with
list_email_labelsorsearch_emails - If auth required, run
npm run auth
Server not found:
- Verify
dist/index.jspath is correct - Run
npm run build - Check Node.js is in PATH
Authentication errors:
- Run
npm run auth - Verify
gcp-oauth.keys.jsonexists and is valid - Check file permissions
- Ensure OAuth credentials are Desktop app or Web application type
Path issues:
- Use absolute paths
- Windows: Use forward slashes or escaped backslashes (
C:\\path\\to\\file) - Verify all paths point to existing files
OAuth callback issues:
- For Desktop app credentials: Use default
http://localhost:3000/oauth2callback - For Web application credentials: Add callback URL to authorized redirect URIs in Google Cloud Console
- For cloud environments: Use custom callback URL and configure reverse proxy