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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@piyapat/office365-mcp-server

v1.1.1

Published

MCP server for Office 365 email - draft and send with attachments via Microsoft Graph API

Readme

@piyapat/office365-mcp-server

MCP server for Microsoft Office 365 email — create drafts and send email (with file attachments) via Microsoft Graph API. Email deletion is intentionally blocked.

Note: This package was previously published as office365-mcp-server and has been renamed to @piyapat/office365-mcp-server.


Tools

| Tool | Description | |---|---| | draft_email | Create a draft email (saved, not sent) | | send_email | Send an email immediately | | send_draft | Send an existing draft by message ID | | list_drafts | List drafts in the Drafts folder | | delete_email | BLOCKED — always returns an error |


Prerequisites

  1. An Azure AD App Registration with:

    • Application permission: Mail.Send, Mail.ReadWrite
    • Admin consent granted for the tenant
  2. Node.js 18+


Azure AD App Registration

  1. Go to Azure Portal → Azure Active Directory → App registrations → New registration
  2. Note the Application (client) ID and Directory (tenant) ID
  3. Certificates & secrets → New client secret → copy the value
  4. API permissions → Add Microsoft Graph application permissions:
    • Mail.Send
    • Mail.ReadWrite
  5. Grant admin consent

Usage with npx (recommended)

1. Build locally (or publish to npm)

npm install
npm run build

2. Set environment variables

export AZURE_TENANT_ID="your-tenant-id"
export AZURE_CLIENT_ID="your-client-id"
export AZURE_CLIENT_SECRET="your-client-secret"

3. Run with npx

npx @piyapat/office365-mcp-server

Or run directly:

node dist/index.js

Claude Desktop / Claude Code configuration

Add to your claude_desktop_config.json or .claude/mcp.json:

{
  "mcpServers": {
    "office365": {
      "command": "npx",
      "args": ["@piyapat/office365-mcp-server"],
      "env": {
        "AZURE_TENANT_ID": "your-tenant-id",
        "AZURE_CLIENT_ID": "your-client-id",
        "AZURE_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

Or if running from a local build:

{
  "mcpServers": {
    "office365": {
      "command": "node",
      "args": ["C:/Works/LLM/office365-mcp-server/dist/index.js"],
      "env": {
        "AZURE_TENANT_ID": "your-tenant-id",
        "AZURE_CLIENT_ID": "your-client-id",
        "AZURE_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

Tool reference

draft_email

| Parameter | Type | Required | Description | |---|---|---|---| | userEmail | string | yes | Sender's O365 mailbox | | subject | string | yes | Subject line | | body | string | yes | Body content | | toRecipients | [{address, name?}] | yes | To recipients | | ccRecipients | [{address, name?}] | no | CC recipients | | bccRecipients | [{address, name?}] | no | BCC recipients | | isHtml | boolean | no | Body is HTML (default false) | | attachments | [{name, contentType, contentBytes}] | no | File attachments (max ~3MB each, base64-encoded) |

send_email

Same as draft_email plus:

| Parameter | Type | Required | Description | |---|---|---|---| | saveToSentItems | boolean | no | Save to Sent Items (default true) |

send_draft

| Parameter | Type | Required | Description | |---|---|---|---| | userEmail | string | yes | Mailbox address | | messageId | string | yes | Draft message ID |

list_drafts

| Parameter | Type | Required | Description | |---|---|---|---| | userEmail | string | yes | Mailbox address | | top | number | no | Max results 1–50 (default 10) |

delete_email — BLOCKED

Always returns OPERATION_BLOCKED error. Cannot be enabled.


Attachments

draft_email and send_email accept an optional attachments array. Each item must be:

{
  "name": "report.pdf",
  "contentType": "application/pdf",
  "contentBytes": "<base64-encoded file content>"
}

Limit: ~3MB per file (Microsoft Graph inline attachment limit). For larger files, an upload session is required (not currently supported).

Common MIME types:

| File type | contentType | |---|---| | PDF | application/pdf | | Word | application/vnd.openxmlformats-officedocument.wordprocessingml.document | | Excel | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | | PNG | image/png | | JPEG | image/jpeg | | Plain text | text/plain |