Skip to content

Commit d956f82

Browse files
committed
Convert to proper MCP server using stdio transport
1 parent 85ff079 commit d956f82

6 files changed

+1714
-152
lines changed

.gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,8 @@ Thumbs.db
4848
.idea/
4949
.vscode/
5050
*.swp
51-
*.swoCLAUDE.md
51+
*.swo
52+
CLAUDE.md
53+
54+
# Home directory symlinks or references
55+
~/

README.md

+117-149
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ If you find this project useful, consider supporting the developer:
3030
2. Install dependencies:
3131
```
3232
npm install
33+
npm install @modelcontextprotocol/sdk --save
3334
```
3435

3536
3. Update the `.env` file with your Google API credentials:
@@ -39,45 +40,57 @@ If you find this project useful, consider supporting the developer:
3940
GOOGLE_REDIRECT_URI=http://localhost:3000/auth/google/callback
4041
```
4142

42-
4. Start the server:
43+
4. Make the MCP server script executable:
4344
```
44-
npm start
45+
chmod +x mcp-server.js
46+
chmod +x start-mcp.sh
4547
```
4648

47-
5. Open http://localhost:3000 in your browser and authorize the application with Google.
49+
5. Start the MCP server:
50+
```
51+
./start-mcp.sh
52+
```
53+
54+
6. Authentication will be handled through the MCP tools when you first use them.
4855

4956
## Connecting to Claude
5057

5158
To use this MCP server with Claude:
5259

53-
1. Claude will start the server automatically using the shell script command
54-
2. Add the following MCP configuration to Claude:
60+
1. Add the following MCP configuration to Claude's settings:
5561

5662
```json
5763
{
5864
"mcpServers": {
5965
"googleCalendar": {
60-
"name": "Google Calendar MCP",
61-
"version": "1.0.0",
62-
"command": "/Users/jonc/code/mcp-google-calendar/start-mcp.sh",
63-
"description": "MCP server for Google Calendar access",
64-
"url": "http://localhost:3000",
65-
"mcpProtocolVersion": "0.1"
66+
"command": "node",
67+
"args": ["/path/to/mcp-google-calendar/mcp-server.js"],
68+
"env": {
69+
"GOOGLE_CLIENT_ID": "your_client_id_here",
70+
"GOOGLE_CLIENT_SECRET": "your_client_secret_here",
71+
"GOOGLE_REDIRECT_URI": "http://localhost:3000/auth/google/callback"
72+
},
73+
"disabled": false,
74+
"autoApprove": []
6675
}
6776
}
6877
}
6978
```
7079

71-
3. In Claude settings, go to Model Context Protocol > Add MCP server
72-
4. Enter the details above (or import a JSON file with these contents)
80+
2. Replace `/path/to/mcp-google-calendar/mcp-server.js` with the actual path to your mcp-server.js file
81+
3. Replace the Google API credentials with your own
82+
4. In Claude desktop app, go to Settings > MCP Servers, or in Claude web app, use the MCP configuration panel
7383
5. Claude will now be able to manage your Google Calendar
7484

75-
## MCP Endpoints
85+
## MCP Tools
86+
87+
This server provides the following MCP tools:
7688

77-
- `/mcp/definition` - GET endpoint that returns the capabilities of this MCP server
78-
- `/mcp/execute` - POST endpoint for executing actions on Google Calendar
89+
### Authentication Tools
90+
- `get_auth_url` - Get the URL for Google Calendar authentication
91+
- `check_auth_status` - Check if the user is authenticated with Google Calendar
7992

80-
## Supported Actions
93+
### Calendar Tools
8194

8295
### Core Calendar Operations
8396
- `list_calendars` - List all available calendars
@@ -102,33 +115,56 @@ To use this MCP server with Claude:
102115

103116
All event-related actions support an optional `calendarId` parameter to work with different calendars. If not specified, the primary calendar is used by default.
104117

105-
## Example Usage
118+
## Example Usage with MCP Tools
119+
120+
When using this MCP server with Claude or other MCP-compatible assistants, you can use the tools directly. Here are some examples:
121+
122+
### Authentication
123+
124+
```
125+
// Get authentication URL
126+
use_mcp_tool(
127+
server_name: "googleCalendar",
128+
tool_name: "get_auth_url",
129+
arguments: {}
130+
)
131+
132+
// Check authentication status
133+
use_mcp_tool(
134+
server_name: "googleCalendar",
135+
tool_name: "check_auth_status",
136+
arguments: {}
137+
)
138+
```
106139

107140
### List Calendars
108-
```json
109-
{
110-
"action": "list_calendars",
111-
"parameters": {}
112-
}
141+
```
142+
use_mcp_tool(
143+
server_name: "googleCalendar",
144+
tool_name: "list_calendars",
145+
arguments: {}
146+
)
113147
```
114148

115149
### List Events
116-
```json
117-
{
118-
"action": "list_events",
119-
"parameters": {
150+
```
151+
use_mcp_tool(
152+
server_name: "googleCalendar",
153+
tool_name: "list_events",
154+
arguments: {
120155
"calendarId": "primary",
121156
"timeMin": "2023-01-01T00:00:00Z",
122157
"maxResults": 10
123158
}
124-
}
159+
)
125160
```
126161

127162
### Create Event
128-
```json
129-
{
130-
"action": "create_event",
131-
"parameters": {
163+
```
164+
use_mcp_tool(
165+
server_name: "googleCalendar",
166+
tool_name: "create_event",
167+
arguments: {
132168
"calendarId": "primary",
133169
"summary": "Team Meeting",
134170
"description": "Weekly team sync",
@@ -142,25 +178,27 @@ All event-related actions support an optional `calendarId` parameter to work wit
142178
"timeZone": "America/Los_Angeles"
143179
}
144180
}
145-
}
181+
)
146182
```
147183

148184
### Get Event
149-
```json
150-
{
151-
"action": "get_event",
152-
"parameters": {
185+
```
186+
use_mcp_tool(
187+
server_name: "googleCalendar",
188+
tool_name: "get_event",
189+
arguments: {
153190
"calendarId": "primary",
154191
"eventId": "event_id_here"
155192
}
156-
}
193+
)
157194
```
158195

159196
### Update Event
160-
```json
161-
{
162-
"action": "update_event",
163-
"parameters": {
197+
```
198+
use_mcp_tool(
199+
server_name: "googleCalendar",
200+
tool_name: "update_event",
201+
arguments: {
164202
"calendarId": "primary",
165203
"eventId": "event_id_here",
166204
"summary": "Updated Meeting Title",
@@ -175,122 +213,41 @@ All event-related actions support an optional `calendarId` parameter to work wit
175213
"timeZone": "America/Los_Angeles"
176214
}
177215
}
178-
}
216+
)
179217
```
180218

181219
### Delete Event
182-
```json
183-
{
184-
"action": "delete_event",
185-
"parameters": {
220+
```
221+
use_mcp_tool(
222+
server_name: "googleCalendar",
223+
tool_name: "delete_event",
224+
arguments: {
186225
"calendarId": "primary",
187226
"eventId": "event_id_here"
188227
}
189-
}
228+
)
190229
```
191230

192231
### Find Duplicate Events
193-
```json
194-
{
195-
"action": "find_duplicates",
196-
"parameters": {
232+
```
233+
use_mcp_tool(
234+
server_name: "googleCalendar",
235+
tool_name: "find_duplicates",
236+
arguments: {
197237
"calendarId": "primary",
198238
"timeMin": "2023-01-01T00:00:00Z",
199239
"timeMax": "2023-12-31T23:59:59Z",
200240
"similarityThreshold": 0.7
201241
}
202-
}
203-
```
204-
205-
### List Recurring Instances
206-
```json
207-
{
208-
"action": "list_recurring_instances",
209-
"parameters": {
210-
"calendarId": "primary",
211-
"eventId": "recurring_event_id_here",
212-
"timeMin": "2023-01-01T00:00:00Z",
213-
"maxResults": 25
214-
}
215-
}
216-
```
217-
218-
### Create Event Exception
219-
```json
220-
{
221-
"action": "create_event_exception",
222-
"parameters": {
223-
"calendarId": "primary",
224-
"recurringEventId": "recurring_event_id_here",
225-
"originalStartTime": "2023-01-15T09:00:00-07:00",
226-
"summary": "Special Team Meeting",
227-
"location": "Virtual Meeting Room",
228-
"reminders": {
229-
"useDefault": false,
230-
"overrides": [
231-
{ "method": "email", "minutes": 30 },
232-
{ "method": "popup", "minutes": 15 }
233-
]
234-
}
235-
}
236-
}
237-
```
238-
239-
### Delete Event Instance
240-
```json
241-
{
242-
"action": "delete_event_instance",
243-
"parameters": {
244-
"calendarId": "primary",
245-
"recurringEventId": "recurring_event_id_here",
246-
"originalStartTime": "2023-01-22T09:00:00-07:00"
247-
}
248-
}
249-
```
250-
251-
### Batch Operations
252-
```json
253-
{
254-
"action": "batch_operations",
255-
"parameters": {
256-
"operations": [
257-
{
258-
"action": "get_event",
259-
"parameters": {
260-
"calendarId": "primary",
261-
"eventId": "event_id_1"
262-
}
263-
},
264-
{
265-
"action": "create_event",
266-
"parameters": {
267-
"summary": "New Event",
268-
"start": {
269-
"dateTime": "2023-02-15T10:00:00-07:00",
270-
"timeZone": "America/Los_Angeles"
271-
},
272-
"end": {
273-
"dateTime": "2023-02-15T11:00:00-07:00",
274-
"timeZone": "America/Los_Angeles"
275-
}
276-
}
277-
},
278-
{
279-
"action": "delete_event",
280-
"parameters": {
281-
"eventId": "event_id_2"
282-
}
283-
}
284-
]
285-
}
286-
}
242+
)
287243
```
288244

289245
### Advanced Search Events
290-
```json
291-
{
292-
"action": "advanced_search_events",
293-
"parameters": {
246+
```
247+
use_mcp_tool(
248+
server_name: "googleCalendar",
249+
tool_name: "advanced_search_events",
250+
arguments: {
294251
"calendarId": "primary",
295252
"timeRange": {
296253
"start": "2023-01-01T00:00:00Z",
@@ -303,18 +260,19 @@ All event-related actions support an optional `calendarId` parameter to work wit
303260
"isRecurring": true,
304261
"maxResults": 50
305262
}
306-
}
263+
)
307264
```
308265

309266
### Manage Webhooks
310-
```json
311-
{
312-
"action": "manage_webhooks",
313-
"parameters": {
267+
```
268+
use_mcp_tool(
269+
server_name: "googleCalendar",
270+
tool_name: "manage_webhooks",
271+
arguments: {
314272
"operation": "create",
315273
"address": "https://your-server.com/webhook/calendar"
316274
}
317-
}
275+
)
318276
```
319277

320278
## Webhook Notifications
@@ -324,7 +282,17 @@ This MCP server supports real-time notifications through webhooks. When events i
324282
### Setting up Webhooks
325283

326284
1. Create a publicly accessible HTTPS endpoint that can receive POST requests
327-
2. Register your endpoint using the `manage_webhooks` action with the "create" operation
285+
2. Register your endpoint using the `manage_webhooks` MCP tool:
286+
```
287+
use_mcp_tool(
288+
server_name: "googleCalendar",
289+
tool_name: "manage_webhooks",
290+
arguments: {
291+
"operation": "create",
292+
"address": "https://your-server.com/webhook/calendar"
293+
}
294+
)
295+
```
328296
3. Your server will start receiving notifications when calendar events change
329297

330298
### Webhook Notification Format
@@ -366,4 +334,4 @@ The server also supports event reminder notifications:
366334
],
367335
"timestamp": "2023-01-15T08:45:00Z"
368336
}
369-
```
337+
```

0 commit comments

Comments
 (0)