Contributions are welcome! Please follow the guidelines below.
-
Clone and install:
git clone https://github.com/dguido/google-workspace-mcp.git cd google-workspace-mcp npm install -
Set up credentials:
export GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com" export GOOGLE_CLIENT_SECRET="your-client-secret"
-
Authenticate:
npm run auth
google-workspace-mcp/
├── src/ # Source code
│ ├── index.ts # Main server implementation
│ ├── auth.ts # Main authentication module
│ ├── auth/ # Authentication components
│ │ ├── client.ts # OAuth2 client setup
│ │ ├── server.ts # Local auth server
│ │ ├── tokenManager.ts # Token storage and validation
│ │ └── utils.ts # Auth utilities
│ ├── handlers/ # Tool implementations
│ ├── schemas/ # Zod validation schemas
│ ├── tools/ # Tool definitions
│ └── utils/ # Shared utilities (responses, toon encoding, logging)
├── dist/ # Compiled JavaScript (generated)
├── docs/ # Documentation
├── scripts/ # Build scripts
├── package.json # NPM package configuration
├── tsconfig.json # TypeScript configuration
└── README.md
npm run build # Compile TypeScript
npm run watch # Compile and watch for changes
npm run typecheck # Type checking onlyTo test the MCP server directly in Claude Code during development:
-
Build the project:
npm run build
-
Create
.mcp.jsonin the project root:{ "mcpServers": { "google-workspace": { "command": "node", "args": ["dist/index.js"] } } } -
Start a new Claude Code session in this directory. The MCP server will auto-load.
Note: .mcp.json is gitignored to prevent accidental commits.
| Script | Description |
|---|---|
npm start |
Start the compiled server |
npm run auth |
Run authentication flow |
npm run build |
Build the project |
npm run watch |
Build and watch for changes |
npm run typecheck |
TypeScript type checking only |
npm run lint |
Run linter |
npm run format |
Format code |
npm run check |
Run typecheck + lint + format check |
npm test |
Run tests |
npm run test:watch |
Run tests in watch mode |
- Schema (
src/schemas/<service>.ts) - Define Zod schema with.refine()for mutual exclusion - Handler (
src/handlers/<service>.ts) - CreatehandleX(drive, args)function - Definition (
src/tools/definitions.ts) - Add to appropriate array - Registration (
src/index.ts) - Import handler, add case to switch - Tests (
src/handlers/<service>.test.ts) - Mock Google API services - Exports - Add to
src/schemas/index.tsandsrc/handlers/index.ts
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow existing patterns in the codebase
- Run
npm run checkbefore committing - Write tests for new functionality
- Keep functions under 100 lines
- Use meaningful variable names
Releases are published automatically via GitHub Actions. Do not run npm publish manually.
To release a new version:
- Bump version:
npm version patch|minor|major --no-git-tag-version - Commit:
git commit -am "Bump version to X.Y.Z" - Push:
git push origin main - Create release:
gh release create vX.Y.Z --generate-notes
The GitHub Action triggers on new releases and publishes to npm automatically.