Enables creation and management of Google Forms through natural language requests, converting conversational inputs into...
Created byApr 23, 2025
Google Forms MCP Server with CamelAIOrg Agents Integration
A Model Context Protocol (MCP) server that integrates with Google Forms API and CamelAIOrg Agents to create, modify, and retrieve forms using natural language instructions.
Overview
This project enables the creation and management of Google Forms through natural language requests. It consists of two main components:
**MCP Server**: A Flask-based server that implements the Model Context Protocol (MCP) to expose Google Forms operations as tools.
**CamelAIOrg Agents**: An AI agent framework that processes natural language requests and translates them into MCP tool calls.
The system features a dark-themed UI with an animated visualization of the request flow between frontend, agents, MCP server, and Google APIs.
Features
Create Google Forms from natural language requests
Add different types of questions (text, paragraph, multiple-choice, checkbox)
Retrieve form responses
Visualize the flow of requests and responses
Dark-themed UI with animations
Full MCP (Model Context Protocol) compliance
Containerized with Docker for easy deployment
Architecture
Process Flowchart
This diagram illustrates how a user request flows through the system:
Role of Components
**Frontend UI:** Provides the user interface for inputting natural language requests and visualizing the process and results.
**CamelAIOrg Agent (Highlighted Yellow):**
* **Responsibility:** Interpretation and Planning.
* Receives the raw natural language request.
* Parses the request to understand the user's intent and extract key details (form title, questions, types, etc.).
* Determines the sequence of actions (MCP tool calls) needed to fulfill the request.
* Communicates with the MCP Server using the defined tool schema.
**MCP Server (Highlighted Blue):**
* **Responsibility:** Execution and Abstraction.
* Receives structured tool calls from the Agent.
* Acts as a dedicated interface to the Google Forms API.
* Translates the abstract tool calls (e.g., `create_form`) into concrete Google Forms API requests.
* Handles authentication, communication, and error handling with the Google Forms API.
* Returns the results from the Google Forms API back to the Agent in a standardized MCP format.
Why is the MCP Server Needed?
The Model Context Protocol (MCP) server acts as a crucial intermediary layer for several reasons:
**Abstraction:** It hides the complexities of the underlying Google Forms API from the CamelAI Agent. The Agent doesn't need to know the specific endpoints, authentication methods, or request/response formats of the Google API. It only needs to know the simplified MCP tool schema (e.g., `create_form`, `add_question`).
**Modularity & Reusability:** The Agent can be designed to interact with any service that exposes an MCP interface. If you wanted to add support for another form service (e.g., Typeform), you could create a separate MCP server for it, and the Agent could potentially use it with minimal changes, just by learning the new MCP tool schema.
**Standardization:** MCP provides a standard way for AI models/agents to interact with external tools and APIs. This promotes interoperability.
**Security & Control:** The MCP server can enforce policies, manage API keys securely, handle rate limiting, and provide a controlled gateway to the external API, rather than embedding sensitive credentials or complex logic directly within the agent.
**Maintainability:** Separating the API interaction logic (MCP Server) from the natural language understanding and planning logic (Agent) makes the system easier to maintain and update. Changes to the Google Forms API only require updates to the MCP server, not the Agent itself.
Prerequisites
Docker and Docker Compose
Google Cloud Platform account
Google Forms API enabled
OAuth2 credentials from Google Cloud Console
Setup Instructions
1. Clone the Repository
2. Set Up Google Forms API
Go to the [Google Cloud Console](https://console.cloud.google.com/)
Create a new project
Enable the Google Forms API and Google Drive API
Create OAuth2 credentials
- Web application type
- Add authorized redirect URI: `http://localhost:5000/oauth2callback`
Download the credentials JSON file
3. Configure Environment Variables
Create a `.env` file in the root directory:
To obtain a refresh token:
Use the OAuth 2.0 Playground: https://developers.google.com/oauthplayground/
Set up with your credentials
Select the required scopes:
- https://www.googleapis.com/auth/forms
- https://www.googleapis.com/auth/drive
- https://www.googleapis.com/auth/drive.file
Exchange authorization code for tokens
Copy the refresh token to your `.env` file
4. Build and Run with Docker Compose
This will start both the MCP Server (on port 5000) and the CamelAIOrg Agents service (on port 5001).
Usage
Web Interface
Access the web interface at `http://localhost:5000`
The interface allows you to:
Enter natural language requests (e.g., "Create a feedback form with 3 questions")
View the request flow between components
See the generated form details and links
View the MCP packets being exchanged
API Endpoints
MCP Server Endpoints (Port 5000)
`GET /api/health` - Health check
`GET /api/schema` - Get MCP tools schema
`POST /api/process` - Process MCP requests
CamelAIOrg Agent Endpoints (Port 5001)
`GET /health` - Health check
`GET /schema` - Get agent capabilities
`POST /process` - Process natural language requests
Example Requests
Here are some example natural language requests you can try:
"Create a customer feedback form with a rating question from 1-5 and a text question for additional comments"
"Create a survey about remote work preferences with 3 multiple choice questions"
"Create an event RSVP form with name, email and attendance options"
MCP Protocol Format
The MCP Server accepts requests in the following format: