gbzarelli/ai-scheduler
If you are the rightful owner of ai-scheduler and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
AI Scheduler with MCP Server and Client is a project that integrates AI-driven scheduling with Google Calendar API and OpenAI's GPT models.
AI Scheduler with MCP Server and Client
This project consists of an AI-driven scheduling platform using Spring Boot, designed to manage calendar events for multiple users. It incorporates Google Calendar API for event management and OpenAI's GPT for AI-driven interactions. The project includes two main components: the MCP Server and MCP Client.
Features
- MCP Server: Manages calendar operations such as creating, listing, and deleting both calendars and events using the Google Calendar API.
- MCP Client: Provides AI capabilities to handle user queries for calendar scheduling through OpenAI's models.
- Intelligent Event Management: Automatically create, search, and manage events based on user's natural language input.
- Ensures No Overlapping Events: Prevents scheduling conflicts and avoids creating events in the past.
Project Structure
-
gcalendar-mcp-server
: Implements the server-side logic with Google Calendar integration.- DemoApplication: Main entry point.
- ScheduleService: Service containing methods for calendar operations.
-
gcalendar-mcp-client
: Houses the AI components leveraging OpenAI models.- DemoApplication: Client application entry point.
- ChatController: Handles API requests for chat interactions.
- AiConfig: Configures AI memory and chat client.
Getting Started
Prerequisites
- Java 21
- Maven
- Docker and Docker Compose (recommended for PostgreSQL setup)
- PostgreSQL (alternative to Docker setup)
- Google Calendar API credentials
- OpenAI API key (or OpenRouter API key for alternative models)
Installation
Environment Setup
Before running either component, set up the required environment variables:
# Set your OpenAI API key (or OpenRouter API key)
export OPENAI_API_KEY="your-api-key-here"
MCP Server
-
Navigate to
gcalendar-mcp-server
:cd gcalendar-mcp-server
-
Set up Google Calendar credentials:
Creating Service Account Credentials:
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Calendar API:
- Navigate to "APIs & Services" > "Library"
- Search for "Google Calendar API" and enable it
- Create a Service Account:
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "Service Account"
- Fill in the service account details and click "Create"
- Skip granting roles (optional) and click "Continue"
- Click "Done"
- Generate and download the JSON key:
- Click on the created service account
- Go to the "Keys" tab
- Click "Add Key" > "Create new key"
- Select "JSON" format and click "Create"
- Save the downloaded file as
credentials.json
insrc/main/resources/
- Share your calendar with the service account:
- Copy the service account email from the credentials file
- In Google Calendar, share your calendar with this email address
- Give it "Make changes and manage sharing" permissions
-
Build the project:
mvn clean install
-
Run the server:
mvn spring-boot:run
MCP Client
-
Navigate to
gcalendar-mcp-client
:cd gcalendar-mcp-client
-
Set up PostgreSQL database:
Option A: Using Docker Compose (Recommended)
# Start PostgreSQL using Docker Compose docker-compose -f .docker-compose/docker-compose.yaml up -d
Option B: Manual Setup
- Create a PostgreSQL database named
spring_ai
- Update database credentials in
src/main/resources/application.properties
if needed
- Create a PostgreSQL database named
-
Ensure the
OPENAI_API_KEY
environment variable is set (see Environment Setup above). -
Build the project:
mvn clean install
-
Run the client:
mvn spring-boot:run
Usage
- Interact with the system through API endpoints available in the MCP Client.
- Use the chat endpoint to communicate with the AI and manage calendar events based on user input.
Configuration
Environment Variables
OPENAI_API_KEY
: Your OpenAI API key (required for MCP Client)
Application Settings
- MCP Server runs on port
8111
by default. - MCP Client connects to server via SSE connection defined in
application.properties
. - Database: PostgreSQL database
spring_ai
with credentials configured inapplication.properties
. - AI Model: Configured to use
openai/gpt-4o
by default (can be changed inapplication.properties
).
Contributing
Feel free to submit issues or pull requests if you have ideas on how to make this project more effective and robust.