@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
@@ -0,0 +1,92 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ /* eslint-disable import/extensions */
4
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
5
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
6
+ import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
7
+ import { instructions } from './instructions';
8
+ import { getComponentDetailsTool, listGetComponentDetailsTool } from './tools/get-component-details';
9
+ import { getComponentsTool, listGetComponentsTool } from './tools/get-components';
10
+ import { getIconsTool, listGetIconsTool } from './tools/get-icons';
11
+ import { getTokensTool, listGetTokensTool } from './tools/get-tokens';
12
+
13
+ // 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
14
+ var pkgJson = require('@atlaskit/ads-mcp/package.json');
15
+ var server = new Server({
16
+ name: pkgJson.name || '@atlaskit/ads-mcp',
17
+ version: pkgJson.version || '0.0.0-unknown'
18
+ }, {
19
+ instructions: instructions,
20
+ capabilities: {
21
+ // Tools are defined in the handlers below.
22
+ tools: {}
23
+ }
24
+ });
25
+ server.setRequestHandler(ListToolsRequestSchema, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
26
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
27
+ while (1) switch (_context.prev = _context.next) {
28
+ case 0:
29
+ return _context.abrupt("return", {
30
+ tools: [listGetTokensTool, listGetComponentsTool, listGetComponentDetailsTool, listGetIconsTool]
31
+ });
32
+ case 1:
33
+ case "end":
34
+ return _context.stop();
35
+ }
36
+ }, _callee);
37
+ })));
38
+ var callTools = {
39
+ get_tokens: getTokensTool,
40
+ get_components: getComponentsTool,
41
+ get_component_details: getComponentDetailsTool,
42
+ get_icons: getIconsTool
43
+ };
44
+
45
+ // Handle tool execution
46
+ server.setRequestHandler(CallToolRequestSchema, /*#__PURE__*/function () {
47
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(request) {
48
+ var tool;
49
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
50
+ while (1) switch (_context2.prev = _context2.next) {
51
+ case 0:
52
+ tool = callTools[request.params.name];
53
+ if (!tool) {
54
+ _context2.next = 3;
55
+ break;
56
+ }
57
+ return _context2.abrupt("return", tool(request.params.arguments));
58
+ case 3:
59
+ throw new Error("Tool '".concat(request.params.name, "' not found, only the following tools are available: ").concat(Object.keys(callTools).join(', ')));
60
+ case 4:
61
+ case "end":
62
+ return _context2.stop();
63
+ }
64
+ }, _callee2);
65
+ }));
66
+ return function (_x) {
67
+ return _ref2.apply(this, arguments);
68
+ };
69
+ }());
70
+ function runServer() {
71
+ return _runServer.apply(this, arguments);
72
+ }
73
+ function _runServer() {
74
+ _runServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
75
+ var transport;
76
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
77
+ while (1) switch (_context3.prev = _context3.next) {
78
+ case 0:
79
+ transport = new StdioServerTransport();
80
+ _context3.next = 3;
81
+ return server.connect(transport);
82
+ case 3:
83
+ case "end":
84
+ return _context3.stop();
85
+ }
86
+ }, _callee3);
87
+ }));
88
+ return _runServer.apply(this, arguments);
89
+ }
90
+ runServer().catch(function (error) {
91
+ throw new Error("Invalid input to ads-mcp: ".concat(JSON.stringify(error.errors)));
92
+ });
@@ -0,0 +1 @@
1
+ export var 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,4 @@
1
+ import { z } from 'zod';
2
+ import zodToJsonSchema from 'zod-to-json-schema';
3
+ export var releasePhase = 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");
4
+ export var emptyInputSchema = zodToJsonSchema(z.object({}));
@@ -0,0 +1,81 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { z } from 'zod';
4
+ import { zodToJsonSchema } from 'zod-to-json-schema';
5
+ import { components } from '../get-components/components';
6
+ var inputSchema = z.object({
7
+ names: z.array(z.string()).describe('The name of the component(s) to get full details about')
8
+ });
9
+ export var listGetComponentDetailsTool = {
10
+ name: 'get_component_details',
11
+ 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",
12
+ annotations: {
13
+ title: 'Get ADS component details',
14
+ readOnlyHint: true,
15
+ destructiveHint: false,
16
+ idempotentHint: true,
17
+ openWorldHint: true
18
+ },
19
+ inputSchema: zodToJsonSchema(inputSchema)
20
+ };
21
+ var cleanName = function cleanName(name) {
22
+ return name.trim().toLowerCase().replace(/\s+/g, '');
23
+ };
24
+ export var getComponentDetailsTool = /*#__PURE__*/function () {
25
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
26
+ var names, filteredComponents;
27
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
28
+ while (1) switch (_context.prev = _context.next) {
29
+ case 0:
30
+ names = params.names.filter(Boolean).map(cleanName);
31
+ if (names.length) {
32
+ _context.next = 3;
33
+ break;
34
+ }
35
+ return _context.abrupt("return", {
36
+ isError: true,
37
+ content: [{
38
+ type: 'text',
39
+ text: "Error: Required parameter 'names' is missing. Available components: ".concat(components.map(function (c) {
40
+ return c.name;
41
+ }).join(', '))
42
+ }]
43
+ });
44
+ case 3:
45
+ filteredComponents = components.filter(function (c) {
46
+ return names.includes(cleanName(c.name));
47
+ });
48
+ if (filteredComponents.length) {
49
+ _context.next = 6;
50
+ break;
51
+ }
52
+ return _context.abrupt("return", {
53
+ isError: true,
54
+ content: [{
55
+ type: 'text',
56
+ text: "Error: Component not found for '".concat(names.join(', '), "'. Available components: ").concat(components.map(function (c) {
57
+ return c.name;
58
+ }).join(', '))
59
+ }]
60
+ });
61
+ case 6:
62
+ return _context.abrupt("return", {
63
+ content: filteredComponents.map(function (component) {
64
+ return {
65
+ // NOTE: Ideally one day the MCP would support structured content…
66
+ // eg. `type: 'object', data: component`
67
+ type: 'text',
68
+ text: JSON.stringify(component, null, 2)
69
+ };
70
+ })
71
+ });
72
+ case 7:
73
+ case "end":
74
+ return _context.stop();
75
+ }
76
+ }, _callee);
77
+ }));
78
+ return function getComponentDetailsTool(_x) {
79
+ return _ref.apply(this, arguments);
80
+ };
81
+ }();