@eui/mcp 1.0.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.
- package/README.md +846 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +27 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +224 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +171 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +100 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/loader/cache-manager.d.ts +74 -0
- package/dist/loader/cache-manager.d.ts.map +1 -0
- package/dist/loader/cache-manager.js +107 -0
- package/dist/loader/cache-manager.js.map +1 -0
- package/dist/loader/documentation-loader.d.ts +57 -0
- package/dist/loader/documentation-loader.d.ts.map +1 -0
- package/dist/loader/documentation-loader.js +81 -0
- package/dist/loader/documentation-loader.js.map +1 -0
- package/dist/loader/documentation-source.d.ts +37 -0
- package/dist/loader/documentation-source.d.ts.map +1 -0
- package/dist/loader/documentation-source.js +2 -0
- package/dist/loader/documentation-source.js.map +1 -0
- package/dist/loader/errors.d.ts +34 -0
- package/dist/loader/errors.d.ts.map +1 -0
- package/dist/loader/errors.js +65 -0
- package/dist/loader/errors.js.map +1 -0
- package/dist/loader/http-client.d.ts +43 -0
- package/dist/loader/http-client.d.ts.map +1 -0
- package/dist/loader/http-client.js +144 -0
- package/dist/loader/http-client.js.map +1 -0
- package/dist/loader/index.d.ts +6 -0
- package/dist/loader/index.d.ts.map +1 -0
- package/dist/loader/index.js +5 -0
- package/dist/loader/index.js.map +1 -0
- package/dist/loader/local-documentation-source.d.ts +62 -0
- package/dist/loader/local-documentation-source.d.ts.map +1 -0
- package/dist/loader/local-documentation-source.js +190 -0
- package/dist/loader/local-documentation-source.js.map +1 -0
- package/dist/loader/path-type-detector.d.ts +34 -0
- package/dist/loader/path-type-detector.d.ts.map +1 -0
- package/dist/loader/path-type-detector.js +78 -0
- package/dist/loader/path-type-detector.js.map +1 -0
- package/dist/loader/remote-documentation-source.d.ts +112 -0
- package/dist/loader/remote-documentation-source.d.ts.map +1 -0
- package/dist/loader/remote-documentation-source.js +252 -0
- package/dist/loader/remote-documentation-source.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +211 -0
- package/dist/main.js.map +1 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +65 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +224 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/publish/index.d.ts +8 -0
- package/dist/publish/index.d.ts.map +1 -0
- package/dist/publish/index.js +8 -0
- package/dist/publish/index.js.map +1 -0
- package/dist/publish/publish-utils.d.ts +74 -0
- package/dist/publish/publish-utils.d.ts.map +1 -0
- package/dist/publish/publish-utils.js +170 -0
- package/dist/publish/publish-utils.js.map +1 -0
- package/dist/query/component-query.d.ts +33 -0
- package/dist/query/component-query.d.ts.map +1 -0
- package/dist/query/component-query.js +63 -0
- package/dist/query/component-query.js.map +1 -0
- package/dist/query/index-builder.d.ts +79 -0
- package/dist/query/index-builder.d.ts.map +1 -0
- package/dist/query/index-builder.js +217 -0
- package/dist/query/index-builder.js.map +1 -0
- package/dist/query/index.d.ts +5 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +6 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/result-formatter.d.ts +108 -0
- package/dist/query/result-formatter.d.ts.map +1 -0
- package/dist/query/result-formatter.js +165 -0
- package/dist/query/result-formatter.js.map +1 -0
- package/dist/query/search-engine.d.ts +54 -0
- package/dist/query/search-engine.d.ts.map +1 -0
- package/dist/query/search-engine.js +178 -0
- package/dist/query/search-engine.js.map +1 -0
- package/dist/test-error.ts +1 -0
- package/dist/tools/get-component-docs.d.ts +43 -0
- package/dist/tools/get-component-docs.d.ts.map +1 -0
- package/dist/tools/get-component-docs.js +55 -0
- package/dist/tools/get-component-docs.js.map +1 -0
- package/dist/tools/get-component-examples.d.ts +45 -0
- package/dist/tools/get-component-examples.d.ts.map +1 -0
- package/dist/tools/get-component-examples.js +56 -0
- package/dist/tools/get-component-examples.js.map +1 -0
- package/dist/tools/get-component-inputs.d.ts +44 -0
- package/dist/tools/get-component-inputs.d.ts.map +1 -0
- package/dist/tools/get-component-inputs.js +55 -0
- package/dist/tools/get-component-inputs.js.map +1 -0
- package/dist/tools/get-component-outputs.d.ts +44 -0
- package/dist/tools/get-component-outputs.d.ts.map +1 -0
- package/dist/tools/get-component-outputs.js +55 -0
- package/dist/tools/get-component-outputs.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-components.d.ts +69 -0
- package/dist/tools/list-components.d.ts.map +1 -0
- package/dist/tools/list-components.js +84 -0
- package/dist/tools/list-components.js.map +1 -0
- package/dist/tools/search-components.d.ts +69 -0
- package/dist/tools/search-components.d.ts.map +1 -0
- package/dist/tools/search-components.js +98 -0
- package/dist/tools/search-components.js.map +1 -0
- package/dist/types/compodoc.d.ts +261 -0
- package/dist/types/compodoc.d.ts.map +1 -0
- package/dist/types/compodoc.js +5 -0
- package/dist/types/compodoc.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/circuit-breaker.d.ts +91 -0
- package/dist/utils/circuit-breaker.d.ts.map +1 -0
- package/dist/utils/circuit-breaker.js +186 -0
- package/dist/utils/circuit-breaker.js.map +1 -0
- package/dist/utils/credential-masking.d.ts +90 -0
- package/dist/utils/credential-masking.d.ts.map +1 -0
- package/dist/utils/credential-masking.js +202 -0
- package/dist/utils/credential-masking.js.map +1 -0
- package/dist/utils/error-handler.d.ts +68 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +184 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/errors.d.ts +156 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +242 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +16 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +76 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +150 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/retry.d.ts +19 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +81 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/version/changelog-file-utils.d.ts +69 -0
- package/dist/version/changelog-file-utils.d.ts.map +1 -0
- package/dist/version/changelog-file-utils.js +161 -0
- package/dist/version/changelog-file-utils.js.map +1 -0
- package/dist/version/changelog-utils.d.ts +98 -0
- package/dist/version/changelog-utils.d.ts.map +1 -0
- package/dist/version/changelog-utils.js +198 -0
- package/dist/version/changelog-utils.js.map +1 -0
- package/dist/version/dry-run-utils.d.ts +108 -0
- package/dist/version/dry-run-utils.d.ts.map +1 -0
- package/dist/version/dry-run-utils.js +126 -0
- package/dist/version/dry-run-utils.js.map +1 -0
- package/dist/version/git-tag-utils.d.ts +50 -0
- package/dist/version/git-tag-utils.d.ts.map +1 -0
- package/dist/version/git-tag-utils.js +66 -0
- package/dist/version/git-tag-utils.js.map +1 -0
- package/dist/version/index.d.ts +11 -0
- package/dist/version/index.d.ts.map +1 -0
- package/dist/version/index.js +11 -0
- package/dist/version/index.js.map +1 -0
- package/dist/version/release-utils.d.ts +94 -0
- package/dist/version/release-utils.d.ts.map +1 -0
- package/dist/version/release-utils.js +170 -0
- package/dist/version/release-utils.js.map +1 -0
- package/dist/version/rollback-utils.d.ts +47 -0
- package/dist/version/rollback-utils.d.ts.map +1 -0
- package/dist/version/rollback-utils.js +73 -0
- package/dist/version/rollback-utils.js.map +1 -0
- package/dist/version/version-manager.d.ts +98 -0
- package/dist/version/version-manager.d.ts.map +1 -0
- package/dist/version/version-manager.js +158 -0
- package/dist/version/version-manager.js.map +1 -0
- package/package.json +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,846 @@
|
|
|
1
|
+
# EUI Compodoc MCP Server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server that exposes Angular component library metadata from Compodoc's `documentation.json` to AI assistants.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This MCP server provides efficient access to Angular component documentation by leveraging Compodoc's pre-generated `documentation.json` file. Instead of parsing TypeScript files on-the-fly, it uses the structured JSON as a knowledge base, offering fast queries for component inputs, outputs, examples, and other metadata.
|
|
8
|
+
|
|
9
|
+
The server implements the [Model Context Protocol](https://modelcontextprotocol.io/), enabling AI assistants like Claude, Kiro, and others to discover and understand Angular components through standardized tool calls.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Fast Component Discovery**: List all available components with filtering options
|
|
14
|
+
- **Detailed Documentation**: Retrieve complete component metadata including inputs, outputs, and examples
|
|
15
|
+
- **Smart Search**: Search components by name, description, or functionality with relevance ranking
|
|
16
|
+
- **Property-Based Testing**: Comprehensive test coverage using fast-check
|
|
17
|
+
- **File Watching**: Automatic reloading when documentation.json changes
|
|
18
|
+
- **Type-Safe**: Built with TypeScript and strict type checking
|
|
19
|
+
- **Error Resilient**: Graceful error handling with meaningful error messages
|
|
20
|
+
- **Zero Configuration**: Works out of the box with sensible defaults
|
|
21
|
+
|
|
22
|
+
## Table of Contents
|
|
23
|
+
|
|
24
|
+
- [Installation](#installation)
|
|
25
|
+
- [Quick Start](#quick-start)
|
|
26
|
+
- [Configuration](#configuration)
|
|
27
|
+
- [MCP Tools Reference](#mcp-tools-reference)
|
|
28
|
+
- [Usage Examples](#usage-examples)
|
|
29
|
+
- [Development](#development)
|
|
30
|
+
- [CI/CD Pipeline](#cicd-pipeline)
|
|
31
|
+
- [Architecture](#architecture)
|
|
32
|
+
- [Testing](#testing)
|
|
33
|
+
- [Troubleshooting](#troubleshooting)
|
|
34
|
+
- [Contributing](#contributing)
|
|
35
|
+
- [License](#license)
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
### Prerequisites
|
|
40
|
+
|
|
41
|
+
- Node.js 18 or higher
|
|
42
|
+
- npm or yarn package manager
|
|
43
|
+
- A Compodoc-generated `documentation.json` file
|
|
44
|
+
|
|
45
|
+
### Install Dependencies
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Build the Project
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm run build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
See the [QUICKSTART.md](./QUICKSTART.md) guide for a step-by-step tutorial on getting started.
|
|
60
|
+
|
|
61
|
+
### Basic Usage
|
|
62
|
+
|
|
63
|
+
1. **Generate Compodoc documentation** for your Angular project:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx @compodoc/compodoc -p tsconfig.json -e json -d ./docs
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. **Create a configuration file** (`config.json`):
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"documentation": {
|
|
74
|
+
"path": "./docs/documentation.json"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
3. **Start the MCP server**:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm start -- --config ./config.json
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
4. **Configure your MCP client** (e.g., in Kiro's `mcp.json`):
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"eui-compodoc": {
|
|
91
|
+
"command": "node",
|
|
92
|
+
"args": ["/path/to/eui-compodoc-mcp/dist/main.js", "--config", "/path/to/config.json"]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Configuration
|
|
99
|
+
|
|
100
|
+
### Configuration File Format
|
|
101
|
+
|
|
102
|
+
The server accepts a JSON configuration file with the following structure:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"server": {
|
|
107
|
+
"name": "eui-compodoc-mcp",
|
|
108
|
+
"version": "1.0.0"
|
|
109
|
+
},
|
|
110
|
+
"documentation": {
|
|
111
|
+
"path": "./documentation.json",
|
|
112
|
+
"watchForChanges": true,
|
|
113
|
+
"reloadDebounce": 1000
|
|
114
|
+
},
|
|
115
|
+
"search": {
|
|
116
|
+
"maxResults": 50,
|
|
117
|
+
"minQueryLength": 2
|
|
118
|
+
},
|
|
119
|
+
"logging": {
|
|
120
|
+
"level": "info",
|
|
121
|
+
"format": "json"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Configuration Options
|
|
127
|
+
|
|
128
|
+
#### Server Configuration
|
|
129
|
+
|
|
130
|
+
| Option | Type | Default | Description |
|
|
131
|
+
|--------|------|---------|-------------|
|
|
132
|
+
| `server.name` | string | `"eui-compodoc-mcp"` | Server name for MCP identification |
|
|
133
|
+
| `server.version` | string | `"1.0.0"` | Server version |
|
|
134
|
+
|
|
135
|
+
#### Documentation Configuration
|
|
136
|
+
|
|
137
|
+
| Option | Type | Default | Description |
|
|
138
|
+
|--------|------|---------|-------------|
|
|
139
|
+
| `documentation.path` | string | `"./documentation.json"` | Path to Compodoc documentation.json file |
|
|
140
|
+
| `documentation.watchForChanges` | boolean | `true` | Enable file watching for hot reloading |
|
|
141
|
+
| `documentation.reloadDebounce` | number | `1000` | Debounce time (ms) for file change events |
|
|
142
|
+
|
|
143
|
+
#### Search Configuration
|
|
144
|
+
|
|
145
|
+
| Option | Type | Default | Description |
|
|
146
|
+
|--------|------|---------|-------------|
|
|
147
|
+
| `search.maxResults` | number | `50` | Maximum search results to return |
|
|
148
|
+
| `search.minQueryLength` | number | `2` | Minimum query length for searches |
|
|
149
|
+
|
|
150
|
+
#### Logging Configuration
|
|
151
|
+
|
|
152
|
+
| Option | Type | Default | Description |
|
|
153
|
+
|--------|------|---------|-------------|
|
|
154
|
+
| `logging.level` | string | `"info"` | Log level: `"debug"`, `"info"`, `"warn"`, `"error"` |
|
|
155
|
+
| `logging.format` | string | `"json"` | Log format: `"json"` or `"text"` |
|
|
156
|
+
|
|
157
|
+
### Environment Variables
|
|
158
|
+
|
|
159
|
+
You can override configuration using environment variables:
|
|
160
|
+
|
|
161
|
+
- `COMPODOC_MCP_CONFIG`: Path to configuration file
|
|
162
|
+
- `COMPODOC_MCP_DOC_PATH`: Override documentation.json path
|
|
163
|
+
- `COMPODOC_MCP_LOG_LEVEL`: Override log level
|
|
164
|
+
|
|
165
|
+
Example:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
COMPODOC_MCP_DOC_PATH=./my-docs/documentation.json npm start
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## MCP Tools Reference
|
|
172
|
+
|
|
173
|
+
The server exposes six MCP tools for querying component documentation:
|
|
174
|
+
|
|
175
|
+
### 1. list-components
|
|
176
|
+
|
|
177
|
+
Lists all available components, directives, pipes, and services.
|
|
178
|
+
|
|
179
|
+
**Parameters:**
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
{
|
|
183
|
+
includeDeprecated?: boolean; // Include deprecated items (default: false)
|
|
184
|
+
type?: 'component' | 'directive' | 'pipe' | 'service' | 'all'; // Filter by type (default: 'all')
|
|
185
|
+
limit?: number; // Max results (default: 50, max: 1000)
|
|
186
|
+
offset?: number; // Pagination offset (default: 0)
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Returns:**
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
{
|
|
194
|
+
items: Array<{
|
|
195
|
+
name: string;
|
|
196
|
+
type: string;
|
|
197
|
+
selector?: string;
|
|
198
|
+
description: string;
|
|
199
|
+
deprecated: boolean;
|
|
200
|
+
}>;
|
|
201
|
+
total: number;
|
|
202
|
+
hasMore: boolean;
|
|
203
|
+
offset: number;
|
|
204
|
+
limit: number;
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 2. get-component-docs
|
|
209
|
+
|
|
210
|
+
Retrieves detailed documentation for a specific component.
|
|
211
|
+
|
|
212
|
+
**Parameters:**
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
{
|
|
216
|
+
name: string; // Component name (required)
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Returns:**
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
{
|
|
224
|
+
name: string;
|
|
225
|
+
type: string;
|
|
226
|
+
selector?: string;
|
|
227
|
+
description: string;
|
|
228
|
+
inputs: Array<{
|
|
229
|
+
name: string;
|
|
230
|
+
type: string;
|
|
231
|
+
required: boolean;
|
|
232
|
+
description: string;
|
|
233
|
+
defaultValue?: string;
|
|
234
|
+
}>;
|
|
235
|
+
outputs: Array<{
|
|
236
|
+
name: string;
|
|
237
|
+
type: string;
|
|
238
|
+
description: string;
|
|
239
|
+
}>;
|
|
240
|
+
methods: Array<{
|
|
241
|
+
name: string;
|
|
242
|
+
signature: string;
|
|
243
|
+
description: string;
|
|
244
|
+
parameters: Array<{
|
|
245
|
+
name: string;
|
|
246
|
+
type: string;
|
|
247
|
+
optional: boolean;
|
|
248
|
+
}>;
|
|
249
|
+
returnType: string;
|
|
250
|
+
}>;
|
|
251
|
+
examples: Array<{
|
|
252
|
+
title: string;
|
|
253
|
+
description: string;
|
|
254
|
+
code: string;
|
|
255
|
+
language: string;
|
|
256
|
+
}>;
|
|
257
|
+
deprecated: boolean;
|
|
258
|
+
deprecationMessage?: string;
|
|
259
|
+
standalone?: boolean;
|
|
260
|
+
imports?: string[];
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### 3. search-components
|
|
265
|
+
|
|
266
|
+
Searches for components by keyword or functionality.
|
|
267
|
+
|
|
268
|
+
**Parameters:**
|
|
269
|
+
|
|
270
|
+
```typescript
|
|
271
|
+
{
|
|
272
|
+
query: string; // Search query (required)
|
|
273
|
+
types?: Array<'component' | 'directive' | 'pipe' | 'service'>; // Filter by types
|
|
274
|
+
includeDeprecated?: boolean; // Include deprecated items (default: false)
|
|
275
|
+
limit?: number; // Max results (default: 50)
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Returns:**
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
{
|
|
283
|
+
items: Array<{
|
|
284
|
+
name: string;
|
|
285
|
+
type: string;
|
|
286
|
+
selector?: string;
|
|
287
|
+
description: string;
|
|
288
|
+
deprecated: boolean;
|
|
289
|
+
relevanceScore: number;
|
|
290
|
+
}>;
|
|
291
|
+
total: number;
|
|
292
|
+
query: string;
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### 4. get-component-inputs
|
|
297
|
+
|
|
298
|
+
Retrieves input properties for a specific component.
|
|
299
|
+
|
|
300
|
+
**Parameters:**
|
|
301
|
+
|
|
302
|
+
```typescript
|
|
303
|
+
{
|
|
304
|
+
name: string; // Component name (required)
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**Returns:**
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
{
|
|
312
|
+
componentName: string;
|
|
313
|
+
inputs: Array<{
|
|
314
|
+
name: string;
|
|
315
|
+
type: string;
|
|
316
|
+
required: boolean;
|
|
317
|
+
description: string;
|
|
318
|
+
defaultValue?: string;
|
|
319
|
+
}>;
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### 5. get-component-outputs
|
|
324
|
+
|
|
325
|
+
Retrieves output events for a specific component.
|
|
326
|
+
|
|
327
|
+
**Parameters:**
|
|
328
|
+
|
|
329
|
+
```typescript
|
|
330
|
+
{
|
|
331
|
+
name: string; // Component name (required)
|
|
332
|
+
}
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**Returns:**
|
|
336
|
+
|
|
337
|
+
```typescript
|
|
338
|
+
{
|
|
339
|
+
componentName: string;
|
|
340
|
+
outputs: Array<{
|
|
341
|
+
name: string;
|
|
342
|
+
type: string;
|
|
343
|
+
description: string;
|
|
344
|
+
}>;
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### 6. get-component-examples
|
|
349
|
+
|
|
350
|
+
Retrieves usage examples for a specific component.
|
|
351
|
+
|
|
352
|
+
**Parameters:**
|
|
353
|
+
|
|
354
|
+
```typescript
|
|
355
|
+
{
|
|
356
|
+
name: string; // Component name (required)
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
**Returns:**
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
{
|
|
364
|
+
componentName: string;
|
|
365
|
+
examples: Array<{
|
|
366
|
+
title: string;
|
|
367
|
+
description: string;
|
|
368
|
+
code: string;
|
|
369
|
+
language: string;
|
|
370
|
+
}>;
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
## Usage Examples
|
|
375
|
+
|
|
376
|
+
### Example 1: List All Components
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
// Request
|
|
380
|
+
{
|
|
381
|
+
"tool": "list-components",
|
|
382
|
+
"params": {
|
|
383
|
+
"type": "component",
|
|
384
|
+
"limit": 10
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Response
|
|
389
|
+
{
|
|
390
|
+
"items": [
|
|
391
|
+
{
|
|
392
|
+
"name": "ButtonComponent",
|
|
393
|
+
"type": "component",
|
|
394
|
+
"selector": "eui-button",
|
|
395
|
+
"description": "A customizable button component",
|
|
396
|
+
"deprecated": false
|
|
397
|
+
},
|
|
398
|
+
// ... more components
|
|
399
|
+
],
|
|
400
|
+
"total": 150,
|
|
401
|
+
"hasMore": true,
|
|
402
|
+
"offset": 0,
|
|
403
|
+
"limit": 10
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### Example 2: Get Component Details
|
|
408
|
+
|
|
409
|
+
```typescript
|
|
410
|
+
// Request
|
|
411
|
+
{
|
|
412
|
+
"tool": "get-component-docs",
|
|
413
|
+
"params": {
|
|
414
|
+
"name": "ButtonComponent"
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// Response
|
|
419
|
+
{
|
|
420
|
+
"name": "ButtonComponent",
|
|
421
|
+
"type": "component",
|
|
422
|
+
"selector": "eui-button",
|
|
423
|
+
"description": "A customizable button component with various styles and sizes",
|
|
424
|
+
"inputs": [
|
|
425
|
+
{
|
|
426
|
+
"name": "label",
|
|
427
|
+
"type": "string",
|
|
428
|
+
"required": true,
|
|
429
|
+
"description": "Button label text"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"name": "disabled",
|
|
433
|
+
"type": "boolean",
|
|
434
|
+
"required": false,
|
|
435
|
+
"description": "Whether the button is disabled",
|
|
436
|
+
"defaultValue": "false"
|
|
437
|
+
}
|
|
438
|
+
],
|
|
439
|
+
"outputs": [
|
|
440
|
+
{
|
|
441
|
+
"name": "click",
|
|
442
|
+
"type": "EventEmitter<MouseEvent>",
|
|
443
|
+
"description": "Emitted when button is clicked"
|
|
444
|
+
}
|
|
445
|
+
],
|
|
446
|
+
"examples": [
|
|
447
|
+
{
|
|
448
|
+
"title": "Basic Button",
|
|
449
|
+
"description": "A simple button with a label",
|
|
450
|
+
"code": "<eui-button label=\"Click Me\"></eui-button>",
|
|
451
|
+
"language": "html"
|
|
452
|
+
}
|
|
453
|
+
],
|
|
454
|
+
"deprecated": false,
|
|
455
|
+
"standalone": true
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### Example 3: Search Components
|
|
460
|
+
|
|
461
|
+
```typescript
|
|
462
|
+
// Request
|
|
463
|
+
{
|
|
464
|
+
"tool": "search-components",
|
|
465
|
+
"params": {
|
|
466
|
+
"query": "button",
|
|
467
|
+
"types": ["component"],
|
|
468
|
+
"limit": 5
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// Response
|
|
473
|
+
{
|
|
474
|
+
"items": [
|
|
475
|
+
{
|
|
476
|
+
"name": "ButtonComponent",
|
|
477
|
+
"type": "component",
|
|
478
|
+
"selector": "eui-button",
|
|
479
|
+
"description": "A customizable button component",
|
|
480
|
+
"deprecated": false,
|
|
481
|
+
"relevanceScore": 100
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
"name": "IconButtonComponent",
|
|
485
|
+
"type": "component",
|
|
486
|
+
"selector": "eui-icon-button",
|
|
487
|
+
"description": "Button with icon support",
|
|
488
|
+
"deprecated": false,
|
|
489
|
+
"relevanceScore": 80
|
|
490
|
+
}
|
|
491
|
+
],
|
|
492
|
+
"total": 2,
|
|
493
|
+
"query": "button"
|
|
494
|
+
}
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
## Development
|
|
498
|
+
|
|
499
|
+
### Project Structure
|
|
500
|
+
|
|
501
|
+
```
|
|
502
|
+
eui-compodoc-mcp/
|
|
503
|
+
├── src/
|
|
504
|
+
│ ├── config/ # Configuration loading and validation
|
|
505
|
+
│ ├── loader/ # Documentation file loading and watching
|
|
506
|
+
│ ├── mcp/ # MCP server implementation
|
|
507
|
+
│ ├── query/ # Query engine and search functionality
|
|
508
|
+
│ ├── tools/ # MCP tool handlers
|
|
509
|
+
│ ├── types/ # TypeScript type definitions
|
|
510
|
+
│ ├── utils/ # Utility functions and logging
|
|
511
|
+
│ └── main.ts # Application entry point
|
|
512
|
+
├── dist/ # Compiled JavaScript output
|
|
513
|
+
├── coverage/ # Test coverage reports
|
|
514
|
+
├── config.json # Configuration file (example)
|
|
515
|
+
├── package.json
|
|
516
|
+
├── tsconfig.json
|
|
517
|
+
└── jest.config.js
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
### Development Commands
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
# Install dependencies
|
|
524
|
+
npm install
|
|
525
|
+
|
|
526
|
+
# Build the project
|
|
527
|
+
npm run build
|
|
528
|
+
|
|
529
|
+
# Development mode with auto-rebuild
|
|
530
|
+
npm run dev
|
|
531
|
+
|
|
532
|
+
# Run tests
|
|
533
|
+
npm test
|
|
534
|
+
|
|
535
|
+
# Run tests in watch mode
|
|
536
|
+
npm run test:watch
|
|
537
|
+
|
|
538
|
+
# Run tests with coverage
|
|
539
|
+
npm run test:coverage
|
|
540
|
+
|
|
541
|
+
# Lint code
|
|
542
|
+
npm run lint
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
### Adding a New Tool
|
|
546
|
+
|
|
547
|
+
1. Create a new file in `src/tools/` (e.g., `my-new-tool.ts`)
|
|
548
|
+
2. Implement the tool class with `execute()` and `getToolDefinition()` methods
|
|
549
|
+
3. Export the tool from `src/tools/index.ts`
|
|
550
|
+
4. Register the tool in `src/mcp/server.ts`
|
|
551
|
+
5. Add tests in `src/tools/__tests__/`
|
|
552
|
+
|
|
553
|
+
Example tool structure:
|
|
554
|
+
|
|
555
|
+
```typescript
|
|
556
|
+
export class MyNewTool {
|
|
557
|
+
constructor(private query: ComponentQuery, private formatter: ResultFormatter) {}
|
|
558
|
+
|
|
559
|
+
execute(params: MyParams): MyResult {
|
|
560
|
+
// Tool implementation
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
static getToolDefinition() {
|
|
564
|
+
return {
|
|
565
|
+
name: 'my-new-tool',
|
|
566
|
+
description: 'Description of what the tool does',
|
|
567
|
+
inputSchema: {
|
|
568
|
+
type: 'object',
|
|
569
|
+
properties: {
|
|
570
|
+
// Parameter definitions
|
|
571
|
+
},
|
|
572
|
+
},
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
## CI/CD Pipeline
|
|
579
|
+
|
|
580
|
+
This project includes a comprehensive GitLab CI/CD pipeline for automated releases.
|
|
581
|
+
|
|
582
|
+
### Pipeline Stages
|
|
583
|
+
|
|
584
|
+
1. **Build**: Compiles TypeScript to JavaScript
|
|
585
|
+
2. **Test**: Runs unit and property-based tests
|
|
586
|
+
3. **Version**: Bumps version, creates Git tags, generates changelog
|
|
587
|
+
4. **Publish**: Publishes package to npm registry (with approval gate)
|
|
588
|
+
5. **Release**: Creates GitLab release with artifacts and notes
|
|
589
|
+
|
|
590
|
+
### Required Setup
|
|
591
|
+
|
|
592
|
+
To use the CI/CD pipeline, you need to configure the following:
|
|
593
|
+
|
|
594
|
+
1. **CI/CD Variables**:
|
|
595
|
+
- `NPM_TOKEN` (required): npm authentication token
|
|
596
|
+
- `GITLAB_TOKEN` (optional): GitLab API token
|
|
597
|
+
|
|
598
|
+
2. **Protected Branches**:
|
|
599
|
+
- Protect the `main` branch
|
|
600
|
+
- Protect version tags (`v*` pattern)
|
|
601
|
+
|
|
602
|
+
3. **Variable Masking**:
|
|
603
|
+
- All credentials are automatically masked in logs
|
|
604
|
+
- Uses credential masking utilities to prevent exposure
|
|
605
|
+
|
|
606
|
+
### Quick Start
|
|
607
|
+
|
|
608
|
+
1. Configure required CI/CD variables in GitLab project settings
|
|
609
|
+
2. Ensure `main` branch is protected
|
|
610
|
+
3. Trigger a release by running the `version` job manually
|
|
611
|
+
4. Approve the publish step for production releases
|
|
612
|
+
|
|
613
|
+
For detailed setup instructions, security best practices, and troubleshooting, see the [CI/CD Setup Guide](./docs/CI_CD_SETUP.md).
|
|
614
|
+
|
|
615
|
+
### Manual Release Process
|
|
616
|
+
|
|
617
|
+
```bash
|
|
618
|
+
# 1. Ensure all changes are merged to main
|
|
619
|
+
# 2. Go to CI/CD → Pipelines in GitLab
|
|
620
|
+
# 3. Click play button on 'version' job
|
|
621
|
+
# 4. Set RELEASE_TYPE variable (patch, minor, major)
|
|
622
|
+
# 5. Approve publish step when prompted
|
|
623
|
+
# 6. Verify release on npm and GitLab
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
## Architecture
|
|
627
|
+
|
|
628
|
+
### High-Level Architecture
|
|
629
|
+
|
|
630
|
+
```
|
|
631
|
+
┌─────────────┐
|
|
632
|
+
│ MCP Client │ (Kiro, Claude, etc.)
|
|
633
|
+
└──────┬──────┘
|
|
634
|
+
│ MCP Protocol (stdio)
|
|
635
|
+
▼
|
|
636
|
+
┌─────────────────────────────────┐
|
|
637
|
+
│ CompodocMcpServer │
|
|
638
|
+
│ - Tool Registration │
|
|
639
|
+
│ - Request Routing │
|
|
640
|
+
│ - Error Handling │
|
|
641
|
+
└──────┬──────────────────────────┘
|
|
642
|
+
│
|
|
643
|
+
▼
|
|
644
|
+
┌─────────────────────────────────┐
|
|
645
|
+
│ Tool Handlers │
|
|
646
|
+
│ - list-components │
|
|
647
|
+
│ - get-component-docs │
|
|
648
|
+
│ - search-components │
|
|
649
|
+
│ - get-component-inputs │
|
|
650
|
+
│ - get-component-outputs │
|
|
651
|
+
│ - get-component-examples │
|
|
652
|
+
└──────┬──────────────────────────┘
|
|
653
|
+
│
|
|
654
|
+
▼
|
|
655
|
+
┌─────────────────────────────────┐
|
|
656
|
+
│ Query Engine │
|
|
657
|
+
│ - ComponentQuery │
|
|
658
|
+
│ - SearchEngine │
|
|
659
|
+
│ - ResultFormatter │
|
|
660
|
+
└──────┬──────────────────────────┘
|
|
661
|
+
│
|
|
662
|
+
▼
|
|
663
|
+
┌─────────────────────────────────┐
|
|
664
|
+
│ In-Memory Index │
|
|
665
|
+
│ - Name lookup (Map) │
|
|
666
|
+
│ - Selector lookup (Map) │
|
|
667
|
+
│ - Search index (inverted) │
|
|
668
|
+
│ - Type-based indexes │
|
|
669
|
+
└──────┬──────────────────────────┘
|
|
670
|
+
│
|
|
671
|
+
▼
|
|
672
|
+
┌─────────────────────────────────┐
|
|
673
|
+
│ DocumentationLoader │
|
|
674
|
+
│ - File reading │
|
|
675
|
+
│ - JSON parsing │
|
|
676
|
+
│ - File watching │
|
|
677
|
+
│ - Index building │
|
|
678
|
+
└──────┬──────────────────────────┘
|
|
679
|
+
│
|
|
680
|
+
▼
|
|
681
|
+
┌─────────────────────────────────┐
|
|
682
|
+
│ documentation.json │
|
|
683
|
+
│ (Compodoc output) │
|
|
684
|
+
└─────────────────────────────────┘
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
### Key Design Principles
|
|
688
|
+
|
|
689
|
+
1. **Single Source of Truth**: `documentation.json` is the only data source
|
|
690
|
+
2. **In-Memory Index**: Fast lookups using Map-based indexes
|
|
691
|
+
3. **Stateless Tools**: Each tool execution is independent
|
|
692
|
+
4. **Error Resilience**: Graceful error handling at every layer
|
|
693
|
+
5. **Hot Reloading**: Automatic index updates when documentation changes
|
|
694
|
+
|
|
695
|
+
## Testing
|
|
696
|
+
|
|
697
|
+
### Test Coverage
|
|
698
|
+
|
|
699
|
+
The project uses a dual testing approach:
|
|
700
|
+
|
|
701
|
+
1. **Unit Tests**: Test individual functions and classes
|
|
702
|
+
2. **Property-Based Tests**: Verify universal properties using fast-check
|
|
703
|
+
|
|
704
|
+
### Running Tests
|
|
705
|
+
|
|
706
|
+
```bash
|
|
707
|
+
# Run all tests
|
|
708
|
+
npm test
|
|
709
|
+
|
|
710
|
+
# Run tests in watch mode
|
|
711
|
+
npm run test:watch
|
|
712
|
+
|
|
713
|
+
# Run tests with coverage
|
|
714
|
+
npm run test:coverage
|
|
715
|
+
|
|
716
|
+
# Run specific test file
|
|
717
|
+
npm test -- src/tools/__tests__/list-components.test.ts
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### Property-Based Testing
|
|
721
|
+
|
|
722
|
+
The project includes comprehensive property-based tests that verify correctness properties such as:
|
|
723
|
+
|
|
724
|
+
- Complete component listing
|
|
725
|
+
- Pagination consistency
|
|
726
|
+
- Search result relevance
|
|
727
|
+
- Type information preservation
|
|
728
|
+
- Round-trip serialization
|
|
729
|
+
|
|
730
|
+
Each property test runs 100+ iterations with randomly generated test data.
|
|
731
|
+
|
|
732
|
+
## Troubleshooting
|
|
733
|
+
|
|
734
|
+
### Common Issues
|
|
735
|
+
|
|
736
|
+
#### Server Won't Start
|
|
737
|
+
|
|
738
|
+
**Problem**: Server fails to start with configuration error
|
|
739
|
+
|
|
740
|
+
**Solution**: Check that your `config.json` is valid JSON and includes required fields:
|
|
741
|
+
|
|
742
|
+
```json
|
|
743
|
+
{
|
|
744
|
+
"documentation": {
|
|
745
|
+
"path": "./documentation.json"
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
#### Documentation Not Found
|
|
751
|
+
|
|
752
|
+
**Problem**: Error message "Failed to load documentation"
|
|
753
|
+
|
|
754
|
+
**Solution**:
|
|
755
|
+
1. Verify the path in your configuration is correct
|
|
756
|
+
2. Ensure the file exists and is readable
|
|
757
|
+
3. Check that the file is valid JSON
|
|
758
|
+
|
|
759
|
+
```bash
|
|
760
|
+
# Test if file is valid JSON
|
|
761
|
+
cat documentation.json | jq .
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
#### Empty Component List
|
|
765
|
+
|
|
766
|
+
**Problem**: `list-components` returns empty array
|
|
767
|
+
|
|
768
|
+
**Solution**:
|
|
769
|
+
1. Check that your `documentation.json` contains components
|
|
770
|
+
2. Try with `includeDeprecated: true` to see if all components are deprecated
|
|
771
|
+
3. Verify the JSON structure matches Compodoc's output format
|
|
772
|
+
|
|
773
|
+
#### Search Returns No Results
|
|
774
|
+
|
|
775
|
+
**Problem**: `search-components` returns empty results
|
|
776
|
+
|
|
777
|
+
**Solution**:
|
|
778
|
+
1. Try a broader search query
|
|
779
|
+
2. Check that components exist with `list-components`
|
|
780
|
+
3. Ensure search query is at least 2 characters (configurable)
|
|
781
|
+
|
|
782
|
+
#### File Watching Not Working
|
|
783
|
+
|
|
784
|
+
**Problem**: Changes to `documentation.json` don't trigger reload
|
|
785
|
+
|
|
786
|
+
**Solution**:
|
|
787
|
+
1. Check that `watchForChanges` is `true` in configuration
|
|
788
|
+
2. Verify file system permissions
|
|
789
|
+
3. Try increasing `reloadDebounce` value
|
|
790
|
+
4. Check server logs for file watcher errors
|
|
791
|
+
|
|
792
|
+
### Debug Mode
|
|
793
|
+
|
|
794
|
+
Enable debug logging to troubleshoot issues:
|
|
795
|
+
|
|
796
|
+
```json
|
|
797
|
+
{
|
|
798
|
+
"logging": {
|
|
799
|
+
"level": "debug"
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
Or use environment variable:
|
|
805
|
+
|
|
806
|
+
```bash
|
|
807
|
+
COMPODOC_MCP_LOG_LEVEL=debug npm start
|
|
808
|
+
```
|
|
809
|
+
|
|
810
|
+
### Getting Help
|
|
811
|
+
|
|
812
|
+
If you encounter issues:
|
|
813
|
+
|
|
814
|
+
1. Check the [Troubleshooting](#troubleshooting) section
|
|
815
|
+
2. Review server logs for error messages
|
|
816
|
+
3. Verify your `documentation.json` is valid Compodoc output
|
|
817
|
+
4. Check that Node.js version is 18 or higher
|
|
818
|
+
|
|
819
|
+
## Contributing
|
|
820
|
+
|
|
821
|
+
Contributions are welcome! Please follow these guidelines:
|
|
822
|
+
|
|
823
|
+
1. Fork the repository
|
|
824
|
+
2. Create a feature branch (`git checkout -b feature/my-feature`)
|
|
825
|
+
3. Write tests for new functionality
|
|
826
|
+
4. Ensure all tests pass (`npm test`)
|
|
827
|
+
5. Follow TypeScript and ESLint conventions
|
|
828
|
+
6. Update documentation as needed
|
|
829
|
+
7. Submit a pull request
|
|
830
|
+
|
|
831
|
+
### Code Style
|
|
832
|
+
|
|
833
|
+
- Use TypeScript strict mode
|
|
834
|
+
- Follow existing code formatting
|
|
835
|
+
- Add JSDoc comments to public APIs
|
|
836
|
+
- Write descriptive commit messages
|
|
837
|
+
|
|
838
|
+
## License
|
|
839
|
+
|
|
840
|
+
MIT License - see LICENSE file for details
|
|
841
|
+
|
|
842
|
+
## Acknowledgments
|
|
843
|
+
|
|
844
|
+
- Built with [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/sdk)
|
|
845
|
+
- Uses [Compodoc](https://compodoc.app/) for Angular documentation generation
|
|
846
|
+
- Property-based testing with [fast-check](https://github.com/dubzzz/fast-check)
|