entraid-mcp-server 0.0.1__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.0.1/.gitignore +51 -0
  2. entraid_mcp_server-0.0.1/LICENSE +21 -0
  3. entraid_mcp_server-0.0.1/PKG-INFO +403 -0
  4. entraid_mcp_server-0.0.1/README.md +350 -0
  5. entraid_mcp_server-0.0.1/pyproject.toml +64 -0
  6. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/__init__.py +8 -0
  7. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/__main__.py +6 -0
  8. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/auth/__init__.py +1 -0
  9. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/auth/graph_auth.py +209 -0
  10. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/__init__.py +8 -0
  11. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/applications.py +191 -0
  12. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/audit_logs.py +92 -0
  13. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/conditional_access.py +223 -0
  14. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/groups.py +473 -0
  15. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/managed_devices.py +414 -0
  16. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/mfa.py +133 -0
  17. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/password_auth.py +104 -0
  18. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/permissions_helper.py +314 -0
  19. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/service_principals.py +187 -0
  20. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/signin_logs.py +136 -0
  21. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/resources/users.py +224 -0
  22. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/server.py +1043 -0
  23. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/tools/__init__.py +1 -0
  24. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/utils/__init__.py +1 -0
  25. entraid_mcp_server-0.0.1/src/msgraph_mcp_server/utils/graph_client.py +83 -0
  26. entraid_mcp_server-0.0.1/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,403 @@
1
+ Metadata-Version: 2.4
2
+ Name: entraid-mcp-server
3
+ Version: 0.0.1
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-beta-sdk>=1.58.0
49
+ Requires-Dist: msgraph-core>=1.3.8
50
+ Requires-Dist: msgraph-sdk>=1.56.0
51
+ Requires-Dist: python-dotenv>=1.1.0
52
+ Description-Content-Type: text/markdown
53
+
54
+ # EntraID MCP Server (Microsoft Graph FastMCP)
55
+
56
+ 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.
57
+
58
+ ## Features
59
+
60
+ - **Modular Resource Structure:**
61
+ - Each resource (users, sign-in logs, MFA, etc.) is implemented in its own module under `src/msgraph_mcp_server/resources/`.
62
+ - Easy to extend with new resources (e.g., groups, devices).
63
+ - **Centralized Graph Client:**
64
+ - Handles authentication and client initialization.
65
+ - Shared by all resource modules.
66
+ - **Comprehensive User Operations:**
67
+ - Search users by name/email.
68
+ - Get user by ID.
69
+ - List all privileged users (directory role members).
70
+ - **Full Group Lifecycle & Membership Management:**
71
+ - Create, read, update, and delete groups.
72
+ - Add/remove group members and owners.
73
+ - Search and list groups and group members.
74
+ - **Application & Service Principal Management:**
75
+ - List, create, update, and delete applications (app registrations).
76
+ - List, create, update, and delete service principals.
77
+ - View app role assignments and delegated permissions for both applications and service principals.
78
+ - **Sign-in Log Operations:**
79
+ - Query sign-in logs for a user for the last X days.
80
+ - **MFA Operations:**
81
+ - Get MFA status for a user.
82
+ - Get MFA status for all members of a group.
83
+ - **Password Management:**
84
+ - Reset user passwords directly with custom or auto-generated secure passwords.
85
+ - Option to require password change on next sign-in.
86
+ - **Permissions Helper:**
87
+ - Suggest appropriate Microsoft Graph permissions for common tasks.
88
+ - Search and explore available Graph permissions.
89
+ - Helps implement the principle of least privilege by recommending only necessary permissions.
90
+ - **Error Handling & Logging:**
91
+ - Consistent error handling and progress reporting via FastMCP context.
92
+ - Detailed logging for troubleshooting.
93
+ - **Security:**
94
+ - `.env` and secret files are excluded from version control.
95
+ - Uses Microsoft best practices for authentication.
96
+
97
+ ## Project Structure
98
+
99
+ ```
100
+ src/msgraph_mcp_server/
101
+ ├── auth/ # Authentication logic (GraphAuthManager)
102
+ ├── resources/ # Resource modules (users, signin_logs, mfa, ...)
103
+ │ ├── users.py # User operations (search, get by ID, etc.)
104
+ │ ├── signin_logs.py # Sign-in log operations
105
+ │ ├── mfa.py # MFA status operations
106
+ │ ├── permissions_helper.py # Graph permissions utilities and suggestions
107
+ │ ├── applications.py # Application (app registration) operations
108
+ │ ├── service_principals.py # Service principal operations
109
+ │ └── ... # Other resource modules
110
+ ├── utils/ # Core GraphClient and other ultilities tool, such as password generator..
111
+ ├── server.py # FastMCP server entry point (registers tools/resources)
112
+ ├── __init__.py # Package marker
113
+ ```
114
+
115
+ ## Usage
116
+
117
+ ### 1. Setup
118
+ - Clone the repo.
119
+ - **Authentication (default – use your current Azure login):**
120
+ By default the server uses
121
+ [`DefaultAzureCredential`](https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential)
122
+ from `azure-identity`. It will automatically pick up your current Azure
123
+ login context in this order: environment variables, workload identity,
124
+ managed identity, Azure CLI (`az login`), Azure Developer CLI
125
+ (`azd auth login`), Azure PowerShell, and Visual Studio / VS Code. For
126
+ local development simply run:
127
+ ```bash
128
+ az login
129
+ ```
130
+ and the server will use that token – **no tenant/client id or secret
131
+ configuration is required**.
132
+ - **Authentication (optional – explicit credentials):**
133
+ If you need to force a specific credential (for example, for CI where
134
+ no interactive login is available), create a `config/.env` file based on
135
+ [`config/.env.example`](config/.env.example). Two flows are supported:
136
+ - Client secret: set `TENANT_ID`, `CLIENT_ID`, `CLIENT_SECRET`.
137
+ - Certificate: set `TENANT_ID`, `CLIENT_ID`, `CERTIFICATE_PATH`, and
138
+ optionally `CERTIFICATE_PWD`.
139
+
140
+ The standard `AZURE_*` environment variables consumed by
141
+ `DefaultAzureCredential` (e.g. `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`,
142
+ `AZURE_CLIENT_SECRET`) are also honoured.
143
+
144
+ ### 2. Testing & Development
145
+
146
+ You can test and develop your MCP server directly using the FastMCP CLI:
147
+
148
+ ```bash
149
+ fastmcp dev '/path/to/src/msgraph_mcp_server/server.py'
150
+ ```
151
+
152
+ 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).
153
+
154
+ ### 3. Available Tools
155
+
156
+ #### User Tools
157
+ - `search_users(query, ctx, limit=10)` — Search users by name/email
158
+ - `get_user_by_id(user_id, ctx)` — Get user details by ID
159
+ - `get_privileged_users(ctx)` — List all users in privileged directory roles
160
+ - `get_user_roles(user_id, ctx)` — Get all directory roles assigned to a user
161
+ - `get_user_groups(user_id, ctx)` — Get all groups (including transitive memberships) for a user
162
+
163
+ #### Group Tools
164
+ - `get_all_groups(ctx, limit=100)` — Get all groups (with paging)
165
+ - `get_group_by_id(group_id, ctx)` — Get a specific group by its ID
166
+ - `search_groups_by_name(name, ctx, limit=50)` — Search for groups by display name
167
+ - `get_group_members(group_id, ctx, limit=100)` — Get members of a group by group ID
168
+ - `create_group(ctx, group_data)` — Create a new group (see below for group_data fields)
169
+ - `update_group(group_id, ctx, group_data)` — Update an existing group (fields: displayName, mailNickname, description, visibility)
170
+ - `delete_group(group_id, ctx)` — Delete a group by its ID
171
+ - `add_group_member(group_id, member_id, ctx)` — Add a member (user, group, device, etc.) to a group
172
+ - `remove_group_member(group_id, member_id, ctx)` — Remove a member from a group
173
+ - `add_group_owner(group_id, owner_id, ctx)` — Add an owner to a group
174
+ - `remove_group_owner(group_id, owner_id, ctx)` — Remove an owner from a group
175
+
176
+ **Group Creation/Update Example:**
177
+ - `group_data` for `create_group` and `update_group` should be a dictionary with keys such as:
178
+ - `displayName` (required for create)
179
+ - `mailNickname` (required for create)
180
+ - `description` (optional)
181
+ - `groupTypes` (optional, e.g., `["Unified"]`)
182
+ - `mailEnabled` (optional)
183
+ - `securityEnabled` (optional)
184
+ - `visibility` (optional, "Private" or "Public")
185
+ - `owners` (optional, list of user IDs)
186
+ - `members` (optional, list of IDs)
187
+ - `membershipRule` (required for dynamic groups)
188
+ - `membershipRuleProcessingState` (optional, "On" or "Paused")
189
+
190
+ See the `groups.py` docstrings for more details on supported fields and behaviors.
191
+
192
+ #### Sign-in Log Tools
193
+ - `get_user_sign_ins(user_id, ctx, days=7)` — Get sign-in logs for a user
194
+
195
+ #### MFA Tools
196
+ - `get_user_mfa_status(user_id, ctx)` — Get MFA status for a user
197
+ - `get_group_mfa_status(group_id, ctx)` — Get MFA status for all group members
198
+
199
+ #### Device Tools (Intune – beta endpoint)
200
+ These tools query Microsoft Intune via the **Microsoft Graph beta** endpoint
201
+ (`https://graph.microsoft.com/beta`) using `msgraph-beta-sdk`, which exposes
202
+ Intune properties and relationships not yet available on the v1.0 endpoint.
203
+
204
+ - `get_all_managed_devices(filter_os=None)` — Get all managed devices (optionally filter by OS)
205
+ - `get_managed_devices_by_user(user_id)` — Get all managed devices for a specific user
206
+ - `get_managed_device_by_id(device_id)` — Get full details (hardware, compliance, enrollment) of a single managed device
207
+ - `get_detected_apps_for_device(device_id)` — List applications detected on a managed device
208
+ - `get_device_compliance_policy_states(device_id)` — Compliance-policy states for a managed device
209
+ - `get_device_configuration_states(device_id)` — Configuration-profile states for a managed device
210
+ - `get_device_compliance_policies()` — List all Intune device compliance policies
211
+ - `get_device_configurations()` — List all Intune device configuration profiles
212
+ - `get_device_categories()` — List all Intune device categories
213
+
214
+ #### Conditional Access Policy Tools
215
+ - `get_conditional_access_policies(ctx)` — Get all conditional access policies
216
+ - `get_conditional_access_policy_by_id(policy_id, ctx)` — Get a single conditional access policy by its ID
217
+
218
+ #### Audit Log Tools
219
+ - `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
220
+
221
+ #### Password Management Tools
222
+ - `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
223
+
224
+ #### Permissions Helper Tools
225
+ - `suggest_permissions_for_task(task_category, task_name)` — Suggest Microsoft Graph permissions for a specific task based on common mappings
226
+ - `list_permission_categories_and_tasks()` — List all available categories and tasks for permission suggestions
227
+ - `get_all_graph_permissions()` — Get all Microsoft Graph permissions directly from the Microsoft Graph API
228
+ - `search_permissions(search_term, permission_type=None)` — Search for Microsoft Graph permissions by keyword
229
+
230
+ #### Application Tools
231
+ - `list_applications(ctx, limit=100)` — List all applications (app registrations) in the tenant, with paging
232
+ - `get_application_by_id(app_id, ctx)` — Get a specific application by its object ID (includes app role assignments and delegated permissions)
233
+ - `create_application(ctx, app_data)` — Create a new application (see below for app_data fields)
234
+ - `update_application(app_id, ctx, app_data)` — Update an existing application (fields: displayName, signInAudience, tags, identifierUris, web, api, requiredResourceAccess)
235
+ - `delete_application(app_id, ctx)` — Delete an application by its object ID
236
+
237
+ **Application Creation/Update Example:**
238
+ - `app_data` for `create_application` and `update_application` should be a dictionary with keys such as:
239
+ - `displayName` (required for create)
240
+ - `signInAudience` (optional)
241
+ - `tags` (optional)
242
+ - `identifierUris` (optional)
243
+ - `web` (optional)
244
+ - `api` (optional)
245
+ - `requiredResourceAccess` (optional)
246
+
247
+ #### Service Principal Tools
248
+ - `list_service_principals(ctx, limit=100)` — List all service principals in the tenant, with paging
249
+ - `get_service_principal_by_id(sp_id, ctx)` — Get a specific service principal by its object ID (includes app role assignments and delegated permissions)
250
+ - `create_service_principal(ctx, sp_data)` — Create a new service principal (see below for sp_data fields)
251
+ - `update_service_principal(sp_id, ctx, sp_data)` — Update an existing service principal (fields: displayName, accountEnabled, tags, appRoleAssignmentRequired)
252
+ - `delete_service_principal(sp_id, ctx)` — Delete a service principal by its object ID
253
+
254
+ **Service Principal Creation/Update Example:**
255
+ - `sp_data` for `create_service_principal` and `update_service_principal` should be a dictionary with keys such as:
256
+ - `appId` (required for create)
257
+ - `accountEnabled` (optional)
258
+ - `tags` (optional)
259
+ - `appRoleAssignmentRequired` (optional)
260
+ - `displayName` (optional)
261
+
262
+ #### Example Resource
263
+ - `greeting://{name}` — Returns a personalized greeting
264
+
265
+ ## Extending the Server
266
+ - Add new resource modules under `resources/` (e.g., `groups.py`, `devices.py`).
267
+ - Register new tools in `server.py` using the FastMCP `@mcp.tool()` decorator.
268
+ - Use the shared `GraphClient` for all API calls.
269
+
270
+ ## Security & Best Practices
271
+ - **Never commit secrets:** `.env` and other sensitive files are gitignored.
272
+ - **Use least privilege:** Grant only the necessary Microsoft Graph permissions to your Azure AD app.
273
+ - **Audit & monitor:** Use the logging output for troubleshooting and monitoring.
274
+
275
+ ## Required Graph API Permissions
276
+ | API / Permission | Type | Description |
277
+ |-----------------------------|-------------|-------------------------------------------|
278
+ | AuditLog.Read.All | Application | Read all audit log data |
279
+ | AuthenticationContext.Read.All | Application | Read all authentication context information |
280
+ | DeviceManagementManagedDevices.Read.All | Application | Read Microsoft Intune devices |
281
+ | DeviceManagementConfiguration.Read.All | Application | Read Microsoft Intune device configuration and policies |
282
+ | DeviceManagementApps.Read.All | Application | Read Microsoft Intune apps (detected apps on devices) |
283
+ | Directory.Read.All | Application | Read directory data |
284
+ | Group.Read.All | Application | Read all groups |
285
+ | GroupMember.Read.All | Application | Read all group memberships |
286
+ | Group.ReadWrite.All | Application | Create, update, delete groups; manage group members and owners |
287
+ | Policy.Read.All | Application | Read your organization's policies |
288
+ | RoleManagement.Read.Directory | Application | Read all directory RBAC settings |
289
+ | User.Read.All | Application | Read all users' full profiles |
290
+ | User-PasswordProfile.ReadWrite.All | Application | Least privileged permission to update the passwordProfile property |
291
+ | UserAuthenticationMethod.Read.All | Application | Read all users' authentication methods |
292
+ | Application.ReadWrite.All | Application | Create, update, and delete applications (app registrations) and service principals |
293
+
294
+ **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.
295
+
296
+ ## Advanced: Using with Claude or Cursor
297
+
298
+ ### Install from PyPI and run via `uvx`
299
+
300
+ Once the package has been published to PyPI you can run the server
301
+ directly with [`uvx`](https://docs.astral.sh/uv/) — no repo clone,
302
+ `--with` list, or file path required:
303
+
304
+ ```bash
305
+ uvx entraid-mcp-server
306
+ ```
307
+
308
+ Pin a specific version with either form:
309
+
310
+ ```bash
311
+ uvx entraid-mcp-server@0.2.0
312
+ uvx --from "entraid-mcp-server==0.2.0" entraid-mcp-server
313
+ ```
314
+
315
+ Equivalent `mcp.json` entry (Cursor / Claude Desktop):
316
+
317
+ ```json
318
+ {
319
+ "EntraID MCP Server": {
320
+ "command": "uvx",
321
+ "args": ["entraid-mcp-server"]
322
+ }
323
+ }
324
+ ```
325
+
326
+ Authentication still defaults to `DefaultAzureCredential`, so `az login`
327
+ is enough for local use; add an `env` block with `TENANT_ID` /
328
+ `CLIENT_ID` / `CLIENT_SECRET` only if you need non-interactive auth.
329
+
330
+ ### Building and publishing the package
331
+
332
+ From the repo root:
333
+
334
+ ```bash
335
+ uv build # produces dist/*.whl and dist/*.tar.gz
336
+ uvx --from ./dist/entraid_mcp_server-<version>-py3-none-any.whl \
337
+ entraid-mcp-server # local smoke test
338
+ ```
339
+
340
+ Upload to PyPI (create an API token at https://pypi.org first):
341
+
342
+ ```bash
343
+ # optional dry run against TestPyPI
344
+ uv publish --publish-url https://test.pypi.org/legacy/ --token <test-token>
345
+
346
+ # real release
347
+ uv publish --token <pypi-token>
348
+ ```
349
+
350
+ For a hands-off release flow, configure
351
+ [PyPI Trusted Publishing (OIDC)](https://docs.pypi.org/trusted-publishers/)
352
+ and add a GitHub Actions workflow that runs `uv build` + `uv publish`
353
+ on every tag push — no long-lived tokens required.
354
+
355
+ ### Using with Claude (Anthropic)
356
+ To install and run this server as a Claude MCP tool, use:
357
+
358
+ ```bash
359
+ fastmcp install '/path/to/src/msgraph_mcp_server/server.py' \
360
+ --with msgraph-sdk --with azure-identity --with azure-core --with msgraph-core \
361
+ -f /path/to/.env
362
+ ```
363
+ - Replace `/path/to/` with your actual project path.
364
+ - The `-f` flag points to your `.env` file (never commit secrets!).
365
+
366
+ ### Using with Cursor
367
+ Add the following to your `.cursor/mcp.json`. By default the server uses
368
+ your current Azure login via `DefaultAzureCredential`, so no `env` block
369
+ is required:
370
+
371
+ ```json
372
+ {
373
+ "EntraID MCP Server": {
374
+ "command": "uv",
375
+ "args": [
376
+ "run",
377
+ "--with", "azure-core",
378
+ "--with", "azure-identity",
379
+ "--with", "fastmcp",
380
+ "--with", "msgraph-core",
381
+ "--with", "msgraph-sdk",
382
+ "fastmcp",
383
+ "run",
384
+ "/path/to/src/msgraph_mcp_server/server.py"
385
+ ]
386
+ }
387
+ }
388
+ ```
389
+
390
+ If you need to force client-secret authentication instead (do **not**
391
+ commit real secrets), add an `env` block:
392
+
393
+ ```json
394
+ "env": {
395
+ "TENANT_ID": "<your-tenant-id>",
396
+ "CLIENT_ID": "<your-client-id>",
397
+ "CLIENT_SECRET": "<your-client-secret>"
398
+ }
399
+ ```
400
+
401
+ ## License
402
+
403
+ MIT