@masonator/m365-mcp 0.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/LICENSE +21 -0
- package/README.md +143 -0
- package/dist/__tests__/auth.test.d.ts +1 -0
- package/dist/__tests__/auth.test.js +598 -0
- package/dist/__tests__/graph.test.d.ts +1 -0
- package/dist/__tests__/graph.test.js +161 -0
- package/dist/__tests__/tools/auth-status.test.d.ts +1 -0
- package/dist/__tests__/tools/auth-status.test.js +179 -0
- package/dist/__tests__/tools/calendar.test.d.ts +1 -0
- package/dist/__tests__/tools/calendar.test.js +154 -0
- package/dist/__tests__/tools/chat.test.d.ts +1 -0
- package/dist/__tests__/tools/chat.test.js +162 -0
- package/dist/__tests__/tools/files.test.d.ts +1 -0
- package/dist/__tests__/tools/files.test.js +143 -0
- package/dist/__tests__/tools/mail.test.d.ts +1 -0
- package/dist/__tests__/tools/mail.test.js +169 -0
- package/dist/__tests__/tools/profile.test.d.ts +1 -0
- package/dist/__tests__/tools/profile.test.js +54 -0
- package/dist/__tests__/tools/transcripts.test.d.ts +1 -0
- package/dist/__tests__/tools/transcripts.test.js +468 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +90 -0
- package/dist/lib/auth.d.ts +75 -0
- package/dist/lib/auth.js +333 -0
- package/dist/lib/graph.d.ts +20 -0
- package/dist/lib/graph.js +53 -0
- package/dist/lib/tools/auth-status.d.ts +15 -0
- package/dist/lib/tools/auth-status.js +90 -0
- package/dist/lib/tools/calendar.d.ts +30 -0
- package/dist/lib/tools/calendar.js +117 -0
- package/dist/lib/tools/chat.d.ts +25 -0
- package/dist/lib/tools/chat.js +79 -0
- package/dist/lib/tools/files.d.ts +34 -0
- package/dist/lib/tools/files.js +71 -0
- package/dist/lib/tools/mail.d.ts +25 -0
- package/dist/lib/tools/mail.js +58 -0
- package/dist/lib/tools/profile.d.ts +13 -0
- package/dist/lib/tools/profile.js +27 -0
- package/dist/lib/tools/transcripts.d.ts +51 -0
- package/dist/lib/tools/transcripts.js +244 -0
- package/dist/types/tokens.d.ts +11 -0
- package/dist/types/tokens.js +1 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Stu Mason
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# M365 MCP
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@masonator/m365-mcp)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://nodejs.org)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://github.com/StuMason/m365-mcp/actions/workflows/ci.yml)
|
|
8
|
+
|
|
9
|
+
MCP server for Microsoft 365 via the Microsoft Graph API. Read-only access to your profile, calendar, email, Teams chats, OneDrive files, and meeting transcripts from any MCP client.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
### Claude Code
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
claude mcp add m365-mcp -e MS365_MCP_CLIENT_ID=your-client-id -e MS365_MCP_CLIENT_SECRET=your-secret -e MS365_MCP_TENANT_ID=your-tenant-id -- npx -y @masonator/m365-mcp
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Claude Desktop
|
|
20
|
+
|
|
21
|
+
Add to your Claude Desktop config (`claude_desktop_config.json`):
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"m365-mcp": {
|
|
27
|
+
"command": "npx",
|
|
28
|
+
"args": ["-y", "@masonator/m365-mcp"],
|
|
29
|
+
"env": {
|
|
30
|
+
"MS365_MCP_CLIENT_ID": "your-azure-ad-client-id",
|
|
31
|
+
"MS365_MCP_CLIENT_SECRET": "your-azure-ad-client-secret",
|
|
32
|
+
"MS365_MCP_TENANT_ID": "your-azure-ad-tenant-id"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### First Run
|
|
40
|
+
|
|
41
|
+
On first use, the server opens your browser to sign in with Microsoft. After granting consent, tokens are stored locally at `~/.config/m365-mcp/tokens.json` (permissions `600`) and refreshed automatically.
|
|
42
|
+
|
|
43
|
+
## Environment Variables
|
|
44
|
+
|
|
45
|
+
| Variable | Required | Description |
|
|
46
|
+
| ------------------------- | -------- | ------------------------------------------------ |
|
|
47
|
+
| `MS365_MCP_CLIENT_ID` | Yes | Azure AD application (client) ID |
|
|
48
|
+
| `MS365_MCP_CLIENT_SECRET` | Yes | Azure AD client secret |
|
|
49
|
+
| `MS365_MCP_TENANT_ID` | Yes | Azure AD tenant ID |
|
|
50
|
+
| `MS365_MCP_TIMEZONE` | No | Timezone for calendar (default: system timezone) |
|
|
51
|
+
|
|
52
|
+
## Azure AD Setup
|
|
53
|
+
|
|
54
|
+
Register an application in Azure AD with these settings:
|
|
55
|
+
|
|
56
|
+
1. **App registration** > New registration
|
|
57
|
+
2. **Redirect URI**: `http://localhost` (Web platform) — the server uses a dynamic port
|
|
58
|
+
3. **Certificates & secrets** > New client secret
|
|
59
|
+
4. **API permissions** > Add the following **delegated** permissions:
|
|
60
|
+
- `User.Read`
|
|
61
|
+
- `Calendars.Read`
|
|
62
|
+
- `Mail.Read`
|
|
63
|
+
- `Chat.Read`
|
|
64
|
+
- `Files.Read`
|
|
65
|
+
- `OnlineMeetingTranscript.Read.All`
|
|
66
|
+
- `Sites.Read.All`
|
|
67
|
+
|
|
68
|
+
## Tools
|
|
69
|
+
|
|
70
|
+
### `ms_auth_status`
|
|
71
|
+
|
|
72
|
+
Check connection status. If not connected, opens browser to sign in.
|
|
73
|
+
|
|
74
|
+
### `ms_profile`
|
|
75
|
+
|
|
76
|
+
Fetch your Microsoft 365 profile — display name, email, job title, office location.
|
|
77
|
+
|
|
78
|
+
### `ms_calendar`
|
|
79
|
+
|
|
80
|
+
Fetch calendar events. Defaults to today.
|
|
81
|
+
|
|
82
|
+
| Parameter | Description |
|
|
83
|
+
| --------- | -------------------------- |
|
|
84
|
+
| `date` | Specific date (YYYY-MM-DD) |
|
|
85
|
+
| `start` | Start of range (ISO 8601) |
|
|
86
|
+
| `end` | End of range (ISO 8601) |
|
|
87
|
+
|
|
88
|
+
### `ms_mail`
|
|
89
|
+
|
|
90
|
+
Read recent emails with optional keyword search.
|
|
91
|
+
|
|
92
|
+
| Parameter | Description |
|
|
93
|
+
| --------- | ----------------------------------- |
|
|
94
|
+
| `search` | Keyword to filter emails |
|
|
95
|
+
| `count` | Number of emails (1-25, default 10) |
|
|
96
|
+
|
|
97
|
+
### `ms_chat`
|
|
98
|
+
|
|
99
|
+
Read Teams chats. Without `chat_id` lists recent chats; with `chat_id` returns messages from that thread.
|
|
100
|
+
|
|
101
|
+
| Parameter | Description |
|
|
102
|
+
| --------- | ---------------------------------- |
|
|
103
|
+
| `chat_id` | Specific chat thread ID |
|
|
104
|
+
| `count` | Number of items (1-25, default 10) |
|
|
105
|
+
|
|
106
|
+
### `ms_files`
|
|
107
|
+
|
|
108
|
+
Browse or search OneDrive files.
|
|
109
|
+
|
|
110
|
+
| Parameter | Description |
|
|
111
|
+
| --------- | -------------------------------- |
|
|
112
|
+
| `path` | Folder path (e.g., `/Documents`) |
|
|
113
|
+
| `search` | Search across OneDrive |
|
|
114
|
+
| `count` | Max items (1-50, default 20) |
|
|
115
|
+
|
|
116
|
+
### `ms_transcripts`
|
|
117
|
+
|
|
118
|
+
Fetch Teams meeting transcripts. Returns previews (~3000 chars) with a `transcript_id` for drill-down to the full transcript.
|
|
119
|
+
|
|
120
|
+
| Parameter | Description |
|
|
121
|
+
| --------------- | --------------------------------------------- |
|
|
122
|
+
| `date` | Date (YYYY-MM-DD) |
|
|
123
|
+
| `start` | Start of range (ISO 8601) |
|
|
124
|
+
| `end` | End of range (ISO 8601) |
|
|
125
|
+
| `transcript_id` | ID from a previous list call for full content |
|
|
126
|
+
|
|
127
|
+
## Development
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
git clone https://github.com/StuMason/m365-mcp.git
|
|
131
|
+
cd m365-mcp
|
|
132
|
+
npm install
|
|
133
|
+
npm run build
|
|
134
|
+
npm test
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Contributing
|
|
138
|
+
|
|
139
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
[MIT](LICENSE) - Stu Mason
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|