@atlaskit/ads-mcp 0.8.1 → 0.8.2
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/CHANGELOG.md +9 -0
- package/README.md +132 -85
- package/dist/cjs/helpers/validation.js +49 -0
- package/dist/cjs/index.js +49 -22
- package/dist/cjs/tools/analyze-a11y/index.js +8 -8
- package/dist/cjs/tools/get-a11y-guidelines/index.js +3 -3
- package/dist/cjs/tools/plan/index.js +5 -5
- package/dist/cjs/tools/search-components/index.js +5 -5
- package/dist/cjs/tools/search-icons/index.js +5 -5
- package/dist/cjs/tools/search-tokens/index.js +5 -5
- package/dist/cjs/tools/suggest-a11y-fixes/index.js +3 -3
- package/dist/es2019/helpers/validation.js +41 -0
- package/dist/es2019/index.js +41 -20
- package/dist/es2019/tools/analyze-a11y/index.js +7 -7
- package/dist/es2019/tools/get-a11y-guidelines/index.js +2 -2
- package/dist/es2019/tools/plan/index.js +4 -4
- package/dist/es2019/tools/search-components/index.js +4 -4
- package/dist/es2019/tools/search-icons/index.js +4 -4
- package/dist/es2019/tools/search-tokens/index.js +4 -4
- package/dist/es2019/tools/suggest-a11y-fixes/index.js +2 -2
- package/dist/esm/helpers/validation.js +43 -0
- package/dist/esm/index.js +56 -29
- package/dist/esm/tools/analyze-a11y/index.js +7 -7
- package/dist/esm/tools/get-a11y-guidelines/index.js +2 -2
- package/dist/esm/tools/plan/index.js +4 -4
- package/dist/esm/tools/search-components/index.js +4 -4
- package/dist/esm/tools/search-icons/index.js +4 -4
- package/dist/esm/tools/search-tokens/index.js +4 -4
- package/dist/esm/tools/suggest-a11y-fixes/index.js +2 -2
- package/dist/types/helpers/validation.d.ts +26 -0
- package/dist/types/tools/analyze-a11y/index.d.ts +35 -12
- package/dist/types/tools/get-a11y-guidelines/index.d.ts +9 -3
- package/dist/types/tools/plan/index.d.ts +6 -7
- package/dist/types/tools/search-components/index.d.ts +6 -7
- package/dist/types/tools/search-icons/index.d.ts +6 -7
- package/dist/types/tools/search-tokens/index.d.ts +6 -7
- package/dist/types/tools/suggest-a11y-fixes/index.d.ts +18 -6
- package/dist/types-ts4.5/helpers/validation.d.ts +26 -0
- package/dist/types-ts4.5/tools/analyze-a11y/index.d.ts +35 -12
- package/dist/types-ts4.5/tools/get-a11y-guidelines/index.d.ts +9 -3
- package/dist/types-ts4.5/tools/plan/index.d.ts +6 -7
- package/dist/types-ts4.5/tools/search-components/index.d.ts +6 -7
- package/dist/types-ts4.5/tools/search-icons/index.d.ts +6 -7
- package/dist/types-ts4.5/tools/search-tokens/index.d.ts +6 -7
- package/dist/types-ts4.5/tools/suggest-a11y-fixes/index.d.ts +18 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/ads-mcp
|
|
2
2
|
|
|
3
|
+
## 0.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`64561aae4b705`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/64561aae4b705) -
|
|
8
|
+
Enhance README.md with comprehensive updates including a new Table of Contents, detailed usage
|
|
9
|
+
instructions for various tools, and FAQs for troubleshooting. Added sections on accessibility
|
|
10
|
+
features and environment variables for better user guidance.
|
|
11
|
+
|
|
3
12
|
## 0.8.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -8,6 +8,29 @@ provides tools to access design tokens, icons, and components/primitives program
|
|
|
8
8
|
**New: Accessibility Analysis & Guidance** The server now includes comprehensive accessibility tools
|
|
9
9
|
to help ensure your interfaces are accessible to all users.
|
|
10
10
|
|
|
11
|
+
## Table of Contents
|
|
12
|
+
|
|
13
|
+
- [Available Tools](#available-tools)
|
|
14
|
+
- [Design System Tools](#design-system-tools)
|
|
15
|
+
- [Accessibility Tools](#accessibility-tools)
|
|
16
|
+
- [Accessibility Features](#accessibility-features)
|
|
17
|
+
- [Example Usage](#example-usage)
|
|
18
|
+
- [Usage](#usage)
|
|
19
|
+
- [For AFM Users (internal Atlassians only)](#for-afm-users-internal-atlassians-only)
|
|
20
|
+
- [For non-AFM Users](#for-non-afm-users)
|
|
21
|
+
- [Cursor IDE](#cursor-ide)
|
|
22
|
+
- [Visual Studio Code](#visual-studio-code)
|
|
23
|
+
- [Github Copilot](#github-copilot)
|
|
24
|
+
- [Codelassian](#codelassian)
|
|
25
|
+
- [Rovodev](#rovodev)
|
|
26
|
+
- [MCP Plugin for Atlas CLI](#mcp-plugin-for-atlas-cli)
|
|
27
|
+
- [Environment Variables](#environment-variables)
|
|
28
|
+
- [Analytics](#analytics)
|
|
29
|
+
- [What We Track](#what-we-track)
|
|
30
|
+
- [Privacy & Error Handling](#privacy--error-handling)
|
|
31
|
+
- [Development](#development)
|
|
32
|
+
- [FAQs](#faqs)
|
|
33
|
+
|
|
11
34
|
## Available Tools
|
|
12
35
|
|
|
13
36
|
### Design System Tools
|
|
@@ -104,9 +127,22 @@ const fixes = await suggest_a11y_fixes({
|
|
|
104
127
|
|
|
105
128
|
## Usage
|
|
106
129
|
|
|
107
|
-
###
|
|
130
|
+
### For AFM Users (internal Atlassians only)
|
|
131
|
+
|
|
132
|
+
If you are working in the AFM root folder or any of the main product folders (`platform/`, `jira/`, `confluence/`,
|
|
133
|
+
`post-office/`, `confluence/`, or `townsquare/`), ads-mcp is pre-configured and ready to use with
|
|
134
|
+
supported tools like Cursor, VSCode (Copilot/Codelassian), and Rovodev.
|
|
135
|
+
|
|
136
|
+
For most users, ads-mcp is pre-configured in AFM, but you may need to manually enable it in
|
|
137
|
+
Cursor or Copilot. Rovodev users get ads-mcp enabled automatically anywhere within AFM. For other
|
|
138
|
+
tools, make sure you are running them from the AFM root or one of the main product folders to access
|
|
139
|
+
ads-mcp.
|
|
108
140
|
|
|
109
|
-
|
|
141
|
+
### For non-AFM Users
|
|
142
|
+
#### Cursor IDE
|
|
143
|
+
|
|
144
|
+
Add the following entry to your `mcp.json` file (located at `~/.cursor/mcp.json` for user-level or
|
|
145
|
+
`.cursor/mcp.json` in your workspace):
|
|
110
146
|
|
|
111
147
|
```json
|
|
112
148
|
{
|
|
@@ -122,9 +158,13 @@ Add the following entry to your `mcp.json` file (located at `~/.cursor/mcp.json`
|
|
|
122
158
|
}
|
|
123
159
|
```
|
|
124
160
|
|
|
125
|
-
|
|
161
|
+
#### Visual Studio Code
|
|
162
|
+
|
|
163
|
+
##### Github Copilot
|
|
126
164
|
|
|
127
|
-
Add the following entry to your `mcp.json` file (located at
|
|
165
|
+
Add the following entry to your `mcp.json` file (located at
|
|
166
|
+
`~/Library/Application Support/Code/User/mcp.json` for user-level or `.vscode/mcp.json` in your
|
|
167
|
+
workspace):
|
|
128
168
|
|
|
129
169
|
```json
|
|
130
170
|
{
|
|
@@ -133,32 +173,62 @@ Add the following entry to your `mcp.json` file (located at `~/Library/Applicati
|
|
|
133
173
|
"type": "stdio",
|
|
134
174
|
"command": "npx",
|
|
135
175
|
"args": ["-y", "@atlaskit/ads-mcp"]
|
|
176
|
+
},
|
|
177
|
+
"env": {
|
|
178
|
+
"ADSMCMP_AGENT": "vscode"
|
|
136
179
|
}
|
|
137
180
|
}
|
|
138
181
|
}
|
|
139
182
|
```
|
|
140
183
|
|
|
141
|
-
|
|
184
|
+
##### Codelassian
|
|
142
185
|
|
|
143
|
-
Add the following entry to your `mcp.json` file (located at `~/.
|
|
186
|
+
Add the following entry to your `mcp.json` file (located at `~/.codelassian/mcp.json` for user-level
|
|
187
|
+
or `.codelassian/mcp.json` in your workspace):
|
|
144
188
|
|
|
145
189
|
```json
|
|
146
190
|
{
|
|
147
191
|
"mcpServers": {
|
|
148
192
|
"ads-mcp": {
|
|
149
193
|
"command": "npx",
|
|
150
|
-
"args": ["-y", "@atlaskit/ads-mcp"]
|
|
194
|
+
"args": ["-y", "@atlaskit/ads-mcp"],
|
|
195
|
+
"env": {
|
|
196
|
+
"ADSMCP_AGENT": "codelassian"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Rovodev
|
|
204
|
+
|
|
205
|
+
Add the following entry to your `mcp.json` file (located at `~/.rovodev/mcp.json` for user-level or
|
|
206
|
+
`mcp.json` in your workspace):
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"mcpServers": {
|
|
211
|
+
"ads-mcp": {
|
|
212
|
+
"command": "npx",
|
|
213
|
+
"args": ["-y", "@atlaskit/ads-mcp"],
|
|
214
|
+
"env": {
|
|
215
|
+
"ADSMCP_AGENT": "rovodev"
|
|
216
|
+
}
|
|
151
217
|
}
|
|
152
218
|
}
|
|
153
219
|
}
|
|
154
220
|
```
|
|
155
|
-
> **Note:**
|
|
156
|
-
> The `timeout` field is supported in the Rovodev configuration. For example, setting `"timeout": 300` will specify the maximum time in **seconds** that the MCP server will wait before terminating the process if it becomes unresponsive. Adjust this value as needed for your environment or workflow.
|
|
157
221
|
|
|
222
|
+
> **Note:**
|
|
223
|
+
> The `timeout` field is supported in the Rovodev configuration. For example, setting
|
|
224
|
+
> `"timeout": 300` will specify the maximum time in **seconds** that the MCP server will wait before
|
|
225
|
+
> terminating the process if it becomes unresponsive. Adjust this value as needed for your
|
|
226
|
+
> environment or workflow.
|
|
158
227
|
|
|
159
|
-
|
|
228
|
+
#### MCP Plugin for Atlas CLI
|
|
160
229
|
|
|
161
|
-
Atlas CLI provides a plugin for managing MCP servers, including listing available servers from a
|
|
230
|
+
Atlas CLI provides a plugin for managing MCP servers, including listing available servers from a
|
|
231
|
+
registry and installing new ones.
|
|
162
232
|
|
|
163
233
|
To install the MCP plugin, run:
|
|
164
234
|
|
|
@@ -173,69 +243,16 @@ atlas mcp install --name=ads-mcp --agent=rovodev
|
|
|
173
243
|
```
|
|
174
244
|
|
|
175
245
|
> **Note:**
|
|
176
|
-
> To see the list of available agents, visit:
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
### AFM-specific issues
|
|
180
|
-
|
|
181
|
-
When using the Atlassian Frontend Monorepo (AFM), there are some issues with project-level or workspace-level MCP configuration when using `npx`. These issues typically manifest as:
|
|
182
|
-
|
|
183
|
-
- **Performance**: `npx` can be slower in AFM environments due to package resolution overhead
|
|
184
|
-
- **Reliability**: Network timeouts and package resolution conflicts are more common
|
|
185
|
-
|
|
186
|
-
> **Note:** These issues only affect project-level or workspace-level MCP configurations. User-level settings (like `~/.cursor/mcp.json` or `~/.rovodev/mcp.json`) work fine with `npx` and don't require the workarounds below.
|
|
187
|
-
|
|
188
|
-
#### Recommended Solution
|
|
189
|
-
|
|
190
|
-
Instead of using `npx`, `yarn dlx` provides better speed and reliability in AFM environments because:
|
|
191
|
-
|
|
192
|
-
- **Faster execution**: Leverages AFM's existing yarn workspace configuration
|
|
193
|
-
- **Better caching**: Uses yarn's package cache more effectively
|
|
194
|
-
- **Consistent resolution**: Respects AFM's package resolution strategy
|
|
195
|
-
|
|
196
|
-
#### Simple Configuration
|
|
197
|
-
|
|
198
|
-
For most AFM users, this configuration will work reliably:
|
|
199
|
-
|
|
200
|
-
```json
|
|
201
|
-
{
|
|
202
|
-
"mcpServers": {
|
|
203
|
-
"ads-mcp": {
|
|
204
|
-
"command": "yarn",
|
|
205
|
-
"args": [
|
|
206
|
-
"dlx",
|
|
207
|
-
"-q",
|
|
208
|
-
"@atlaskit/ads-mcp"
|
|
209
|
-
]
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
#### Robust Configuration with Fallback
|
|
216
|
-
|
|
217
|
-
If you need maximum reliability across different environments, use this configuration that falls back to `npm` if `yarn` is unavailable:
|
|
246
|
+
> To see the list of available agents, visit:
|
|
247
|
+
> [Introducing the MCP plugin for Atlas CLI](https://hello.atlassian.net/wiki/spaces/~dnorton/blog/2025/10/07/5931517464/Introducing+the+MCP+plugin+for+Atlas+CLI)
|
|
218
248
|
|
|
219
|
-
|
|
220
|
-
{
|
|
221
|
-
"mcpServers": {
|
|
222
|
-
"ads-mcp": {
|
|
223
|
-
"command": "sh",
|
|
224
|
-
"args": [
|
|
225
|
-
"-c",
|
|
226
|
-
"which yarn &>/dev/null && [ \"$(yarn --version | cut -d. -f1)\" -ge 2 ] && yarn dlx -q @atlaskit/ads-mcp || (which ads-mcp &>/dev/null && (npm update -g @atlaskit/ads-mcp && ads-mcp) || (npm install -g @atlaskit/ads-mcp && ads-mcp))"
|
|
227
|
-
]
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
```
|
|
249
|
+
### Environment Variables
|
|
232
250
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
3. **Finally installs globally** with npm if nothing else works
|
|
251
|
+
The ADS MCP server supports several environment variables, mainly for analytics purposes to help
|
|
252
|
+
improve the service. These variables enable platform identification, specification of configuration
|
|
253
|
+
paths, and opting out of analytics collection if needed.
|
|
237
254
|
|
|
238
|
-
|
|
255
|
+
> **Note:** All environment variables are optional. The MCP server will work without any of them set.
|
|
239
256
|
|
|
240
257
|
- `ADSMCP_AGENT` - Identifies the AI agent/platform using the MCP server. Supported values:
|
|
241
258
|
- `cursor` - Cursor editor
|
|
@@ -247,21 +264,28 @@ This robust configuration:
|
|
|
247
264
|
The `ADSMCP_AGENT` variable helps track which platforms are using the MCP server for analytics
|
|
248
265
|
purposes.
|
|
249
266
|
|
|
267
|
+
- `ADSMCP_CONFIG_PATH` - Specifies the path to the MCP config file being used to run the server.
|
|
268
|
+
This is used for analytics to understand where the server is being configured from (e.g.,
|
|
269
|
+
`mcp.json`, `jira/.cursor/mcp.json`, `platform/.vscode/mcp.json`). Defaults to `unknown` if not
|
|
270
|
+
specified.
|
|
271
|
+
|
|
250
272
|
- `ADSMCP_ANALYTICS_OPT_OUT` - Opt out of analytics collection. Set to `true` to disable:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
273
|
+
|
|
274
|
+
```json
|
|
275
|
+
{
|
|
276
|
+
"mcpServers": {
|
|
277
|
+
"ads": {
|
|
278
|
+
"command": "npx",
|
|
279
|
+
"args": ["-y", "@atlaskit/ads-mcp"],
|
|
280
|
+
"env": {
|
|
281
|
+
"ADSMCP_AGENT": "codelassian",
|
|
282
|
+
"ADSMCP_CONFIG_PATH": "platform/.codelassian/mcp.json",
|
|
283
|
+
"ADSMCP_ANALYTICS_OPT_OUT": true
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
```
|
|
265
289
|
|
|
266
290
|
## Analytics
|
|
267
291
|
|
|
@@ -311,3 +335,26 @@ running it from, but you should force it like so:
|
|
|
311
335
|
}
|
|
312
336
|
}
|
|
313
337
|
```
|
|
338
|
+
|
|
339
|
+
## FAQs
|
|
340
|
+
|
|
341
|
+
1. I'm seeing an error like "Error: Cannot find module
|
|
342
|
+
`/Users/[username]/.npm/_npx/[hash]/node_modules/[module]/...`"
|
|
343
|
+
|
|
344
|
+
This usually means the cached package is corrupted or outdated. To resolve:
|
|
345
|
+
1. Disable `ads-mcp` in your list of installed MCP servers.
|
|
346
|
+
2. Delete the affected `/Users/[username]/.npm/_npx/[hash]` directory.
|
|
347
|
+
3. Re-enable `ads-mcp` in your MCP servers.
|
|
348
|
+
|
|
349
|
+
2. In VSCode (Copilot), `ads-mcp` keeps auto-starting in the chat panel even when disabled.
|
|
350
|
+
|
|
351
|
+
To prevent auto-start:
|
|
352
|
+
1. Open VSCode settings.
|
|
353
|
+
2. Search for `@feature:chat mcp`.
|
|
354
|
+
3. Set `Chat › Mcp: Autostart` to `never`.
|
|
355
|
+
|
|
356
|
+
3. Who should I contact for support or questions?
|
|
357
|
+
|
|
358
|
+
For internal Atlassians, please reach out in the
|
|
359
|
+
[#help-ads-ai](https://atlassian.enterprise.slack.com/archives/C091C8JCUTV) Slack channel with
|
|
360
|
+
any issues or inquiries.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.validateToolArguments = validateToolArguments;
|
|
7
|
+
var _zodToJsonSchema = require("zod-to-json-schema");
|
|
8
|
+
/**
|
|
9
|
+
* Validates arguments against a Zod schema and returns a discriminated union result.
|
|
10
|
+
*
|
|
11
|
+
* @param schema - The Zod schema to validate against
|
|
12
|
+
* @param args - The arguments to validate
|
|
13
|
+
* @returns { success: true; data: T } if validation succeeds, { success: false; error: ValidationErrorResult } if validation fails
|
|
14
|
+
*/
|
|
15
|
+
function validateToolArguments(schema, args) {
|
|
16
|
+
var result = schema.safeParse(args);
|
|
17
|
+
if (result.success) {
|
|
18
|
+
return {
|
|
19
|
+
success: true,
|
|
20
|
+
data: result.data
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Convert the Zod schema to JSON Schema for the error response
|
|
25
|
+
var jsonSchema = (0, _zodToJsonSchema.zodToJsonSchema)(schema);
|
|
26
|
+
var validationErrors = result.error.errors.map(function (error) {
|
|
27
|
+
return {
|
|
28
|
+
path: error.path.join('.'),
|
|
29
|
+
message: error.message,
|
|
30
|
+
code: error.code
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
var errorMessage = {
|
|
34
|
+
error: 'Invalid arguments provided',
|
|
35
|
+
validationErrors: validationErrors,
|
|
36
|
+
expectedSchema: jsonSchema,
|
|
37
|
+
receivedArguments: args
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
success: false,
|
|
41
|
+
error: {
|
|
42
|
+
content: [{
|
|
43
|
+
isError: true,
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: JSON.stringify(errorMessage, null, 2)
|
|
46
|
+
}]
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
5
6
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
7
|
var _index = require("@modelcontextprotocol/sdk/server/index.js");
|
|
7
8
|
var _stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
8
9
|
var _types = require("@modelcontextprotocol/sdk/types.js");
|
|
9
10
|
var _analytics = require("./helpers/analytics");
|
|
11
|
+
var _validation = require("./helpers/validation");
|
|
10
12
|
var _instructions = require("./instructions");
|
|
11
13
|
var _analyzeA11y = require("./tools/analyze-a11y");
|
|
12
14
|
var _getA11yGuidelines = require("./tools/get-a11y-guidelines");
|
|
@@ -91,30 +93,30 @@ server.setRequestHandler(_types.ListToolsRequestSchema, /*#__PURE__*/function ()
|
|
|
91
93
|
};
|
|
92
94
|
}());
|
|
93
95
|
var callTools = {
|
|
94
|
-
ads_analyze_a11y: _analyzeA11y.analyzeA11yTool,
|
|
95
|
-
ads_analyze_localhost_a11y: _analyzeA11y.analyzeLocalhostA11yTool,
|
|
96
|
-
ads_get_a11y_guidelines: _getA11yGuidelines.getA11yGuidelinesTool,
|
|
97
|
-
ads_get_all_icons: _getAllIcons.getAllIconsTool,
|
|
98
|
-
ads_get_all_tokens: _getAllTokens.getAllTokensTool,
|
|
99
|
-
ads_get_components: _getComponents.getComponentsTool,
|
|
100
|
-
ads_plan: _plan.planTool,
|
|
96
|
+
ads_analyze_a11y: [_analyzeA11y.analyzeA11yTool, _analyzeA11y.analyzeA11yInputSchema],
|
|
97
|
+
ads_analyze_localhost_a11y: [_analyzeA11y.analyzeLocalhostA11yTool, _analyzeA11y.analyzeA11yLocalhostInputSchema],
|
|
98
|
+
ads_get_a11y_guidelines: [_getA11yGuidelines.getA11yGuidelinesTool, _getA11yGuidelines.getA11yGuidelinesInputSchema],
|
|
99
|
+
ads_get_all_icons: [_getAllIcons.getAllIconsTool, null],
|
|
100
|
+
ads_get_all_tokens: [_getAllTokens.getAllTokensTool, null],
|
|
101
|
+
ads_get_components: [_getComponents.getComponentsTool, null],
|
|
102
|
+
ads_plan: [_plan.planTool, _plan.planInputSchema],
|
|
101
103
|
// NOTE: These should not actually be called as they're not in the `list_tools` endpoint.
|
|
102
104
|
// But there might be a reason to keep them around for backwards-compatibility.
|
|
103
|
-
ads_search_components: _searchComponents.searchComponentsTool,
|
|
104
|
-
ads_search_icons: _searchIcons.searchIconsTool,
|
|
105
|
-
ads_search_tokens: _searchTokens.searchTokensTool,
|
|
106
|
-
ads_suggest_a11y_fixes: _suggestA11yFixes.suggestA11yFixesTool
|
|
105
|
+
ads_search_components: [_searchComponents.searchComponentsTool, _searchComponents.searchComponentsInputSchema],
|
|
106
|
+
ads_search_icons: [_searchIcons.searchIconsTool, _searchIcons.searchIconsInputSchema],
|
|
107
|
+
ads_search_tokens: [_searchTokens.searchTokensTool, _searchTokens.searchTokensInputSchema],
|
|
108
|
+
ads_suggest_a11y_fixes: [_suggestA11yFixes.suggestA11yFixesTool, _suggestA11yFixes.suggestA11yFixesInputSchema]
|
|
107
109
|
};
|
|
108
110
|
|
|
109
111
|
// Handle tool execution
|
|
110
112
|
server.setRequestHandler(_types.CallToolRequestSchema, /*#__PURE__*/function () {
|
|
111
113
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(request, extra) {
|
|
112
|
-
var toolName, tool, actionSubject, result;
|
|
114
|
+
var toolName, _callTools$toolName, tool, inputSchema, actionSubject, toolArguments, inputValidation, result;
|
|
113
115
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
114
116
|
while (1) switch (_context2.prev = _context2.next) {
|
|
115
117
|
case 0:
|
|
116
118
|
toolName = request.params.name;
|
|
117
|
-
|
|
119
|
+
_callTools$toolName = (0, _slicedToArray2.default)(callTools[toolName], 2), tool = _callTools$toolName[0], inputSchema = _callTools$toolName[1];
|
|
118
120
|
actionSubject = "ads.mcp.callTool"; // Track call tool request
|
|
119
121
|
(0, _analytics.sendOperationalEvent)({
|
|
120
122
|
action: 'called',
|
|
@@ -127,13 +129,38 @@ server.setRequestHandler(_types.CallToolRequestSchema, /*#__PURE__*/function ()
|
|
|
127
129
|
}
|
|
128
130
|
});
|
|
129
131
|
if (!tool) {
|
|
130
|
-
_context2.next =
|
|
132
|
+
_context2.next = 23;
|
|
131
133
|
break;
|
|
132
134
|
}
|
|
133
135
|
_context2.prev = 5;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
if (!inputSchema) {
|
|
137
|
+
_context2.next = 12;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
inputValidation = (0, _validation.validateToolArguments)(inputSchema, request.params.arguments);
|
|
141
|
+
if (inputValidation.success) {
|
|
142
|
+
_context2.next = 11;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
(0, _analytics.sendOperationalEvent)({
|
|
146
|
+
action: 'failed',
|
|
147
|
+
actionSubject: actionSubject,
|
|
148
|
+
actionSubjectId: toolName,
|
|
149
|
+
attributes: {
|
|
150
|
+
toolName: toolName,
|
|
151
|
+
request: request,
|
|
152
|
+
extra: extra,
|
|
153
|
+
errorMessage: 'Invalid arguments provided',
|
|
154
|
+
failedValidation: true
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
return _context2.abrupt("return", inputValidation.error);
|
|
158
|
+
case 11:
|
|
159
|
+
toolArguments = inputValidation.data;
|
|
160
|
+
case 12:
|
|
161
|
+
_context2.next = 14;
|
|
162
|
+
return tool(toolArguments);
|
|
163
|
+
case 14:
|
|
137
164
|
result = _context2.sent;
|
|
138
165
|
// Track successful tool execution
|
|
139
166
|
(0, _analytics.sendOperationalEvent)({
|
|
@@ -147,8 +174,8 @@ server.setRequestHandler(_types.CallToolRequestSchema, /*#__PURE__*/function ()
|
|
|
147
174
|
}
|
|
148
175
|
});
|
|
149
176
|
return _context2.abrupt("return", result);
|
|
150
|
-
case
|
|
151
|
-
_context2.prev =
|
|
177
|
+
case 19:
|
|
178
|
+
_context2.prev = 19;
|
|
152
179
|
_context2.t0 = _context2["catch"](5);
|
|
153
180
|
// Track tool execution error
|
|
154
181
|
(0, _analytics.sendOperationalEvent)({
|
|
@@ -168,7 +195,7 @@ server.setRequestHandler(_types.CallToolRequestSchema, /*#__PURE__*/function ()
|
|
|
168
195
|
- when used alone, without the throw new McpError, it causes "Client error for command...", which will loop back to this catch
|
|
169
196
|
*/
|
|
170
197
|
throw new _types.McpError(-32000, "Failed to execute '".concat(toolName, "' tool: ").concat(_context2.t0 instanceof Error ? _context2.t0.message : 'Unknown error'));
|
|
171
|
-
case
|
|
198
|
+
case 23:
|
|
172
199
|
// Track tool not found error
|
|
173
200
|
(0, _analytics.sendOperationalEvent)({
|
|
174
201
|
action: 'notFound',
|
|
@@ -182,11 +209,11 @@ server.setRequestHandler(_types.CallToolRequestSchema, /*#__PURE__*/function ()
|
|
|
182
209
|
});
|
|
183
210
|
console.error("Tool '".concat(request.params.name, "' not found, only the following tools are available: ").concat(Object.keys(callTools).join(', ')));
|
|
184
211
|
return _context2.abrupt("return");
|
|
185
|
-
case
|
|
212
|
+
case 26:
|
|
186
213
|
case "end":
|
|
187
214
|
return _context2.stop();
|
|
188
215
|
}
|
|
189
|
-
}, _callee2, null, [[5,
|
|
216
|
+
}, _callee2, null, [[5, 19]]);
|
|
190
217
|
}));
|
|
191
218
|
return function (_x3, _x4) {
|
|
192
219
|
return _ref2.apply(this, arguments);
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.listAnalyzeLocalhostA11yTool = exports.listAnalyzeA11yTool = exports.analyzeLocalhostA11yTool = exports.analyzeA11yTool = void 0;
|
|
7
|
+
exports.listAnalyzeLocalhostA11yTool = exports.listAnalyzeA11yTool = exports.analyzeLocalhostA11yTool = exports.analyzeA11yTool = exports.analyzeA11yLocalhostInputSchema = exports.analyzeA11yInputSchema = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
@@ -16,11 +16,11 @@ var _zod = require("zod");
|
|
|
16
16
|
var _zodToJsonSchema = require("zod-to-json-schema");
|
|
17
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
-
var
|
|
19
|
+
var analyzeA11yInputSchema = exports.analyzeA11yInputSchema = _zod.z.object({
|
|
20
20
|
code: _zod.z.string().describe('React component code to analyze for accessibility'),
|
|
21
|
-
componentName: _zod.z.string().
|
|
22
|
-
context: _zod.z.string().
|
|
23
|
-
includePatternAnalysis: _zod.z.boolean().
|
|
21
|
+
componentName: _zod.z.string().describe('Name of the component being analyzed').optional(),
|
|
22
|
+
context: _zod.z.string().describe('Additional context about the component usage').optional(),
|
|
23
|
+
includePatternAnalysis: _zod.z.boolean().default(true).describe('Include pattern-based analysis in addition to axe-core').optional()
|
|
24
24
|
});
|
|
25
25
|
var listAnalyzeA11yTool = exports.listAnalyzeA11yTool = {
|
|
26
26
|
name: 'ads_analyze_a11y',
|
|
@@ -32,9 +32,9 @@ var listAnalyzeA11yTool = exports.listAnalyzeA11yTool = {
|
|
|
32
32
|
idempotentHint: true,
|
|
33
33
|
openWorldHint: true
|
|
34
34
|
},
|
|
35
|
-
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(
|
|
35
|
+
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(analyzeA11yInputSchema)
|
|
36
36
|
};
|
|
37
|
-
var
|
|
37
|
+
var analyzeA11yLocalhostInputSchema = exports.analyzeA11yLocalhostInputSchema = _zod.z.object({
|
|
38
38
|
url: _zod.z.string().describe('The URL to analyze for accessibility (e.g. `http://localhost:9000`)'),
|
|
39
39
|
componentName: _zod.z.string().optional().describe('Name of the component being analyzed'),
|
|
40
40
|
context: _zod.z.string().optional().describe('Additional context about the component usage'),
|
|
@@ -50,7 +50,7 @@ var listAnalyzeLocalhostA11yTool = exports.listAnalyzeLocalhostA11yTool = {
|
|
|
50
50
|
idempotentHint: true,
|
|
51
51
|
openWorldHint: true
|
|
52
52
|
},
|
|
53
|
-
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(
|
|
53
|
+
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(analyzeA11yLocalhostInputSchema)
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
// Common accessibility patterns to detect in code
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.listGetA11yGuidelinesTool = exports.getA11yGuidelinesTool = void 0;
|
|
7
|
+
exports.listGetA11yGuidelinesTool = exports.getA11yGuidelinesTool = exports.getA11yGuidelinesInputSchema = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
@@ -14,7 +14,7 @@ var _guidelines = require("./guidelines");
|
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
16
|
var topics = Object.keys(_guidelines.accessibilityGuidelines);
|
|
17
|
-
var
|
|
17
|
+
var getA11yGuidelinesInputSchema = exports.getA11yGuidelinesInputSchema = _zod.z.object({
|
|
18
18
|
topic: _zod.z.string().optional().describe('Select the topic to get the accessibility guidelines for: ' + topics.join(', '))
|
|
19
19
|
});
|
|
20
20
|
var listGetA11yGuidelinesTool = exports.listGetA11yGuidelinesTool = {
|
|
@@ -27,7 +27,7 @@ var listGetA11yGuidelinesTool = exports.listGetA11yGuidelinesTool = {
|
|
|
27
27
|
idempotentHint: true,
|
|
28
28
|
openWorldHint: true
|
|
29
29
|
},
|
|
30
|
-
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(
|
|
30
|
+
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(getA11yGuidelinesInputSchema)
|
|
31
31
|
};
|
|
32
32
|
var getA11yGuidelinesTool = exports.getA11yGuidelinesTool = /*#__PURE__*/function () {
|
|
33
33
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.planTool = exports.listPlanTool = void 0;
|
|
7
|
+
exports.planTool = exports.planInputSchema = exports.listPlanTool = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
@@ -15,12 +15,12 @@ var _searchIcons = require("../search-icons");
|
|
|
15
15
|
var _searchTokens = require("../search-tokens");
|
|
16
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
-
var
|
|
18
|
+
var planInputSchema = exports.planInputSchema = _zod.z.object({
|
|
19
19
|
tokens: _zod.z.array(_zod.z.string()).describe('Array of terms to search for tokens, eg. `["spacing", "inverted text", "background primary"]`. Provide a minimum of 2 terms when known.'),
|
|
20
20
|
icons: _zod.z.array(_zod.z.string()).describe('Array of terms to search for icons, eg. `["search", "folder", "user"]`. Provide a minimum of 2 terms when known.'),
|
|
21
21
|
components: _zod.z.array(_zod.z.string()).describe('Array of terms to search for components, eg. `["button", "input", "select"]`. Provide a minimum of 2 terms when known.'),
|
|
22
|
-
limit: _zod.z.number().
|
|
23
|
-
exactName: _zod.z.boolean().
|
|
22
|
+
limit: _zod.z.number().default(1).describe('Maximum number of results per search term in the provided arrays (default: 1)').optional(),
|
|
23
|
+
exactName: _zod.z.boolean().default(false).describe('Search tokens, icons, and components by their exact name match (use when you explicitly know the name and need more details)').optional()
|
|
24
24
|
});
|
|
25
25
|
var listPlanTool = exports.listPlanTool = {
|
|
26
26
|
name: 'ads_plan',
|
|
@@ -32,7 +32,7 @@ var listPlanTool = exports.listPlanTool = {
|
|
|
32
32
|
idempotentHint: true,
|
|
33
33
|
openWorldHint: true
|
|
34
34
|
},
|
|
35
|
-
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(
|
|
35
|
+
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(planInputSchema)
|
|
36
36
|
};
|
|
37
37
|
var planTool = exports.planTool = /*#__PURE__*/function () {
|
|
38
38
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(params) {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.searchComponentsTool = exports.listSearchComponentsTool = void 0;
|
|
7
|
+
exports.searchComponentsTool = exports.searchComponentsInputSchema = exports.listSearchComponentsTool = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _fuse = _interopRequireDefault(require("fuse.js"));
|
|
@@ -12,10 +12,10 @@ var _zod = require("zod");
|
|
|
12
12
|
var _zodToJsonSchema = require("zod-to-json-schema");
|
|
13
13
|
var _helpers = require("../../helpers");
|
|
14
14
|
var _components = require("../get-components/components");
|
|
15
|
-
var
|
|
15
|
+
var searchComponentsInputSchema = exports.searchComponentsInputSchema = _zod.z.object({
|
|
16
16
|
terms: _zod.z.array(_zod.z.string()).describe('An array of search terms to find components by name, package name, description, or example, eg. `["button", "input", "select"]`'),
|
|
17
|
-
limit: _zod.z.number().
|
|
18
|
-
exactName: _zod.z.boolean().
|
|
17
|
+
limit: _zod.z.number().default(1).describe('Maximum number of results per search term in the array (default: 1)').optional(),
|
|
18
|
+
exactName: _zod.z.boolean().default(false).describe('Enable to explicitly search components by the exact name match (when you know the name, but need more details)').optional()
|
|
19
19
|
});
|
|
20
20
|
var listSearchComponentsTool = exports.listSearchComponentsTool = {
|
|
21
21
|
name: 'ads_search_components',
|
|
@@ -27,7 +27,7 @@ var listSearchComponentsTool = exports.listSearchComponentsTool = {
|
|
|
27
27
|
idempotentHint: true,
|
|
28
28
|
openWorldHint: true
|
|
29
29
|
},
|
|
30
|
-
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(
|
|
30
|
+
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(searchComponentsInputSchema)
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// Clean component result to only return name, package name, example, and props
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.searchIconsTool = exports.listSearchIconsTool = void 0;
|
|
7
|
+
exports.searchIconsTool = exports.searchIconsInputSchema = exports.listSearchIconsTool = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -13,10 +13,10 @@ var _zod = require("zod");
|
|
|
13
13
|
var _zodToJsonSchema = require("zod-to-json-schema");
|
|
14
14
|
var _metadata = require("@atlaskit/icon/metadata");
|
|
15
15
|
var _helpers = require("../../helpers");
|
|
16
|
-
var
|
|
16
|
+
var searchIconsInputSchema = exports.searchIconsInputSchema = _zod.z.object({
|
|
17
17
|
terms: _zod.z.array(_zod.z.string()).describe('An array of search terms to find icons by name, keywords, or categorization, eg. `["search", "folder", "user"]`'),
|
|
18
|
-
limit: _zod.z.number().
|
|
19
|
-
exactName: _zod.z.boolean().
|
|
18
|
+
limit: _zod.z.number().default(1).describe('Maximum number of results per search term in the array (default: 1)').optional(),
|
|
19
|
+
exactName: _zod.z.boolean().default(false).describe('Enable to explicitly search icons by the exact name match (when you know the name, but need more details)').optional()
|
|
20
20
|
});
|
|
21
21
|
var icons = Object.entries(_metadata.coreIconMetadata).map(function (_ref) {
|
|
22
22
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
@@ -45,7 +45,7 @@ var listSearchIconsTool = exports.listSearchIconsTool = {
|
|
|
45
45
|
idempotentHint: true,
|
|
46
46
|
openWorldHint: true
|
|
47
47
|
},
|
|
48
|
-
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(
|
|
48
|
+
inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(searchIconsInputSchema)
|
|
49
49
|
};
|
|
50
50
|
var searchIconsTool = exports.searchIconsTool = /*#__PURE__*/function () {
|
|
51
51
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(params) {
|