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.
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.
- 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
┌─────────────┐ ┌─────────────┐ ┌────────────┐ ┌────────────┐
│ │ │ │ │ │ │ │
│ Frontend │◄──►│ CamelAIOrg │◄──►│ MCP Server │◄──►│ Google │
│ (UI) │ │ Agents │ │ │ │ Forms API │
│ │ │ │ │ │ │ │
└─────────────┘ └─────────────┘ └────────────┘ └────────────┘
This diagram illustrates how a user request flows through the system:
graph TD
subgraph "User Interface"
A[Frontend UI]
end
subgraph "Processing Logic"
B((CamelAIOrg Agent))
C((MCP Server))
end
subgraph "External Service"
D{{Google Forms API}}
end
A -->|"1. User enters: Create feedback form"| B
B -->|"2. Interprets request, sends tool call"| C
C -->|"3. Translates to API request"| D
D -->|"4. Returns formId and URL"| C
C -->|"5. Processes API response"| B
B -->|"6. Formats final result to UI"| A
style B fill:#f9d423,stroke:#333,stroke-width:2px,color:#333
style C fill:#8ecae6,stroke:#333,stroke-width:2px,color:#333
- 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.
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.
- Docker and Docker Compose
- Google Cloud Platform account
- Google Forms API enabled
- OAuth2 credentials from Google Cloud Console
git clone https://github.com/yourusername/google-form-mcp-server.git
cd google-form-mcp-server
- Go to the Google Cloud Console
- 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
Create a .env
file in the root directory:
# Google API Credentials
GOOGLE_CLIENT_ID=your_client_id_here
GOOGLE_CLIENT_SECRET=your_client_secret_here
GOOGLE_REFRESH_TOKEN=your_refresh_token_here
# Server Configuration
FLASK_ENV=development
PORT=5000
DEBUG=True
# CamelAIOrg Agents Configuration
AGENT_ENDPOINT=http://agents:5001/process
AGENT_API_KEY=your_agent_api_key_here
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:
- Exchange authorization code for tokens
- Copy the refresh token to your
.env
file
docker-compose up --build
This will start both the MCP Server (on port 5000) and the CamelAIOrg Agents service (on port 5001).
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
GET /api/health
- Health checkGET /api/schema
- Get MCP tools schemaPOST /api/process
- Process MCP requests
GET /health
- Health checkGET /schema
- Get agent capabilitiesPOST /process
- Process natural language 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"
The MCP Server accepts requests in the following format:
{
"transaction_id": "unique_transaction_id",
"tool_name": "create_form",
"parameters": {
"title": "Form Title",
"description": "Form Description"
}
}
And responds with:
{
"transaction_id": "unique_transaction_id",
"status": "success",
"result": {
"form_id": "form_id",
"response_url": "https://docs.google.com/forms/d/form_id/viewform",
"edit_url": "https://docs.google.com/forms/d/form_id/edit",
"title": "Form Title"
}
}
google-form-mcp-server/
├── server/ # MCP Server
│ ├── app.py # Main Flask application
│ ├── config.py # Configuration
│ ├── forms_api.py # Google Forms API integration
│ ├── mcp_handler.py # MCP protocol handler
│ ├── requirements.txt # Python dependencies
│ ├── static/ # Static assets
│ ├── templates/ # HTML templates
│ └── utils/ # Utility functions
├── agents/ # CamelAIOrg Agents
│ ├── agent_integration.py # Agent implementation
│ ├── agent_server.py # Agent API server
│ └── requirements.txt # Python dependencies
├── Dockerfile # MCP Server Dockerfile
├── docker-compose.yml # Docker Compose configuration
├── .env.example # Example environment variables
└── README.md # Project documentation
To run the MCP Server without Docker:
cd server
pip install -r requirements.txt
python app.py
To run the Agents service without Docker:
cd agents
pip install -r requirements.txt
python agent_server.py
MIT
- Google Forms API
- CamelAIOrg for their agent framework
- Model Context Protocol (MCP) specification