@atlaskit/ads-mcp 0.0.1

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 (63) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/LICENSE.md +11 -0
  3. package/README.md +29 -0
  4. package/build/tsconfig.json +17 -0
  5. package/dist/cjs/index.js +95 -0
  6. package/dist/cjs/instructions.js +7 -0
  7. package/dist/cjs/schema.js +11 -0
  8. package/dist/cjs/tools/get-component-details/index.js +88 -0
  9. package/dist/cjs/tools/get-components/components.js +2044 -0
  10. package/dist/cjs/tools/get-components/index.js +56 -0
  11. package/dist/cjs/tools/get-icons/index.js +64 -0
  12. package/dist/cjs/tools/get-tokens/index.js +50 -0
  13. package/dist/cjs/tools/get-tokens/tokens.js +778 -0
  14. package/dist/es2019/index.js +49 -0
  15. package/dist/es2019/instructions.js +5 -0
  16. package/dist/es2019/schema.js +13 -0
  17. package/dist/es2019/tools/get-component-details/index.js +51 -0
  18. package/dist/es2019/tools/get-components/components.js +2941 -0
  19. package/dist/es2019/tools/get-components/index.js +32 -0
  20. package/dist/es2019/tools/get-icons/index.js +45 -0
  21. package/dist/es2019/tools/get-tokens/index.js +31 -0
  22. package/dist/es2019/tools/get-tokens/tokens.js +772 -0
  23. package/dist/esm/index.js +92 -0
  24. package/dist/esm/instructions.js +1 -0
  25. package/dist/esm/schema.js +4 -0
  26. package/dist/esm/tools/get-component-details/index.js +81 -0
  27. package/dist/esm/tools/get-components/components.js +2038 -0
  28. package/dist/esm/tools/get-components/index.js +49 -0
  29. package/dist/esm/tools/get-icons/index.js +57 -0
  30. package/dist/esm/tools/get-tokens/index.js +43 -0
  31. package/dist/esm/tools/get-tokens/tokens.js +772 -0
  32. package/dist/types/index.d.ts +1 -0
  33. package/dist/types/instructions.d.ts +1 -0
  34. package/dist/types/schema.d.ts +9 -0
  35. package/dist/types/tools/get-component-details/index.d.ts +39 -0
  36. package/dist/types/tools/get-components/components.d.ts +20 -0
  37. package/dist/types/tools/get-components/index.d.ts +23 -0
  38. package/dist/types/tools/get-icons/index.d.ts +23 -0
  39. package/dist/types/tools/get-tokens/index.d.ts +23 -0
  40. package/dist/types/tools/get-tokens/tokens.d.ts +15 -0
  41. package/dist/types-ts4.5/index.d.ts +1 -0
  42. package/dist/types-ts4.5/instructions.d.ts +1 -0
  43. package/dist/types-ts4.5/schema.d.ts +15 -0
  44. package/dist/types-ts4.5/tools/get-component-details/index.d.ts +39 -0
  45. package/dist/types-ts4.5/tools/get-components/components.d.ts +20 -0
  46. package/dist/types-ts4.5/tools/get-components/index.d.ts +23 -0
  47. package/dist/types-ts4.5/tools/get-icons/index.d.ts +23 -0
  48. package/dist/types-ts4.5/tools/get-tokens/index.d.ts +23 -0
  49. package/dist/types-ts4.5/tools/get-tokens/tokens.d.ts +15 -0
  50. package/index.js +5 -0
  51. package/package.json +43 -0
  52. package/src/index.tsx +70 -0
  53. package/src/instructions.tsx +5 -0
  54. package/src/schema.tsx +19 -0
  55. package/src/tools/get-component-details/index.tsx +64 -0
  56. package/src/tools/get-components/components.tsx +3477 -0
  57. package/src/tools/get-components/index.tsx +36 -0
  58. package/src/tools/get-icons/index.tsx +49 -0
  59. package/src/tools/get-tokens/index.tsx +35 -0
  60. package/src/tools/get-tokens/tokens.tsx +726 -0
  61. package/tsconfig.app.json +42 -0
  62. package/tsconfig.dev.json +38 -0
  63. package/tsconfig.json +14 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1 @@
1
+ # @atlaskit/ads-mcp
package/LICENSE.md ADDED
@@ -0,0 +1,11 @@
1
+ Copyright 2023 Atlassian Pty Ltd
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
4
+ compliance with the License. You may obtain a copy of the License at
5
+
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ Unless required by applicable law or agreed to in writing, software distributed under the License is
9
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10
+ implied. See the License for the specific language governing permissions and limitations under the
11
+ License.
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Atlassian Design System MCP Server
2
+
3
+ Current state: Early Access
4
+
5
+ The official Model Context Protocol (MCP) server for the Atlassian Design System. This server provides tools to access design tokens, icons, and components/primitives programmatically.
6
+
7
+ This may expand to add accessibility, usage, and other guidance over time.
8
+
9
+ ## Usage
10
+
11
+ Add an entry to your `mcp.json` (eg. `~/.cursor/mcp.json` or wherever your MCP config lives):
12
+ ```json
13
+ {
14
+ "mcpServers": {
15
+ "ads": {
16
+ "command": "npx",
17
+ "args": ["-y", "@atlaskit/ads-mcp"]
18
+ }
19
+ }
20
+ }
21
+ ```
22
+
23
+ ## Development
24
+
25
+ Modify the usage instructions above, but replace `@atlaskit/ads-mcp` with a local path to the `index.js`:
26
+ ```json
27
+ -"@atlaskit/ads-mcp"
28
+ +"~/git/atlassian/atlassian-frontend-monorepo/platform/packages/design-system/ads-mcp/index.js"
29
+ ```
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../tsconfig",
3
+ "compilerOptions": {
4
+ "target": "es5",
5
+ "paths": {}
6
+ },
7
+ "include": [
8
+ "../src/**/*.ts",
9
+ "../src/**/*.tsx"
10
+ ],
11
+ "exclude": [
12
+ "../src/**/__tests__/*",
13
+ "../src/**/*.test.*",
14
+ "../src/**/test.*",
15
+ "../src/**/examples.*"
16
+ ]
17
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
5
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
6
+ var _index = require("@modelcontextprotocol/sdk/server/index.js");
7
+ var _stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
8
+ var _types = require("@modelcontextprotocol/sdk/types.js");
9
+ var _instructions = require("./instructions");
10
+ var _getComponentDetails = require("./tools/get-component-details");
11
+ var _getComponents = require("./tools/get-components");
12
+ var _getIcons = require("./tools/get-icons");
13
+ var _getTokens = require("./tools/get-tokens");
14
+ /* eslint-disable import/extensions */
15
+
16
+ // eslint-disable-next-line import/no-extraneous-dependencies -- this uses require because not all node versions this package supports use the same import assertions/attributes
17
+ var pkgJson = require('@atlaskit/ads-mcp/package.json');
18
+ var server = new _index.Server({
19
+ name: pkgJson.name || '@atlaskit/ads-mcp',
20
+ version: pkgJson.version || '0.0.0-unknown'
21
+ }, {
22
+ instructions: _instructions.instructions,
23
+ capabilities: {
24
+ // Tools are defined in the handlers below.
25
+ tools: {}
26
+ }
27
+ });
28
+ server.setRequestHandler(_types.ListToolsRequestSchema, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
29
+ return _regenerator.default.wrap(function _callee$(_context) {
30
+ while (1) switch (_context.prev = _context.next) {
31
+ case 0:
32
+ return _context.abrupt("return", {
33
+ tools: [_getTokens.listGetTokensTool, _getComponents.listGetComponentsTool, _getComponentDetails.listGetComponentDetailsTool, _getIcons.listGetIconsTool]
34
+ });
35
+ case 1:
36
+ case "end":
37
+ return _context.stop();
38
+ }
39
+ }, _callee);
40
+ })));
41
+ var callTools = {
42
+ get_tokens: _getTokens.getTokensTool,
43
+ get_components: _getComponents.getComponentsTool,
44
+ get_component_details: _getComponentDetails.getComponentDetailsTool,
45
+ get_icons: _getIcons.getIconsTool
46
+ };
47
+
48
+ // Handle tool execution
49
+ server.setRequestHandler(_types.CallToolRequestSchema, /*#__PURE__*/function () {
50
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(request) {
51
+ var tool;
52
+ return _regenerator.default.wrap(function _callee2$(_context2) {
53
+ while (1) switch (_context2.prev = _context2.next) {
54
+ case 0:
55
+ tool = callTools[request.params.name];
56
+ if (!tool) {
57
+ _context2.next = 3;
58
+ break;
59
+ }
60
+ return _context2.abrupt("return", tool(request.params.arguments));
61
+ case 3:
62
+ throw new Error("Tool '".concat(request.params.name, "' not found, only the following tools are available: ").concat(Object.keys(callTools).join(', ')));
63
+ case 4:
64
+ case "end":
65
+ return _context2.stop();
66
+ }
67
+ }, _callee2);
68
+ }));
69
+ return function (_x) {
70
+ return _ref2.apply(this, arguments);
71
+ };
72
+ }());
73
+ function runServer() {
74
+ return _runServer.apply(this, arguments);
75
+ }
76
+ function _runServer() {
77
+ _runServer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
78
+ var transport;
79
+ return _regenerator.default.wrap(function _callee3$(_context3) {
80
+ while (1) switch (_context3.prev = _context3.next) {
81
+ case 0:
82
+ transport = new _stdio.StdioServerTransport();
83
+ _context3.next = 3;
84
+ return server.connect(transport);
85
+ case 3:
86
+ case "end":
87
+ return _context3.stop();
88
+ }
89
+ }, _callee3);
90
+ }));
91
+ return _runServer.apply(this, arguments);
92
+ }
93
+ runServer().catch(function (error) {
94
+ throw new Error("Invalid input to ads-mcp: ".concat(JSON.stringify(error.errors)));
95
+ });
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.instructions = void 0;
7
+ var instructions = exports.instructions = "\nYou are an expert in the Atlassian Design System (aka ADS). You are able to answer questions about the design system and provide guidance on what offerings to use when building user interfaces.\n\nYou are able to use the provided tools to help answer your questions, but may also access https://atlassian.design/llms.txt or https://atlassian.design/ directly for deeper research and information.\n";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.releasePhase = exports.emptyInputSchema = void 0;
8
+ var _zod = require("zod");
9
+ var _zodToJsonSchema = _interopRequireDefault(require("zod-to-json-schema"));
10
+ var releasePhase = exports.releasePhase = _zod.z.enum(['early_access', 'beta', 'general_availability', 'intent_to_deprecate', 'deprecated']).default('general_availability').describe("\nThe release phase or status of the offering, providing guidance on what you can expect at each phase and who can use them.\nYou should typically only use `general_availability` or `beta` components. If a release phase or status is not defined, you should assume it is `general_availability`.\n\n- `early_access`: New experimental feature. There may be breaking changes in minor releases at versions `0.x`. We don't recommend using this unless you are part of an early access pilot group, as support is otherwise not available.\n- `beta`: New and ready to use. The feature is supported and stable at versions `1.0`+. We are working on improvements based on customer feedback. This may include expanding feature sets, and evolving tooling, guidance, and self-service. Breaking changes will only be made in major releases, and should be infrequent.\n- `general_availability`: Fully stable and ready to use.\n- `intent_to_deprecate` aka Caution: This feature is being considered for deprecation. There may be some issues with this feature that need to be resolved. If you are not already using the feature, use the recommended alternative instead.\n- `deprecated`: This feature is no longer supported and will be removed after the deprecation period ends. We have provided a recommended solution to replace it and communicated how to move to it.\n");
11
+ var emptyInputSchema = exports.emptyInputSchema = (0, _zodToJsonSchema.default)(_zod.z.object({}));
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.listGetComponentDetailsTool = exports.getComponentDetailsTool = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ var _zod = require("zod");
11
+ var _zodToJsonSchema = require("zod-to-json-schema");
12
+ var _components = require("../get-components/components");
13
+ var inputSchema = _zod.z.object({
14
+ names: _zod.z.array(_zod.z.string()).describe('The name of the component(s) to get full details about')
15
+ });
16
+ var listGetComponentDetailsTool = exports.listGetComponentDetailsTool = {
17
+ name: 'get_component_details',
18
+ description: "You MUST use this to fetch detailed information about a specific Atlassian Design System component(s) including code examples, props, accessibility guidelines, and other usage guidance.\nIf you're not sure how to query this, you should use the `get_components` tool to get a list of all components and their names before using this tool.\n",
19
+ annotations: {
20
+ title: 'Get ADS component details',
21
+ readOnlyHint: true,
22
+ destructiveHint: false,
23
+ idempotentHint: true,
24
+ openWorldHint: true
25
+ },
26
+ inputSchema: (0, _zodToJsonSchema.zodToJsonSchema)(inputSchema)
27
+ };
28
+ var cleanName = function cleanName(name) {
29
+ return name.trim().toLowerCase().replace(/\s+/g, '');
30
+ };
31
+ var getComponentDetailsTool = exports.getComponentDetailsTool = /*#__PURE__*/function () {
32
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(params) {
33
+ var names, filteredComponents;
34
+ return _regenerator.default.wrap(function _callee$(_context) {
35
+ while (1) switch (_context.prev = _context.next) {
36
+ case 0:
37
+ names = params.names.filter(Boolean).map(cleanName);
38
+ if (names.length) {
39
+ _context.next = 3;
40
+ break;
41
+ }
42
+ return _context.abrupt("return", {
43
+ isError: true,
44
+ content: [{
45
+ type: 'text',
46
+ text: "Error: Required parameter 'names' is missing. Available components: ".concat(_components.components.map(function (c) {
47
+ return c.name;
48
+ }).join(', '))
49
+ }]
50
+ });
51
+ case 3:
52
+ filteredComponents = _components.components.filter(function (c) {
53
+ return names.includes(cleanName(c.name));
54
+ });
55
+ if (filteredComponents.length) {
56
+ _context.next = 6;
57
+ break;
58
+ }
59
+ return _context.abrupt("return", {
60
+ isError: true,
61
+ content: [{
62
+ type: 'text',
63
+ text: "Error: Component not found for '".concat(names.join(', '), "'. Available components: ").concat(_components.components.map(function (c) {
64
+ return c.name;
65
+ }).join(', '))
66
+ }]
67
+ });
68
+ case 6:
69
+ return _context.abrupt("return", {
70
+ content: filteredComponents.map(function (component) {
71
+ return {
72
+ // NOTE: Ideally one day the MCP would support structured content…
73
+ // eg. `type: 'object', data: component`
74
+ type: 'text',
75
+ text: JSON.stringify(component, null, 2)
76
+ };
77
+ })
78
+ });
79
+ case 7:
80
+ case "end":
81
+ return _context.stop();
82
+ }
83
+ }, _callee);
84
+ }));
85
+ return function getComponentDetailsTool(_x) {
86
+ return _ref.apply(this, arguments);
87
+ };
88
+ }();