Google Workspace MCP Server
by dbzavi
README.md
# Google Workspace MCP Server (Railway Deployment)
A robust, generic Model Context Protocol (MCP) Server that integrates AI agents with Google Workspace. It acts as a bridge, enabling any standard MCP-compliant AI agent (such as Claude Desktop) to securely interact with Gmail and Google Docs.
This version has been optimized for deployment to cloud providers like **Railway** using an Express-based HTTP server with Server-Sent Events (SSE) and API Key authentication.
## Provided Tools
1. **`gmail_draft_email`**: Creates a draft email in your Gmail account without sending it.
2. **`gmail_send_email`**: Sends an email directly from your Gmail account.
3. **`docs_append_content`**: Appends text content to the end of a specified Google Document.
## Setup Instructions
### 1. Configure Environment Variables
This server expects the following environment variables to securely connect to Google APIs without relying on local files:
- `PORT`: (Optional) Port for the Express server (default: 3000). Provided automatically by Railway.
- `MCP_API_KEY`: A secure random string you choose to protect your endpoint (e.g., `sk-mcp-12345...`).
- `GOOGLE_CLIENT_ID`: Your Google OAuth 2.0 Client ID.
- `GOOGLE_CLIENT_SECRET`: Your Google OAuth 2.0 Client Secret.
- `GOOGLE_REFRESH_TOKEN`: The refresh token generated after your initial OAuth consent flow.
### 2. Deploy to Railway
1. Push this repository to GitHub.
2. Create a new project in Railway and select the repository.
3. Railway will automatically build the TypeScript project via `npm run build` and start it.
4. Add the required environment variables in the Railway dashboard.
5. Generate a public domain for your Railway service (e.g., `https://my-mcp-server.up.railway.app`).
### 3. Configure Your MCP Client
Instead of running a local `node` process, you must configure your AI agent to connect via SSE over HTTP. Provide the API key in the environment to authenticate.
#### Claude Desktop Configuration
Add this server to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"google-workspace": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/inspector", "http://my-mcp-server.up.railway.app/sse"],
"env": {
"MCP_API_KEY": "your_secure_api_key_here"
}
}
}
}
```
*(Note: To connect Claude Desktop directly to a remote SSE server, you typically use a specialized SSE client wrapper, or pass the authorization header via the client's built-in HTTP connector if supported).*
This server cannot be deployed
Maintenance
ActivityStale
ResponsivenessNo issues