entraid-mcp-server 0.2.0__tar.gz

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.
Files changed (26) hide show
  1. entraid_mcp_server-0.2.0/.gitignore +51 -0
  2. entraid_mcp_server-0.2.0/LICENSE +21 -0
  3. entraid_mcp_server-0.2.0/PKG-INFO +389 -0
  4. entraid_mcp_server-0.2.0/README.md +337 -0
  5. entraid_mcp_server-0.2.0/pyproject.toml +63 -0
  6. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/__init__.py +8 -0
  7. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/__main__.py +6 -0
  8. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/auth/__init__.py +1 -0
  9. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/auth/graph_auth.py +182 -0
  10. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/__init__.py +8 -0
  11. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/applications.py +191 -0
  12. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/audit_logs.py +92 -0
  13. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/conditional_access.py +223 -0
  14. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/groups.py +473 -0
  15. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/managed_devices.py +83 -0
  16. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/mfa.py +133 -0
  17. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/password_auth.py +104 -0
  18. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/permissions_helper.py +314 -0
  19. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/service_principals.py +187 -0
  20. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/signin_logs.py +136 -0
  21. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/resources/users.py +224 -0
  22. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/server.py +943 -0
  23. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/tools/__init__.py +1 -0
  24. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/utils/__init__.py +1 -0
  25. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/utils/graph_client.py +65 -0
  26. entraid_mcp_server-0.2.0/src/msgraph_mcp_server/utils/password_generator.py +65 -0
@@ -0,0 +1,51 @@
1
+ # Python bytecode and caches
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ # Distribution / packaging
6
+ build/
7
+ dist/
8
+ *.egg-info/
9
+ .eggs/
10
+
11
+ # Virtual environments
12
+ .venv/
13
+ venv/
14
+ env/
15
+
16
+ # IDE / Editor settings
17
+ .vscode/
18
+ .idea/
19
+ *.iml
20
+
21
+ # MacOS
22
+ .DS_Store
23
+
24
+ # Logs and coverage
25
+ *.log
26
+ htmlcov/
27
+ .coverage
28
+ .cache/
29
+
30
+ # Test & local databases
31
+ *.sqlite
32
+ *.sqlite3
33
+
34
+ # Node
35
+ node_modules/
36
+
37
+ # Secret / configuration files
38
+ *.env
39
+ config/.env
40
+ *.pem
41
+ *.key
42
+ *.pfx
43
+
44
+ # Git
45
+ *.orig
46
+
47
+ # Lock files (optional – uncomment if you don't commit lock files)
48
+ # uv.lock
49
+ # poetry.lock
50
+ # Pipenv.lock
51
+ permissions-reference.md
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 baoduy
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.
@@ -0,0 +1,389 @@
1
+ Metadata-Version: 2.4
2
+ Name: entraid-mcp-server
3
+ Version: 0.2.0
4
+ Summary: FastMCP server for Microsoft Graph / Entra ID, using Azure DefaultAzureCredential by default.
5
+ Project-URL: Homepage, https://github.com/baoduy/entraid-mcp-server
6
+ Project-URL: Repository, https://github.com/baoduy/entraid-mcp-server
7
+ Project-URL: Issues, https://github.com/baoduy/entraid-mcp-server/issues
8
+ Author: baoduy
9
+ License: MIT License
10
+
11
+ Copyright (c) 2024 baoduy
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Keywords: azure,azure-identity,entra-id,fastmcp,mcp,microsoft-graph
32
+ Classifier: Development Status :: 4 - Beta
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: Intended Audience :: System Administrators
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Operating System :: OS Independent
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3.10
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
43
+ Classifier: Topic :: System :: Systems Administration :: Authentication/Directory
44
+ Requires-Python: >=3.10
45
+ Requires-Dist: azure-core>=1.39.0
46
+ Requires-Dist: azure-identity>=1.25.3
47
+ Requires-Dist: fastmcp>=2.10.0
48
+ Requires-Dist: msgraph-core>=1.3.8
49
+ Requires-Dist: msgraph-sdk>=1.56.0
50
+ Requires-Dist: python-dotenv>=1.1.0
51
+ Description-Content-Type: text/markdown
52
+
53
+ # EntraID MCP Server (Microsoft Graph FastMCP)
54
+
55
+ This project provides a modular, resource-oriented FastMCP server for interacting with Microsoft Graph API. It is designed for extensibility, maintainability, and security, supporting advanced queries for users, sign-in logs, MFA status, and privileged users.
56
+
57
+ ## Features
58
+
59
+ - **Modular Resource Structure:**
60
+ - Each resource (users, sign-in logs, MFA, etc.) is implemented in its own module under `src/msgraph_mcp_server/resources/`.
61
+ - Easy to extend with new resources (e.g., groups, devices).
62
+ - **Centralized Graph Client:**
63
+ - Handles authentication and client initialization.
64
+ - Shared by all resource modules.
65
+ - **Comprehensive User Operations:**
66
+ - Search users by name/email.
67
+ - Get user by ID.
68
+ - List all privileged users (directory role members).
69
+ - **Full Group Lifecycle & Membership Management:**
70
+ - Create, read, update, and delete groups.
71
+ - Add/remove group members and owners.
72
+ - Search and list groups and group members.
73
+ - **Application & Service Principal Management:**
74
+ - List, create, update, and delete applications (app registrations).
75
+ - List, create, update, and delete service principals.
76
+ - View app role assignments and delegated permissions for both applications and service principals.
77
+ - **Sign-in Log Operations:**
78
+ - Query sign-in logs for a user for the last X days.
79
+ - **MFA Operations:**
80
+ - Get MFA status for a user.
81
+ - Get MFA status for all members of a group.
82
+ - **Password Management:**
83
+ - Reset user passwords directly with custom or auto-generated secure passwords.
84
+ - Option to require password change on next sign-in.
85
+ - **Permissions Helper:**
86
+ - Suggest appropriate Microsoft Graph permissions for common tasks.
87
+ - Search and explore available Graph permissions.
88
+ - Helps implement the principle of least privilege by recommending only necessary permissions.
89
+ - **Error Handling & Logging:**
90
+ - Consistent error handling and progress reporting via FastMCP context.
91
+ - Detailed logging for troubleshooting.
92
+ - **Security:**
93
+ - `.env` and secret files are excluded from version control.
94
+ - Uses Microsoft best practices for authentication.
95
+
96
+ ## Project Structure
97
+
98
+ ```
99
+ src/msgraph_mcp_server/
100
+ ├── auth/ # Authentication logic (GraphAuthManager)
101
+ ├── resources/ # Resource modules (users, signin_logs, mfa, ...)
102
+ │ ├── users.py # User operations (search, get by ID, etc.)
103
+ │ ├── signin_logs.py # Sign-in log operations
104
+ │ ├── mfa.py # MFA status operations
105
+ │ ├── permissions_helper.py # Graph permissions utilities and suggestions
106
+ │ ├── applications.py # Application (app registration) operations
107
+ │ ├── service_principals.py # Service principal operations
108
+ │ └── ... # Other resource modules
109
+ ├── utils/ # Core GraphClient and other ultilities tool, such as password generator..
110
+ ├── server.py # FastMCP server entry point (registers tools/resources)
111
+ ├── __init__.py # Package marker
112
+ ```
113
+
114
+ ## Usage
115
+
116
+ ### 1. Setup
117
+ - Clone the repo.
118
+ - **Authentication (default – use your current Azure login):**
119
+ By default the server uses
120
+ [`DefaultAzureCredential`](https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential)
121
+ from `azure-identity`. It will automatically pick up your current Azure
122
+ login context in this order: environment variables, workload identity,
123
+ managed identity, Azure CLI (`az login`), Azure Developer CLI
124
+ (`azd auth login`), Azure PowerShell, and Visual Studio / VS Code. For
125
+ local development simply run:
126
+ ```bash
127
+ az login
128
+ ```
129
+ and the server will use that token – **no tenant/client id or secret
130
+ configuration is required**.
131
+ - **Authentication (optional – explicit credentials):**
132
+ If you need to force a specific credential (for example, for CI where
133
+ no interactive login is available), create a `config/.env` file based on
134
+ [`config/.env.example`](config/.env.example). Two flows are supported:
135
+ - Client secret: set `TENANT_ID`, `CLIENT_ID`, `CLIENT_SECRET`.
136
+ - Certificate: set `TENANT_ID`, `CLIENT_ID`, `CERTIFICATE_PATH`, and
137
+ optionally `CERTIFICATE_PWD`.
138
+
139
+ The standard `AZURE_*` environment variables consumed by
140
+ `DefaultAzureCredential` (e.g. `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`,
141
+ `AZURE_CLIENT_SECRET`) are also honoured.
142
+
143
+ ### 2. Testing & Development
144
+
145
+ You can test and develop your MCP server directly using the FastMCP CLI:
146
+
147
+ ```bash
148
+ fastmcp dev '/path/to/src/msgraph_mcp_server/server.py'
149
+ ```
150
+
151
+ This launches an interactive development environment with the MCP Inspector. For more information and advanced usage, see the [FastMCP documentation](https://github.com/jlowin/fastmcp).
152
+
153
+ ### 3. Available Tools
154
+
155
+ #### User Tools
156
+ - `search_users(query, ctx, limit=10)` — Search users by name/email
157
+ - `get_user_by_id(user_id, ctx)` — Get user details by ID
158
+ - `get_privileged_users(ctx)` — List all users in privileged directory roles
159
+ - `get_user_roles(user_id, ctx)` — Get all directory roles assigned to a user
160
+ - `get_user_groups(user_id, ctx)` — Get all groups (including transitive memberships) for a user
161
+
162
+ #### Group Tools
163
+ - `get_all_groups(ctx, limit=100)` — Get all groups (with paging)
164
+ - `get_group_by_id(group_id, ctx)` — Get a specific group by its ID
165
+ - `search_groups_by_name(name, ctx, limit=50)` — Search for groups by display name
166
+ - `get_group_members(group_id, ctx, limit=100)` — Get members of a group by group ID
167
+ - `create_group(ctx, group_data)` — Create a new group (see below for group_data fields)
168
+ - `update_group(group_id, ctx, group_data)` — Update an existing group (fields: displayName, mailNickname, description, visibility)
169
+ - `delete_group(group_id, ctx)` — Delete a group by its ID
170
+ - `add_group_member(group_id, member_id, ctx)` — Add a member (user, group, device, etc.) to a group
171
+ - `remove_group_member(group_id, member_id, ctx)` — Remove a member from a group
172
+ - `add_group_owner(group_id, owner_id, ctx)` — Add an owner to a group
173
+ - `remove_group_owner(group_id, owner_id, ctx)` — Remove an owner from a group
174
+
175
+ **Group Creation/Update Example:**
176
+ - `group_data` for `create_group` and `update_group` should be a dictionary with keys such as:
177
+ - `displayName` (required for create)
178
+ - `mailNickname` (required for create)
179
+ - `description` (optional)
180
+ - `groupTypes` (optional, e.g., `["Unified"]`)
181
+ - `mailEnabled` (optional)
182
+ - `securityEnabled` (optional)
183
+ - `visibility` (optional, "Private" or "Public")
184
+ - `owners` (optional, list of user IDs)
185
+ - `members` (optional, list of IDs)
186
+ - `membershipRule` (required for dynamic groups)
187
+ - `membershipRuleProcessingState` (optional, "On" or "Paused")
188
+
189
+ See the `groups.py` docstrings for more details on supported fields and behaviors.
190
+
191
+ #### Sign-in Log Tools
192
+ - `get_user_sign_ins(user_id, ctx, days=7)` — Get sign-in logs for a user
193
+
194
+ #### MFA Tools
195
+ - `get_user_mfa_status(user_id, ctx)` — Get MFA status for a user
196
+ - `get_group_mfa_status(group_id, ctx)` — Get MFA status for all group members
197
+
198
+ #### Device Tools
199
+ - `get_all_managed_devices(filter_os=None)` — Get all managed devices (optionally filter by OS)
200
+ - `get_managed_devices_by_user(user_id)` — Get all managed devices for a specific user
201
+
202
+ #### Conditional Access Policy Tools
203
+ - `get_conditional_access_policies(ctx)` — Get all conditional access policies
204
+ - `get_conditional_access_policy_by_id(policy_id, ctx)` — Get a single conditional access policy by its ID
205
+
206
+ #### Audit Log Tools
207
+ - `get_user_audit_logs(user_id, days=30)` — Get all relevant directory audit logs for a user by user_id within the last N days
208
+
209
+ #### Password Management Tools
210
+ - `reset_user_password_direct(user_id, password=None, require_change_on_next_sign_in=True, generate_password=False, password_length=12)` — Reset a user's password with a specific password value or generate a secure random password
211
+
212
+ #### Permissions Helper Tools
213
+ - `suggest_permissions_for_task(task_category, task_name)` — Suggest Microsoft Graph permissions for a specific task based on common mappings
214
+ - `list_permission_categories_and_tasks()` — List all available categories and tasks for permission suggestions
215
+ - `get_all_graph_permissions()` — Get all Microsoft Graph permissions directly from the Microsoft Graph API
216
+ - `search_permissions(search_term, permission_type=None)` — Search for Microsoft Graph permissions by keyword
217
+
218
+ #### Application Tools
219
+ - `list_applications(ctx, limit=100)` — List all applications (app registrations) in the tenant, with paging
220
+ - `get_application_by_id(app_id, ctx)` — Get a specific application by its object ID (includes app role assignments and delegated permissions)
221
+ - `create_application(ctx, app_data)` — Create a new application (see below for app_data fields)
222
+ - `update_application(app_id, ctx, app_data)` — Update an existing application (fields: displayName, signInAudience, tags, identifierUris, web, api, requiredResourceAccess)
223
+ - `delete_application(app_id, ctx)` — Delete an application by its object ID
224
+
225
+ **Application Creation/Update Example:**
226
+ - `app_data` for `create_application` and `update_application` should be a dictionary with keys such as:
227
+ - `displayName` (required for create)
228
+ - `signInAudience` (optional)
229
+ - `tags` (optional)
230
+ - `identifierUris` (optional)
231
+ - `web` (optional)
232
+ - `api` (optional)
233
+ - `requiredResourceAccess` (optional)
234
+
235
+ #### Service Principal Tools
236
+ - `list_service_principals(ctx, limit=100)` — List all service principals in the tenant, with paging
237
+ - `get_service_principal_by_id(sp_id, ctx)` — Get a specific service principal by its object ID (includes app role assignments and delegated permissions)
238
+ - `create_service_principal(ctx, sp_data)` — Create a new service principal (see below for sp_data fields)
239
+ - `update_service_principal(sp_id, ctx, sp_data)` — Update an existing service principal (fields: displayName, accountEnabled, tags, appRoleAssignmentRequired)
240
+ - `delete_service_principal(sp_id, ctx)` — Delete a service principal by its object ID
241
+
242
+ **Service Principal Creation/Update Example:**
243
+ - `sp_data` for `create_service_principal` and `update_service_principal` should be a dictionary with keys such as:
244
+ - `appId` (required for create)
245
+ - `accountEnabled` (optional)
246
+ - `tags` (optional)
247
+ - `appRoleAssignmentRequired` (optional)
248
+ - `displayName` (optional)
249
+
250
+ #### Example Resource
251
+ - `greeting://{name}` — Returns a personalized greeting
252
+
253
+ ## Extending the Server
254
+ - Add new resource modules under `resources/` (e.g., `groups.py`, `devices.py`).
255
+ - Register new tools in `server.py` using the FastMCP `@mcp.tool()` decorator.
256
+ - Use the shared `GraphClient` for all API calls.
257
+
258
+ ## Security & Best Practices
259
+ - **Never commit secrets:** `.env` and other sensitive files are gitignored.
260
+ - **Use least privilege:** Grant only the necessary Microsoft Graph permissions to your Azure AD app.
261
+ - **Audit & monitor:** Use the logging output for troubleshooting and monitoring.
262
+
263
+ ## Required Graph API Permissions
264
+ | API / Permission | Type | Description |
265
+ |-----------------------------|-------------|-------------------------------------------|
266
+ | AuditLog.Read.All | Application | Read all audit log data |
267
+ | AuthenticationContext.Read.All | Application | Read all authentication context information |
268
+ | DeviceManagementManagedDevices.Read.All | Application | Read Microsoft Intune devices |
269
+ | Directory.Read.All | Application | Read directory data |
270
+ | Group.Read.All | Application | Read all groups |
271
+ | GroupMember.Read.All | Application | Read all group memberships |
272
+ | Group.ReadWrite.All | Application | Create, update, delete groups; manage group members and owners |
273
+ | Policy.Read.All | Application | Read your organization's policies |
274
+ | RoleManagement.Read.Directory | Application | Read all directory RBAC settings |
275
+ | User.Read.All | Application | Read all users' full profiles |
276
+ | User-PasswordProfile.ReadWrite.All | Application | Least privileged permission to update the passwordProfile property |
277
+ | UserAuthenticationMethod.Read.All | Application | Read all users' authentication methods |
278
+ | Application.ReadWrite.All | Application | Create, update, and delete applications (app registrations) and service principals |
279
+
280
+ **Note:** `Group.ReadWrite.All` is required for group creation, update, deletion, and for adding/removing group members or owners. `Group.Read.All` and `GroupMember.Read.All` are sufficient for read-only group and membership queries.
281
+
282
+ ## Advanced: Using with Claude or Cursor
283
+
284
+ ### Install from PyPI and run via `uvx`
285
+
286
+ Once the package has been published to PyPI you can run the server
287
+ directly with [`uvx`](https://docs.astral.sh/uv/) — no repo clone,
288
+ `--with` list, or file path required:
289
+
290
+ ```bash
291
+ uvx entraid-mcp-server
292
+ ```
293
+
294
+ Pin a specific version with either form:
295
+
296
+ ```bash
297
+ uvx entraid-mcp-server@0.2.0
298
+ uvx --from "entraid-mcp-server==0.2.0" entraid-mcp-server
299
+ ```
300
+
301
+ Equivalent `mcp.json` entry (Cursor / Claude Desktop):
302
+
303
+ ```json
304
+ {
305
+ "EntraID MCP Server": {
306
+ "command": "uvx",
307
+ "args": ["entraid-mcp-server"]
308
+ }
309
+ }
310
+ ```
311
+
312
+ Authentication still defaults to `DefaultAzureCredential`, so `az login`
313
+ is enough for local use; add an `env` block with `TENANT_ID` /
314
+ `CLIENT_ID` / `CLIENT_SECRET` only if you need non-interactive auth.
315
+
316
+ ### Building and publishing the package
317
+
318
+ From the repo root:
319
+
320
+ ```bash
321
+ uv build # produces dist/*.whl and dist/*.tar.gz
322
+ uvx --from ./dist/entraid_mcp_server-<version>-py3-none-any.whl \
323
+ entraid-mcp-server # local smoke test
324
+ ```
325
+
326
+ Upload to PyPI (create an API token at https://pypi.org first):
327
+
328
+ ```bash
329
+ # optional dry run against TestPyPI
330
+ uv publish --publish-url https://test.pypi.org/legacy/ --token <test-token>
331
+
332
+ # real release
333
+ uv publish --token <pypi-token>
334
+ ```
335
+
336
+ For a hands-off release flow, configure
337
+ [PyPI Trusted Publishing (OIDC)](https://docs.pypi.org/trusted-publishers/)
338
+ and add a GitHub Actions workflow that runs `uv build` + `uv publish`
339
+ on every tag push — no long-lived tokens required.
340
+
341
+ ### Using with Claude (Anthropic)
342
+ To install and run this server as a Claude MCP tool, use:
343
+
344
+ ```bash
345
+ fastmcp install '/path/to/src/msgraph_mcp_server/server.py' \
346
+ --with msgraph-sdk --with azure-identity --with azure-core --with msgraph-core \
347
+ -f /path/to/.env
348
+ ```
349
+ - Replace `/path/to/` with your actual project path.
350
+ - The `-f` flag points to your `.env` file (never commit secrets!).
351
+
352
+ ### Using with Cursor
353
+ Add the following to your `.cursor/mcp.json`. By default the server uses
354
+ your current Azure login via `DefaultAzureCredential`, so no `env` block
355
+ is required:
356
+
357
+ ```json
358
+ {
359
+ "EntraID MCP Server": {
360
+ "command": "uv",
361
+ "args": [
362
+ "run",
363
+ "--with", "azure-core",
364
+ "--with", "azure-identity",
365
+ "--with", "fastmcp",
366
+ "--with", "msgraph-core",
367
+ "--with", "msgraph-sdk",
368
+ "fastmcp",
369
+ "run",
370
+ "/path/to/src/msgraph_mcp_server/server.py"
371
+ ]
372
+ }
373
+ }
374
+ ```
375
+
376
+ If you need to force client-secret authentication instead (do **not**
377
+ commit real secrets), add an `env` block:
378
+
379
+ ```json
380
+ "env": {
381
+ "TENANT_ID": "<your-tenant-id>",
382
+ "CLIENT_ID": "<your-client-id>",
383
+ "CLIENT_SECRET": "<your-client-secret>"
384
+ }
385
+ ```
386
+
387
+ ## License
388
+
389
+ MIT