@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 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 github:usually-frustrated/ms-graph-mcp run
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 github:usually-frustrated/ms-graph-mcp permissions
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 github:usually-frustrated/ms-graph-mcp revoke
73
+ bunx --bun @frustrated/ms-graph-mcp revoke
74
74
  ```
75
75
 
76
76
  ## Documentation
package/bun.lock CHANGED
@@ -5,7 +5,7 @@
5
5
  "": {
6
6
  "name": "@frustrated/ms-graph-mcp",
7
7
  "dependencies": {
8
- "@azure/msal-node": "latest",
8
+ "@azure/msal-node": "^3.0.0",
9
9
  "@commander-js/extra-typings": "^14.0.0",
10
10
  "@microsoft/microsoft-graph-client": "^3.0.0",
11
11
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frustrated/ms-graph-mcp",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "A JSR-based TypeScript MCP package for personal Microsoft Graph access via CLI",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
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: `http://localhost:${addr.port}${REDIRECT_URI_PATH}`,
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
- const addr = server.address() as AddressInfo;
128
- const finalRedirectUri = `http://localhost:${addr.port}${REDIRECT_URI_PATH}`;
129
- const finalAuthUrl = authCodeUrl.replace(
130
- `http://localhost:0${REDIRECT_URI_PATH}`,
131
- finalRedirectUri,
132
- );
133
- console.log(
134
- `\nOpen this URL in your browser to authenticate:\n\n ${finalAuthUrl}\n`,
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) => {