gas-mcp-server-v2

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 henry@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 parentId handling
  • โœ… 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

Deploy on 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

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Enable APIs:
    • Google Sheets API
    • Google Apps Script API
    • Google Drive API
  4. 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

  1. Access: https://your-railway-app.up.railway.app/mcp/authorize
  2. Complete OAuth flow
  3. Copy the refresh token
  4. 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

  1. parentId not working: Check Google Apps Script API is enabled
  2. Authentication errors: Verify refresh token and scopes
  3. Permission errors: Ensure OAuth consent screen is configured

๐Ÿ“ License

MIT ยฉ 2025 - Gas MCP Server v2.0