ms365-mcp-server 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +214 -116
- package/bin/cli.js +2 -2
- package/dist/index.js +320 -645
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,61 +1,57 @@
|
|
|
1
1
|
# ✉️ Microsoft 365 MCP Server
|
|
2
2
|
|
|
3
|
-
A powerful **Model Context Protocol (MCP) server** that enables seamless Microsoft 365 email integration through natural language interactions. Built for **
|
|
3
|
+
A powerful **Model Context Protocol (MCP) server** that enables seamless Microsoft 365 email integration through natural language interactions. Built for **SIYA Desktop**, **LLMs**, and any MCP-compatible application with **production-ready security**.
|
|
4
4
|
|
|
5
5
|
## ✨ Key Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- **`
|
|
20
|
-
- **`
|
|
21
|
-
- **`
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- **`
|
|
25
|
-
- **`
|
|
26
|
-
- **`move_email`** - Move emails between folders
|
|
27
|
-
- **`delete_email`** - Permanently delete email messages
|
|
28
|
-
- **`list_folders`** - Browse all mail folders and their statistics
|
|
29
|
-
- **`get_contacts`** - Retrieve contact list from Microsoft 365
|
|
30
|
-
- **`search_contacts`** - Search contacts by name or email address
|
|
31
|
-
|
|
32
|
-
### 🔐 Authentication Tools (6 tools)
|
|
33
|
-
- **`authenticate_with_device_code`** - Complete authentication in MCP (RECOMMENDED)
|
|
34
|
-
- **`device_code_login`** - Start device code authentication flow
|
|
35
|
-
- **`check_pending_auth`** - Check for pending device code authentication
|
|
36
|
-
- **`verify_authentication`** - Check current authentication status
|
|
37
|
-
- **`logout`** - Clear authentication tokens and reset session
|
|
38
|
-
- **`get_device_code`** - Get device code info for manual authentication
|
|
39
|
-
|
|
40
|
-
**Total: 18 tools** (12 email operations + 6 authentication tools)
|
|
7
|
+
- **🎯 Optimized Tool Architecture** - Only 6 unified tools (67% reduction from 18 tools)
|
|
8
|
+
- **📧 Complete Email Management** - Send, read, search, organize, and manage attachments
|
|
9
|
+
- **🔐 Bulletproof Authentication** - Proactive token refresh prevents chat interruptions
|
|
10
|
+
- **🤖 AI-First Design** - Intuitive action-based tools perfect for LLM interactions
|
|
11
|
+
- **🔒 Enterprise Security** - OAuth2 with secure keychain storage and automatic refresh
|
|
12
|
+
- **📁 Smart Contact Management** - Search and retrieve your Microsoft 365 contacts
|
|
13
|
+
- **🌐 Cross-Platform** - Works on macOS, Linux, and Windows
|
|
14
|
+
|
|
15
|
+
## 🛠️ Available Tools (6 Total)
|
|
16
|
+
|
|
17
|
+
### **📧 Email Management**
|
|
18
|
+
- **`send_email`** - Send emails with attachments and rich formatting
|
|
19
|
+
- **`manage_email`** - **UNIFIED**: Read, search, list, mark, move, or delete emails
|
|
20
|
+
- **`get_attachment`** - Download email attachments with metadata
|
|
21
|
+
- **`list_folders`** - Browse mailbox folders with item counts
|
|
22
|
+
|
|
23
|
+
### **👥 Contacts & Authentication**
|
|
24
|
+
- **`manage_contacts`** - **UNIFIED**: List all contacts or search by name/email
|
|
25
|
+
- **`authenticate`** - **UNIFIED**: Complete authentication management (login, status, logout)
|
|
41
26
|
|
|
42
27
|
## 🚀 Quick Start
|
|
43
28
|
|
|
44
|
-
### Installation
|
|
29
|
+
### 1. Installation
|
|
30
|
+
|
|
31
|
+
**Option A: Global Installation**
|
|
45
32
|
```bash
|
|
46
|
-
#
|
|
33
|
+
# Install globally
|
|
47
34
|
npm install -g ms365-mcp-server
|
|
48
35
|
|
|
49
|
-
# Authenticate (no Azure
|
|
36
|
+
# Authenticate (no Azure setup needed!)
|
|
50
37
|
ms365-mcp-server --login
|
|
51
38
|
|
|
52
39
|
# Start the server
|
|
53
40
|
ms365-mcp-server
|
|
54
41
|
```
|
|
55
42
|
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
**Option B: Run with npx (no installation needed)**
|
|
44
|
+
```bash
|
|
45
|
+
# Authenticate
|
|
46
|
+
npx ms365-mcp-server --login
|
|
58
47
|
|
|
48
|
+
# Start the server
|
|
49
|
+
npx ms365-mcp-server
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2. SIYA Desktop Integration
|
|
53
|
+
|
|
54
|
+
**For Global Installation:**
|
|
59
55
|
```json
|
|
60
56
|
{
|
|
61
57
|
"mcpServers": {
|
|
@@ -67,31 +63,57 @@ Add to your `claude_desktop_config.json`:
|
|
|
67
63
|
}
|
|
68
64
|
```
|
|
69
65
|
|
|
66
|
+
**For npx Usage:**
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"mcpServers": {
|
|
70
|
+
"ms365": {
|
|
71
|
+
"command": "npx",
|
|
72
|
+
"args": ["ms365-mcp-server"]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Start Using
|
|
79
|
+
Chat with SIYA and ask it to help with your emails! The tools are designed for natural language interaction.
|
|
80
|
+
|
|
70
81
|
## 🔐 Authentication
|
|
71
82
|
|
|
72
83
|
### Simple Setup (Recommended)
|
|
73
84
|
```bash
|
|
74
|
-
# One-command authentication
|
|
85
|
+
# One-command authentication
|
|
75
86
|
ms365-mcp-server --login
|
|
76
87
|
```
|
|
77
88
|
|
|
78
|
-
### MCP Authentication
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
### MCP Tool Authentication
|
|
90
|
+
```javascript
|
|
91
|
+
// Check authentication status
|
|
92
|
+
{
|
|
93
|
+
"tool": "authenticate",
|
|
94
|
+
"arguments": {
|
|
95
|
+
"action": "status"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
85
98
|
|
|
86
|
-
|
|
87
|
-
|
|
99
|
+
// Login with device code
|
|
100
|
+
{
|
|
101
|
+
"tool": "authenticate",
|
|
102
|
+
"arguments": {
|
|
103
|
+
"action": "login"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
88
106
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
107
|
+
// Logout
|
|
108
|
+
{
|
|
109
|
+
"tool": "authenticate",
|
|
110
|
+
"arguments": {
|
|
111
|
+
"action": "logout"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
92
114
|
```
|
|
93
115
|
|
|
94
|
-
##
|
|
116
|
+
## 💡 Tool Usage Examples
|
|
95
117
|
|
|
96
118
|
### Email Operations
|
|
97
119
|
```javascript
|
|
@@ -110,91 +132,166 @@ ms365-mcp-server --setup-auth
|
|
|
110
132
|
}
|
|
111
133
|
}
|
|
112
134
|
|
|
113
|
-
// Search emails with
|
|
135
|
+
// Search emails with smart name matching
|
|
114
136
|
{
|
|
115
|
-
"tool": "
|
|
137
|
+
"tool": "manage_email",
|
|
116
138
|
"arguments": {
|
|
117
|
-
"
|
|
139
|
+
"action": "search",
|
|
140
|
+
"from": "John Smith", // Works with names or emails
|
|
118
141
|
"after": "2024-01-01",
|
|
119
142
|
"hasAttachment": true
|
|
120
143
|
}
|
|
121
144
|
}
|
|
122
145
|
|
|
123
|
-
//
|
|
146
|
+
// List recent inbox emails
|
|
124
147
|
{
|
|
125
|
-
"tool": "
|
|
148
|
+
"tool": "manage_email",
|
|
126
149
|
"arguments": {
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
150
|
+
"action": "list",
|
|
151
|
+
"folderId": "inbox",
|
|
152
|
+
"maxResults": 10
|
|
130
153
|
}
|
|
131
154
|
}
|
|
132
155
|
|
|
133
|
-
//
|
|
156
|
+
// Find emails sent to you (TO or CC)
|
|
134
157
|
{
|
|
135
|
-
"tool": "
|
|
136
|
-
"arguments": {
|
|
158
|
+
"tool": "manage_email",
|
|
159
|
+
"arguments": {
|
|
160
|
+
"action": "search_to_me",
|
|
161
|
+
"from": "boss@company.com",
|
|
162
|
+
"isUnread": true
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Read a specific email
|
|
167
|
+
{
|
|
168
|
+
"tool": "manage_email",
|
|
169
|
+
"arguments": {
|
|
170
|
+
"action": "read",
|
|
171
|
+
"messageId": "email_id_here"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Mark email as read
|
|
176
|
+
{
|
|
177
|
+
"tool": "manage_email",
|
|
178
|
+
"arguments": {
|
|
179
|
+
"action": "mark",
|
|
180
|
+
"messageId": "email_id",
|
|
181
|
+
"isRead": true
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Move email to folder
|
|
186
|
+
{
|
|
187
|
+
"tool": "manage_email",
|
|
188
|
+
"arguments": {
|
|
189
|
+
"action": "move",
|
|
190
|
+
"messageId": "email_id",
|
|
191
|
+
"destinationFolderId": "archive"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Delete email
|
|
196
|
+
{
|
|
197
|
+
"tool": "manage_email",
|
|
198
|
+
"arguments": {
|
|
199
|
+
"action": "delete",
|
|
200
|
+
"messageId": "email_id"
|
|
201
|
+
}
|
|
137
202
|
}
|
|
138
203
|
```
|
|
139
204
|
|
|
140
|
-
###
|
|
205
|
+
### Contact & Authentication
|
|
206
|
+
```javascript
|
|
207
|
+
// List all contacts
|
|
208
|
+
{
|
|
209
|
+
"tool": "manage_contacts",
|
|
210
|
+
"arguments": {
|
|
211
|
+
"action": "list",
|
|
212
|
+
"maxResults": 100
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Search contacts by name
|
|
217
|
+
{
|
|
218
|
+
"tool": "manage_contacts",
|
|
219
|
+
"arguments": {
|
|
220
|
+
"action": "search",
|
|
221
|
+
"query": "John"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
141
224
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
225
|
+
// Get attachment from email
|
|
226
|
+
{
|
|
227
|
+
"tool": "get_attachment",
|
|
228
|
+
"arguments": {
|
|
229
|
+
"messageId": "email_id",
|
|
230
|
+
"attachmentId": "attachment_id"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
148
233
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
234
|
+
// List mailbox folders
|
|
235
|
+
{
|
|
236
|
+
"tool": "list_folders",
|
|
237
|
+
"arguments": {}
|
|
238
|
+
}
|
|
239
|
+
```
|
|
154
240
|
|
|
155
241
|
## 🎯 Command Line Options
|
|
156
242
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
|
|
243
|
+
```bash
|
|
244
|
+
# Authentication
|
|
245
|
+
ms365-mcp-server --login # Authenticate using device code
|
|
246
|
+
ms365-mcp-server --logout # Clear stored tokens
|
|
247
|
+
ms365-mcp-server --verify-login # Check authentication status
|
|
248
|
+
|
|
249
|
+
# Management
|
|
250
|
+
ms365-mcp-server --setup-auth # Interactive credential setup
|
|
251
|
+
ms365-mcp-server --reset-auth # Clear all authentication data
|
|
252
|
+
ms365-mcp-server --debug # Enable detailed logging
|
|
253
|
+
```
|
|
163
254
|
|
|
164
|
-
## 🛡️ Security
|
|
255
|
+
## 🛡️ Security & Reliability
|
|
165
256
|
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
- **Local Processing** - No data transmitted to third-party servers
|
|
257
|
+
- **🔄 Proactive Token Refresh** - Prevents authentication interruptions during long conversations
|
|
258
|
+
- **🔐 Secure Storage** - OS keychain integration with encrypted fallback
|
|
259
|
+
- **🛡️ OAuth2 Compliance** - Microsoft MSAL library with enterprise-grade security
|
|
260
|
+
- **🏠 Privacy First** - All processing happens locally, no data sent to third parties
|
|
261
|
+
- **🔒 Single-User Model** - Simplified security without account enumeration risks
|
|
172
262
|
|
|
173
263
|
## 🚨 Troubleshooting
|
|
174
264
|
|
|
175
|
-
###
|
|
176
|
-
|
|
177
|
-
**"MS365 credentials not configured"**
|
|
265
|
+
### Authentication Issues
|
|
178
266
|
```bash
|
|
267
|
+
# Check current status
|
|
268
|
+
ms365-mcp-server --verify-login
|
|
269
|
+
|
|
270
|
+
# Reset and re-authenticate
|
|
271
|
+
ms365-mcp-server --logout
|
|
179
272
|
ms365-mcp-server --login
|
|
180
273
|
```
|
|
181
274
|
|
|
182
|
-
|
|
275
|
+
### Debug Mode
|
|
183
276
|
```bash
|
|
184
|
-
|
|
185
|
-
ms365-mcp-server --
|
|
186
|
-
|
|
277
|
+
# Enable detailed logging
|
|
278
|
+
ms365-mcp-server --debug
|
|
279
|
+
|
|
280
|
+
# Logs location: /tmp/ms365-mcp-server.log
|
|
187
281
|
```
|
|
188
282
|
|
|
189
|
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
283
|
+
### Common Solutions
|
|
284
|
+
- **"Credentials not configured"** → Run `--login`
|
|
285
|
+
- **"Token expired"** → Authentication auto-refreshes, or run `--login`
|
|
286
|
+
- **Device code timeout** → Codes expire in 15 minutes, try `--login` again
|
|
192
287
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
288
|
+
## 🧠 Perfect for AI Assistants
|
|
289
|
+
|
|
290
|
+
- **📞 Natural Language Interface** - Ask SIYA to "check my emails from John today"
|
|
291
|
+
- **🤖 Smart Email Processing** - Let AI help organize, respond, and analyze emails
|
|
292
|
+
- **⚡ Optimized for LLMs** - Unified tools reduce context switching and improve performance
|
|
293
|
+
- **🔄 Reliable Sessions** - Proactive authentication prevents chat interruptions
|
|
294
|
+
- **📊 Email Analytics** - Extract insights and patterns from your email data
|
|
198
295
|
|
|
199
296
|
## 🔧 Development
|
|
200
297
|
|
|
@@ -202,20 +299,21 @@ ms365-mcp-server --debug
|
|
|
202
299
|
# Local development
|
|
203
300
|
npm run dev
|
|
204
301
|
|
|
205
|
-
# Build
|
|
302
|
+
# Build and test
|
|
206
303
|
npm run build
|
|
304
|
+
npm test
|
|
207
305
|
|
|
208
|
-
# Version management
|
|
306
|
+
# Version management
|
|
209
307
|
npm run version-bump [patch|minor|major]
|
|
210
308
|
```
|
|
211
309
|
|
|
212
|
-
##
|
|
310
|
+
## 📈 What's New in v1.1.0
|
|
213
311
|
|
|
214
|
-
-
|
|
215
|
-
-
|
|
216
|
-
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
312
|
+
- **🎯 67% Fewer Tools** - Consolidated 18 tools into 6 unified tools
|
|
313
|
+
- **🔄 Bulletproof Auth** - Proactive token refresh prevents interruptions
|
|
314
|
+
- **⚡ Better Performance** - Optimized tool architecture for faster responses
|
|
315
|
+
- **🧠 AI-Optimized** - Action-based design perfect for LLM interactions
|
|
316
|
+
- **🛡️ Enhanced Security** - Improved error handling and retry logic
|
|
219
317
|
|
|
220
318
|
## 📝 License
|
|
221
319
|
|
|
@@ -223,10 +321,10 @@ MIT License - see LICENSE file for details.
|
|
|
223
321
|
|
|
224
322
|
## 🤝 Contributing
|
|
225
323
|
|
|
226
|
-
Contributions welcome! Please
|
|
324
|
+
Contributions welcome! Please submit issues and pull requests.
|
|
227
325
|
|
|
228
326
|
---
|
|
229
327
|
|
|
230
|
-
**Built with 🔒 Security and ❤️ for the AI community**
|
|
328
|
+
**Built with 🔒 Security and ❤️ for the AI community**
|
|
231
329
|
|
|
232
|
-
*Production-ready Microsoft 365 integration for
|
|
330
|
+
*Production-ready Microsoft 365 integration for SIYA Desktop and MCP applications*
|
package/bin/cli.js
CHANGED
|
@@ -64,7 +64,7 @@ let login = false;
|
|
|
64
64
|
let logout = false;
|
|
65
65
|
let verifyLogin = false;
|
|
66
66
|
|
|
67
|
-
// Detect if we're running under an MCP context (Claude/ChatGPT/etc.)
|
|
67
|
+
// Detect if we're running under an MCP context (Claude/SIYA/ChatGPT/etc.)
|
|
68
68
|
const isMcpContext =
|
|
69
69
|
!process.stdin.isTTY ||
|
|
70
70
|
process.env.npm_execpath?.includes('npx') ||
|
|
@@ -106,7 +106,7 @@ for (let i = 0; i < args.length; i++) {
|
|
|
106
106
|
writeDebug('Verify login mode enabled');
|
|
107
107
|
} else if (arg === '--help' || arg === '-h') {
|
|
108
108
|
console.log(`
|
|
109
|
-
MS365 MCP Server - Microsoft 365 Integration for Claude Desktop
|
|
109
|
+
MS365 MCP Server - Microsoft 365 Integration for Claude/SIYA Desktop
|
|
110
110
|
|
|
111
111
|
Usage: npx ms365-mcp-server [options]
|
|
112
112
|
|