@iress-oss/ids-mcp-server 0.0.1 → 5.14.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.
Files changed (122) hide show
  1. package/LICENSE.txt +201 -0
  2. package/README.md +29 -159
  3. package/dist/componentHandlers.js +241 -0
  4. package/dist/componentHandlers.test.js +380 -0
  5. package/{build → dist}/config.js +5 -5
  6. package/dist/index.js +53 -0
  7. package/{build → dist}/iressHandlers.js +52 -46
  8. package/dist/iressHandlers.test.js +316 -0
  9. package/{build → dist}/resourceHandlers.js +23 -22
  10. package/dist/resourceHandlers.test.js +352 -0
  11. package/{build → dist}/searchHandlers.js +107 -92
  12. package/dist/searchHandlers.test.js +524 -0
  13. package/{build → dist}/toolHandler.js +13 -13
  14. package/dist/toolHandler.test.js +369 -0
  15. package/dist/tools.js +165 -0
  16. package/{build → dist}/utils.js +11 -15
  17. package/dist/utils.test.js +286 -0
  18. package/{docs/ids → generated/docs}/components-autocomplete-docs.md +3 -3
  19. package/{docs/ids → generated/docs}/components-autocomplete-recipes-docs.md +17 -51
  20. package/{docs/ids → generated/docs}/components-card-recipes-docs.md +1 -1
  21. package/{docs/ids → generated/docs}/components-checkbox-docs.md +6 -19
  22. package/{docs/ids → generated/docs}/components-checkboxgroup-docs.md +18 -18
  23. package/{docs/ids → generated/docs}/components-checkboxgroup-recipes-docs.md +9 -9
  24. package/{docs/ids → generated/docs}/components-col-docs.md +1 -1
  25. package/{docs/ids → generated/docs}/components-combobox-docs.md +4 -4
  26. package/{docs/ids → generated/docs}/components-container-docs.md +8 -42
  27. package/{docs/ids → generated/docs}/components-filter-docs.md +14 -67
  28. package/{docs/ids → generated/docs}/components-form-docs.md +341 -335
  29. package/{docs/ids → generated/docs}/components-form-recipes-docs.md +198 -1
  30. package/{docs/ids → generated/docs}/components-hide-docs.md +16 -70
  31. package/{docs/ids → generated/docs}/components-icon-docs.md +4 -4
  32. package/{docs/ids → generated/docs}/components-input-recipes-docs.md +2 -2
  33. package/{docs/ids → generated/docs}/components-inputcurrency-recipes-docs.md +6 -40
  34. package/{docs/ids → generated/docs}/components-modal-docs.md +3 -113
  35. package/generated/docs/components-popover-docs.md +464 -0
  36. package/{docs/ids → generated/docs}/components-radiogroup-docs.md +21 -21
  37. package/{docs/ids → generated/docs}/components-richselect-docs.md +149 -111
  38. package/{docs/ids → generated/docs}/components-row-docs.md +4 -4
  39. package/{docs/ids → generated/docs}/components-skeleton-docs.md +3 -3
  40. package/{docs/ids → generated/docs}/components-skeleton-recipes-docs.md +1 -1
  41. package/{docs/ids → generated/docs}/components-skiplink-docs.md +1 -1
  42. package/{docs/ids → generated/docs}/components-slideout-docs.md +3 -113
  43. package/{docs/ids → generated/docs}/components-table-ag-grid-docs.md +109 -137
  44. package/{docs/ids → generated/docs}/components-table-docs.md +92 -597
  45. package/{docs/ids → generated/docs}/components-tabset-docs.md +2 -2
  46. package/{docs/ids → generated/docs}/components-tag-docs.md +1 -1
  47. package/{docs/ids → generated/docs}/components-toaster-docs.md +5 -5
  48. package/{docs/ids → generated/docs}/extensions-editor-docs.md +4 -4
  49. package/generated/docs/foundations-accessibility-docs.md +62 -0
  50. package/{docs/ids → generated/docs}/foundations-colours-docs.md +1 -1
  51. package/generated/docs/foundations-consistency-docs.md +52 -0
  52. package/generated/docs/foundations-content-docs.md +23 -0
  53. package/generated/docs/foundations-introduction-docs.md +17 -0
  54. package/generated/docs/foundations-principles-docs.md +70 -0
  55. package/{docs/ids → generated/docs}/foundations-typography-docs.md +7 -2
  56. package/generated/docs/foundations-user-experience-docs.md +63 -0
  57. package/generated/docs/foundations-visual-design-docs.md +46 -0
  58. package/{docs/ids → generated/docs}/get-started-develop-docs.md +3 -3
  59. package/generated/docs/guidelines.md +812 -0
  60. package/{docs/ids → generated/docs}/introduction-docs.md +4 -4
  61. package/{docs/ids → generated/docs}/patterns-loading-docs.md +332 -2
  62. package/generated/docs/resources-migration-guides-from-v4-to-v5-docs.md +437 -0
  63. package/generated/docs/themes-available-themes-docs.md +66 -0
  64. package/generated/docs/themes-tokens-docs.md +1200 -0
  65. package/generated/docs/versions-docs.md +17 -0
  66. package/package.json +42 -14
  67. package/LICENSE +0 -193
  68. package/build/componentHandlers.js +0 -205
  69. package/build/index.js +0 -51
  70. package/build/tools.js +0 -165
  71. package/docs/api-reference.md +0 -0
  72. package/docs/best-practices.md +0 -0
  73. package/docs/configuration.md +0 -0
  74. package/docs/examples.md +0 -0
  75. package/docs/guidelines.md +0 -269
  76. package/docs/ids/components-popover-docs.md +0 -4
  77. package/docs/ids/resources-migration-guides-from-v4-to-v5-docs.md +0 -639
  78. package/docs/ids/themes-available-themes-docs.md +0 -74
  79. package/docs/ids/themes-tokens-docs.md +0 -4580
  80. package/docs/ids/versions-docs.md +0 -27
  81. package/docs/tutorials/basic-integration.md +0 -0
  82. /package/{build → dist}/types.js +0 -0
  83. /package/{docs/ids → generated/docs}/components-alert-docs.md +0 -0
  84. /package/{docs/ids → generated/docs}/components-badge-docs.md +0 -0
  85. /package/{docs/ids → generated/docs}/components-button-docs.md +0 -0
  86. /package/{docs/ids → generated/docs}/components-button-recipes-docs.md +0 -0
  87. /package/{docs/ids → generated/docs}/components-buttongroup-docs.md +0 -0
  88. /package/{docs/ids → generated/docs}/components-card-docs.md +0 -0
  89. /package/{docs/ids → generated/docs}/components-divider-docs.md +0 -0
  90. /package/{docs/ids → generated/docs}/components-expander-docs.md +0 -0
  91. /package/{docs/ids → generated/docs}/components-field-docs.md +0 -0
  92. /package/{docs/ids → generated/docs}/components-inline-docs.md +0 -0
  93. /package/{docs/ids → generated/docs}/components-input-docs.md +0 -0
  94. /package/{docs/ids → generated/docs}/components-inputcurrency-docs.md +0 -0
  95. /package/{docs/ids → generated/docs}/components-label-docs.md +0 -0
  96. /package/{docs/ids → generated/docs}/components-menu-docs.md +0 -0
  97. /package/{docs/ids → generated/docs}/components-menu-menuitem-docs.md +0 -0
  98. /package/{docs/ids → generated/docs}/components-navbar-docs.md +0 -0
  99. /package/{docs/ids → generated/docs}/components-navbar-recipes-docs.md +0 -0
  100. /package/{docs/ids → generated/docs}/components-panel-docs.md +0 -0
  101. /package/{docs/ids → generated/docs}/components-placeholder-docs.md +0 -0
  102. /package/{docs/ids → generated/docs}/components-popover-recipes-docs.md +0 -0
  103. /package/{docs/ids → generated/docs}/components-progress-docs.md +0 -0
  104. /package/{docs/ids → generated/docs}/components-radio-docs.md +0 -0
  105. /package/{docs/ids → generated/docs}/components-readonly-docs.md +0 -0
  106. /package/{docs/ids → generated/docs}/components-select-docs.md +0 -0
  107. /package/{docs/ids → generated/docs}/components-slider-docs.md +0 -0
  108. /package/{docs/ids → generated/docs}/components-spinner-docs.md +0 -0
  109. /package/{docs/ids → generated/docs}/components-stack-docs.md +0 -0
  110. /package/{docs/ids → generated/docs}/components-tabset-tab-docs.md +0 -0
  111. /package/{docs/ids → generated/docs}/components-text-docs.md +0 -0
  112. /package/{docs/ids → generated/docs}/components-toaster-toast-docs.md +0 -0
  113. /package/{docs/ids → generated/docs}/components-toggle-docs.md +0 -0
  114. /package/{docs/ids → generated/docs}/components-tooltip-docs.md +0 -0
  115. /package/{docs/ids → generated/docs}/components-validationmessage-docs.md +0 -0
  116. /package/{docs/ids → generated/docs}/contact-us-docs.md +0 -0
  117. /package/{docs/ids → generated/docs}/extensions-editor-recipes-docs.md +0 -0
  118. /package/{docs/ids → generated/docs}/frequently-asked-questions-docs.md +0 -0
  119. /package/{docs/ids → generated/docs}/get-started-using-storybook-docs.md +0 -0
  120. /package/{docs/ids → generated/docs}/resources-changelog-docs.md +0 -0
  121. /package/{docs/ids → generated/docs}/resources-code-katas-docs.md +0 -0
  122. /package/{docs/ids → generated/docs}/themes-introduction-docs.md +0 -0
package/LICENSE.txt ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -14,92 +14,45 @@ A Model Context Protocol (MCP) server specifically designed for the **Iress Desi
14
14
 
15
15
  ## Installation
16
16
 
17
- 1. Clone or download this repository
18
- 2. Install dependencies:
19
- ```bash
20
- yarn install
21
- ```
22
- 3. Build the project:
23
- ```bash
24
- yarn build
25
- ```
17
+ ### Quick Setup (VS Code)
26
18
 
27
- ## Usage
19
+ **🚀 One-Click Installation**: Click the link below to automatically add the IDS MCP server to your VS Code settings:
28
20
 
29
- ### Development Server
21
+ [**Add IDS MCP Server to VS Code**](vscode:mcp/install?%7B%22name%22%3A%22iress-design-system%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22%40iress-oss%2Fids-mcp-server%22%5D%7D)
30
22
 
31
- For easy testing during development, use the interactive dev server:
23
+ This will automatically configure VS Code to use the IDS Component Library MCP Server with your AI assistant.
32
24
 
33
- ```bash
34
- yarn dev-server
35
- ```
25
+ ### Manual Setup (VS Code)
36
26
 
37
- This starts an interactive shell where you can test MCP commands and shows detailed connection information:
27
+ Alternatively, you can manually add the server to your VS Code settings:
38
28
 
39
- ```
40
- 🚀 IDS Component Library MCP Server
41
- ===================================
42
-
43
- 📍 Server Configuration:
44
- Protocol: stdio (Model Context Protocol)
45
- Server Path: /Users/luke.peary/Sandbox/ids-mcp-server/build/index.js
46
- Docs Directory: /Users/luke.peary/Sandbox/ids-mcp-server/docs/ids
47
- Working Directory: /Users/luke.peary/Sandbox/ids-mcp-server
48
-
49
- 🔌 Starting MCP server...
50
- ✅ MCP server is ready!
51
- 📡 Connection: stdio transport established
52
- 🔗 MCP Client Config:
53
- {
54
- "command": "node",
55
- "args": ["/Users/luke.peary/Sandbox/ids-mcp-server/build/index.js"],
56
- "cwd": "/Users/luke.peary/Sandbox/ids-mcp-server"
57
- }
58
-
59
- Available commands:
60
- find-component <name> - Find IDS components by name or functionality
61
- get-props <component> - Get component props and API details
62
- get-examples <component> - Get usage examples and patterns
63
- search-ids <query> - Search across all IDS documentation
64
- list-components [category] - List available components
65
- get-tokens [type] - Get design tokens (colors, spacing, etc.)
66
- list-resources - List available resources
67
- help - Show this help
68
- exit - Exit the dev server
69
-
70
- > find-component button
71
- 📤 Request: {"jsonrpc":"2.0","id":123,"method":"tools/call","params":{"name":"find_component","arguments":{"query":"button"}}}
72
- 📥 Response: {
73
- "result": {
74
- "content": [
75
- {
76
- "type": "text",
77
- "text": "Found 3 relevant IDS components:\n\n1. **components-button-docs.md**\n button: A button is a clickable item used to perform an action.\n\n2. **components-buttongroup-docs.md**\n buttongroup: Button group component documentation..."
78
- }
79
- ]
29
+ 1. Open VS Code Settings (⌘/Ctrl + ,)
30
+ 2. Search for "MCP"
31
+ 3. Add the following server configuration:
32
+
33
+ ```json
34
+ "mcp": {
35
+ "servers": {
36
+ "iress-design-system": {
37
+ "command": "npx",
38
+ "args": ["@iress-oss/ids-mcp-server"]
39
+ }
80
40
  }
81
41
  }
82
42
  ```
83
43
 
84
- #### Common Dev Server Commands
85
-
86
- - `find-component button` - Find button-related components
87
- - `get-props button` - Get IressButton component props and API
88
- - `get-examples input` - Get IressInput usage examples
89
- - `search-ids "mode=primary"` - Search for primary mode usage
90
- - `list-components components` - List all UI components
91
- - `get-tokens colors` - Get IDS color design tokens
92
- - `raw {"jsonrpc":"2.0","id":1,"method":"tools/list"}` - Send custom MCP request
44
+ ### Other MCP Clients
93
45
 
94
- ### Running the Server
46
+ For other MCP clients or manual configuration, use this server configuration:
95
47
 
96
- The server runs on stdio and communicates using the MCP protocol:
97
-
98
- ```bash
99
- node build/index.js
48
+ ```json
49
+ {
50
+ "command": "npx",
51
+ "args": ["@iress-oss/ids-mcp-server"]
52
+ }
100
53
  ```
101
54
 
102
- ### Available Tools
55
+ ## Available Tools
103
56
 
104
57
  1. **find_component**: Find IDS components by name or functionality - perfect for component discovery
105
58
  2. **get_component_props**: Get detailed prop information and API reference for specific components
@@ -108,7 +61,7 @@ node build/index.js
108
61
  5. **list_components**: List all available components organized by category
109
62
  6. **get_design_tokens**: Access IDS design tokens (colors, spacing, typography, etc.)
110
63
 
111
- ### Available Resources
64
+ ## Available Resources
112
65
 
113
66
  All IDS component documentation files are exposed as categorized resources:
114
67
 
@@ -116,45 +69,9 @@ All IDS component documentation files are exposed as categorized resources:
116
69
  - **Foundations**: Colors, Typography, Spacing, etc. (`foundations-*-docs.md`)
117
70
  - **Resources**: Changelog, Guidelines, etc. (`resources-*-docs.md`)
118
71
 
119
- Resources have URIs like: `file:///absolute/path/to/docs/ids/components-button-docs.md`
120
-
121
- ## Example Usage
122
-
123
- ### With MCP Client
124
-
125
- ```bash
126
- # List available IDS tools
127
- echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node build/index.js
128
-
129
- # Find button components
130
- echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"find_component","arguments":{"query":"button"}}}' | node build/index.js
131
-
132
- # Get IressButton props
133
- echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_component_props","arguments":{"component":"button"}}}' | node build/index.js
134
-
135
- # Search for primary mode usage
136
- echo '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"search_ids_docs","arguments":{"query":"mode=\"primary\""}}}' | node build/index.js
137
- ```
138
-
139
- ### Configuration for MCP Clients
140
-
141
- Add this to your MCP client configuration:
142
-
143
- ```json
144
- {
145
- "mcpServers": {
146
- "ids-component-library": {
147
- "command": "node",
148
- "args": ["/path/to/ids-mcp-server/build/index.js"],
149
- "cwd": "/path/to/ids-mcp-server"
150
- }
151
- }
152
- }
153
- ```
154
-
155
72
  ## Documentation Structure
156
73
 
157
- The server works with the IDS component library documentation in the `docs/ids/` directory:
74
+ The server works with the IDS component library documentation in the `generated/docs/` directory:
158
75
 
159
76
  **Components** (50+ UI components):
160
77
 
@@ -164,60 +81,13 @@ The server works with the IDS component library documentation in the `docs/ids/`
164
81
  - `components-modal-docs.md` - IressModal component
165
82
  - `components-*-recipes-docs.md` - Usage patterns and recipes
166
83
 
167
- **Foundations** (Design system basics):
84
+ **Foundations** (Guidelines and tokens):
168
85
 
169
86
  - `foundations-colours-docs.md` - Color palette and usage
170
87
  - `foundations-typography-docs.md` - Text styles and hierarchy
171
88
  - `foundations-spacing-docs.md` - Layout and spacing tokens
172
89
 
173
- **Resources** (Guidelines and tools):
90
+ **Resources** (Supporting documentation):
174
91
 
175
92
  - `resources-changelog-docs.md` - Version history and updates
176
93
  - `introduction-docs.md` - Getting started guide
177
-
178
- ## Development
179
-
180
- ### Project Structure
181
-
182
- ```
183
- ├── src/
184
- │ └── index.ts # IDS MCP server implementation
185
- ├── docs/
186
- │ └── ids/ # IDS component library documentation
187
- │ ├── components-*-docs.md # Component documentation
188
- │ ├── foundations-*-docs.md # Design tokens and foundations
189
- │ └── resources-*-docs.md # Guidelines and resources
190
- ├── build/ # Compiled JavaScript output
191
- ├── package.json
192
- ├── tsconfig.json
193
- └── README.md
194
- ```
195
-
196
- ### Adding Documentation
197
-
198
- The server automatically discovers all `.md` files in the `docs/ids/` directory. To add new IDS component documentation:
199
-
200
- 1. Add new component docs as `components-{name}-docs.md`
201
- 2. Add foundation docs as `foundations-{name}-docs.md`
202
- 3. Add resource docs as `resources-{name}-docs.md`
203
-
204
- The server will automatically categorize and expose them through the MCP protocol.
205
-
206
- ### Customization
207
-
208
- To use a different documentation directory, modify the `DOCS_DIR` constant in `src/index.ts`:
209
-
210
- ```typescript
211
- const DOCS_DIR = path.join(__dirname, "..", "docs", "your-docs-folder");
212
- ```
213
-
214
- ## Security
215
-
216
- - Files are restricted to the configured docs directory
217
- - Path traversal attacks are prevented
218
- - Only `.md` files are processed
219
- - All input parameters are validated
220
-
221
- ## License
222
-
223
- [Your License Here]
@@ -0,0 +1,241 @@
1
+ /**
2
+ * Tool handlers for component-related operations
3
+ */
4
+ import { z } from 'zod';
5
+ import * as path from 'path';
6
+ import { getMarkdownFiles, mapIressComponentToFile, extractIressComponents, readFileContent, } from './utils.js';
7
+ import { DOCS_DIR } from './config.js';
8
+ function checkIressComponentMatch(query) {
9
+ if (query.startsWith('Iress')) {
10
+ const componentFile = mapIressComponentToFile(query);
11
+ if (componentFile) {
12
+ return {
13
+ content: [
14
+ {
15
+ type: 'text',
16
+ text: `Found exact match for **${query}**:\n\n**${componentFile}**\n ${query} component documentation\n\n*Use \`get_iress_component_info\` with "${query}" for detailed information.*`,
17
+ },
18
+ ],
19
+ };
20
+ }
21
+ }
22
+ return null;
23
+ }
24
+ function calculateRelevanceScore(file, content, query, lines) {
25
+ let relevanceScore = 0;
26
+ const queryLower = query.toLowerCase();
27
+ const filenameLower = file.toLowerCase();
28
+ // Check for Iress component mentions in content
29
+ const iressComponents = extractIressComponents(content);
30
+ const hasMatchingIressComponent = iressComponents.some((comp) => comp.toLowerCase().includes(queryLower) ||
31
+ queryLower.includes(comp.toLowerCase().replace('iress', '')));
32
+ if (hasMatchingIressComponent) {
33
+ relevanceScore += 75;
34
+ }
35
+ // High relevance for filename matches
36
+ if (filenameLower.includes(queryLower)) {
37
+ relevanceScore += 100;
38
+ }
39
+ // Medium relevance for title matches
40
+ const title = lines.find((line) => line.startsWith('#'))?.replace(/^#+\s*/, '') ?? '';
41
+ if (title.toLowerCase().includes(queryLower)) {
42
+ relevanceScore += 50;
43
+ }
44
+ // Lower relevance for content matches
45
+ const contentMatches = content.toLowerCase().split(queryLower).length - 1;
46
+ relevanceScore += contentMatches * 2;
47
+ return relevanceScore;
48
+ }
49
+ function createSearchResult(file, relevanceScore, lines) {
50
+ const componentName = file
51
+ .replace(/^components-/, '')
52
+ .replace('-docs.md', '');
53
+ const description = lines
54
+ .slice(0, 10)
55
+ .find((line) => line.trim() && !line.startsWith('#') && !line.startsWith('<!--'))
56
+ ?.trim() ?? 'IDS component documentation';
57
+ return {
58
+ file,
59
+ relevance: relevanceScore,
60
+ description: `${componentName}: ${description}`,
61
+ };
62
+ }
63
+ export function handleFindComponent(args) {
64
+ const schema = z.object({
65
+ query: z.string(),
66
+ category: z.enum(['components', 'foundations', 'resources']).optional(),
67
+ });
68
+ const { query, category } = schema.parse(args);
69
+ // Check if query is an Iress component name
70
+ const iressMatch = checkIressComponentMatch(query);
71
+ if (iressMatch) {
72
+ return iressMatch;
73
+ }
74
+ const markdownFiles = getMarkdownFiles();
75
+ // Filter files by category if specified
76
+ const filteredFiles = category
77
+ ? markdownFiles.filter((file) => file.startsWith(`${category}-`))
78
+ : markdownFiles;
79
+ const results = [];
80
+ for (const file of filteredFiles) {
81
+ try {
82
+ const filePath = path.join(DOCS_DIR, file);
83
+ const content = readFileContent(filePath);
84
+ const lines = content.split('\n');
85
+ const relevanceScore = calculateRelevanceScore(file, content, query, lines);
86
+ if (relevanceScore > 0) {
87
+ results.push(createSearchResult(file, relevanceScore, lines));
88
+ }
89
+ }
90
+ catch (error) {
91
+ console.error(`Error reading file ${file}:`, error);
92
+ }
93
+ }
94
+ // Sort by relevance
95
+ results.sort((a, b) => b.relevance - a.relevance);
96
+ return {
97
+ content: [
98
+ {
99
+ type: 'text',
100
+ text: results.length > 0
101
+ ? `Found ${results.length} relevant IDS components:\n\n${results
102
+ .slice(0, 10) // Limit to top 10 results
103
+ .map((r, index) => `${index + 1}. **${r.file}**\n ${r.description}`)
104
+ .join('\n\n')}`
105
+ : `No IDS components found matching "${query}". Try searching for common component names like "button", "input", "table", or "modal".`,
106
+ },
107
+ ],
108
+ };
109
+ }
110
+ function findComponentFile(component, markdownFiles) {
111
+ return markdownFiles.find((file) => file.includes(`components-${component.toLowerCase()}`) ||
112
+ file.toLowerCase().includes(component.toLowerCase()));
113
+ }
114
+ function formatAvailableComponents(markdownFiles) {
115
+ return markdownFiles
116
+ .filter((f) => f.startsWith('components-'))
117
+ .map((f) => `- ${f.replace('components-', '').replace('-docs.md', '')}`)
118
+ .join('\n');
119
+ }
120
+ function isPropsRelatedLine(line) {
121
+ return (line.includes('mode') ||
122
+ line.includes('prop') ||
123
+ line.includes('Properties') ||
124
+ line.includes('API') ||
125
+ line.includes('Examples'));
126
+ }
127
+ function extractPropSections(content) {
128
+ const lines = content.split('\n');
129
+ const propSections = [];
130
+ let inPropsSection = false;
131
+ let currentSection = '';
132
+ for (const line of lines) {
133
+ if (isPropsRelatedLine(line)) {
134
+ if (currentSection) {
135
+ propSections.push(currentSection);
136
+ }
137
+ currentSection = line + '\n';
138
+ inPropsSection = true;
139
+ }
140
+ else if (inPropsSection && line.trim()) {
141
+ currentSection += line + '\n';
142
+ }
143
+ else if (inPropsSection && !line.trim()) {
144
+ if (currentSection) {
145
+ propSections.push(currentSection);
146
+ currentSection = '';
147
+ }
148
+ inPropsSection = false;
149
+ }
150
+ }
151
+ if (currentSection) {
152
+ propSections.push(currentSection);
153
+ }
154
+ return propSections;
155
+ }
156
+ function formatPropsResponse(propSections, content, componentFile) {
157
+ return propSections.length > 0
158
+ ? propSections.join('\n---\n\n')
159
+ : `Props information extracted from ${componentFile}:\n\n${content.slice(0, 2000)}...`;
160
+ }
161
+ export function handleGetComponentProps(args) {
162
+ const schema = z.object({
163
+ component: z.string(),
164
+ });
165
+ const { component } = schema.parse(args);
166
+ const markdownFiles = getMarkdownFiles();
167
+ const componentFile = findComponentFile(component, markdownFiles);
168
+ if (!componentFile) {
169
+ return {
170
+ content: [
171
+ {
172
+ type: 'text',
173
+ text: `Component "${component}" not found. Available components:\n${formatAvailableComponents(markdownFiles)}`,
174
+ },
175
+ ],
176
+ };
177
+ }
178
+ try {
179
+ const filePath = path.join(DOCS_DIR, componentFile);
180
+ const content = readFileContent(filePath);
181
+ const propSections = extractPropSections(content);
182
+ return {
183
+ content: [
184
+ {
185
+ type: 'text',
186
+ text: `**${component} Component Props & API**\n\n${formatPropsResponse(propSections, content, componentFile)}`,
187
+ },
188
+ ],
189
+ };
190
+ }
191
+ catch (error) {
192
+ throw new Error(`Failed to read component file ${componentFile}: ${error instanceof Error ? error.message : String(error)}`);
193
+ }
194
+ }
195
+ export function handleListComponents(args) {
196
+ const schema = z.object({
197
+ category: z
198
+ .enum(['components', 'foundations', 'resources', 'all'])
199
+ .default('all'),
200
+ });
201
+ const { category } = schema.parse(args);
202
+ const markdownFiles = getMarkdownFiles();
203
+ const categorized = {
204
+ components: markdownFiles
205
+ .filter((f) => f.startsWith('components-'))
206
+ .map((f) => f.replace('components-', '').replace('-docs.md', '')),
207
+ foundations: markdownFiles
208
+ .filter((f) => f.startsWith('foundations-'))
209
+ .map((f) => f.replace('foundations-', '').replace('-docs.md', '')),
210
+ resources: markdownFiles
211
+ .filter((f) => f.startsWith('resources-'))
212
+ .map((f) => f.replace('resources-', '').replace('-docs.md', '')),
213
+ };
214
+ let output = '**IDS Component Library**\n\n';
215
+ if (category === 'all') {
216
+ const componentsList = categorized.components
217
+ .map((c) => `- ${c}`)
218
+ .join('\n');
219
+ const foundationsList = categorized.foundations
220
+ .map((c) => `- ${c}`)
221
+ .join('\n');
222
+ const resourcesList = categorized.resources.map((c) => `- ${c}`).join('\n');
223
+ output += `**Components (${categorized.components.length})**\n${componentsList}\n\n`;
224
+ output += `**Foundations (${categorized.foundations.length})**\n${foundationsList}\n\n`;
225
+ output += `**Resources (${categorized.resources.length})**\n${resourcesList}`;
226
+ }
227
+ else {
228
+ const items = categorized[category];
229
+ const itemsList = items.map((c) => `- ${c}`).join('\n');
230
+ const categoryTitle = category.charAt(0).toUpperCase() + category.slice(1);
231
+ output += `**${categoryTitle} (${items.length})**\n${itemsList}`;
232
+ }
233
+ return {
234
+ content: [
235
+ {
236
+ type: 'text',
237
+ text: output,
238
+ },
239
+ ],
240
+ };
241
+ }