@atlaskit/ads-mcp 1.7.4 → 1.8.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/CHANGELOG.md +31 -0
- package/dist/cjs/tools/search-tokens/list-search-tokens-tool.js +1 -1
- package/dist/cjs/tools/search-tokens/search-tokens-input-schema.js +2 -1
- package/dist/cjs/tools/search-tokens/search-tokens-tool.js +9 -6
- package/dist/es2019/tools/search-tokens/list-search-tokens-tool.js +1 -1
- package/dist/es2019/tools/search-tokens/search-tokens-input-schema.js +2 -1
- package/dist/es2019/tools/search-tokens/search-tokens-tool.js +6 -2
- package/dist/esm/tools/search-tokens/list-search-tokens-tool.js +1 -1
- package/dist/esm/tools/search-tokens/search-tokens-input-schema.js +2 -1
- package/dist/esm/tools/search-tokens/search-tokens-tool.js +9 -4
- package/dist/types/tools/search-tokens/search-tokens-input-schema.d.ts +3 -0
- package/dist/types/tools/search-tokens/search-tokens-tool.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @atlaskit/ads-mcp
|
|
2
2
|
|
|
3
|
+
## 1.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`7b42e3dbea8db`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7b42e3dbea8db) -
|
|
8
|
+
Add an opt-in `includeMetadata` option to ADS MCP token search so callers can retrieve token usage
|
|
9
|
+
guidelines while existing searches remain compact by default.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { searchTokensTool } from '@atlaskit/ads-mcp/tools/search-tokens';
|
|
13
|
+
|
|
14
|
+
await searchTokensTool({
|
|
15
|
+
terms: ['border.width.focused'],
|
|
16
|
+
includeMetadata: true,
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Metadata-inclusive results contain the existing `name` and `exampleValue` fields plus
|
|
21
|
+
`usageGuidelines`:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"name": "border.width.focused",
|
|
26
|
+
"exampleValue": "0.125rem",
|
|
27
|
+
"usageGuidelines": {
|
|
28
|
+
"usage": "Controls the thickness of borders/dividers. Use to standardize border widths throughout UI.",
|
|
29
|
+
"cssProperties": ["border-width"]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
3
34
|
## 1.7.4
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
|
@@ -10,7 +10,7 @@ var _searchTokensInputSchema = require("./search-tokens-input-schema");
|
|
|
10
10
|
|
|
11
11
|
var listSearchTokensTool = exports.listSearchTokensTool = {
|
|
12
12
|
name: 'ads_search_tokens',
|
|
13
|
-
description: "Searches Atlassian Design System **design tokens** from bundled metadata. Returns JSON objects with **name** and **exampleValue** for each match (search also considers description, usage guidelines, and CSS property hints in metadata).\n\nWHEN TO USE:\n**Styling or theming in code**\u2014you need the right `token('\u2026')` names for colors, space, typography, etc. Use during layout and visual work when tokens must match ADS. Prefer `ads_plan` when you also need icons and components in the same step.\n\nExample:\n```tsx\nimport { token } from '@atlaskit/tokens';\nconst styles = css({ color: token('color.text'), padding: token('space.100') });\n```",
|
|
13
|
+
description: "Searches Atlassian Design System **design tokens** from bundled metadata. Returns compact JSON objects with **name** and **exampleValue** for each match by default (search also considers description, usage guidelines, and CSS property hints in metadata). Set **includeMetadata** to include usage guidelines in each result.\n\nWHEN TO USE:\n**Styling or theming in code**\u2014you need the right `token('\u2026')` names for colors, space, typography, etc. Use during layout and visual work when tokens must match ADS. Prefer `ads_plan` when you also need icons and components in the same step.\n\nExample:\n```tsx\nimport { token } from '@atlaskit/tokens';\nconst styles = css({ color: token('color.text'), padding: token('space.100') });\n```",
|
|
14
14
|
annotations: {
|
|
15
15
|
title: 'Search ADS tokens',
|
|
16
16
|
readOnlyHint: true,
|
|
@@ -9,5 +9,6 @@ var _zod = require("zod");
|
|
|
9
9
|
|
|
10
10
|
var searchTokensInputSchema = exports.searchTokensInputSchema = _zod.z.object({
|
|
11
11
|
terms: _zod.z.array(_zod.z.string()).describe('Required: one or more terms; fuzzy match on token **name**, **description**, **exampleValue**, **usageGuidelines.usage**, and **usageGuidelines.cssProperties**. Example: `["spacing", "color.text", "background"]`.'),
|
|
12
|
-
limit: _zod.z.number().default(2).describe('Max matches **per term** (default 2).').optional()
|
|
12
|
+
limit: _zod.z.number().default(2).describe('Max matches **per term** (default 2).').optional(),
|
|
13
|
+
includeMetadata: _zod.z.boolean().default(false).describe('Include usage guidelines in each result (default false).').optional()
|
|
13
14
|
});
|
|
@@ -6,21 +6,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.searchTokensTool = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
12
|
var _fuse = _interopRequireDefault(require("fuse.js"));
|
|
12
13
|
var _tokenMetadata = require("@atlaskit/tokens/token-metadata");
|
|
13
14
|
var _helpers = require("../../helpers");
|
|
14
15
|
var _cleanQuery = require("../../helpers/clean-query");
|
|
15
|
-
|
|
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
|
+
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; } /* eslint-disable-next-line import/extensions -- MCP SDK requires .js extensions for ESM imports */
|
|
17
18
|
var searchTokensTool = exports.searchTokensTool = /*#__PURE__*/function () {
|
|
18
19
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
|
|
19
|
-
var terms, _ref$limit, limit, searchTerms, fuse, matchedItems, matchedTokens;
|
|
20
|
+
var terms, _ref$limit, limit, _ref$includeMetadata, includeMetadata, searchTerms, fuse, matchedItems, matchedTokens;
|
|
20
21
|
return _regenerator.default.wrap(function (_context) {
|
|
21
22
|
while (1) switch (_context.prev = _context.next) {
|
|
22
23
|
case 0:
|
|
23
|
-
terms = _ref.terms, _ref$limit = _ref.limit, limit = _ref$limit === void 0 ? 2 : _ref$limit;
|
|
24
|
+
terms = _ref.terms, _ref$limit = _ref.limit, limit = _ref$limit === void 0 ? 2 : _ref$limit, _ref$includeMetadata = _ref.includeMetadata, includeMetadata = _ref$includeMetadata === void 0 ? false : _ref$includeMetadata;
|
|
24
25
|
// Unique cleaned terms (order preserved) so duplicates don't concatenate into a bogus query.
|
|
25
26
|
searchTerms = (0, _toConsumableArray2.default)(new Set(terms.filter(Boolean).map(_cleanQuery.cleanQuery)));
|
|
26
27
|
if (searchTerms.length) {
|
|
@@ -71,10 +72,12 @@ var searchTokensTool = exports.searchTokensTool = /*#__PURE__*/function () {
|
|
|
71
72
|
searchTermsJoin: '.'
|
|
72
73
|
});
|
|
73
74
|
matchedTokens = matchedItems.map(function (item) {
|
|
74
|
-
return {
|
|
75
|
+
return _objectSpread({
|
|
75
76
|
name: item.name,
|
|
76
77
|
exampleValue: item.exampleValue
|
|
77
|
-
}
|
|
78
|
+
}, includeMetadata ? {
|
|
79
|
+
usageGuidelines: item.usageGuidelines
|
|
80
|
+
} : {});
|
|
78
81
|
});
|
|
79
82
|
if (matchedTokens.length) {
|
|
80
83
|
_context.next = 2;
|
|
@@ -4,7 +4,7 @@ import { zodToJsonSchema } from '../../helpers/zod-to-json-schema';
|
|
|
4
4
|
import { searchTokensInputSchema } from './search-tokens-input-schema';
|
|
5
5
|
export const listSearchTokensTool = {
|
|
6
6
|
name: 'ads_search_tokens',
|
|
7
|
-
description: `Searches Atlassian Design System **design tokens** from bundled metadata. Returns JSON objects with **name** and **exampleValue** for each match (search also considers description, usage guidelines, and CSS property hints in metadata).
|
|
7
|
+
description: `Searches Atlassian Design System **design tokens** from bundled metadata. Returns compact JSON objects with **name** and **exampleValue** for each match by default (search also considers description, usage guidelines, and CSS property hints in metadata). Set **includeMetadata** to include usage guidelines in each result.
|
|
8
8
|
|
|
9
9
|
WHEN TO USE:
|
|
10
10
|
**Styling or theming in code**—you need the right \`token('…')\` names for colors, space, typography, etc. Use during layout and visual work when tokens must match ADS. Prefer \`ads_plan\` when you also need icons and components in the same step.
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
export const searchTokensInputSchema = z.object({
|
|
4
4
|
terms: z.array(z.string()).describe('Required: one or more terms; fuzzy match on token **name**, **description**, **exampleValue**, **usageGuidelines.usage**, and **usageGuidelines.cssProperties**. Example: `["spacing", "color.text", "background"]`.'),
|
|
5
|
-
limit: z.number().default(2).describe('Max matches **per term** (default 2).').optional()
|
|
5
|
+
limit: z.number().default(2).describe('Max matches **per term** (default 2).').optional(),
|
|
6
|
+
includeMetadata: z.boolean().default(false).describe('Include usage guidelines in each result (default false).').optional()
|
|
6
7
|
});
|
|
@@ -6,7 +6,8 @@ import { mergeMultiTermFuseResults } from '../../helpers';
|
|
|
6
6
|
import { cleanQuery } from '../../helpers/clean-query';
|
|
7
7
|
export const searchTokensTool = async ({
|
|
8
8
|
terms,
|
|
9
|
-
limit = 2
|
|
9
|
+
limit = 2,
|
|
10
|
+
includeMetadata = false
|
|
10
11
|
}) => {
|
|
11
12
|
// Unique cleaned terms (order preserved) so duplicates don't concatenate into a bogus query.
|
|
12
13
|
const searchTerms = [...new Set(terms.filter(Boolean).map(cleanQuery))];
|
|
@@ -54,7 +55,10 @@ export const searchTokensTool = async ({
|
|
|
54
55
|
});
|
|
55
56
|
const matchedTokens = matchedItems.map(item => ({
|
|
56
57
|
name: item.name,
|
|
57
|
-
exampleValue: item.exampleValue
|
|
58
|
+
exampleValue: item.exampleValue,
|
|
59
|
+
...(includeMetadata ? {
|
|
60
|
+
usageGuidelines: item.usageGuidelines
|
|
61
|
+
} : {})
|
|
58
62
|
}));
|
|
59
63
|
if (!matchedTokens.length) {
|
|
60
64
|
return {
|
|
@@ -4,7 +4,7 @@ import { zodToJsonSchema } from '../../helpers/zod-to-json-schema';
|
|
|
4
4
|
import { searchTokensInputSchema } from './search-tokens-input-schema';
|
|
5
5
|
export var listSearchTokensTool = {
|
|
6
6
|
name: 'ads_search_tokens',
|
|
7
|
-
description: "Searches Atlassian Design System **design tokens** from bundled metadata. Returns JSON objects with **name** and **exampleValue** for each match (search also considers description, usage guidelines, and CSS property hints in metadata).\n\nWHEN TO USE:\n**Styling or theming in code**\u2014you need the right `token('\u2026')` names for colors, space, typography, etc. Use during layout and visual work when tokens must match ADS. Prefer `ads_plan` when you also need icons and components in the same step.\n\nExample:\n```tsx\nimport { token } from '@atlaskit/tokens';\nconst styles = css({ color: token('color.text'), padding: token('space.100') });\n```",
|
|
7
|
+
description: "Searches Atlassian Design System **design tokens** from bundled metadata. Returns compact JSON objects with **name** and **exampleValue** for each match by default (search also considers description, usage guidelines, and CSS property hints in metadata). Set **includeMetadata** to include usage guidelines in each result.\n\nWHEN TO USE:\n**Styling or theming in code**\u2014you need the right `token('\u2026')` names for colors, space, typography, etc. Use during layout and visual work when tokens must match ADS. Prefer `ads_plan` when you also need icons and components in the same step.\n\nExample:\n```tsx\nimport { token } from '@atlaskit/tokens';\nconst styles = css({ color: token('color.text'), padding: token('space.100') });\n```",
|
|
8
8
|
annotations: {
|
|
9
9
|
title: 'Search ADS tokens',
|
|
10
10
|
readOnlyHint: true,
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
export var searchTokensInputSchema = z.object({
|
|
4
4
|
terms: z.array(z.string()).describe('Required: one or more terms; fuzzy match on token **name**, **description**, **exampleValue**, **usageGuidelines.usage**, and **usageGuidelines.cssProperties**. Example: `["spacing", "color.text", "background"]`.'),
|
|
5
|
-
limit: z.number().default(2).describe('Max matches **per term** (default 2).').optional()
|
|
5
|
+
limit: z.number().default(2).describe('Max matches **per term** (default 2).').optional(),
|
|
6
|
+
includeMetadata: z.boolean().default(false).describe('Include usage guidelines in each result (default false).').optional()
|
|
6
7
|
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
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; }
|
|
6
|
+
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) { _defineProperty(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; }
|
|
4
7
|
/* eslint-disable-next-line import/extensions -- MCP SDK requires .js extensions for ESM imports */
|
|
5
8
|
|
|
6
9
|
import Fuse from 'fuse.js';
|
|
@@ -9,11 +12,11 @@ import { mergeMultiTermFuseResults } from '../../helpers';
|
|
|
9
12
|
import { cleanQuery } from '../../helpers/clean-query';
|
|
10
13
|
export var searchTokensTool = /*#__PURE__*/function () {
|
|
11
14
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
|
|
12
|
-
var terms, _ref$limit, limit, searchTerms, fuse, matchedItems, matchedTokens;
|
|
15
|
+
var terms, _ref$limit, limit, _ref$includeMetadata, includeMetadata, searchTerms, fuse, matchedItems, matchedTokens;
|
|
13
16
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
14
17
|
while (1) switch (_context.prev = _context.next) {
|
|
15
18
|
case 0:
|
|
16
|
-
terms = _ref.terms, _ref$limit = _ref.limit, limit = _ref$limit === void 0 ? 2 : _ref$limit;
|
|
19
|
+
terms = _ref.terms, _ref$limit = _ref.limit, limit = _ref$limit === void 0 ? 2 : _ref$limit, _ref$includeMetadata = _ref.includeMetadata, includeMetadata = _ref$includeMetadata === void 0 ? false : _ref$includeMetadata;
|
|
17
20
|
// Unique cleaned terms (order preserved) so duplicates don't concatenate into a bogus query.
|
|
18
21
|
searchTerms = _toConsumableArray(new Set(terms.filter(Boolean).map(cleanQuery)));
|
|
19
22
|
if (searchTerms.length) {
|
|
@@ -64,10 +67,12 @@ export var searchTokensTool = /*#__PURE__*/function () {
|
|
|
64
67
|
searchTermsJoin: '.'
|
|
65
68
|
});
|
|
66
69
|
matchedTokens = matchedItems.map(function (item) {
|
|
67
|
-
return {
|
|
70
|
+
return _objectSpread({
|
|
68
71
|
name: item.name,
|
|
69
72
|
exampleValue: item.exampleValue
|
|
70
|
-
}
|
|
73
|
+
}, includeMetadata ? {
|
|
74
|
+
usageGuidelines: item.usageGuidelines
|
|
75
|
+
} : {});
|
|
71
76
|
});
|
|
72
77
|
if (matchedTokens.length) {
|
|
73
78
|
_context.next = 2;
|
|
@@ -2,10 +2,13 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const searchTokensInputSchema: z.ZodObject<{
|
|
3
3
|
terms: z.ZodArray<z.ZodString, 'many'>;
|
|
4
4
|
limit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
5
|
+
includeMetadata: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
5
6
|
}, 'strip', z.ZodTypeAny, {
|
|
6
7
|
terms: string[];
|
|
7
8
|
limit?: number | undefined;
|
|
9
|
+
includeMetadata?: boolean | undefined;
|
|
8
10
|
}, {
|
|
9
11
|
terms: string[];
|
|
10
12
|
limit?: number | undefined;
|
|
13
|
+
includeMetadata?: boolean | undefined;
|
|
11
14
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
import { type z } from 'zod';
|
|
3
3
|
import { type searchTokensInputSchema } from './search-tokens-input-schema';
|
|
4
|
-
export declare const searchTokensTool: ({ terms, limit, }: z.infer<typeof searchTokensInputSchema>) => Promise<CallToolResult>;
|
|
4
|
+
export declare const searchTokensTool: ({ terms, limit, includeMetadata, }: z.infer<typeof searchTokensInputSchema>) => Promise<CallToolResult>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/ads-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "The official Atlassian Design System MCP server to develop apps and user interfaces matching the Atlassian style.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@atlaskit/icon": "^37.3.0",
|
|
25
25
|
"@atlaskit/icon-lab": "^7.5.0",
|
|
26
26
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
27
|
-
"@atlaskit/tokens": "^16.
|
|
27
|
+
"@atlaskit/tokens": "^16.6.0",
|
|
28
28
|
"@axe-core/playwright": "^4.11.1",
|
|
29
29
|
"@axe-core/puppeteer": "^4.11.1",
|
|
30
30
|
"@babel/runtime": "^7.0.0",
|