@frustrated/ms-graph-mcp 0.1.6 → 0.1.8
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 +3 -3
- package/bun.lock +1 -1
- package/package.json +1 -1
- package/src/auth.ts +18 -23
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ This will:
|
|
|
45
45
|
Once initialized, Manus agents will typically run the MCP server to interact with Microsoft Graph. The server listens for JSON requests on `stdin` and outputs JSON responses to `stdout`.
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
bunx --bun
|
|
48
|
+
bunx --bun @frustrated/ms-graph-mcp run
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
### Top-Level Tools
|
|
@@ -62,7 +62,7 @@ For detailed information on specific tools and their functionalities, refer to t
|
|
|
62
62
|
To view the currently configured Client ID, Tenant ID, and enabled/disabled tools:
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
|
-
bunx --bun
|
|
65
|
+
bunx --bun @frustrated/ms-graph-mcp permissions
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
### Revoking Access
|
|
@@ -70,7 +70,7 @@ bunx --bun github:usually-frustrated/ms-graph-mcp permissions
|
|
|
70
70
|
To revoke authentication and clear all stored tokens:
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
|
-
bunx --bun
|
|
73
|
+
bunx --bun @frustrated/ms-graph-mcp revoke
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
## Documentation
|
package/bun.lock
CHANGED
package/package.json
CHANGED
package/src/auth.ts
CHANGED
|
@@ -61,22 +61,10 @@ async function loadTokenCache(): Promise<boolean> {
|
|
|
61
61
|
|
|
62
62
|
export async function initAuth(): Promise<void> {
|
|
63
63
|
console.log("Initiating Microsoft Graph authentication...");
|
|
64
|
-
console.log(
|
|
65
|
-
"Please ensure you have registered a multi-tenant application in Azure AD with the following redirect URI: http://localhost:PORT/auth-callback",
|
|
66
|
-
);
|
|
67
64
|
|
|
68
65
|
const cryptoProvider = new CryptoProvider();
|
|
69
66
|
const pkceCodes = await cryptoProvider.generatePkceCodes();
|
|
70
67
|
|
|
71
|
-
const authCodeUrlParameters = {
|
|
72
|
-
scopes: SCOPES,
|
|
73
|
-
redirectUri: `http://localhost:0${REDIRECT_URI_PATH}`,
|
|
74
|
-
codeChallenge: pkceCodes.challenge,
|
|
75
|
-
codeChallengeMethod: "S256" as const,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const authCodeUrl = await pca.getAuthCodeUrl(authCodeUrlParameters);
|
|
79
|
-
|
|
80
68
|
return new Promise((resolve, reject) => {
|
|
81
69
|
const server = createServer(async (req, res) => {
|
|
82
70
|
if (req.url?.startsWith(REDIRECT_URI_PATH)) {
|
|
@@ -86,10 +74,11 @@ export async function initAuth(): Promise<void> {
|
|
|
86
74
|
if (code) {
|
|
87
75
|
try {
|
|
88
76
|
const addr = server.address() as AddressInfo;
|
|
77
|
+
const redirectUri = `http://localhost:${addr.port}${REDIRECT_URI_PATH}`;
|
|
89
78
|
const tokenResult = await pca.acquireTokenByCode({
|
|
90
79
|
code,
|
|
91
80
|
scopes: SCOPES,
|
|
92
|
-
redirectUri
|
|
81
|
+
redirectUri,
|
|
93
82
|
codeVerifier: pkceCodes.verifier,
|
|
94
83
|
});
|
|
95
84
|
|
|
@@ -123,16 +112,22 @@ export async function initAuth(): Promise<void> {
|
|
|
123
112
|
}
|
|
124
113
|
});
|
|
125
114
|
|
|
126
|
-
server.listen(0, () => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
115
|
+
server.listen(0, async () => {
|
|
116
|
+
try {
|
|
117
|
+
const addr = server.address() as AddressInfo;
|
|
118
|
+
const redirectUri = `http://localhost:${addr.port}${REDIRECT_URI_PATH}`;
|
|
119
|
+
const authCodeUrl = await pca.getAuthCodeUrl({
|
|
120
|
+
scopes: SCOPES,
|
|
121
|
+
redirectUri,
|
|
122
|
+
codeChallenge: pkceCodes.challenge,
|
|
123
|
+
codeChallengeMethod: "S256" as const,
|
|
124
|
+
});
|
|
125
|
+
console.log(
|
|
126
|
+
`\nOpen this URL in your browser to authenticate:\n\n ${authCodeUrl}\n`,
|
|
127
|
+
);
|
|
128
|
+
} catch (err) {
|
|
129
|
+
server.close(() => reject(err));
|
|
130
|
+
}
|
|
136
131
|
});
|
|
137
132
|
|
|
138
133
|
server.on("error", (err) => {
|