home / mcp / microsoft 365 mcp server

Microsoft 365 MCP Server

Provides access to Microsoft 365 data (email, calendar, files, Teams, contacts, and more) via MCP-compatible AI clients.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "aanerud-mcp-microsoft-office": {
      "command": "node",
      "args": [
        "/path/to/MCP-Microsoft-Office/mcp-adapter.cjs"
      ],
      "env": {
        "PORT": "3000",
        "JWT_SECRET": "YOUR_JWT_SECRET_HERE",
        "MCP_SERVER_URL": "http://localhost:3000",
        "MCP_BEARER_TOKEN": "paste-your-token-here",
        "MICROSOFT_CLIENT_ID": "<MICROSOFT_CLIENT_ID>",
        "MICROSOFT_TENANT_ID": "<MICROSOFT_TENANT_ID>",
        "CORS_ALLOWED_ORIGINS": "https://yourdomain.com",
        "MICROSOFT_REDIRECT_URI": "http://localhost:3000/api/auth/callback",
        "DEVICE_REGISTRY_ENCRYPTION_KEY": "YOUR_32_BYTE_KEY_HERE"
      }
    }
  }
}

You set up a local MCP server that connects your Microsoft 365 data to your preferred AI assistant. It lets you read emails, manage calendars, access files, and interact with Teams, all while keeping control and security in your environment.

How to use

You interact with Claude Desktop or any MCP-compatible AI, and the MCP Adapter translates your requests into actions on the MCP Server. After you’ve authenticated with Microsoft and started the server, your AI can read emails, fetch calendar events, access files, and perform Teams actions using natural language queries. The adapter runs on your machine and communicates with the local server, enabling multi-user access with data isolation.

How to install

Prerequisites: Install Node.js 18+ and make sure you have a Microsoft 365 account and an Azure App Registration ready for OAuth.

# 1) Clone the project
# Replace with your actual repository path if you clone locally
git clone https://github.com/Aanerud/MCP-Microsoft-Office.git
cd MCP-Microsoft-Office

# 2) Install dependencies (this also sets up the database)
npm install

# 3) Edit the environment file with your Azure app details
# Add these values to .env:
# MICROSOFT_CLIENT_ID=your-client-id-here
# MICROSOFT_TENANT_ID=your-tenant-id-here

# 4) Start the server for local development
npm run dev:web

Additional sections

Configuration, security, and troubleshooting details are covered to help you run a robust MCP server. You can authenticate with Microsoft, generate an MCP token for your AI client, and connect the local MCP Adapter to the server so your AI can perform actions across Mail, Calendar, Files, Teams, and more.

Security and multi-user isolation ensure each user’s data remains private. Tokens are stored securely, tokens are renewed automatically where supported, and the server enforces access controls and rate limits.

If you need to adjust client connections, configure the local adapter path, and ensure Claude Desktop points to the adapter with the correct MCP server URL and token.

Available tools

getInbox

Read your inbox messages from your connected Microsoft 365 account.

sendEmail

Send an email on behalf of the authenticated user.

searchEmails

Search for specific emails across mailboxes.

flagEmail

Flag or unflag an email for follow-up.

getEmailDetails

Retrieve full content of a specific email.

markAsRead

Mark emails as read or unread.

getMailAttachments

List attachments for a selected email.

addMailAttachment

Add an attachment to an email.

removeMailAttachment

Remove an attachment from an email.

getEvents

Fetch calendar events from Microsoft 365.

createEvent

Create a new calendar event.

updateEvent

Modify an existing calendar event.

cancelEvent

Cancel or delete a calendar event.

getAvailability

Check free/busy availability across calendars.

findMeetingTimes

Find optimal meeting times based on attendee availability.

acceptEvent

Accept a calendar invitation.

declineEvent

Decline a calendar invitation.

tentativelyAcceptEvent

Tentatively accept a calendar invitation.

getCalendars

List all calendars.

getRooms

Find available meeting rooms.

addAttachment

Add attachment to a calendar event.

removeAttachment

Remove an attachment from a calendar event.

listFiles

List OneDrive files.

searchFiles

Search for files in OneDrive.

downloadFile

Download a file from OneDrive.

uploadFile

Upload a new file to OneDrive.

getFileMetadata

Get file metadata.

getFileContent

Read file contents.

setFileContent

Write file contents.

updateFileContent

Update file contents.

createSharingLink

Create a share link for a file.

getSharingLinks

List sharing links for files.

removeSharingPermission

Remove sharing permissions.

listChats

List Teams chats.

getChat

Get chat details.

listChatMessages

Read messages in a chat.

sendChatMessage

Send a message to a chat.

listTeams

List your Teams teams.

getTeam

Get team details.

listChannels

List channels in a team.

getChannel

Get channel details.

listChannelMessages

Read messages in a channel.

sendChannelMessage

Post a message to a channel.

createOnlineMeeting

Create an online meeting in Teams.

getOnlineMeeting

Get details of a Teams online meeting.

findPeople

Find people by name in the directory.

getRelevantPeople

Get frequent contacts.

getPersonById

Get detailed person information.

search

Unified search across emails, files, events, and people.

listTaskLists

List all Task lists.

getTaskList

Get a specific task list.

createTaskList

Create a new task list.

updateTaskList

Rename a task list.

deleteTaskList

Delete a task list.

listTasks

List tasks in a list.

getTask

Get task details.

createTask

Create a new task.

updateTask

Update a task.

deleteTask

Delete a task.

completeTask

Mark a task as complete.

listContacts

List your contacts.

getContact

Get contact details.

createContact

Add a new contact.

updateContact

Update contact information.

deleteContact

Remove a contact.

searchContacts

Search your contacts.

listGroups

List Microsoft 365 groups.

getGroup

Get group details.

listGroupMembers

List members of a group.

listMyGroups

List groups you’re in.