@atlaskit/ads-mcp 0.17.1 → 0.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +88 -0
  3. package/dist/cjs/index.js +19 -40
  4. package/dist/cjs/tools/get-all-icons/icons.js +43 -0
  5. package/dist/cjs/tools/get-all-icons/index.js +4 -19
  6. package/dist/cjs/tools/get-all-tokens/index.js +3 -6
  7. package/dist/cjs/tools/get-all-tokens/tokens.js +18 -0
  8. package/dist/cjs/tools/get-components/components.codegen.js +8 -0
  9. package/dist/cjs/tools/get-components/components.js +423 -235
  10. package/dist/cjs/tools/get-components/index.js +2 -2
  11. package/dist/cjs/tools/get-components/load-all-components.js +16 -0
  12. package/dist/cjs/tools/get-guidelines/guidelines-structured-content.codegen.js +72 -6
  13. package/dist/cjs/tools/get-lint-rules/lint-rules-structured-content.codegen.js +111 -7
  14. package/dist/cjs/tools/search-components/index.js +13 -12
  15. package/dist/cjs/tools/search-icons/index.js +7 -24
  16. package/dist/es2019/index.js +13 -31
  17. package/dist/es2019/tools/get-all-icons/icons.js +25 -0
  18. package/dist/es2019/tools/get-all-icons/index.js +1 -10
  19. package/dist/es2019/tools/get-all-tokens/index.js +2 -5
  20. package/dist/es2019/tools/get-all-tokens/tokens.js +13 -0
  21. package/dist/es2019/tools/get-components/components.codegen.js +8 -0
  22. package/dist/es2019/tools/get-components/components.js +423 -235
  23. package/dist/es2019/tools/get-components/index.js +11 -9
  24. package/dist/es2019/tools/get-components/load-all-components.js +10 -0
  25. package/dist/es2019/tools/get-guidelines/guidelines-structured-content.codegen.js +72 -6
  26. package/dist/es2019/tools/get-lint-rules/lint-rules-structured-content.codegen.js +111 -7
  27. package/dist/es2019/tools/search-components/index.js +2 -1
  28. package/dist/es2019/tools/search-icons/index.js +1 -10
  29. package/dist/esm/index.js +19 -40
  30. package/dist/esm/tools/get-all-icons/icons.js +37 -0
  31. package/dist/esm/tools/get-all-icons/index.js +3 -18
  32. package/dist/esm/tools/get-all-tokens/index.js +2 -5
  33. package/dist/esm/tools/get-all-tokens/tokens.js +13 -0
  34. package/dist/esm/tools/get-components/components.codegen.js +8 -0
  35. package/dist/esm/tools/get-components/components.js +423 -235
  36. package/dist/esm/tools/get-components/index.js +2 -2
  37. package/dist/esm/tools/get-components/load-all-components.js +10 -0
  38. package/dist/esm/tools/get-guidelines/guidelines-structured-content.codegen.js +72 -6
  39. package/dist/esm/tools/get-lint-rules/lint-rules-structured-content.codegen.js +111 -7
  40. package/dist/esm/tools/search-components/index.js +9 -8
  41. package/dist/esm/tools/search-icons/index.js +3 -20
  42. package/dist/types/tools/get-all-icons/icons.d.ts +11 -0
  43. package/dist/types/tools/get-all-tokens/tokens.d.ts +7 -0
  44. package/dist/types/tools/get-components/components.codegen.d.ts +10 -0
  45. package/dist/types/tools/get-components/components.d.ts +1 -1
  46. package/dist/types/tools/get-components/load-all-components.d.ts +2 -0
  47. package/dist/types/tools/get-components/types.d.ts +20 -14
  48. package/dist/types/tools/get-guidelines/guidelines-structured-content.codegen.d.ts +1 -1
  49. package/dist/types/tools/get-lint-rules/lint-rules-structured-content.codegen.d.ts +1 -1
  50. package/dist/types-ts4.5/tools/get-all-icons/icons.d.ts +11 -0
  51. package/dist/types-ts4.5/tools/get-all-tokens/tokens.d.ts +7 -0
  52. package/dist/types-ts4.5/tools/get-components/components.codegen.d.ts +10 -0
  53. package/dist/types-ts4.5/tools/get-components/components.d.ts +1 -1
  54. package/dist/types-ts4.5/tools/get-components/load-all-components.d.ts +2 -0
  55. package/dist/types-ts4.5/tools/get-components/types.d.ts +20 -14
  56. package/dist/types-ts4.5/tools/get-guidelines/guidelines-structured-content.codegen.d.ts +1 -1
  57. package/dist/types-ts4.5/tools/get-lint-rules/lint-rules-structured-content.codegen.d.ts +1 -1
  58. package/package.json +5 -3
  59. package/dist/cjs/tools/get-icons/icon-mcp-structured-content.codegen.js +0 -8
  60. package/dist/cjs/tools/get-icons/icon-structured-content.codegen.js +0 -8
  61. package/dist/cjs/tools/get-icons/index.js +0 -135
  62. package/dist/cjs/tools/get-tokens/index.js +0 -125
  63. package/dist/cjs/tools/get-tokens/token-mcp-structured-content.codegen.js +0 -2356
  64. package/dist/cjs/tools/get-tokens/token-structured-content.codegen.js +0 -2356
  65. package/dist/es2019/tools/get-icons/icon-mcp-structured-content.codegen.js +0 -8
  66. package/dist/es2019/tools/get-icons/icon-structured-content.codegen.js +0 -8
  67. package/dist/es2019/tools/get-icons/index.js +0 -110
  68. package/dist/es2019/tools/get-tokens/index.js +0 -100
  69. package/dist/es2019/tools/get-tokens/token-mcp-structured-content.codegen.js +0 -2350
  70. package/dist/es2019/tools/get-tokens/token-structured-content.codegen.js +0 -2350
  71. package/dist/esm/tools/get-icons/icon-mcp-structured-content.codegen.js +0 -8
  72. package/dist/esm/tools/get-icons/icon-structured-content.codegen.js +0 -8
  73. package/dist/esm/tools/get-icons/index.js +0 -128
  74. package/dist/esm/tools/get-tokens/index.js +0 -118
  75. package/dist/esm/tools/get-tokens/token-mcp-structured-content.codegen.js +0 -2350
  76. package/dist/esm/tools/get-tokens/token-structured-content.codegen.js +0 -2350
  77. package/dist/types/tools/get-icons/icon-mcp-structured-content.codegen.d.ts +0 -13
  78. package/dist/types/tools/get-icons/icon-structured-content.codegen.d.ts +0 -13
  79. package/dist/types/tools/get-icons/index.d.ts +0 -35
  80. package/dist/types/tools/get-tokens/index.d.ts +0 -35
  81. package/dist/types/tools/get-tokens/token-mcp-structured-content.codegen.d.ts +0 -13
  82. package/dist/types/tools/get-tokens/token-structured-content.codegen.d.ts +0 -13
  83. package/dist/types-ts4.5/tools/get-icons/icon-mcp-structured-content.codegen.d.ts +0 -13
  84. package/dist/types-ts4.5/tools/get-icons/icon-structured-content.codegen.d.ts +0 -13
  85. package/dist/types-ts4.5/tools/get-icons/index.d.ts +0 -35
  86. package/dist/types-ts4.5/tools/get-tokens/index.d.ts +0 -35
  87. package/dist/types-ts4.5/tools/get-tokens/token-mcp-structured-content.codegen.d.ts +0 -13
  88. package/dist/types-ts4.5/tools/get-tokens/token-structured-content.codegen.d.ts +0 -13
@@ -1,110 +0,0 @@
1
- /* eslint-disable-next-line import/extensions -- MCP SDK requires .js extensions for ESM imports */
2
-
3
- import Fuse from 'fuse.js';
4
- import { z } from 'zod';
5
- import { cleanQuery, zodToJsonSchema } from '../../helpers';
6
- import { iconMcpStructuredContent } from './icon-mcp-structured-content.codegen';
7
- export const getIconsInputSchema = z.object({
8
- terms: z.array(z.string()).default([]).describe('An array of search terms to find icons by name, keywords, or categorization, eg. `["search", "folder", "user"]`. If empty or not provided, returns all icons.').optional(),
9
- limit: z.number().default(1).describe('Maximum number of results per search term in the array (default: 1)').optional(),
10
- exactName: 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()
11
- });
12
- export const listGetIconsTool = {
13
- name: 'ads_get_icons',
14
- description: `Get Atlassian Design System icons with optional search functionality.
15
-
16
- - If search parameters are provided, searches for icons matching the criteria.
17
- - If no search parameters are provided, returns all icons.
18
-
19
- Example icon usage:
20
- \`\`\`tsx
21
- import AddIcon from '@atlaskit/icon/core/add';
22
- <AddIcon label="Add work item" size="small" />
23
- \`\`\``,
24
- annotations: {
25
- title: 'Get ADS icons',
26
- readOnlyHint: true,
27
- destructiveHint: false,
28
- idempotentHint: true,
29
- openWorldHint: true
30
- },
31
- inputSchema: zodToJsonSchema(getIconsInputSchema)
32
- };
33
- export const getIconsTool = async params => {
34
- const {
35
- terms = [],
36
- limit = 1,
37
- exactName = false
38
- } = params;
39
- const searchTerms = terms.filter(Boolean).map(cleanQuery);
40
- const iconDocs = iconMcpStructuredContent.filter(icon => icon.status === 'published');
41
-
42
- // If no search terms provided, return all icons as JSON array
43
- if (searchTerms.length === 0) {
44
- const payload = iconDocs.map(icon => icon.content);
45
- return {
46
- content: [{
47
- type: 'text',
48
- text: JSON.stringify(payload)
49
- }]
50
- };
51
- }
52
-
53
- // Search logic (similar to search-icons)
54
- if (exactName) {
55
- // for each search term, search for the exact match
56
- const exactNameMatches = searchTerms.map(term => {
57
- return iconDocs.find(icon => icon.componentName.toLowerCase() === term.toLowerCase());
58
- }).filter(icon => icon !== undefined);
59
-
60
- // Return exact matches if found, or empty result if exactName is true
61
- const payload = exactNameMatches.length === 1 ? exactNameMatches[0].content : exactNameMatches.map(icon => icon.content);
62
- return {
63
- content: [{
64
- type: 'text',
65
- text: JSON.stringify(payload)
66
- }]
67
- };
68
- }
69
-
70
- // use Fuse.js to fuzzy-search for the icons
71
- const fuse = new Fuse(iconDocs, {
72
- keys: [{
73
- name: 'componentName',
74
- weight: 3
75
- }, {
76
- name: 'keywords',
77
- weight: 2
78
- }, {
79
- name: 'categorization',
80
- weight: 1
81
- }, {
82
- name: 'usage',
83
- weight: 1
84
- }],
85
- threshold: 0.4
86
- });
87
- const results = searchTerms.map(term => {
88
- // always search exact match from the icons
89
- const exactNameMatch = iconDocs.find(icon => icon.componentName.toLowerCase() === term.toLowerCase());
90
- if (exactNameMatch) {
91
- return [{
92
- item: exactNameMatch
93
- }];
94
- }
95
- return fuse.search(term).slice(0, limit);
96
- }).flat();
97
-
98
- // Remove duplicates based on componentName
99
- const uniqueResults = results.filter((result, index, arr) => {
100
- return arr.findIndex(r => r.item.componentName === result.item.componentName) === index;
101
- });
102
- const matchedIcons = uniqueResults.map(result => result.item);
103
- const payload = matchedIcons.length === 1 ? matchedIcons[0].content : matchedIcons.map(icon => icon.content);
104
- return {
105
- content: [{
106
- type: 'text',
107
- text: JSON.stringify(payload)
108
- }]
109
- };
110
- };
@@ -1,100 +0,0 @@
1
- /* eslint-disable-next-line import/extensions -- MCP SDK requires .js extensions for ESM imports */
2
-
3
- import Fuse from 'fuse.js';
4
- import { z } from 'zod';
5
- import { cleanQuery, zodToJsonSchema } from '../../helpers';
6
- import { tokenMcpStructuredContent } from './token-mcp-structured-content.codegen';
7
- export const getTokensInputSchema = z.object({
8
- terms: z.array(z.string()).default([]).describe('An array of search terms to find tokens by name or description, eg. `["spacing", "inverted text", "background primary"]`. If empty or not provided, returns all tokens.').optional(),
9
- limit: z.number().default(1).describe('Maximum number of results per search term in the array (default: 1)').optional(),
10
- exactName: z.boolean().default(false).describe('Enable to explicitly search tokens by the exact name match (when you know the name, but need more details)').optional()
11
- });
12
- export const listGetTokensTool = {
13
- name: 'ads_get_tokens',
14
- description: `Get Atlassian Design System tokens with optional search functionality.
15
-
16
- - If search parameters are provided, searches for tokens matching the criteria.
17
- - If no search parameters are provided, returns all tokens.
18
-
19
- Example token usage:
20
- \`\`\`tsx
21
- import { token } from '@atlaskit/tokens';
22
- const styles = css({ color: token('color.text'), padding: token('space.100') });
23
- \`\`\``,
24
- annotations: {
25
- title: 'Get ADS tokens',
26
- readOnlyHint: true,
27
- destructiveHint: false,
28
- idempotentHint: true,
29
- openWorldHint: true
30
- },
31
- inputSchema: zodToJsonSchema(getTokensInputSchema)
32
- };
33
- export const getTokensTool = async params => {
34
- const {
35
- terms = [],
36
- limit = 1,
37
- exactName = false
38
- } = params;
39
- const searchTerms = terms.filter(Boolean).map(cleanQuery);
40
- const tokenDocs = tokenMcpStructuredContent;
41
-
42
- // If no search terms provided, return all tokens as JSON array
43
- if (searchTerms.length === 0) {
44
- const payload = tokenDocs.map(token => token.content);
45
- return {
46
- content: [{
47
- type: 'text',
48
- text: JSON.stringify(payload)
49
- }]
50
- };
51
- }
52
-
53
- // Search logic (same as search-tokens)
54
- if (exactName) {
55
- // for each search term, search for the exact match
56
- const exactNameMatches = searchTerms.map(term => {
57
- return tokenDocs.find(token => token.name.toLowerCase() === term.toLowerCase());
58
- }).filter(token => token !== undefined);
59
- if (exactNameMatches.length > 0) {
60
- const payload = exactNameMatches.length === 1 ? exactNameMatches[0].content : exactNameMatches.map(token => token.content);
61
- return {
62
- content: [{
63
- type: 'text',
64
- text: JSON.stringify(payload)
65
- }]
66
- };
67
- }
68
- }
69
-
70
- // use Fuse.js to fuzzy-search for the tokens
71
- const fuse = new Fuse(tokenDocs, {
72
- keys: [{
73
- name: 'name',
74
- weight: 3
75
- }, {
76
- name: 'description',
77
- weight: 2
78
- }, {
79
- name: 'exampleValue',
80
- weight: 1
81
- }],
82
- threshold: 0.4
83
- });
84
- const results = searchTerms.map(term => {
85
- return fuse.search(term).slice(0, limit);
86
- }).flat();
87
-
88
- // Remove duplicates based on token name
89
- const uniqueResults = results.filter((result, index, arr) => {
90
- return arr.findIndex(r => r.item.name === result.item.name) === index;
91
- });
92
- const matchedTokens = uniqueResults.map(result => result.item);
93
- const payload = matchedTokens.length === 1 ? matchedTokens[0].content : matchedTokens.map(token => token.content);
94
- return {
95
- content: [{
96
- type: 'text',
97
- text: JSON.stringify(payload)
98
- }]
99
- };
100
- };