m365connector 0.3.6 → 0.3.7
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 +29 -103
- package/package.json +4 -3
- package/src/browser-session.js +619 -0
- package/src/index.js +31 -14
- package/src/lib/content-reader.js +2746 -0
- package/src/lib/search-api.js +989 -0
- package/src/lib/vendor/jszip.min.js +13 -0
- package/src/token-providers.js +739 -0
- package/src/tools/search.js +17 -66
- package/src/ws-server.js +0 -203
package/README.md
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
# m365connector
|
|
2
2
|
|
|
3
|
-
MCP server that lets AI agents search and read
|
|
3
|
+
MCP server that lets AI agents search and read Microsoft 365 data through a local Edge browser profile and Chrome DevTools Protocol (CDP). No browser extension is required at runtime.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## How it works
|
|
5
|
+
## How It Works
|
|
8
6
|
|
|
9
7
|
```
|
|
10
|
-
MCP Client m365connector
|
|
11
|
-
(Claude Code) (this package) (
|
|
8
|
+
MCP Client m365connector Microsoft Edge
|
|
9
|
+
(Claude Code) (this package) (user profile + CDP)
|
|
12
10
|
|
|
13
|
-
HTTP :52366
|
|
14
|
-
───────────►
|
|
15
|
-
Streamable HTTP
|
|
16
|
-
transport
|
|
11
|
+
HTTP :52366 CDP :52367
|
|
12
|
+
───────────► ─────────────────►
|
|
13
|
+
Streamable HTTP Captures M365 tokens,
|
|
14
|
+
transport opens Office/OWA pages
|
|
17
15
|
```
|
|
18
16
|
|
|
19
|
-
The
|
|
17
|
+
The server starts or connects to Edge with a persistent user profile. It captures Substrate tokens from M365 pages for search. Graph tokens are acquired from Graph Explorer by opening `developer.microsoft.com/en-us/graph/graph-explorer` and, if needed, `tryit.graphexplorer.microsoft.com`, then selecting a valid `https://graph.microsoft.com` access token rendered by the page.
|
|
20
18
|
|
|
21
19
|
## Prerequisites
|
|
22
20
|
|
|
23
21
|
- Node.js 18+
|
|
24
|
-
-
|
|
25
|
-
- An M365
|
|
22
|
+
- Microsoft Edge
|
|
23
|
+
- An M365 work or school account signed in within the configured Edge profile
|
|
26
24
|
|
|
27
|
-
## Quick
|
|
25
|
+
## Quick Start
|
|
28
26
|
|
|
29
27
|
```bash
|
|
30
28
|
npx m365connector
|
|
@@ -32,12 +30,11 @@ npx m365connector
|
|
|
32
30
|
|
|
33
31
|
You should see:
|
|
34
32
|
|
|
35
|
-
```
|
|
36
|
-
[m365connector/ws] listening on ws://127.0.0.1:52365
|
|
33
|
+
```text
|
|
37
34
|
[m365connector] MCP HTTP listening on http://127.0.0.1:52366/mcp
|
|
38
35
|
```
|
|
39
36
|
|
|
40
|
-
Then add to your MCP client config
|
|
37
|
+
Then add to your MCP client config:
|
|
41
38
|
|
|
42
39
|
```json
|
|
43
40
|
{
|
|
@@ -50,99 +47,28 @@ Then add to your MCP client config (e.g. `~/.claude/mcp.json`):
|
|
|
50
47
|
}
|
|
51
48
|
```
|
|
52
49
|
|
|
53
|
-
##
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npm install -g m365connector
|
|
57
|
-
m365connector
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Environment variables
|
|
50
|
+
## Environment Variables
|
|
61
51
|
|
|
62
52
|
| Variable | Default | Description |
|
|
63
53
|
|----------|---------|-------------|
|
|
64
54
|
| `M365C_MCP_PORT` | 52366 | HTTP port for MCP clients |
|
|
65
|
-
| `
|
|
55
|
+
| `M365C_EDGE_DEBUG_PORT` | 52367 | Edge CDP port |
|
|
56
|
+
| `M365C_EDGE_PATH` | auto-detected | Microsoft Edge executable path |
|
|
57
|
+
| `M365C_EDGE_USER_DATA_DIR` | phantomwright `ud-m365` profile when present, else `~/.m365connector/edge-profile` | Persistent Edge user data directory |
|
|
58
|
+
| `M365C_EDGE_PROFILE_DIRECTORY` | `Default` | Edge profile directory inside the user data dir |
|
|
59
|
+
| `M365C_TOKEN_CACHE_PATH` | `~/.m365connector/token-cache.json` | Local token cache path; stores only current unexpired captured tokens |
|
|
66
60
|
|
|
67
61
|
## Tools
|
|
68
62
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|-----------|------|----------|---------|-------------|
|
|
75
|
-
| query | string | yes | | Search query |
|
|
76
|
-
| conversation_id | string | yes | | Conversation identifier for grouping requests |
|
|
77
|
-
| source | string | no | `"all"` | `all`, `email`, `files`, `chat`, `events`, `external` |
|
|
78
|
-
| connector | string | no | | External connector name (when source=`external`) |
|
|
79
|
-
| size | integer | no | 10 | Results per page (1--25) |
|
|
80
|
-
| from | integer | no | 0 | Pagination offset |
|
|
81
|
-
|
|
82
|
-
### open
|
|
83
|
-
|
|
84
|
-
Read the content of a search result.
|
|
85
|
-
|
|
86
|
-
| Parameter | Type | Required | Description |
|
|
87
|
-
|-----------|------|----------|-------------|
|
|
88
|
-
| read_handle | string | yes | Opaque handle from a search result's `_readHandle` field |
|
|
89
|
-
| conversation_id | string | yes | Conversation identifier |
|
|
90
|
-
|
|
91
|
-
Returns content with a `completeness` field: `full`, `partial`, or `snippet`.
|
|
92
|
-
|
|
93
|
-
### whoami
|
|
94
|
-
|
|
95
|
-
Get the current signed-in user's basic profile from Graph.
|
|
96
|
-
When directory scopes are available, response also includes best-effort `manager`, `directReports`, and `directReportsCount` info.
|
|
97
|
-
|
|
98
|
-
| Parameter | Type | Required | Default | Description |
|
|
99
|
-
|-----------|------|----------|---------|-------------|
|
|
100
|
-
| conversation_id | string | yes | | Conversation identifier |
|
|
101
|
-
| direct_reports_size | integer | no | 30 | Maximum number of direct reports to return (1--100) |
|
|
102
|
-
|
|
103
|
-
### find_people
|
|
104
|
-
|
|
105
|
-
Find people via Graph directory query using free-text and structured filters.
|
|
106
|
-
|
|
107
|
-
| Parameter | Type | Required | Default | Description |
|
|
108
|
-
|-----------|------|----------|---------|-------------|
|
|
109
|
-
| conversation_id | string | yes | | Conversation identifier |
|
|
110
|
-
| query | string | no | | Free-text query matched across person fields |
|
|
111
|
-
| alias | string | no | | Filter by alias (`mailNickname`) |
|
|
112
|
-
| principalName | string | no | | Filter by user principal name |
|
|
113
|
-
| displayName | string | no | | Filter by display name |
|
|
114
|
-
| department | string | no | | Filter by department (prefix match) |
|
|
115
|
-
| office | string | no | | Filter by office location (prefix match) |
|
|
116
|
-
| title | string | no | | Filter by job title (prefix match) |
|
|
117
|
-
| size | integer | no | 20 | Maximum people to return (1--50) |
|
|
118
|
-
| include_direct_reports | boolean | no | false | Include direct reports for each result |
|
|
119
|
-
| direct_reports_size | integer | no | 30 | Maximum direct reports per result (1--100) |
|
|
120
|
-
|
|
121
|
-
At least one of `query`, `alias`, `principalName`, `displayName`, `department`, `office`, or `title` is required.
|
|
122
|
-
|
|
123
|
-
### count_people
|
|
124
|
-
|
|
125
|
-
Count people matching Graph directory filters without returning the full result list.
|
|
126
|
-
|
|
127
|
-
| Parameter | Type | Required | Default | Description |
|
|
128
|
-
|-----------|------|----------|---------|-------------|
|
|
129
|
-
| conversation_id | string | yes | | Conversation identifier |
|
|
130
|
-
| query | string | no | | Free-text query matched across person fields |
|
|
131
|
-
| alias | string | no | | Filter by alias (`mailNickname`) |
|
|
132
|
-
| principalName | string | no | | Filter by user principal name |
|
|
133
|
-
| displayName | string | no | | Filter by display name |
|
|
134
|
-
| department | string | no | | Filter by department (prefix match) |
|
|
135
|
-
| office | string | no | | Filter by office location (prefix match) |
|
|
136
|
-
| title | string | no | | Filter by job title (prefix match) |
|
|
137
|
-
|
|
138
|
-
At least one of `query`, `alias`, `principalName`, `displayName`, `department`, `office`, or `title` is required.
|
|
63
|
+
- `search`: Search emails, files, Teams chats, calendar events, and external connectors through Substrate.
|
|
64
|
+
- `open`: Read a search result. Office files and protected email can fall back to Edge-driven Office Online or OWA extraction.
|
|
65
|
+
- `whoami`: Read current user profile from Microsoft Graph.
|
|
66
|
+
- `find_people`: Find directory users with Graph filters.
|
|
67
|
+
- `count_people`: Count directory users with Graph filters.
|
|
139
68
|
|
|
140
69
|
## Security
|
|
141
70
|
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
- Read handles are server-issued opaque UUIDs with 30-minute TTL
|
|
145
|
-
|
|
146
|
-
## License
|
|
147
|
-
|
|
148
|
-
MIT
|
|
71
|
+
- The MCP server binds to `127.0.0.1`.
|
|
72
|
+
- The Edge CDP port is local-only and uses the configured local user profile.
|
|
73
|
+
- Read handles are server-issued opaque UUIDs with 30-minute TTL.
|
|
74
|
+
- Access tokens are kept in server memory, cached locally with `0600` permissions, and are not printed.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "m365connector",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "MCP server for
|
|
3
|
+
"version": "0.3.7",
|
|
4
|
+
"description": "MCP server for Microsoft 365 data via Edge CDP",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"src"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"start": "node src/index.js"
|
|
15
|
+
"start": "node src/index.js",
|
|
16
|
+
"test": "node --test"
|
|
16
17
|
},
|
|
17
18
|
"keywords": [
|
|
18
19
|
"mcp",
|