0.0.4 • Published 10 months ago

@ashokpokharel977/mcp-server-gsuite v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

mcp-server-gsuite

CI npm version License: MIT Node.js Version

MCP server for interacting with Google Drive, Sheets, and Docs. This package provides a TypeScript/JavaScript interface for Google Workspace services with rich formatting support.

Features

  • Google Drive Operations

    • Search and list files
    • Create and update files
    • Create and manage folders
    • Read file metadata and content
    • Support for file permissions
  • Google Docs Operations

    • Create documents with rich formatting
    • Update document content
    • Support for cover pages, headers, footers
    • Text styling and formatting
  • Google Sheets Operations

    • Create spreadsheets
    • Read and write cell values
    • Format cells (colors, fonts, borders)
    • Row and column operations (insert, delete, resize)
    • Cell merging

Installation

npm install @ashokpokharel977/mcp-server-gsuite

Setup

  1. Create a new Google Cloud project
  2. Enable the Google Drive API
  3. Configure an OAuth consent screen
  4. Add required OAuth scopes:
    • https://www.googleapis.com/auth/drive.file - Create, update and read files created by the app
    • https://www.googleapis.com/auth/drive.metadata.readonly - View file metadata
    • https://www.googleapis.com/auth/documents - Create and edit Google Docs
    • https://www.googleapis.com/auth/spreadsheets - Create and edit Google Sheets
  5. Create an OAuth Client ID for application type "Desktop App"
  6. Download the OAuth keys JSON file

Usage

Docker Usage

Authentication:

docker run -i --rm \
  --mount type=bind,source=/path/to/oauth-keys.json,target=/app/oauth-keys.json \
  -v mcp-gsuite:/app/credentials \
  -e GOOGLE_OAUTH_PATH=/app/oauth-keys.json \
  -e GOOGLE_CREDENTIALS_PATH=/app/credentials/credentials.json \
  -p 3000:3000 \
  @ashokpokharel977/mcp-server-gsuite auth

Server configuration:

{
  "mcpServers": {
    "gsuite": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v", "mcp-gsuite:/app/credentials",
        "-e", "GOOGLE_CREDENTIALS_PATH=/app/credentials/credentials.json",
        "@ashokpokharel977/mcp-server-gsuite"
      ]
    }
  }
}

NPX Usage

{
  "mcpServers": {
    "gsuite": {
      "command": "npx",
      "args": [
        "-y",
        "@ashokpokharel977/mcp-server-gsuite"
      ],
      "env": {
        "GOOGLE_CREDENTIALS_PATH": "/path/to/credentials.json",
        "GOOGLE_OAUTH_PATH": "/path/to/oauth-keys.json"
      }
    }
  }
}

MCP Inspector usage

  1. Running Local
npx @modelcontextprotocol/inspector node dist/index.js -e GOOGLE_CREDENTIALS_PATH="$HOME/.google/server-creds.json" -e GOOGLE_OAUTH_PATH="$HOME/.google/oauth.keys.json"
  1. Running Remote
npx @modelcontextprotocol/inspector npx @ashokpokharel977/mcp-server-gsuite -e GOOGLE_CREDENTIALS_PATH="$HOME/.google/server-creds.json" -e GOOGLE_OAUTH_PATH="$HOME/.google/oauth.keys.json"

Development

Prerequisites

  • Node.js >= 18
  • npm

Setup

  1. Clone the repository:
git clone https://github.com/ashokpokharel977/mcp-gsuite.git
cd mcp-gsuite
  1. Install dependencies:
npm install
  1. Build the project:
npm run build

Available Scripts

  • npm run clean - Clean build artifacts
  • npm run build - Build the project
  • npm run dev - Run in development mode with hot reload
  • npm start - Start the server
  • npm run auth - Run authentication flow

Continuous Integration

The project uses GitHub Actions for CI/CD:

  • CI Workflow: Runs on every push and pull request to the main branch

    • Builds the project
    • Runs type checks
    • Tests against Node.js 18.x and 20.x
  • Publish Workflow: Automatically publishes to NPM when a new release is created

    • Requires NPM_TOKEN secret to be set in repository settings

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Publishing

To publish a new version:

  1. Update version in package.json
  2. Create and push a new tag:
git tag v0.0.1
git push origin v0.0.1
  1. Create a new release on GitHub
  2. The publish workflow will automatically publish to NPM

License

This project is licensed under the MIT License - see the LICENSE file for details.