mcp-consultant-tools 0.4.5

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 ADDED
@@ -0,0 +1,968 @@
1
+ # PowerPlatform MCP Server
2
+
3
+ A Model Context Protocol (MCP) server that provides intelligent access to PowerPlatform/Dataverse entities and records. This tool offers context-aware assistance, entity exploration and metadata access.
4
+
5
+ Key features:
6
+ - Rich entity metadata exploration with formatted, context-aware prompts
7
+ - Advanced OData query support with intelligent filtering
8
+ - Comprehensive relationship mapping and visualization
9
+ - AI-assisted query building and data modeling through AI agent
10
+ - Full access to entity attributes, relationships, and global option sets
11
+
12
+ ## Installation
13
+
14
+ You can install and run this tool in two ways:
15
+
16
+ ### Option 1: Install globally
17
+
18
+ ```bash
19
+ npm install -g mcp-consultant-tools
20
+ ```
21
+
22
+ Then run it:
23
+
24
+ ```bash
25
+ mcp-consultant-tools
26
+ ```
27
+
28
+ ### Option 2: Run directly with npx
29
+
30
+ Run without installing:
31
+
32
+ ```bash
33
+ npx mcp-consultant-tools
34
+ ```
35
+
36
+ ## Configuration
37
+
38
+ This is an MCP server designed to work with MCP-compatible clients like Claude Desktop, Cursor, or Claude Code (VS Code extension).
39
+
40
+ ### Quick Start: Claude Desktop Configuration
41
+
42
+ Add this to your Claude Desktop config file at `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
43
+
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "mcp-consultant-tools": {
48
+ "command": "npx",
49
+ "args": ["-y", "mcp-consultant-tools"],
50
+ "env": {
51
+ "POWERPLATFORM_URL": "https://yourenvironment.crm.dynamics.com",
52
+ "POWERPLATFORM_CLIENT_ID": "your-azure-app-client-id",
53
+ "POWERPLATFORM_CLIENT_SECRET": "your-azure-app-client-secret",
54
+ "POWERPLATFORM_TENANT_ID": "your-azure-tenant-id",
55
+ "AZUREDEVOPS_ORGANIZATION": "your-organization-name",
56
+ "AZUREDEVOPS_PAT": "your-personal-access-token",
57
+ "AZUREDEVOPS_PROJECTS": "Project1,Project2",
58
+ "AZUREDEVOPS_API_VERSION": "7.1",
59
+ "AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE": "true",
60
+ "AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE": "false",
61
+ "AZUREDEVOPS_ENABLE_WIKI_WRITE": "false"
62
+ }
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ ### Local Development Configuration
69
+
70
+ For local development and testing, you can run the server directly from your cloned repository using Node.js. Add this to your Claude Desktop config:
71
+
72
+ ```json
73
+ {
74
+ "mcpServers": {
75
+ "mcp-consultant-tools-dev": {
76
+ "command": "node",
77
+ "args": ["/absolute/path/to/mcp-consultant-tools/build/index.js"],
78
+ "env": {
79
+ "POWERPLATFORM_URL": "https://yourenvironment.crm.dynamics.com",
80
+ "POWERPLATFORM_CLIENT_ID": "your-azure-app-client-id",
81
+ "POWERPLATFORM_CLIENT_SECRET": "your-azure-app-client-secret",
82
+ "POWERPLATFORM_TENANT_ID": "your-azure-tenant-id",
83
+ "AZUREDEVOPS_ORGANIZATION": "your-organization-name",
84
+ "AZUREDEVOPS_PAT": "your-personal-access-token",
85
+ "AZUREDEVOPS_PROJECTS": "Project1,Project2",
86
+ "AZUREDEVOPS_API_VERSION": "7.1",
87
+ "AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE": "true",
88
+ "AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE": "false",
89
+ "AZUREDEVOPS_ENABLE_WIKI_WRITE": "false"
90
+ }
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ **Important:** Replace `/absolute/path/to/mcp-consultant-tools` with the actual path to your cloned repository (e.g., `/Users/yourname/Repo/mcp-consultant-tools`).
97
+
98
+ ### Environment Variables Reference
99
+
100
+ **PowerPlatform/Dataverse (Required):**
101
+ - `POWERPLATFORM_URL`: Your PowerPlatform environment URL
102
+ - `POWERPLATFORM_CLIENT_ID`: Azure AD app registration client ID
103
+ - `POWERPLATFORM_CLIENT_SECRET`: Azure AD app registration client secret
104
+ - `POWERPLATFORM_TENANT_ID`: Azure tenant ID
105
+
106
+ **Azure DevOps (Optional):**
107
+ - `AZUREDEVOPS_ORGANIZATION`: Your Azure DevOps organization name
108
+ - `AZUREDEVOPS_PAT`: Personal Access Token with appropriate scopes
109
+ - `AZUREDEVOPS_PROJECTS`: Comma-separated list of allowed projects
110
+ - `AZUREDEVOPS_API_VERSION`: API version (default: "7.1")
111
+ - `AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE`: Enable work item write operations (default: "false")
112
+ - `AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE`: Enable work item delete operations (default: "false")
113
+ - `AZUREDEVOPS_ENABLE_WIKI_WRITE`: Enable wiki write operations (default: "false")
114
+
115
+ **After configuration:**
116
+ 1. Save the config file
117
+ 2. Completely restart Claude Desktop (quit and reopen)
118
+ 3. The MCP server will be available in Claude Desktop
119
+
120
+ ## Usage
121
+
122
+ Once configured, the MCP server will expose tools for retrieving PowerPlatform entity metadata and records.
123
+
124
+ ### Available Tools
125
+
126
+ #### Entity Metadata & Data Tools
127
+ - `get-entity-metadata`: Get metadata about a PowerPlatform entity
128
+ - `get-entity-attributes`: Get attributes/fields of a PowerPlatform entity
129
+ - `get-entity-attribute`: Get a specific attribute/field of a PowerPlatform entity
130
+ - `get-entity-relationships`: Get relationships for a PowerPlatform entity
131
+ - `get-global-option-set`: Get a global option set definition
132
+ - `get-record`: Get a specific record by entity name and ID
133
+ - `query-records`: Query records using an OData filter expression
134
+ - `use-powerplatform-prompt`: Use pre-defined prompt templates for PowerPlatform entities
135
+
136
+ #### Plugin Registration & Validation Tools
137
+ - `get-plugin-assemblies`: List all plugin assemblies in the environment
138
+ - `get-plugin-assembly-complete`: Get comprehensive plugin assembly information including all types, steps, images, and automatic validation
139
+ - `get-entity-plugin-pipeline`: Get all plugins that execute on a specific entity, organized by message and execution order
140
+ - `get-plugin-trace-logs`: Query plugin trace logs with filtering and exception parsing
141
+
142
+ ## MCP Prompts
143
+
144
+ The server includes a prompts feature that provides formatted, context-rich information about PowerPlatform entities.
145
+
146
+ ### Available Prompt Types
147
+
148
+ #### Entity Prompts
149
+ The `use-powerplatform-prompt` tool supports the following prompt types:
150
+
151
+ 1. **ENTITY_OVERVIEW**: Comprehensive overview of an entity
152
+ 2. **ATTRIBUTE_DETAILS**: Detailed information about a specific entity attribute
153
+ 3. **QUERY_TEMPLATE**: OData query template for an entity with example filters
154
+ 4. **RELATIONSHIP_MAP**: Visual map of entity relationships
155
+
156
+ #### Plugin Prompts
157
+ 5. **plugin-deployment-report**: Generate a comprehensive deployment report for a plugin assembly with validation warnings
158
+ 6. **entity-plugin-pipeline-report**: Generate a visual execution pipeline showing all plugins for an entity in order
159
+
160
+ ### Examples
161
+
162
+ #### Entity Overview Prompt
163
+
164
+ ```javascript
165
+ // Example client code
166
+ await mcpClient.invoke("use-powerplatform-prompt", {
167
+ promptType: "ENTITY_OVERVIEW",
168
+ entityName: "account"
169
+ });
170
+ ```
171
+
172
+ **Output:**
173
+ ```
174
+ ## Power Platform Entity: account
175
+
176
+ This is an overview of the 'account' entity in Microsoft Power Platform/Dataverse:
177
+
178
+ ### Entity Details
179
+ - Display Name: Account
180
+ - Schema Name: Account
181
+ - Description: Business that represents a customer or potential customer
182
+ - Primary Key: accountid
183
+ - Primary Name: name
184
+
185
+ ### Key Attributes
186
+ - name: String (Account Name)
187
+ - emailaddress1: String (Email)
188
+ - telephone1: String (Main Phone)
189
+ - address1_city: String (City)
190
+ - statecode: Status (Status)
191
+ - accountnumber: String (Account Number)
192
+ - industrycode: OptionSetValue (Industry)
193
+ - revenue: Money (Annual Revenue)
194
+ - ownerid: Owner (Owner)
195
+ - createdon: DateTime (Created On)
196
+
197
+ ### Relationships
198
+ - One-to-Many Relationships: 42
199
+ - Many-to-Many Relationships: 8
200
+
201
+ You can query this entity using OData filters against the plural name.
202
+ ```
203
+
204
+ #### Attribute Details Prompt
205
+
206
+ ```javascript
207
+ await mcpClient.invoke("use-powerplatform-prompt", {
208
+ promptType: "ATTRIBUTE_DETAILS",
209
+ entityName: "account",
210
+ attributeName: "revenue"
211
+ });
212
+ ```
213
+
214
+ **Output:**
215
+ ```
216
+ ## Attribute: revenue
217
+
218
+ Details for the 'revenue' attribute of the 'account' entity:
219
+
220
+ - Display Name: Annual Revenue
221
+ - Description: Annual revenue for the account
222
+ - Type: Money
223
+ - Format: Currency
224
+ - Is Required: No
225
+ - Is Searchable: true
226
+
227
+ ### Usage Notes
228
+ - Data Type: Money
229
+ - Required: No
230
+ - Max Length: N/A
231
+ ```
232
+
233
+ #### Query Template Prompt
234
+
235
+ ```javascript
236
+ await mcpClient.invoke("use-powerplatform-prompt", {
237
+ promptType: "QUERY_TEMPLATE",
238
+ entityName: "account"
239
+ });
240
+ ```
241
+
242
+ **Output:**
243
+ ```
244
+ ## OData Query Template for accounts
245
+
246
+ Use this template to build queries against the accounts entity:
247
+ accounts?$select=name,emailaddress1,telephone1, address1_city,statecode&$filter=name eq 'Example'&$orderby=name asc&$top=50
248
+ ```
249
+
250
+ ### Common Filter Examples
251
+ - Equals: `name eq 'Contoso'`
252
+ - Contains: `contains(name, 'Contoso')`
253
+ - Greater than date: `createdon gt 2023-01-01T00:00:00Z`
254
+ - Multiple conditions: `name eq 'Contoso' and statecode eq 0`
255
+ ```
256
+
257
+ #### Relationship Map Prompt
258
+
259
+ ```javascript
260
+ await mcpClient.invoke("use-powerplatform-prompt", {
261
+ promptType: "RELATIONSHIP_MAP",
262
+ entityName: "contact"
263
+ });
264
+ ```
265
+
266
+ **Output:**
267
+ ```
268
+ ## Relationship Map for contact
269
+
270
+ This shows all relationships for the 'contact' entity:
271
+
272
+ ### One-to-Many Relationships (contact as Primary)
273
+ - contact_activity_parties: contact (1) → activityparty (N)
274
+ - contact_connections1: contact (1) → connection (N)
275
+ - contact_connections2: contact (1) → connection (N)
276
+ - contact_customer_contacts: contact (1) → contact (N)
277
+ - contact_master_contact: contact (1) → contact (N)
278
+
279
+ ### One-to-Many Relationships (contact as Related)
280
+ - account_primary_contact: account (1) → contact (N)
281
+ - customer_contacts: customer (1) → contact (N)
282
+ - system_user_contacts: systemuser (1) → contact (N)
283
+
284
+ ### Many-to-Many Relationships
285
+ - contactleads_association: contact (N) ↔ lead (N)
286
+ - contactopportunities_association: contact (N) ↔ opportunity (N)
287
+ - contactquotes_association: contact (N) ↔ quote (N)
288
+ ```
289
+
290
+ ## Prompt Examples
291
+
292
+ Here are some examples of how you can interact with assistant using the PowerPlatform MCP prompts:
293
+
294
+ ### 1. Entity Understanding
295
+
296
+ You can ask assistant about entities in natural language:
297
+
298
+ ```
299
+ User: "Tell me about the Account entity in our PowerPlatform environment"
300
+
301
+ Response:
302
+ [uses ENTITY_OVERVIEW prompt internally]
303
+
304
+ Here's what I found about the Account entity:
305
+ - It's a core business entity representing customers and potential customers
306
+ - The primary identifier is 'accountid' and the primary name field is 'name'
307
+ - Key fields include:
308
+ * name (Account Name)
309
+ * emailaddress1 (Email)
310
+ * telephone1 (Main Phone)
311
+ * revenue (Annual Revenue)
312
+ - It has 42 one-to-many relationships and 8 many-to-many relationships
313
+ ```
314
+
315
+ ### 2. Building Queries
316
+
317
+ You can ask for help constructing queries:
318
+
319
+ ```
320
+ User: "Help me write a query to find active accounts with revenue over $1M in California"
321
+
322
+ Response:
323
+ [uses QUERY_TEMPLATE prompt internally]
324
+
325
+ Here's the OData query you need:
326
+ accounts?$select=name,revenue,statecode,address1_stateorprovince
327
+ &$filter=statecode eq 0
328
+ and revenue gt 1000000
329
+ and address1_stateorprovince eq 'California'
330
+ &$orderby=revenue desc
331
+
332
+ This query:
333
+ 1. Selects relevant fields
334
+ 2. Filters for active accounts (statecode eq 0)
335
+ 3. Checks revenue > $1M
336
+ 4. Filters for California location
337
+ 5. Orders by revenue highest to lowest
338
+ ```
339
+
340
+ ### 3. Understanding Relationships
341
+
342
+ You can explore entity relationships naturally:
343
+
344
+ ```
345
+ User: "How are Accounts and Contacts related in our system?"
346
+
347
+ Response:
348
+ [uses RELATIONSHIP_MAP prompt for both entities internally]
349
+
350
+ Here are the key relationships between Accounts and Contacts:
351
+
352
+ 1. Primary Contact (One-to-Many):
353
+ - account_primary_contact: Account (1) → Contact (N)
354
+ - An account can have many contacts, but one designated as primary
355
+
356
+ 2. Customer Relationship:
357
+ - contact_customer_accounts: Contact (N) ← Account (1)
358
+ - Contacts can be associated with customer accounts
359
+
360
+ 3. Additional Relationships:
361
+ - accountleads_association: For lead tracking
362
+ - account_connections: For relationship management
363
+ ```
364
+
365
+ ### 4. Field/Attribute Investigation
366
+
367
+ You can ask about specific fields:
368
+
369
+ ```
370
+ User: "What kind of field is the revenue field on Account?"
371
+
372
+ Response:
373
+ [uses ATTRIBUTE_DETAILS prompt internally]
374
+
375
+ The revenue field on Account is:
376
+ - Data Type: Money
377
+ - Format: Currency
378
+ - Not required
379
+ - Searchable: Yes
380
+ - Used for: Tracking annual revenue for the account
381
+ - Can be used in advanced find and filtered views
382
+ ```
383
+
384
+ ### 5. Complex Data Modeling
385
+
386
+ You can get help with data modeling decisions:
387
+
388
+ ```
389
+ User: "I need to design a solution for tracking product reviews. Which entities should I relate to?"
390
+
391
+ Response:
392
+ [uses multiple ENTITY_OVERVIEW and RELATIONSHIP_MAP prompts internally]
393
+
394
+ Based on the existing data model, here's a suggested approach:
395
+
396
+ 1. Product (existing entity):
397
+ - Already has relationships with:
398
+ * Price lists
399
+ * Product categories
400
+ * Inventory units
401
+
402
+ 2. New Review entity should relate to:
403
+ - Product (N:1) - Each review is for one product
404
+ - Contact (N:1) - Reviews are written by contacts
405
+ - Account (N:1) - Optional link to company if B2B review
406
+
407
+ Here's a sample lookup field structure...
408
+ [continues with detailed implementation guidance]
409
+ ```
410
+
411
+ ### 6. Debugging Assistance
412
+
413
+ You can get help troubleshooting:
414
+
415
+ ```
416
+ User: "Why am I getting 'invalid property' when querying account.customertypecode?"
417
+
418
+ Response:
419
+ [uses ATTRIBUTE_DETAILS prompt internally]
420
+
421
+ I see the issue. The field 'customertypecode' is actually named 'customertype' in your environment. Here's the correct field information:
422
+ - Logical Name: customertype
423
+ - Type: OptionSetValue
424
+ - Valid Values:
425
+ * 1 = Competitor
426
+ * 2 = Consultant
427
+ * 3 = Customer
428
+ * 4 = Investor
429
+ * 5 = Partner
430
+ * 6 = Influencer
431
+
432
+ Try updating your query to use 'customertype' instead of 'customertypecode'.
433
+ ```
434
+
435
+ These examples show how AI assistant can leverage the MCP prompts to provide context-aware, accurate assistance for PowerPlatform development tasks. The AI understands your environment's specific configuration and can help with both simple queries and complex architectural decisions.
436
+
437
+ ## Plugin Registration & Validation
438
+
439
+ The server includes powerful tools for plugin discovery, validation, and troubleshooting. These tools eliminate the need for the Plugin Registration Tool for most inspection tasks and enable AI-assisted PR reviews.
440
+
441
+ ### Use Cases
442
+
443
+ #### 1. Discover Plugin Assemblies
444
+ ```javascript
445
+ // List all custom (unmanaged) plugin assemblies
446
+ await mcpClient.invoke("get-plugin-assemblies", {
447
+ includeManaged: false
448
+ });
449
+ ```
450
+
451
+ **Output:**
452
+ ```json
453
+ {
454
+ "totalCount": 10,
455
+ "assemblies": [
456
+ {
457
+ "name": "MyCompany.Plugins",
458
+ "version": "1.0.0.5",
459
+ "isolationMode": "Sandbox",
460
+ "modifiedOn": "2024-01-15T10:30:00Z",
461
+ "modifiedBy": "John Doe"
462
+ }
463
+ ]
464
+ }
465
+ ```
466
+
467
+ #### 2. Validate Plugin Deployment (PR Review)
468
+ ```javascript
469
+ // Get comprehensive assembly info with automatic validation
470
+ await mcpClient.invoke("get-plugin-assembly-complete", {
471
+ assemblyName": "MyCompany.Plugins",
472
+ includeDisabled: false
473
+ });
474
+ ```
475
+
476
+ **Returns:**
477
+ - Assembly metadata (version, isolation mode, last modified)
478
+ - All plugin types (class names)
479
+ - All registered steps with:
480
+ - Stage (PreValidation/PreOperation/PostOperation)
481
+ - Mode (Synchronous/Asynchronous)
482
+ - Execution rank
483
+ - Filtering attributes
484
+ - Pre/Post images with column lists
485
+ - **Automatic validation** detecting:
486
+ - Missing filtering attributes (performance issue)
487
+ - Missing images (potential runtime errors)
488
+ - Disabled steps
489
+ - Configuration issues
490
+
491
+ #### 3. View Entity Plugin Pipeline
492
+ ```javascript
493
+ // See all plugins that run on an entity in execution order
494
+ await mcpClient.invoke("get-entity-plugin-pipeline", {
495
+ entityName": "account",
496
+ messageFilter": "Update" // Optional: filter by message
497
+ });
498
+ ```
499
+
500
+ **Shows:**
501
+ - All plugins organized by stage and rank
502
+ - Execution order
503
+ - Filtering attributes per step
504
+ - Images configured
505
+ - Assembly versions
506
+
507
+ #### 4. Troubleshoot with Trace Logs
508
+ ```javascript
509
+ // Query recent plugin failures
510
+ await mcpClient.invoke("get-plugin-trace-logs", {
511
+ entityName: "account",
512
+ exceptionOnly: true,
513
+ hoursBack: 24,
514
+ maxRecords: 50
515
+ });
516
+ ```
517
+
518
+ **Returns:**
519
+ - Parsed exception details
520
+ - Exception type and message
521
+ - Stack traces
522
+ - Execution duration
523
+ - Correlation IDs for further investigation
524
+
525
+ ### Plugin Validation for PR Reviews
526
+
527
+ When reviewing plugin PRs, use the `plugin-deployment-report` prompt for a human-readable validation report:
528
+
529
+ ```javascript
530
+ await mcpClient.callPrompt("plugin-deployment-report", {
531
+ assemblyName: "MyCompany.Plugins"
532
+ });
533
+ ```
534
+
535
+ **Sample Report:**
536
+ ```markdown
537
+ # Plugin Deployment Report: MyCompany.Plugins
538
+
539
+ ## Assembly Information
540
+ - Version: 1.0.0.5
541
+ - Isolation Mode: Sandbox
542
+ - Last Modified: 2024-01-15 by John Doe
543
+
544
+ ## Registered Steps (8 total)
545
+
546
+ ### Update - Account (PreOperation, Sync, Rank 10)
547
+ - Plugin: MyCompany.Plugins.AccountPlugin
548
+ - Status: ✓ Enabled
549
+ - Filtering Attributes: name, revenue, industrycode
550
+ - Images:
551
+ - PreImage "Target" → Attributes: name, revenue, accountnumber
552
+
553
+ ## Validation Results
554
+
555
+ ✓ All steps are enabled
556
+ ✓ All Update/Delete steps have filtering attributes
557
+ ⚠ Warning: 2 steps without images (may need entity data)
558
+
559
+ ### Potential Issues
560
+ - Account.Delete step missing PreImage - code may fail at runtime
561
+ ```
562
+
563
+ ### Entity Pipeline Visualization
564
+
565
+ View the execution pipeline for an entity with the `entity-plugin-pipeline-report` prompt:
566
+
567
+ ```javascript
568
+ await mcpClient.callPrompt("entity-plugin-pipeline-report", {
569
+ entityName: "account",
570
+ messageFilter: "Update" // Optional
571
+ });
572
+ ```
573
+
574
+ **Sample Report:**
575
+ ```markdown
576
+ # Plugin Pipeline: Account Entity
577
+
578
+ ## Update Message
579
+
580
+ ### Stage 1: PreValidation (Synchronous)
581
+ 1. [Rank 5] DataValidationPlugin.ValidateAccount
582
+ - Assembly: ValidationPlugins v1.0.0
583
+ - Filtering: name, accountnumber
584
+
585
+ ### Stage 2: PreOperation (Synchronous)
586
+ 1. [Rank 10] BusinessLogicPlugin.EnrichAccountData
587
+ - Assembly: BusinessLogic v2.0.1
588
+ - Filtering: revenue, industrycode
589
+ - Images: PreImage
590
+
591
+ ### Stage 3: PostOperation
592
+ 1. [Rank 10] IntegrationPlugin.SyncToERP (Async)
593
+ - Assembly: Integrations v3.1.0
594
+ - Filtering: revenue
595
+ ```
596
+
597
+ ## Azure DevOps Integration
598
+
599
+ In addition to PowerPlatform capabilities, this MCP server provides comprehensive Azure DevOps integration for accessing wikis and work items across your organization.
600
+
601
+ ### Azure DevOps Configuration
602
+
603
+ Set the following environment variables to enable Azure DevOps integration:
604
+
605
+ ```bash
606
+ # Required: Azure DevOps organization and authentication
607
+ AZUREDEVOPS_ORGANIZATION=your-organization-name
608
+ AZUREDEVOPS_PAT=your-personal-access-token
609
+ AZUREDEVOPS_PROJECTS=Project1,Project2,Project3 # Comma-separated list of allowed projects
610
+
611
+ # Optional: API version (default: 7.1)
612
+ AZUREDEVOPS_API_VERSION=7.1
613
+
614
+ # Optional: Feature flags to control write/delete operations (default: false for all)
615
+ AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true # Enable create/update work items
616
+ AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE=true # Enable delete work items
617
+ AZUREDEVOPS_ENABLE_WIKI_WRITE=true # Enable create/update wiki pages
618
+ ```
619
+
620
+ #### Creating a Personal Access Token (PAT)
621
+
622
+ 1. Go to Azure DevOps → User Settings → Personal Access Tokens
623
+ 2. Click "New Token"
624
+ 3. Set required scopes:
625
+ - **Wiki**: `vso.wiki` (Read)
626
+ - **Work Items**: `vso.work` (Read) and optionally `vso.work_write` (Read & Write)
627
+ - **Search**: `vso.search` (Read - for wiki search)
628
+ 4. Copy the token and set it in `AZUREDEVOPS_PAT` environment variable
629
+
630
+ **Security Note**: The PAT is scoped to specific permissions and projects. For maximum security, create separate PATs for read-only vs write operations.
631
+
632
+ ### Available Azure DevOps Tools
633
+
634
+ #### Wiki Tools (5 tools)
635
+ - `get-wikis`: List all wikis in a project
636
+ - `search-wiki-pages`: Search wiki content across projects with highlighting
637
+ - `get-wiki-page`: Get specific wiki page content and metadata
638
+ - `create-wiki-page`: Create new wiki page (requires `AZUREDEVOPS_ENABLE_WIKI_WRITE=true`)
639
+ - `update-wiki-page`: Update existing wiki page (requires `AZUREDEVOPS_ENABLE_WIKI_WRITE=true`)
640
+
641
+ #### Work Item Tools (7 tools)
642
+ - `get-work-item`: Get work item by ID with full details
643
+ - `query-work-items`: Execute WIQL queries to find work items
644
+ - `get-work-item-comments`: Get discussion comments for a work item
645
+ - `add-work-item-comment`: Add comment to work item (requires `AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true`)
646
+ - `update-work-item`: Update work item fields using JSON Patch (requires `AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true`)
647
+ - `create-work-item`: Create new work item (requires `AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true`)
648
+ - `delete-work-item`: Delete work item (requires `AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE=true`)
649
+
650
+ ### Available Azure DevOps Prompts
651
+
652
+ The server includes 4 prompts for formatted, human-readable Azure DevOps data:
653
+
654
+ 1. **wiki-search-results**: Search wiki pages and get formatted results with content snippets
655
+ 2. **wiki-page-content**: Get formatted wiki page with navigation context
656
+ 3. **work-item-summary**: Comprehensive work item summary with details and comments
657
+ 4. **work-items-query-report**: Execute WIQL query and get results grouped by state/type
658
+
659
+ ### Azure DevOps Usage Examples
660
+
661
+ #### Example 1: Search Wiki Documentation
662
+
663
+ ```javascript
664
+ // Search for authentication-related wiki pages
665
+ await mcpClient.callPrompt("wiki-search-results", {
666
+ searchText: "authentication",
667
+ project: "MyProject",
668
+ maxResults: 10
669
+ });
670
+ ```
671
+
672
+ **Sample Output:**
673
+ ```markdown
674
+ # Wiki Search Results: "authentication"
675
+
676
+ **Project:** MyProject
677
+ **Total Results:** 3
678
+
679
+ ## Results
680
+
681
+ ### 1. Setup-Guide.md
682
+ - **Path:** /Setup/Setup-Guide
683
+ - **Wiki:** MyProject.wiki
684
+ - **Project:** MyProject
685
+ - **Highlights:**
686
+ - Authentication can be configured using OAuth or Azure AD
687
+ - The authentication flow supports SAML and JWT tokens
688
+ ```
689
+
690
+ #### Example 2: Get Work Item with Comments
691
+
692
+ ```javascript
693
+ // Get detailed work item summary with all comments
694
+ await mcpClient.callPrompt("work-item-summary", {
695
+ project: "MyProject",
696
+ workItemId: 12345
697
+ });
698
+ ```
699
+
700
+ **Sample Output:**
701
+ ```markdown
702
+ # Work Item #12345: Login button not working
703
+
704
+ ## Details
705
+ - **Type:** Bug
706
+ - **State:** Active
707
+ - **Assigned To:** John Doe
708
+ - **Created By:** Jane Smith
709
+ - **Created Date:** 2024-01-15T10:30:00Z
710
+ - **Area Path:** MyProject\\Web\\Authentication
711
+ - **Iteration Path:** Sprint 23
712
+ - **Tags:** critical, authentication
713
+
714
+ ## Description
715
+ When users click the login button on the homepage, nothing happens.
716
+ The console shows a JavaScript error: "Cannot read property 'submit' of null"
717
+
718
+ ## Repro Steps
719
+ 1. Navigate to https://myapp.com
720
+ 2. Click the "Login" button in the top right
721
+ 3. Observe that nothing happens
722
+
723
+ ## Comments (3)
724
+
725
+ ### John Doe - 1/15/2024 11:00 AM
726
+ I've investigated this issue. The problem is in the form validation logic.
727
+
728
+ ### Jane Smith - 1/15/2024 2:30 PM
729
+ Created PR #456 to fix this issue.
730
+ ```
731
+
732
+ #### Example 3: Query Active Bugs
733
+
734
+ ```javascript
735
+ // Find all active bugs assigned to current user
736
+ await mcpClient.callPrompt("work-items-query-report", {
737
+ project: "MyProject",
738
+ wiql: "SELECT [System.Id], [System.Title], [System.State] FROM WorkItems WHERE [System.WorkItemType] = 'Bug' AND [System.State] = 'Active' AND [System.AssignedTo] = @me"
739
+ });
740
+ ```
741
+
742
+ **Sample Output:**
743
+ ```markdown
744
+ # Work Items Query Results
745
+
746
+ **Project:** MyProject
747
+ **Total Results:** 5
748
+
749
+ ## Active (5)
750
+
751
+ - **#12345**: Login button not working
752
+ - Type: Bug, Assigned: John Doe
753
+ - **#12346**: Password reset email not sent
754
+ - Type: Bug, Assigned: John Doe
755
+ - **#12347**: Dashboard loads slowly
756
+ - Type: Bug, Assigned: John Doe
757
+ ```
758
+
759
+ #### Example 4: Read Wiki Page
760
+
761
+ ```javascript
762
+ // Get formatted wiki page content
763
+ await mcpClient.callPrompt("wiki-page-content", {
764
+ project: "MyProject",
765
+ wikiId: "MyProject.wiki",
766
+ pagePath: "/Architecture/API-Design"
767
+ });
768
+ ```
769
+
770
+ **Sample Output:**
771
+ ```markdown
772
+ # Wiki Page: /Architecture/API-Design
773
+
774
+ **Project:** MyProject
775
+ **Wiki:** MyProject.wiki
776
+ **Git Path:** Architecture/API-Design.md
777
+
778
+ ## Sub-pages
779
+ - /Architecture/API-Design/REST-Guidelines
780
+ - /Architecture/API-Design/Authentication
781
+ - /Architecture/API-Design/Versioning
782
+
783
+ ## Content
784
+
785
+ # API Design Guidelines
786
+
787
+ This document describes our API design standards...
788
+
789
+ ## RESTful Principles
790
+ 1. Use nouns for resources
791
+ 2. Use HTTP methods correctly...
792
+ ```
793
+
794
+ #### Example 5: Create Work Item (Write Operations)
795
+
796
+ ```javascript
797
+ // Create a new bug (requires AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true)
798
+ await mcpClient.invoke("create-work-item", {
799
+ project: "MyProject",
800
+ workItemType: "Bug",
801
+ fields: {
802
+ "System.Title": "Login page shows 404 error",
803
+ "System.Description": "After deploying v2.3, the login page returns 404",
804
+ "System.AssignedTo": "john@company.com",
805
+ "Microsoft.VSTS.TCM.ReproSteps": "1. Navigate to /login\n2. Observe 404 error",
806
+ "System.Tags": "critical; deployment"
807
+ }
808
+ });
809
+ ```
810
+
811
+ #### Example 6: Update Work Item State
812
+
813
+ ```javascript
814
+ // Update work item to Resolved (requires AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true)
815
+ await mcpClient.invoke("update-work-item", {
816
+ project: "MyProject",
817
+ workItemId: 12345,
818
+ patchOperations: [
819
+ {
820
+ "op": "add",
821
+ "path": "/fields/System.State",
822
+ "value": "Resolved"
823
+ },
824
+ {
825
+ "op": "add",
826
+ "path": "/fields/System.History",
827
+ "value": "Fixed in PR #456. Verified in staging environment."
828
+ }
829
+ ]
830
+ });
831
+ ```
832
+
833
+ ### WIQL Query Language
834
+
835
+ Work Items queries use WIQL (Work Item Query Language), a SQL-like language:
836
+
837
+ **Common WIQL Patterns:**
838
+
839
+ ```sql
840
+ -- Find all active bugs
841
+ SELECT [System.Id], [System.Title]
842
+ FROM WorkItems
843
+ WHERE [System.WorkItemType] = 'Bug'
844
+ AND [System.State] = 'Active'
845
+
846
+ -- Find work items changed in last 7 days
847
+ SELECT [System.Id], [System.Title], [System.ChangedDate]
848
+ FROM WorkItems
849
+ WHERE [System.TeamProject] = @project
850
+ AND [System.ChangedDate] > @today - 7
851
+
852
+ -- Find my active tasks in current sprint
853
+ SELECT [System.Id], [System.Title]
854
+ FROM WorkItems
855
+ WHERE [System.WorkItemType] = 'Task'
856
+ AND [System.AssignedTo] = @me
857
+ AND [System.State] = 'Active'
858
+ AND [System.IterationPath] UNDER @currentIteration
859
+
860
+ -- Find user stories with specific tag
861
+ SELECT [System.Id], [System.Title], [System.Tags]
862
+ FROM WorkItems
863
+ WHERE [System.WorkItemType] = 'User Story'
864
+ AND [System.Tags] CONTAINS 'authentication'
865
+ ```
866
+
867
+ **WIQL Macros:**
868
+ - `@me` - Current user
869
+ - `@today` - Today's date
870
+ - `@project` - Current project
871
+ - `@currentIteration` - Current iteration path
872
+
873
+ ### Integration Use Cases
874
+
875
+ #### Use Case 1: AI-Assisted Development with Context
876
+
877
+ When working on a feature, the AI can automatically search relevant wiki documentation:
878
+
879
+ ```
880
+ User: "I need to implement OAuth authentication for our API"
881
+
882
+ AI Agent:
883
+ 1. Searches wiki: search-wiki-pages with "OAuth authentication"
884
+ 2. Finds and reads: get-wiki-page for /Architecture/Authentication/OAuth-Setup
885
+ 3. Queries related work items: query-work-items for authentication tasks
886
+ 4. Provides implementation guidance based on your organization's standards
887
+ ```
888
+
889
+ #### Use Case 2: Automated Work Item Management
890
+
891
+ AI can help manage work items throughout development:
892
+
893
+ ```
894
+ User: "I fixed bug #12345, mark it as resolved"
895
+
896
+ AI Agent:
897
+ 1. Gets work item details: get-work-item
898
+ 2. Updates state: update-work-item to "Resolved"
899
+ 3. Adds comment: add-work-item-comment with fix details
900
+ 4. Links to PR if available
901
+ ```
902
+
903
+ #### Use Case 3: Sprint Planning Assistant
904
+
905
+ AI can analyze sprint work items and provide insights:
906
+
907
+ ```
908
+ User: "Show me all active bugs in our current sprint"
909
+
910
+ AI Agent:
911
+ 1. Executes WIQL query: query-work-items
912
+ 2. Groups results: work-items-query-report by priority/state
913
+ 3. Identifies blockers and dependencies
914
+ 4. Suggests prioritization based on severity
915
+ ```
916
+
917
+ #### Use Case 4: Documentation Discovery
918
+
919
+ AI can search and summarize documentation across wiki pages:
920
+
921
+ ```
922
+ User: "How do we handle database migrations in our projects?"
923
+
924
+ AI Agent:
925
+ 1. Searches wikis: search-wiki-pages for "database migrations"
926
+ 2. Reads relevant pages: wiki-page-content for each result
927
+ 3. Summarizes best practices from your team's documentation
928
+ 4. Provides code examples from wiki pages
929
+ ```
930
+
931
+ ### Security and Access Control
932
+
933
+ The Azure DevOps integration respects your organization's security boundaries:
934
+
935
+ 1. **Project Scoping**: Only projects listed in `AZUREDEVOPS_PROJECTS` are accessible
936
+ 2. **PAT Permissions**: Access is limited to PAT scopes (read-only, read-write, etc.)
937
+ 3. **Feature Flags**: Write operations are disabled by default and must be explicitly enabled
938
+ 4. **Audit Trail**: All API operations are logged in Azure DevOps audit logs
939
+
940
+ **Recommended Setup for Different Scenarios:**
941
+
942
+ **Read-Only (Documentation/Research):**
943
+ ```bash
944
+ AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=false
945
+ AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE=false
946
+ AZUREDEVOPS_ENABLE_WIKI_WRITE=false
947
+ # PAT with: vso.wiki (read), vso.work (read), vso.search (read)
948
+ ```
949
+
950
+ **Developer Workflow (Read + Comment):**
951
+ ```bash
952
+ AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true # Can update work items and add comments
953
+ AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE=false # Cannot delete
954
+ AZUREDEVOPS_ENABLE_WIKI_WRITE=false # Cannot modify wikis
955
+ # PAT with: vso.wiki (read), vso.work_write (read/write), vso.search (read)
956
+ ```
957
+
958
+ **Full Access (Team Lead/Admin):**
959
+ ```bash
960
+ AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true
961
+ AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE=true
962
+ AZUREDEVOPS_ENABLE_WIKI_WRITE=true
963
+ # PAT with: vso.wiki (read/write), vso.work_write (read/write), vso.search (read)
964
+ ```
965
+
966
+ ## License
967
+
968
+ MIT