overdozer1124/gas-mcp-server-v2
3.1
If you are the rightful owner of gas-mcp-server-v2 and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
Gas MCP Server v2.0 is a Google Apps Script MCP Server with enhanced authentication and container-bound support, designed for secure and efficient Google API access.
🚀 Gas MCP Server v2.0
Google Apps Script MCP Server with Enhanced Authentication and Container-Bound Support
🎯 Features
- ✅ Container-Bound Apps Script Creation: Proper
parentIdhandling - ✅ OAuth2 Authentication: Secure Google API access
- ✅ MCP Protocol Compatible: Works with Claude Desktop
- ✅ Error Handling: Comprehensive error reporting
- ✅ Debug Support: Detailed logging for troubleshooting
🔧 Installation
1. Deploy to Railway
2. Environment Variables
Set the following environment variables in Railway:
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_REDIRECT_URI=https://your-railway-app.up.railway.app/oauth/callback
GOOGLE_REFRESH_TOKEN=your_refresh_token
NODE_ENV=production
PORT=3001
🔑 Authentication Setup
1. Google Cloud Console
- Go to Google Cloud Console
- Create a new project or select existing
- Enable APIs:
- Google Sheets API
- Google Apps Script API
- Google Drive API
- Create OAuth 2.0 Credentials:
- Application type: Web application
- Authorized redirect URIs:
https://your-railway-app.up.railway.app/oauth/callback
2. Get Refresh Token
- Access:
https://your-railway-app.up.railway.app/mcp/authorize - Complete OAuth flow
- Copy the refresh token
- Update Railway environment variable:
GOOGLE_REFRESH_TOKEN
🚀 API Endpoints
Health Check
GET /health
Authorization
GET /mcp/authorize
GET /oauth/callback
Apps Script Operations
POST /create_container_bound_script
PUT /update_script_content
POST /run_script
🧪 Testing Container-Bound Creation
curl -X POST "https://your-railway-app.up.railway.app/create_container_bound_script" \
-H "Content-Type: application/json" \
-d '{
"title": "Test Container-Bound Script",
"parentId": "YOUR_SPREADSHEET_ID"
}'
Expected Response:
{
"success": true,
"scriptId": "SCRIPT_ID",
"url": "https://script.google.com/d/SCRIPT_ID/edit",
"parentId": "YOUR_SPREADSHEET_ID",
"containerBound": true
}
🔍 Troubleshooting
Container-Bound Verification
In Apps Script editor, run:
function verifyContainerBinding() {
try {
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
console.log('✅ Container-bound successful:', spreadsheet.getId());
return spreadsheet.getId();
} catch (error) {
console.log('❌ Container-bound failed:', error.toString());
return null;
}
}
Common Issues
parentIdnot working: Check Google Apps Script API is enabled- Authentication errors: Verify refresh token and scopes
- Permission errors: Ensure OAuth consent screen is configured
📝 License
MIT © 2025 - Gas MCP Server v2.0