@siemens/element-mcp 48.3.0-v.1.7.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.
Files changed (46) hide show
  1. package/AGENTS.md +57 -0
  2. package/LICENSE.md +20 -0
  3. package/README.md +330 -0
  4. package/config.json +36 -0
  5. package/database/vectors.db +0 -0
  6. package/dist/src/cli.d.ts +3 -0
  7. package/dist/src/cli.d.ts.map +1 -0
  8. package/dist/src/cli.js +298 -0
  9. package/dist/src/cli.js.map +1 -0
  10. package/dist/src/config.d.ts +34 -0
  11. package/dist/src/config.d.ts.map +1 -0
  12. package/dist/src/config.js +33 -0
  13. package/dist/src/config.js.map +1 -0
  14. package/dist/src/db-handler.d.ts +47 -0
  15. package/dist/src/db-handler.d.ts.map +1 -0
  16. package/dist/src/db-handler.js +143 -0
  17. package/dist/src/db-handler.js.map +1 -0
  18. package/dist/src/embeddings.d.ts +84 -0
  19. package/dist/src/embeddings.d.ts.map +1 -0
  20. package/dist/src/embeddings.js +300 -0
  21. package/dist/src/embeddings.js.map +1 -0
  22. package/dist/src/index.d.ts +24 -0
  23. package/dist/src/index.d.ts.map +1 -0
  24. package/dist/src/index.js +342 -0
  25. package/dist/src/index.js.map +1 -0
  26. package/dist/src/keys.d.ts +4 -0
  27. package/dist/src/keys.d.ts.map +1 -0
  28. package/dist/src/keys.js +25 -0
  29. package/dist/src/keys.js.map +1 -0
  30. package/dist/src/logger.d.ts +24 -0
  31. package/dist/src/logger.d.ts.map +1 -0
  32. package/dist/src/logger.js +185 -0
  33. package/dist/src/logger.js.map +1 -0
  34. package/dist/src/prompt.d.ts +19 -0
  35. package/dist/src/prompt.d.ts.map +1 -0
  36. package/dist/src/prompt.js +94 -0
  37. package/dist/src/prompt.js.map +1 -0
  38. package/dist/src/setup.d.ts +26 -0
  39. package/dist/src/setup.d.ts.map +1 -0
  40. package/dist/src/setup.js +718 -0
  41. package/dist/src/setup.js.map +1 -0
  42. package/dist/src/token.d.ts +22 -0
  43. package/dist/src/token.d.ts.map +1 -0
  44. package/dist/src/token.js +75 -0
  45. package/dist/src/token.js.map +1 -0
  46. package/package.json +59 -0
package/AGENTS.md ADDED
@@ -0,0 +1,57 @@
1
+ # Element Development Guidelines
2
+
3
+ ## Project Overview
4
+
5
+ This document provides guidelines for developing applications using the Siemens Element design
6
+ system packages. The libraries are available under both `@siemens/` and `@simpl/` prefixes (legacy
7
+ and some other non-public packages), including element-ng, charts-ng, maps-ng, dashboards-ng,
8
+ native-charts-ng, and other related packages.
9
+
10
+ The Element design system includes the element-theme package and comprehensive token system for
11
+ consistent styling and theming across applications.
12
+
13
+ ## Development Approach
14
+
15
+ Always search Element documentation first before implementing any UI components or patterns. This
16
+ includes looking up UX guidelines, component APIs, helper classes like "card" and "button" which are
17
+ considered components, and design patterns from the official documentation.
18
+
19
+ Use modern Angular syntax with standalone components, Angular Signals for state management, and
20
+ separate template/style files. Avoid inline templates or styles unless they are very short. Import
21
+ components individually and use arrow functions with const declarations.
22
+
23
+ Prefer using existing components and patterns over implementing your own. Do not use antipatterns
24
+ such as card-in-card layouts, apply elevation sparingly and correctly. Use mock data to simulate
25
+ real-world scenarios and maintain consistent theming throughout using Element design tokens and
26
+ documented application layouts.
27
+
28
+ ## Code Quality
29
+
30
+ Write minimal comments only where necessary and avoid meta-comments about changes. Don't add
31
+ unnecessary try-catch blocks or one-line if statements without braces. Fix root causes rather than
32
+ symptoms and assume APIs are available without fallbacks.
33
+
34
+ Use utility classes from the Element design system when available instead of writing custom CSS.
35
+ Don't override utility classes - create new identifying classes if customization is needed. Leverage
36
+ color token variables and documented layout patterns. Use modern TypeScript features (like arrow
37
+ functions and bind to const instead of function) and avoid deprecated or legacy syntax.
38
+
39
+ ## Package Management and Testing
40
+
41
+ Install missing packages using appropriate package managers and fix import paths when packages exist
42
+ but imports fail. Run lint, format, and test commands if available in the project, checking
43
+ package.json for available scripts.
44
+
45
+ Keep documentation changes minimal unless starting or changing an entire project. Focus on
46
+ implementation over excessive documentation and create realistic, cohesive applications using the
47
+ Element ecosystem components and design guidelines.
48
+
49
+ ## Implementation Strategy
50
+
51
+ When building applications, research relevant layouts and navigation patterns first. Plan component
52
+ structure with standalone imports, create appropriate mock data, and apply Element design tokens
53
+ consistently. Use documented Element components and verify functionality through available testing
54
+ suites.
55
+
56
+ This approach ensures high-quality development within the Element ecosystem while maintaining modern
57
+ Angular best practices and leveraging the full design system capabilities.
package/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License
2
+
3
+ Copyright (c) Siemens 2016 - 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the “Software”), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,330 @@
1
+ # Siemens MCP Server for Element
2
+
3
+ A Model Context Protocol (MCP) server that provides AI assistants (Agents) with access to
4
+ [Siemens Element](https://element.siemens.io) design system and component API documentation through
5
+ Retrieval-Augmented Generation (RAG). This enables more accurate and relevant assistance with design
6
+ system and component library APIs.
7
+
8
+ ## Usage and use cases
9
+
10
+ - Local MCP server installation includes all design system documentation, component APIs, examples
11
+ and icon information
12
+ - MCP server integration with your AI Agent setup of choice, integrated into your IDE (for example,
13
+ GitHub Copilot Agent integration within VS Code with project-related MCP configuration)
14
+ - Use cases include (but are not limited to):
15
+ - Get design system best practice information
16
+ - Export components
17
+ - Review project text according to UX writing guidelines
18
+ - Generate new pages using design system components
19
+ - Add and modify pages
20
+
21
+ ## Installation
22
+
23
+ ### Prerequisites
24
+
25
+ - Node.js (20+ recommended)
26
+ - Access to the API [https://api.siemens.com/llm](https://api.siemens.com) by creating a free token
27
+ at <https://my.siemens.com> with `llm` scope. We use the `embeddings` API. Siemens access is
28
+ required to request a token. We are working on a configurable alternative.
29
+ - IDE/Agent/LLM setup of your choice (for example: VS Code, GitHub Copilot, Claude Sonnet 4.5)
30
+
31
+ ### Version selection
32
+
33
+ We distribute a MCP server package `@siemens/element-mcp` for every `@siemens/element-ng` version.
34
+ The version of `@siemens/element-mcp` must match your version of `@siemens/element-ng`. The version
35
+ number of the MCP package `@siemens/element-mcp` is a combination of the `@siemens/element-ng`
36
+ version and the version of the MCP code.
37
+
38
+ For example, `@siemens/element-mcp@48.2.0-v.1.4.8` comes with the data of
39
+ `@siemens/element-ng@48.2.0` and `v.1.4.8` is the version of the MCP script.
40
+
41
+ To facilitate the version selection, we use
42
+ [npm distribution tags](https://docs.npmjs.com/cli/commands/npm-dist-tag) `@element<version>` that
43
+ match the version of `@siemens/element-ng`. When using the corresponding distribution tag on
44
+ installation, you get the latest version of the MCP package that matches your `@siemens/element-ng`
45
+ version and simplifies handling in your `package.json`.
46
+
47
+ ```json
48
+ "dependencies": {
49
+ "@siemens/element-ng": "48.2.0",
50
+ },
51
+ "devDependencies": {
52
+ "@siemens/element-mcp": "48.2.0-v.1.4.8",
53
+ }
54
+ ```
55
+
56
+ New MCP package versions on the same `element-ng` version are incremented like `48.2.0-v.1.4.9`,
57
+ `48.2.0-v.1.4.10`, `48.2.0-v.1.5.0`.
58
+
59
+ ### Project installation
60
+
61
+ ```bash
62
+ npm install --save-dev --save-exact @siemens/element-mcp@element48.2.0
63
+
64
+ # Or with yarn
65
+ yarn add -D --exact @siemens/element-mcp@element48.2.0
66
+ ```
67
+
68
+ ### Global installation
69
+
70
+ ```bash
71
+ npm install -g @siemens/element-mcp@element48.2.0
72
+ ```
73
+
74
+ ### Upgrading
75
+
76
+ Simply install the tag for your version and framework again:
77
+
78
+ ```bash
79
+ # in project
80
+ npm install --save-dev --save-exact @siemens/element-mcp@element48.3.0
81
+
82
+ # with yarn
83
+ yarn add -D --exact @siemens/element-mcp@element48.3.0
84
+
85
+ # global
86
+ npm install -g --save-exact @siemens/element-mcp@element48.3.0
87
+ ```
88
+
89
+ ## Quick Start
90
+
91
+ After local project or global package installation, you need to initialize the MCP server and
92
+ provide the access token.
93
+
94
+ 1. **Navigate to your project directory**:
95
+
96
+ ```bash
97
+ cd your-project
98
+ ```
99
+
100
+ 2. **Run initial setup**:
101
+
102
+ ```bash
103
+ npx @siemens/element-mcp init
104
+ ```
105
+
106
+ Or if token is already set up:
107
+
108
+ ```bash
109
+ npx @siemens/element-mcp setup
110
+ ```
111
+
112
+ > Important: Run this command in the root of every project where you want to use the MCP server.
113
+
114
+ 3. **Follow the prompts**:
115
+ - Enter your LLM token from https://my.siemens.com/ (requires 'llm' scope)
116
+ - This token is needed to generate embeddings for semantic search of the documentation. The
117
+ embeddings help find relevant documentation chunks, but the actual LLM (language model) that
118
+ processes your queries and generates responses is provided separately by your AI tool (e.g.,
119
+ GitHub Copilot, Claude, etc.)
120
+ - Choose which tools to configure (VS Code, Cline, Zed, etc.)
121
+ - Optionally set up Element instruction files for AI agents
122
+ - The tool will create MCP configuration files based on your selection, commit the local
123
+ configuration to share it (make sure it is not ignored by `.gitignore`)
124
+
125
+ 4. **Restart your AI tools** (VS Code, Cline, Zed, etc.)
126
+ - Ensure the server is running and trust the MCP server, e.g. click the "Server" icon in the
127
+ Github Copilot Chat panel in VS Code.
128
+ - **For GitHub Copilot in VS Code**: Make sure you are in Agent Mode (not Chat Mode). Use models
129
+ like **Claude Sonnet 4.5**.
130
+
131
+ 5. **Start prompting**:
132
+ - "How do I use the Filtered-Search component from @siemens/element-ng?"
133
+ - "Show me examples of @siemens/charts-ng usage"
134
+ - "Implement a dashboard with different widgets"
135
+ - "Find icons related to AI or machine learning"
136
+ - "Review the texts of this project"
137
+
138
+ > The MCP server starts automatically when your AI tools need it.
139
+
140
+ ## Setup Options
141
+
142
+ During `init` or `setup`, select which configuration(s) to create:
143
+
144
+ - **Local VS Code / GitHub Copilot (Repository)** creates a VS Code MCP configuration file at
145
+ `.vscode/mcp.json` in the current repository
146
+ - **Cline Global Settings** updates global Cline MCP configuration
147
+ - **VS Code / GitHub Copilot Global Config** writes user-level MCP config
148
+ - **Zed Global Settings** configures Zed editor / agent MCP
149
+
150
+ ## AI Agent Instructions (optional)
151
+
152
+ After MCP configuration, you can set up Element and Angular instruction files so AI agents work more
153
+ effectively with your codebase. Do this in each repository where you want instructions.
154
+
155
+ You have two options:
156
+
157
+ - **Symbolic link to receive updates**
158
+ Keeps files synced with the installed package. Requires the package to remain installed and may
159
+ not work on all systems or package managers. The tool can create symlinks automatically;
160
+ otherwise, create links yourself pointing to the installed package's `AGENTS.md` and Element
161
+ instructions.
162
+
163
+ - **Copy the content** Copy the contents of the package’s `AGENTS.md` into one of the following in
164
+ your repo:
165
+ - `.github/instructions/Element.instructions.md`
166
+ - `AGENTS.md`
167
+ - `.github/copilot-instructions.md`
168
+
169
+ If you prefer manual copy, open the package’s `AGENTS.md`, then paste it into your chosen file and
170
+ commit it. Repeat per repository whenever you want to update the instructions.
171
+
172
+ ## Logging
173
+
174
+ Per default no logging is performed, but you can enable local-only logging of all search queries and
175
+ retrieval results during setup.
176
+
177
+ ### Manually enabling logging
178
+
179
+ In your MCP configuration add the flag `--log` to log all search queries and retrieval results to
180
+ local log files in `~/.element-mcp`.
181
+
182
+ ```json
183
+ {
184
+ "servers": {
185
+ "@siemens/element-mcp": {
186
+ "type": "stdio",
187
+ "command": "npx",
188
+ "args": ["@siemens/element-mcp", "--log"]
189
+ }
190
+ }
191
+ }
192
+ ```
193
+
194
+ ### Viewing and sharing logs
195
+
196
+ To view logs, use the `npx @siemens/element-mcp log` command, select any relevant session and look
197
+ at the output or the files copied to your current working directory.
198
+
199
+ For feedback about the MCP and Agent results, please create an issue at
200
+ [https://code.siemens.com/ux/sdl-mcp/issues](https://code.siemens.com/ux/sdl-mcp/issues), share your
201
+ information, and include the relevant logs.
202
+
203
+ ## Usage
204
+
205
+ ### Commands
206
+
207
+ #### Init (First-time setup)
208
+
209
+ Complete initial setup: configure token and create all MCP configurations.
210
+
211
+ ```bash
212
+ npx @siemens/element-mcp init
213
+ ```
214
+
215
+ #### Setup (Update configurations)
216
+
217
+ Create or update MCP configuration files for your tools (uses existing token).
218
+
219
+ ```bash
220
+ npx @siemens/element-mcp setup
221
+ ```
222
+
223
+ #### Setup Token
224
+
225
+ Set or update only the LLM token in system keychain.
226
+
227
+ ```bash
228
+ npx @siemens/element-mcp setup-token
229
+ ```
230
+
231
+ #### Check
232
+
233
+ Verify your installation and configuration.
234
+
235
+ ```bash
236
+ npx @siemens/element-mcp check
237
+ ```
238
+
239
+ #### Test
240
+
241
+ Test the MCP server with a sample query.
242
+
243
+ ```bash
244
+ npx @siemens/element-mcp test
245
+ ```
246
+
247
+ #### Log
248
+
249
+ Check your previous MCP retrieval logs (if enabled / not disabled).
250
+
251
+ ```bash
252
+ npx @siemens/element-mcp log
253
+ ```
254
+
255
+ ### Connection Issues
256
+
257
+ - Verify that the MCP server is running (it should start automatically)
258
+ - Restart your AI tool after configuration changes
259
+ - Verify your LLM token is valid at https://my.siemens.com/
260
+
261
+ ## Manual Configuration
262
+
263
+ If you prefer to set up the configurations manually, here are the required files and their contents.
264
+
265
+ ### VS Code (.vscode/mcp.json or User/mcp.json)
266
+
267
+ ```json
268
+ {
269
+ "servers": {
270
+ "@siemens/element-mcp": {
271
+ "type": "stdio",
272
+ "command": "npx",
273
+ "args": ["@siemens/element-mcp"]
274
+ }
275
+ }
276
+ }
277
+ ```
278
+
279
+ ### Cline (Global Cline MCP settings)
280
+
281
+ ```json
282
+ {
283
+ "mcpServers": {
284
+ "@siemens/element-mcp": {
285
+ "command": "npx",
286
+ "args": ["@siemens/element-mcp"]
287
+ }
288
+ }
289
+ }
290
+ ```
291
+
292
+ ### Zed (Global Zed settings)
293
+
294
+ ```json
295
+ {
296
+ "context_servers": {
297
+ "@siemens/element-mcp": {
298
+ "source": "custom",
299
+ "command": "<path-to-npx, run which/where npx to find>",
300
+ "args": ["@siemens/element-mcp"],
301
+ "env": {}
302
+ }
303
+ }
304
+ }
305
+ ```
306
+
307
+ ## License
308
+
309
+ The following applies for code and documentation of the git repository, unless explicitly mentioned.
310
+
311
+ Copyright (c) Siemens 2016 - 2025
312
+
313
+ MIT, see [LICENSE.md](LICENSE.md).
314
+
315
+ ### Open Source Software
316
+
317
+ The software of this distributed MCP npm package consists of the database file and JavaScript files,
318
+ which provide access to the database, implementing the Model Context Protocol. This package does not
319
+ include any third party software. However, to use this software, you need the Open Source Software
320
+ packages specified in the `dependencies` part of the [package.json](package.json) file, and their
321
+ dependencies. When installing this package with a npm package manager, the dependencies are
322
+ automatically installed (e.g., when using npm).
323
+
324
+ ## Support
325
+
326
+ For issues and questions, please use the issue tracker at:
327
+ [https://code.siemens.com/ux/sdl-mcp/issues](https://code.siemens.com/ux/sdl-mcp/issues)
328
+
329
+ For suboptimal retrievals / agent behavior, consider attaching a relevant log to help us figure out
330
+ how to improve the service, see [Viewing and sharing logs](#viewing-and-sharing-logs).
package/config.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@siemens/element-mcp",
3
+ "description": "Element MCP server",
4
+ "framework": "base",
5
+ "displayName": "Element",
6
+ "binName": "element-mcp",
7
+ "compatTokenName": "simpl-mcp",
8
+ "designSystem": "Element",
9
+ "projectName": "Element",
10
+ "searchToolName": "element-search",
11
+ "iconSearch": true,
12
+ "iconSearchToolName": "element-icon-search",
13
+ "iconName": "@simpl/element-icons",
14
+ "agentsFile": true,
15
+ "instructionFileName": "Element.instructions.md",
16
+ "observabilityLogging": false,
17
+ "exampleQuestions": [
18
+ "How do I use the Filtered-Search component from @siemens/element-ng?",
19
+ "Show me examples of @siemens/charts-ng usage",
20
+ "Implement a dashboard with different widgets",
21
+ "Find icons related to AI or machine learning"
22
+ ],
23
+ "texts": {
24
+ "FRAMEWORK_LIBRARY_LIST": "element-ng, charts-ng, maps-ng, dashboards-ng, and native-charts-ng",
25
+ "FRAMEWORK_DEV_QUESTION": "Angular development question",
26
+ "FRAMEWORK_IMPLEMENTATIONS": "Angular implementations",
27
+ "FRAMEWORK_SUPPORTED_LIBRARIES": "• element-ng - Core UI components (buttons, inputs, modals, etc.)\n• maps-ng - Interactive mapping components\n• charts-ng - Data visualization charts\n• dashboards-ng - Dashboard layout components\n• native-charts-ng - Native charting solutions",
28
+ "FRAMEWORK_SEMANTIC_SEARCH_TOOL": "Semantic search tool for Siemens (SiMPL) Element Design System and Angular component libraries",
29
+ "FRAMEWORK_ALL_QUERIES": "This applies to ALL Angular-related queries regardless of whether (SiMPL) Element libraries are explicitly mentioned",
30
+ "FRAMEWORK_VERSION_SPECIFIC": "The tool provides access to version-specific Siemens (SiMPL) Element documentation that is automatically tuned to match the user's library versions",
31
+ "FRAMEWORK_SETUP_ADVICE": "This ensures you get the exact APIs, components, and implementation patterns available in their specific setup rather than generic Angular advice",
32
+ "FRAMEWORK_COMPREHENSIVE_GUIDANCE": "Always search first to leverage the comprehensive element-ng, maps-ng, charts-ng, dashboards-ng, and native-charts-ng documentation before offering any Angular guidance",
33
+ "FRAMEWORK_SEARCH_QUERY": "Search query for (SiMPL) Element documentation. Can include component names, functionality descriptions, API questions, or usage patterns. Examples: \"button component\", \"chart configuration\", \"map markers\", \"dashboard layout\"",
34
+ "FRAMEWORK_DOCUMENTATION_RESULTS": "# Element Angular Documentation Results"
35
+ }
36
+ }
Binary file
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/mcp/cli.ts"],"names":[],"mappings":""}