npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

agenza-graph-mcp

v1.6.5

Published

Microsoft Graph MCP Server with LINE confirmation workflow for calendar management

Downloads

6,657

Readme

microsoft-graph-mcp

Microsoft Graph MCP Server with LINE confirmation workflow for calendar management

npm version License: MIT

✨ Features

  • 📅 Calendar Management - Create, update, delete Microsoft 365 calendar events
  • LINE Confirmation - Require LINE approval before creating/updating events
  • 🔄 Redis Storage - Shared pending events across multiple processes
  • 🕐 Availability Check - Check free/busy slots and working hours (9 AM - 5 PM)
  • 📧 Email Integration - Send emails via Microsoft Graph
  • 🎯 Appointment Tracking - Unique appointment numbers for easy reference
  • 🔔 Real-time Notifications - LINE notifications for all event changes

📦 Installation

# Using bun (recommended)
bun add microsoft-graph-mcp

# Using npm
npm install microsoft-graph-mcp

# Using pnpm
pnpm add microsoft-graph-mcp

🚀 Quick Start

As MCP Server (Claude Desktop)

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "agenza-graph": {
      "command": "bunx",
      "args": ["microsoft-graph-mcp"],
      "env": {
        "TENANT_ID": "your-azure-tenant-id",
        "CLIENT_ID": "your-azure-client-id",
        "CLIENT_SECRET": "your-azure-client-secret",
        "USER_PRINCIPAL_NAME": "[email protected]",
        "GRAPH_SCOPES": "https://graph.microsoft.com/.default",
        "LINE_CHANNEL_ACCESS_TOKEN": "your-line-channel-token",
        "LINE_USER_IDS": "user-id-1,user-id-2",
        "REDIS_URL": "redis://localhost:6379"
      }
    }
  }
}

As Library

import { MCPGraphServer } from 'microsoft-graph-mcp/server';
import { AuthManager } from 'microsoft-graph-mcp/auth';

const auth = new AuthManager(['https://graph.microsoft.com/.default']);
const server = new MCPGraphServer(auth);

await server.start();

🔧 Configuration

Environment Variables

| Variable | Required | Description | |----------|----------|-------------| | TENANT_ID | ✅ | Azure AD Tenant ID | | CLIENT_ID | ✅ | Azure AD Application (Client) ID | | CLIENT_SECRET | ✅ | Azure AD Client Secret | | USER_PRINCIPAL_NAME | ✅ | User email (e.g., [email protected]) | | GRAPH_SCOPES | ✅ | Microsoft Graph scopes (typically https://graph.microsoft.com/.default) | | LINE_CHANNEL_ACCESS_TOKEN | ✅ | LINE Messaging API channel access token | | LINE_USER_IDS | ✅ | Comma-separated LINE user IDs for notifications | | REDIS_URL | ✅ | Redis connection URL (e.g., redis://localhost:6379) |

Azure AD Setup

  1. Register an application in Azure AD
  2. Add API permissions: Calendars.ReadWrite, Mail.Send, User.Read
  3. Create a client secret
  4. Grant admin consent for your organization

LINE Setup

  1. Create a LINE Messaging API channel
  2. Get your channel access token
  3. Get user IDs by having users add your LINE bot

🛠️ Available Tools

Calendar Tools

  • get_user_profile - Get Microsoft 365 user profile information
  • get_calendar_events - Get calendar events for a date range
  • get_available_slots - Get available time slots (9 AM - 5 PM, excluding lunch 12-1 PM)
  • check_availability - Check if a specific time slot is available
  • create_event - Create calendar event (requires LINE confirmation)
  • update_event - Update existing event (requires LINE confirmation)
  • delete_event - Delete calendar event (sends LINE notification)

Email Tools

  • send_email - Send email via Microsoft Graph

📝 Usage Examples

Create Event

// This will send LINE confirmation before creating
await callTool('create_event', {
  subject: 'Team Meeting',
  start: {
    dateTime: '2025-01-20T10:00:00',
    timeZone: 'Asia/Bangkok'
  },
  end: {
    dateTime: '2025-01-20T11:00:00',
    timeZone: 'Asia/Bangkok'
  },
  appointment: 'Meeting',
  description: 'Quarterly review meeting',
  email: '[email protected]'
});

Check Availability

const result = await callTool('check_availability', {
  start: {
    dateTime: '2025-01-20T14:00:00',
    timeZone: 'Asia/Bangkok'
  },
  end: {
    dateTime: '2025-01-20T15:00:00',
    timeZone: 'Asia/Bangkok'
  }
});

Get Available Slots

const slots = await callTool('get_available_slots', {
  startDateTime: '2025-01-20T00:00:00',
  endDateTime: '2025-01-20T23:59:59',
  timezone: 'Asia/Bangkok'
});

🔄 LINE Confirmation Workflow

  1. Create/Update Request - MCP server receives request
  2. Validation - Check time slot availability
  3. LINE Message - Send confirmation request to configured LINE users
  4. User Action - User confirms or rejects via LINE
  5. Execution - If confirmed, event is created/updated in Microsoft 365
  6. Notification - LINE notification sent with appointment number

🏗️ Architecture

src/
├── handlers/              # Tool handlers
│   ├── user-profile.handler.ts
│   ├── calendar-events.handler.ts
│   ├── available-slots.handler.ts
│   ├── check-availability.handler.ts
│   ├── create-event.handler.ts
│   ├── update-event.handler.ts
│   ├── delete-event.handler.ts
│   └── send-email.handler.ts
├── tools/                 # Tool definitions
│   └── definitions.ts
├── types/                 # TypeScript types
│   └── tool-args.ts
├── shared/               # Shared services
│   ├── calendar-service.ts
│   └── pending-events-store.ts
├── auth/                 # Authentication
│   └── index.ts
├── utils/                # Utilities
│   ├── index.ts
│   ├── calendar-helpers.ts
│   ├── line-notify.ts
│   └── appointment-utils.ts
├── mcp-server.ts         # MCP server
└── index.ts              # Entry point

🧪 Development

# Install dependencies
bun install

# Build
bun run build

# Development mode with auto-reload
bun run dev

# Type check
bun run type-check

# Clean build directory
bun run clean

📄 License

MIT © OSD

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📮 Support

🔗 Links