Skip to main content
Glama
Google Forms MCP Server

Google Forms MCP Server

by geoigarashi
README.md
# Google Forms MCP Server

Local Model Context Protocol (`stdio`) server written in Python 3.12+ using the official `mcp` (`MCPServer`) SDK. It exposes **34 tools** and **1 resource** covering **Google Forms API v1** and **Google Drive API v3** form management.

## Features

- **Form lifecycle:** Create forms with initial items in one call, read schemas, update titles/descriptions, toggle quiz mode and email collection, and control publish/response state.
- **All supported item types:** Short/paragraph text, radio/checkbox/dropdown choices (with `"Other"` and conditional section branching), linear scales, icon ratings, date, time/duration, choice/checkbox grids, sections, text blocks, public HTTPS images, and YouTube videos.
- **Quiz grading and analytics:** Set point values, answer keys, and feedback; fetch paginated responses with question title enrichment; compute per-question counts and quiz score summaries locally.
- **Cloud Pub/Sub watches:** Create, list, renew, and delete 7-day watches for `SCHEMA` or `RESPONSES` events.
- **Drive management:** List, copy, rename, move, share, and trash or delete forms (`drive.file` scope).

## Documentation

- [Setup Guide](docs/SETUP_GUIDE.md): Google Cloud Console setup, OAuth authorization, Antigravity 2.0 and MCP client configuration, and troubleshooting.
- [API Reference](docs/API_REFERENCE.md): Complete reference for all 34 tools, the `google-forms://capabilities` resource, scopes, error types, and API limits.
- [Examples](docs/EXAMPLES.md): Practical prompts and JSON payloads for surveys, quizzes, section branching, response summaries, Drive operations, and watches.
- [Contributing](CONTRIBUTING.md): Local dev setup, linting, and test commands.

## Quick Start

### 1. Install

```bash
git clone https://github.com/geoigarashi/google-forms-mcp.git
cd google-forms-mcp
python -m venv .venv
```

```powershell
# Windows (PowerShell)
.\.venv\Scripts\python.exe -m pip install -e .
```

```bash
# macOS / Linux
source .venv/bin/activate
pip install -e .
```

### 2. Add Google OAuth Credentials and Authorize Once

1. Create a Desktop App OAuth 2.0 client in [Google Cloud Console](https://console.cloud.google.com/) with **Google Forms API** and **Google Drive API** enabled.
2. Save the downloaded client JSON to `secrets/credentials.json`.
3. Run the one-time interactive authorization from your terminal:

```bash
python -m google_forms_mcp --check-config
python -m google_forms_mcp --auth
```

See [Setup Guide](docs/SETUP_GUIDE.md) for full details, including adding Test users when sharing with another Google account.

### 3. Configure Your MCP Client

For **Antigravity 2.0**, add `"google-forms"` to your global config file (`C:\Users\<YourUser>\.gemini\config\mcp_config.json` on Windows, or `~/.gemini/config/mcp_config.json` on macOS/Linux):

```json
{
  "mcpServers": {
    "google-forms": {
      "command": "/path/to/google-forms-mcp/.venv/bin/python",
      "args": ["-m", "google_forms_mcp"],
      "env": {
        "GOOGLE_MCP_CREDENTIALS_PATH": "/path/to/google-forms-mcp/secrets/credentials.json",
        "GOOGLE_MCP_TOKEN_PATH": "/path/to/google-forms-mcp/secrets/token.json",
        "GOOGLE_MCP_LOG_LEVEL": "INFO"
      }
    }
  }
}
```

On Windows, use `"C:\\path\\to\\google-forms-mcp\\.venv\\Scripts\\python.exe"` and Windows-style escaped paths (`\\`). Restart your MCP client and open a new conversation.

## Architecture

```text
src/google_forms_mcp/
├── __init__.py       # Package version
├── __main__.py       # CLI entrypoint (--auth, --check-config, stdio MCP loop)
├── exceptions.py     # Error hierarchy (Config, Auth, Validation, FormsAPI, DriveAPI)
├── config.py         # .env and environment settings loader (pathlib.Path)
├── auth.py           # OAuth 2.0 credential manager (non-interactive stdio safety)
├── schemas.py        # Pydantic v2 schemas and domain validators
├── builders.py       # Pure Google Forms API v1 JSON payload builders
├── analytics.py      # Local response enrichment and summary statistics
├── forms_client.py   # Google Forms API v1 client
├── drive_client.py   # Google Drive API v3 client scoped to Forms files
└── server.py         # MCPServer tool and resource definitions
```

## Development and Tests

```bash
ruff check .
ruff format --check .
pytest -v
```

## License

[MIT](LICENSE)

TDQS

B3.1/5.0

Scored across 34 tools

Disambiguation4/5

Most tools target clearly distinct resources or actions: question-type adders, response readers, watch management, and Drive operations are separable. Some overlap remains between the granular add_* tools, the batch add_questions tool, and the raw batch_update_form escape hatch, which could make an agent hesitate between them.

Naming Consistency5/5

Names consistently use snake_case verb_noun patterns such as create_form, get_form, add_text_question, list_responses, and delete_watch. Minor plural/singular variation (add_questions vs add_text_question) does not break the predictable convention.

Tool Count2/5

At 34 tools, the surface is heavy, and many granular add_* tools duplicate capabilities already available through add_questions and batch_update_form. The domain is broad, but several tools could be consolidated without losing functionality.

Completeness5/5

The set covers form lifecycle (create/get/update/delete/copy), item authoring and reordering, settings and publishing, response listing/retrieval/summarization, watches, and Drive sharing/folder operations. No obvious workflow dead end appears for the stated Google Forms domain.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues