# MCP server for Google Calendar
## Credentials
The `credentials.json` file is needed to authenticate againts the Google services.
To generate the file, the following steps must be performed:
1. Visit the _Google Cloud Platform_ website
2. Crete a new project (or use an existant one)
3. Into the _APIs & Services_ section, enable the _Google Calendar API_ service
4. Go to _Credentials_ and generate a new credential as _Service Account_
5. Copy the service account's email generated. It will be needed to share the calendar with it
6. After the credential is created, a JSON file will be able to download. Place it into the root of this project and name it as `credentials.json`
## Calendar sharing
To interact with a calendar, it needs to be shared with the service account previously created to access it following these steps:
1. Visit the _Google Calendar_ website
2. Into the sidebar, place on the target calendar, click the three dots (...) and then go to _Settings and sharing_
3. Go the _Shared with_ and add the email address for the service account copied previously when the credential was created
4. Go to _Integrate calendar_ and copy the _Calendar ID_ value
## Inspector
While developing, you can use the inspector to debug the server. To do this:
```bash
npm run inspector
```
## Build MCP Server
Before adding the MCP server to the configuration file, you need to build it. The build process will create a Docker image that can be run in WSL.
```bash
npm run build
docker build -t mcpserver-googlecalendar .
```
## Add MCP Server
To add the MCP server, add to the configuration file and paste the _Calendar ID_ copied previously:
```json
{
"mcpServers": {
"google-calendar": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GOOGLE_CALENDAR_ID",
"mcpserver-googlecalendar"
],
"env": {
"GOOGLE_CALENDAR_ID": "[CALENDAR_ID_HERE]"
}
}
}
}
```