mcp-consultant-tools 1.0.0 → 3.0.0
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/LICENSE +47 -0
- package/README.md +113 -146
- package/build/FigmaService.js +107 -0
- package/build/figma/extractors/built-in.js +205 -0
- package/build/figma/extractors/design-extractor.js +65 -0
- package/build/figma/extractors/index.js +10 -0
- package/build/figma/extractors/node-walker.js +92 -0
- package/build/figma/extractors/types.js +1 -0
- package/build/figma/transformers/component.js +28 -0
- package/build/figma/transformers/effects.js +49 -0
- package/build/figma/transformers/layout.js +202 -0
- package/build/figma/transformers/style.js +538 -0
- package/build/figma/transformers/text.js +33 -0
- package/build/figma/utils/common.js +166 -0
- package/build/figma/utils/fetch-with-retry.js +69 -0
- package/build/figma/utils/identity.js +70 -0
- package/build/index.js +95 -150
- package/package.json +8 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Michal Sobieraj
|
|
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.
|
|
22
|
+
|
|
23
|
+
================================================================================
|
|
24
|
+
This project includes code derived from Figma-Context-MCP
|
|
25
|
+
(https://github.com/glipsman/figma-context-mcp)
|
|
26
|
+
|
|
27
|
+
Original Copyright Notice:
|
|
28
|
+
Copyright (c) 2025 Graham Lipsman
|
|
29
|
+
|
|
30
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
31
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
32
|
+
in the Software without restriction, including without limitation the rights
|
|
33
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
34
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
35
|
+
furnished to do so, subject to the following conditions:
|
|
36
|
+
|
|
37
|
+
The above copyright notice and this permission notice shall be included in all
|
|
38
|
+
copies or substantial portions of the Software.
|
|
39
|
+
|
|
40
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
41
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
42
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
43
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
44
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
45
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
46
|
+
SOFTWARE.
|
|
47
|
+
================================================================================
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MCP Consultant Tools
|
|
2
2
|
|
|
3
|
-
A Model Context Protocol (MCP) server that provides intelligent access to PowerPlatform/Dataverse entities and
|
|
3
|
+
A Model Context Protocol (MCP) server that provides intelligent access to PowerPlatform/Dataverse entities, Azure DevOps, and Figma designs. This tool offers context-aware assistance, entity exploration, and metadata access across multiple platforms.
|
|
4
4
|
|
|
5
5
|
Key features:
|
|
6
|
-
- Rich entity metadata exploration with formatted, context-aware prompts
|
|
7
|
-
-
|
|
8
|
-
-
|
|
6
|
+
- **PowerPlatform/Dataverse**: Rich entity metadata exploration with formatted, context-aware prompts, advanced OData query support, comprehensive relationship mapping
|
|
7
|
+
- **Azure DevOps**: Wiki search, work item management, WIQL queries, and team collaboration tools
|
|
8
|
+
- **Figma**: Design data extraction with simplified AI-friendly format, component analysis, and style deduplication
|
|
9
9
|
- AI-assisted query building and data modeling through AI agent
|
|
10
10
|
- Full access to entity attributes, relationships, and global option sets
|
|
11
11
|
|
|
@@ -37,6 +37,44 @@ npx mcp-consultant-tools
|
|
|
37
37
|
|
|
38
38
|
This is an MCP server designed to work with MCP-compatible clients like Claude Desktop, Cursor, or Claude Code (VS Code extension).
|
|
39
39
|
|
|
40
|
+
### Quick Start: VS Code (Claude Code) Configuration
|
|
41
|
+
|
|
42
|
+
For VS Code with Claude Code extension, create a `.vscode/mcp.json` file in your repository:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"servers": {
|
|
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
|
+
"FIGMA_API_KEY": "your-figma-personal-access-token",
|
|
63
|
+
"FIGMA_OAUTH_TOKEN": "",
|
|
64
|
+
"FIGMA_USE_OAUTH": "false"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**After configuration:**
|
|
72
|
+
1. Save the `.vscode/mcp.json` file
|
|
73
|
+
2. Reload VS Code window
|
|
74
|
+
3. The MCP server will be available in Claude Code
|
|
75
|
+
|
|
76
|
+
**Note:** You can omit PowerPlatform, Azure DevOps, or Figma credentials if you only need certain integrations (see Environment Variables Reference below).
|
|
77
|
+
|
|
40
78
|
### Quick Start: Claude Desktop Configuration
|
|
41
79
|
|
|
42
80
|
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):
|
|
@@ -58,7 +96,10 @@ Add this to your Claude Desktop config file at `~/Library/Application Support/Cl
|
|
|
58
96
|
"AZUREDEVOPS_API_VERSION": "7.1",
|
|
59
97
|
"AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE": "true",
|
|
60
98
|
"AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE": "false",
|
|
61
|
-
"AZUREDEVOPS_ENABLE_WIKI_WRITE": "false"
|
|
99
|
+
"AZUREDEVOPS_ENABLE_WIKI_WRITE": "false",
|
|
100
|
+
"FIGMA_API_KEY": "your-figma-personal-access-token",
|
|
101
|
+
"FIGMA_OAUTH_TOKEN": "",
|
|
102
|
+
"FIGMA_USE_OAUTH": "false"
|
|
62
103
|
}
|
|
63
104
|
}
|
|
64
105
|
}
|
|
@@ -86,7 +127,10 @@ For local development and testing, you can run the server directly from your clo
|
|
|
86
127
|
"AZUREDEVOPS_API_VERSION": "7.1",
|
|
87
128
|
"AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE": "true",
|
|
88
129
|
"AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE": "false",
|
|
89
|
-
"AZUREDEVOPS_ENABLE_WIKI_WRITE": "false"
|
|
130
|
+
"AZUREDEVOPS_ENABLE_WIKI_WRITE": "false",
|
|
131
|
+
"FIGMA_API_KEY": "your-figma-personal-access-token",
|
|
132
|
+
"FIGMA_OAUTH_TOKEN": "",
|
|
133
|
+
"FIGMA_USE_OAUTH": "false"
|
|
90
134
|
}
|
|
91
135
|
}
|
|
92
136
|
}
|
|
@@ -97,10 +141,11 @@ For local development and testing, you can run the server directly from your clo
|
|
|
97
141
|
|
|
98
142
|
### Environment Variables Reference
|
|
99
143
|
|
|
100
|
-
**Note:**
|
|
144
|
+
**Note:** All integrations (PowerPlatform, Azure DevOps, Figma) are optional. You can configure only the services you need:
|
|
101
145
|
- PowerPlatform only: Set `POWERPLATFORM_*` variables
|
|
102
146
|
- Azure DevOps only: Set `AZUREDEVOPS_*` variables
|
|
103
|
-
-
|
|
147
|
+
- Figma only: Set `FIGMA_*` variables
|
|
148
|
+
- Any combination: Set only the variables you need
|
|
104
149
|
|
|
105
150
|
**PowerPlatform/Dataverse (Optional):**
|
|
106
151
|
- `POWERPLATFORM_URL`: Your PowerPlatform environment URL
|
|
@@ -117,6 +162,18 @@ For local development and testing, you can run the server directly from your clo
|
|
|
117
162
|
- `AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE`: Enable work item delete operations (default: "false")
|
|
118
163
|
- `AZUREDEVOPS_ENABLE_WIKI_WRITE`: Enable wiki write operations (default: "false")
|
|
119
164
|
|
|
165
|
+
**Figma (Optional):**
|
|
166
|
+
- `FIGMA_API_KEY`: Figma Personal Access Token (generate at: https://www.figma.com/developers/api#authentication)
|
|
167
|
+
- `FIGMA_OAUTH_TOKEN`: Alternative to API key for OAuth authentication
|
|
168
|
+
- `FIGMA_USE_OAUTH`: Set to "true" if using OAuth token instead of API key (default: "false")
|
|
169
|
+
|
|
170
|
+
**How to get a Figma API Key:**
|
|
171
|
+
1. Go to https://www.figma.com/developers/api#authentication
|
|
172
|
+
2. Scroll to "Personal Access Tokens"
|
|
173
|
+
3. Click "Get personal access token"
|
|
174
|
+
4. Log in to Figma
|
|
175
|
+
5. Generate new token and copy it to your config
|
|
176
|
+
|
|
120
177
|
**After configuration:**
|
|
121
178
|
1. Save the config file
|
|
122
179
|
2. Completely restart Claude Desktop (quit and reopen)
|
|
@@ -128,6 +185,10 @@ Once configured, the MCP server will expose tools for retrieving PowerPlatform e
|
|
|
128
185
|
|
|
129
186
|
### Available Tools
|
|
130
187
|
|
|
188
|
+
The server provides **30 tools** across PowerPlatform, Azure DevOps, and Figma integrations.
|
|
189
|
+
|
|
190
|
+
### PowerPlatform/Dataverse Tools
|
|
191
|
+
|
|
131
192
|
#### Entity Metadata & Data Tools
|
|
132
193
|
- `get-entity-metadata`: Get metadata about a PowerPlatform entity
|
|
133
194
|
- `get-entity-attributes`: Get attributes/fields of a PowerPlatform entity
|
|
@@ -136,7 +197,6 @@ Once configured, the MCP server will expose tools for retrieving PowerPlatform e
|
|
|
136
197
|
- `get-global-option-set`: Get a global option set definition
|
|
137
198
|
- `get-record`: Get a specific record by entity name and ID
|
|
138
199
|
- `query-records`: Query records using an OData filter expression
|
|
139
|
-
- `use-powerplatform-prompt`: Use pre-defined prompt templates for PowerPlatform entities
|
|
140
200
|
|
|
141
201
|
#### Plugin Registration & Validation Tools
|
|
142
202
|
- `get-plugin-assemblies`: List all plugin assemblies in the environment
|
|
@@ -144,153 +204,60 @@ Once configured, the MCP server will expose tools for retrieving PowerPlatform e
|
|
|
144
204
|
- `get-entity-plugin-pipeline`: Get all plugins that execute on a specific entity, organized by message and execution order
|
|
145
205
|
- `get-plugin-trace-logs`: Query plugin trace logs with filtering and exception parsing
|
|
146
206
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
#### Entity Prompts
|
|
154
|
-
The `use-powerplatform-prompt` tool supports the following prompt types:
|
|
155
|
-
|
|
156
|
-
1. **ENTITY_OVERVIEW**: Comprehensive overview of an entity
|
|
157
|
-
2. **ATTRIBUTE_DETAILS**: Detailed information about a specific entity attribute
|
|
158
|
-
3. **QUERY_TEMPLATE**: OData query template for an entity with example filters
|
|
159
|
-
4. **RELATIONSHIP_MAP**: Visual map of entity relationships
|
|
160
|
-
|
|
161
|
-
#### Plugin Prompts
|
|
162
|
-
5. **plugin-deployment-report**: Generate a comprehensive deployment report for a plugin assembly with validation warnings
|
|
163
|
-
6. **entity-plugin-pipeline-report**: Generate a visual execution pipeline showing all plugins for an entity in order
|
|
164
|
-
|
|
165
|
-
### Examples
|
|
166
|
-
|
|
167
|
-
#### Entity Overview Prompt
|
|
168
|
-
|
|
169
|
-
```javascript
|
|
170
|
-
// Example client code
|
|
171
|
-
await mcpClient.invoke("use-powerplatform-prompt", {
|
|
172
|
-
promptType: "ENTITY_OVERVIEW",
|
|
173
|
-
entityName: "account"
|
|
174
|
-
});
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**Output:**
|
|
178
|
-
```
|
|
179
|
-
## Power Platform Entity: account
|
|
180
|
-
|
|
181
|
-
This is an overview of the 'account' entity in Microsoft Power Platform/Dataverse:
|
|
207
|
+
#### Workflow & Power Automate Flow Tools
|
|
208
|
+
- `get-flows`: List all Power Automate cloud flows (category = 5)
|
|
209
|
+
- `get-flow-definition`: Get complete flow definition including JSON logic from clientdata field
|
|
210
|
+
- `get-flow-runs`: Get flow run history with status, duration, and error details
|
|
211
|
+
- `get-workflows`: List all classic Dynamics workflows (category = 0)
|
|
212
|
+
- `get-workflow-definition`: Get complete workflow definition including XAML and trigger configuration
|
|
182
213
|
|
|
183
|
-
###
|
|
184
|
-
- Display Name: Account
|
|
185
|
-
- Schema Name: Account
|
|
186
|
-
- Description: Business that represents a customer or potential customer
|
|
187
|
-
- Primary Key: accountid
|
|
188
|
-
- Primary Name: name
|
|
214
|
+
### Azure DevOps Tools
|
|
189
215
|
|
|
190
|
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
- accountnumber: String (Account Number)
|
|
197
|
-
- industrycode: OptionSetValue (Industry)
|
|
198
|
-
- revenue: Money (Annual Revenue)
|
|
199
|
-
- ownerid: Owner (Owner)
|
|
200
|
-
- createdon: DateTime (Created On)
|
|
201
|
-
|
|
202
|
-
### Relationships
|
|
203
|
-
- One-to-Many Relationships: 42
|
|
204
|
-
- Many-to-Many Relationships: 8
|
|
205
|
-
|
|
206
|
-
You can query this entity using OData filters against the plural name.
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
#### Attribute Details Prompt
|
|
210
|
-
|
|
211
|
-
```javascript
|
|
212
|
-
await mcpClient.invoke("use-powerplatform-prompt", {
|
|
213
|
-
promptType: "ATTRIBUTE_DETAILS",
|
|
214
|
-
entityName: "account",
|
|
215
|
-
attributeName: "revenue"
|
|
216
|
-
});
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
**Output:**
|
|
220
|
-
```
|
|
221
|
-
## Attribute: revenue
|
|
222
|
-
|
|
223
|
-
Details for the 'revenue' attribute of the 'account' entity:
|
|
224
|
-
|
|
225
|
-
- Display Name: Annual Revenue
|
|
226
|
-
- Description: Annual revenue for the account
|
|
227
|
-
- Type: Money
|
|
228
|
-
- Format: Currency
|
|
229
|
-
- Is Required: No
|
|
230
|
-
- Is Searchable: true
|
|
231
|
-
|
|
232
|
-
### Usage Notes
|
|
233
|
-
- Data Type: Money
|
|
234
|
-
- Required: No
|
|
235
|
-
- Max Length: N/A
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
#### Query Template Prompt
|
|
239
|
-
|
|
240
|
-
```javascript
|
|
241
|
-
await mcpClient.invoke("use-powerplatform-prompt", {
|
|
242
|
-
promptType: "QUERY_TEMPLATE",
|
|
243
|
-
entityName: "account"
|
|
244
|
-
});
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
**Output:**
|
|
248
|
-
```
|
|
249
|
-
## OData Query Template for accounts
|
|
216
|
+
#### Wiki Tools
|
|
217
|
+
- `get-wikis`: List all wikis in a project
|
|
218
|
+
- `search-wiki-pages`: Full-text search across wiki pages with highlighting
|
|
219
|
+
- `get-wiki-page`: Get specific wiki page content and metadata
|
|
220
|
+
- `create-wiki-page`: Create new wiki page (requires `AZUREDEVOPS_ENABLE_WIKI_WRITE=true`)
|
|
221
|
+
- `update-wiki-page`: Update existing wiki page (requires `AZUREDEVOPS_ENABLE_WIKI_WRITE=true`)
|
|
250
222
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
223
|
+
#### Work Item Tools
|
|
224
|
+
- `get-work-item`: Get work item by ID with full details
|
|
225
|
+
- `query-work-items`: Execute WIQL queries to find work items
|
|
226
|
+
- `get-work-item-comments`: Get discussion comments for a work item
|
|
227
|
+
- `add-work-item-comment`: Add comment to work item (requires `AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true`)
|
|
228
|
+
- `update-work-item`: Update work item fields using JSON Patch (requires `AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true`)
|
|
229
|
+
- `create-work-item`: Create new work item (requires `AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true`)
|
|
230
|
+
- `delete-work-item`: Delete work item (requires `AZUREDEVOPS_ENABLE_WORK_ITEM_DELETE=true`)
|
|
254
231
|
|
|
255
|
-
###
|
|
256
|
-
-
|
|
257
|
-
-
|
|
258
|
-
- Greater than date: `createdon gt 2023-01-01T00:00:00Z`
|
|
259
|
-
- Multiple conditions: `name eq 'Contoso' and statecode eq 0`
|
|
260
|
-
```
|
|
232
|
+
### Figma Tools
|
|
233
|
+
- `get-figma-data`: Get comprehensive Figma design data including layout, text, styles, and components. Fetches from Figma API and transforms into simplified, AI-friendly format. Can fetch entire files or specific nodes.
|
|
234
|
+
- `download-figma-images`: Placeholder for future image download functionality (Coming in v2)
|
|
261
235
|
|
|
262
|
-
|
|
236
|
+
## MCP Prompts
|
|
263
237
|
|
|
264
|
-
|
|
265
|
-
await mcpClient.invoke("use-powerplatform-prompt", {
|
|
266
|
-
promptType: "RELATIONSHIP_MAP",
|
|
267
|
-
entityName: "contact"
|
|
268
|
-
});
|
|
269
|
-
```
|
|
238
|
+
The server includes **12 prompts** that provide formatted, context-rich information across all integrations.
|
|
270
239
|
|
|
271
|
-
|
|
272
|
-
```
|
|
273
|
-
## Relationship Map for contact
|
|
240
|
+
### Available Prompts
|
|
274
241
|
|
|
275
|
-
|
|
242
|
+
#### Entity Prompts
|
|
243
|
+
1. **entity-overview**: Comprehensive overview of a PowerPlatform entity
|
|
244
|
+
2. **attribute-details**: Detailed information about a specific entity attribute
|
|
245
|
+
3. **query-template**: OData query template for an entity with example filters
|
|
246
|
+
4. **relationship-map**: Visual map of entity relationships
|
|
276
247
|
|
|
277
|
-
|
|
278
|
-
-
|
|
279
|
-
-
|
|
280
|
-
- contact_connections2: contact (1) → connection (N)
|
|
281
|
-
- contact_customer_contacts: contact (1) → contact (N)
|
|
282
|
-
- contact_master_contact: contact (1) → contact (N)
|
|
248
|
+
#### PowerPlatform Plugin Prompts
|
|
249
|
+
5. **plugin-deployment-report**: Generate a comprehensive deployment report for a plugin assembly with validation warnings
|
|
250
|
+
6. **entity-plugin-pipeline-report**: Generate a visual execution pipeline showing all plugins for an entity in order
|
|
283
251
|
|
|
284
|
-
|
|
285
|
-
-
|
|
286
|
-
-
|
|
287
|
-
- system_user_contacts: systemuser (1) → contact (N)
|
|
252
|
+
#### PowerPlatform Workflow & Flow Prompts
|
|
253
|
+
7. **flows-report**: Comprehensive report of all Power Automate flows grouped by state
|
|
254
|
+
8. **workflows-report**: Comprehensive report of all classic Dynamics workflows grouped by state
|
|
288
255
|
|
|
289
|
-
|
|
290
|
-
-
|
|
291
|
-
-
|
|
292
|
-
-
|
|
293
|
-
|
|
256
|
+
#### Azure DevOps Prompts
|
|
257
|
+
9. **wiki-search-results**: Search Azure DevOps wiki pages with formatted results and content snippets
|
|
258
|
+
10. **wiki-page-content**: Get a formatted wiki page with navigation context and sub-pages
|
|
259
|
+
11. **work-item-summary**: Get a comprehensive summary of a work item with details and comments
|
|
260
|
+
12. **work-items-query-report**: Execute a WIQL query and get results grouped by state/type
|
|
294
261
|
|
|
295
262
|
## Prompt Examples
|
|
296
263
|
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { fetchWithRetry } from "./figma/utils/fetch-with-retry.js";
|
|
2
|
+
import { simplifyRawFigmaObject } from "./figma/extractors/design-extractor.js";
|
|
3
|
+
import { allExtractors } from "./figma/extractors/built-in.js";
|
|
4
|
+
/**
|
|
5
|
+
* Service for interacting with the Figma API
|
|
6
|
+
* Follows the service pattern established by PowerPlatformService
|
|
7
|
+
*/
|
|
8
|
+
export class FigmaService {
|
|
9
|
+
config;
|
|
10
|
+
baseUrl = "https://api.figma.com/v1";
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.config = config;
|
|
13
|
+
// Validate configuration
|
|
14
|
+
if (!this.config.apiKey && !this.config.oauthToken) {
|
|
15
|
+
throw new Error("Figma configuration requires either apiKey or oauthToken");
|
|
16
|
+
}
|
|
17
|
+
if (this.config.useOAuth && !this.config.oauthToken) {
|
|
18
|
+
throw new Error("useOAuth is true but oauthToken is not provided");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get authentication headers based on configuration
|
|
23
|
+
*/
|
|
24
|
+
getAuthHeaders() {
|
|
25
|
+
if (this.config.useOAuth && this.config.oauthToken) {
|
|
26
|
+
console.error("Using OAuth Bearer token for authentication");
|
|
27
|
+
return { Authorization: `Bearer ${this.config.oauthToken}` };
|
|
28
|
+
}
|
|
29
|
+
else if (this.config.apiKey) {
|
|
30
|
+
console.error("Using Personal Access Token for authentication");
|
|
31
|
+
return { "X-Figma-Token": this.config.apiKey };
|
|
32
|
+
}
|
|
33
|
+
throw new Error("No valid authentication method configured");
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Make an authenticated request to the Figma API
|
|
37
|
+
*/
|
|
38
|
+
async request(endpoint) {
|
|
39
|
+
try {
|
|
40
|
+
console.error(`Calling ${this.baseUrl}${endpoint}`);
|
|
41
|
+
const headers = this.getAuthHeaders();
|
|
42
|
+
return await fetchWithRetry(`${this.baseUrl}${endpoint}`, {
|
|
43
|
+
headers,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
48
|
+
throw new Error(`Failed to make request to Figma API endpoint '${endpoint}': ${errorMessage}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get raw Figma API response for a file
|
|
53
|
+
* @param fileKey - The Figma file key from the URL
|
|
54
|
+
* @param depth - Optional depth limit for traversal
|
|
55
|
+
*/
|
|
56
|
+
async getFigmaFile(fileKey, depth) {
|
|
57
|
+
const endpoint = `/files/${fileKey}${depth ? `?depth=${depth}` : ""}`;
|
|
58
|
+
console.error(`Retrieving Figma file: ${fileKey} (depth: ${depth ?? "default"})`);
|
|
59
|
+
const response = await this.request(endpoint);
|
|
60
|
+
return response;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get raw Figma API response for specific nodes
|
|
64
|
+
* @param fileKey - The Figma file key from the URL
|
|
65
|
+
* @param nodeIds - Array of node IDs to fetch
|
|
66
|
+
* @param depth - Optional depth limit for traversal
|
|
67
|
+
*/
|
|
68
|
+
async getFigmaNodes(fileKey, nodeIds, depth) {
|
|
69
|
+
const endpoint = `/files/${fileKey}/nodes?ids=${nodeIds.join(",")}${depth ? `&depth=${depth}` : ""}`;
|
|
70
|
+
console.error(`Retrieving Figma nodes: ${nodeIds.join(", ")} from ${fileKey} (depth: ${depth ?? "default"})`);
|
|
71
|
+
const response = await this.request(endpoint);
|
|
72
|
+
return response;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get comprehensive Figma design data in simplified, AI-friendly format
|
|
76
|
+
* This is the main method exposed to MCP tools
|
|
77
|
+
*
|
|
78
|
+
* @param fileKey - The Figma file key from the URL
|
|
79
|
+
* @param nodeId - Optional specific node ID(s) to fetch (format: "1:10" or "1:10;2:20")
|
|
80
|
+
* @param depth - Optional tree traversal depth limit
|
|
81
|
+
* @returns Simplified design data ready for AI consumption
|
|
82
|
+
*/
|
|
83
|
+
async getFigmaData(fileKey, nodeId, depth) {
|
|
84
|
+
try {
|
|
85
|
+
// Fetch raw data from Figma API
|
|
86
|
+
let rawData;
|
|
87
|
+
if (nodeId) {
|
|
88
|
+
// Parse node IDs (support both single and multiple, semicolon-separated)
|
|
89
|
+
const nodeIds = nodeId.split(";").map(id => id.trim()).filter(id => id.length > 0);
|
|
90
|
+
rawData = await this.getFigmaNodes(fileKey, nodeIds, depth);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
rawData = await this.getFigmaFile(fileKey, depth);
|
|
94
|
+
}
|
|
95
|
+
// Transform raw Figma data into simplified format using extractors
|
|
96
|
+
const options = {
|
|
97
|
+
maxDepth: depth,
|
|
98
|
+
};
|
|
99
|
+
const simplifiedData = simplifyRawFigmaObject(rawData, allExtractors, options);
|
|
100
|
+
return simplifiedData;
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
console.error("Error fetching Figma data:", error);
|
|
104
|
+
throw new Error(`Failed to fetch Figma data: ${error.message}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|