Calendar Mcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Calendar Mcp (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
An MCP (Model Context Protocol) server that reads your Microsoft 365 calendar and answers two questions for any day:
get_todays_meetings)get_availability — busy blocks + free gaps within working hours)It authenticates as you using the Microsoft device code flow (no admin consent, no app secrets) and reads your calendar via the Microsoft Graph API.
This README doubles as a learning guide structured around four topics:
What MCP is. The Model Context Protocol is an open standard that lets an AI client (Claude Desktop, Claude Code, etc.) call external tools, read resources, and use prompts through a uniform JSON-RPC interface. Instead of every integration being bespoke, an MCP server exposes capabilities and any MCP client can use them.
The three roles.
| Role | In this project |
|---|---|
| Host / Client | Claude Desktop or Claude Code — starts the server, sends requests |
| Server | calendar-mcp — exposes the two calendar tools |
| Transport | stdio — JSON-RPC messages over stdin/stdout |
Message flow (this server):
Client calendar-mcp (server) Microsoft Graph
│ initialize ──────────────────▶ │
│ ◀────────────── capabilities │ │
│ tools/list ──────────────────▶ │
│ ◀──────── [get_todays_meetings, get_availability] │
│ tools/call get_availability ─▶ │
│ │ acquireTokenSilent (MSAL cache) │
│ │ GET /me/calendarView ──────────────▶│
│ │ ◀──────────────── events │
│ ◀──── text: free/busy slots │ │Architecture of this codebase (one responsibility per file — see team standards):
src/
├── index.ts MCP server: registers tools, formats output
├── login.ts one-time device-code sign-in CLI
├── config.ts env validation (Zod) → Config
├── logger.ts structured logger → STDERR (stdout is the protocol!)
├── time.ts timezone math (wall-clock ⇄ UTC instants)
├── types/calendar.ts Zod schemas + domain types + Result<T>
└── services/
├── auth-service.ts MSAL device-code flow + token cache persistence
├── graph-service.ts calls Microsoft Graph, normalizes events
└── availability-service.ts merges busy blocks, computes free gaps (pure)Two architectural rules worth internalizing:
console.log corrupts the stream. That's why logger.ts writes only to stderr.
separate login script. The server itself only refreshes tokens silently, so it never needs to prompt a human mid-request.
You need a Client ID and Tenant ID. This app uses delegated permissions (it acts as you), so no client secret and no admin consent are required.
calendar-mcp (anything).AZURE_CLIENT_IDAZURE_TENANT_ID(or use common if you chose a multi-tenant/personal account type).
Allow public client flows to Yes. (Required for device code flow.) Save.
→ Delegated permissions → search and add `Calendars.Read` → Add permissions.
Grant admin consent depending on tenant policy.
cp .env.example .env
# edit .env and set AZURE_CLIENT_ID (and AZURE_TENANT_ID if not "common")| Variable | Required | Default | Notes |
|---|---|---|---|
AZURE_CLIENT_ID | ✅ | — | Application (client) ID GUID |
AZURE_TENANT_ID | common | Tenant GUID, or common for personal/multi-tenant | |
TOKEN_CACHE_PATH | ~/.calendar-mcp/token-cache.json | Where tokens are stored (chmod 600) | |
TIMEZONE | system tz | IANA name, e.g. Asia/Kolkata | |
WORKING_HOURS_START | 9 | Hour 0–23 for availability window | |
WORKING_HOURS_END | 18 | Hour 1–24 for availability window |
npm install
npm run login # device-code flow: opens a URL, you paste a code, sign in ONCE
npm run build # compile TypeScript → dist/npm run login prints something like:
To sign in, use a web browser to open https://microsoft.com/devicelogin
and enter the code ABCD-EFGH to authenticate.After success, a token cache is written to TOKEN_CACHE_PATH. The server uses it silently from then on.
npm start # runs dist/index.js over stdio
# or during development:
npm run dev # runs src/index.ts via tsx (no build step)Claude Desktop — edit claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"calendar": {
"command": "node",
"args": ["/Users/khushal/Documents/practice project/calendar-mcp/dist/index.js"],
"env": {
"AZURE_CLIENT_ID": "your-client-id-guid",
"AZURE_TENANT_ID": "common",
"TIMEZONE": "Asia/Kolkata"
}
}
}
}Claude Code (CLI):
claude mcp add calendar -- node "/Users/khushal/Documents/practice project/calendar-mcp/dist/index.js"Restart the client. The calendar server's tools will appear.
Note: run npm run login first so the token cache exists before the client launches the server. The server never prompts for sign-in itself.Once connected, you talk to your calendar in natural language and the model picks the right tool:
| You ask… | Tool called | Result |
|---|---|---|
| "What meetings do I have today?" | get_todays_meetings | Ordered list with times, locations, organizers |
| "What's on my calendar on 2026-06-25?" | get_todays_meetings {date} | Same, for that date |
| "When am I free today?" | get_availability | Free gaps + busy blocks within 9–18 |
| "Do I have a 2-hour block this afternoon?" | get_availability | Model reads the free slots and reasons over them |
| "Find me 30 min between meetings before 2pm" | get_availability {workingHoursEnd:14} | Narrowed window |
Why this composes well: get_availability returns structured free/busy spans, so the model can chain reasoning ("schedule the review in your longest free block") without you doing the arithmetic. This is the real value of MCP — the tool provides facts; the model provides judgment.
Example tool output:
Availability for 2026-06-23 (Asia/Kolkata), working hours 09:00–18:00:
Total free: 5h 30m
Free slots:
• 9:00 AM – 11:00 AM
• 11:30 AM – 1:00 PM
• 2:00 PM – 4:00 PM
Busy blocks:
• 11:00 AM – 11:30 AM
• 1:00 PM – 2:00 PM
• 4:00 PM – 6:00 PMThe server answers initialize and tools/list before any auth. Smoke-test with raw JSON-RPC (a well-formed dummy client ID is enough):
printf '%s\n%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"t","version":"0"}}}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
| AZURE_CLIENT_ID=11111111-1111-1111-1111-111111111111 node dist/index.js 2>/dev/nullYou should see the server info and both tool schemas.
Calling a tool with no cached login returns a friendly, non-crashing error:
printf '%s\n%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"t","version":"0"}}}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_todays_meetings","arguments":{}}}' \
| AZURE_CLIENT_ID=11111111-1111-1111-1111-111111111111 TOKEN_CACHE_PATH=/tmp/none.json node dist/index.js 2>/dev/null
# → "Not signed in. Run `npm run login` ..."npm run login # if you haven't already
npx @modelcontextprotocol/inspector node dist/index.jsThe MCP Inspector opens a UI where you can call get_todays_meetings and get_availability and see live results from your calendar.
npm run build compiles with no errorstools/list returns both toolsnpm run login completes and writes the token cacheget_todays_meetings matches what you see in Outlookget_availability free + busy spans add up to the working windowfind_slot tool that takes a duration and returns the earliest free block.freeBusy query across attendees(/me/calendar/getSchedule).
TOKEN_CACHE_PATH) holds refresh/access tokens. It's writtenchmod 600 and is git-ignored. Treat it like a password.
Calendars.Read is requested — the server cannot modify your calendar.| Command | Does |
|---|---|
npm run dev | Run the server from source (tsx) |
npm run build | Compile to dist/ |
npm start | Run the compiled server |
npm run login | One-time device-code sign-in (source) |
npm run login:prod | Same, from compiled dist/ |
npm run typecheck | Type-check without emitting |
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.