mcp-openapi-schema-explorer 1.0.2 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ FROM node:22-alpine3.21
2
+
3
+ WORKDIR /workspaces/mcp-openapi-schema-explorer
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "MCP OpenAPI Schema Explorer",
3
- "dockerFile": "../Dockerfile",
3
+ "dockerFile": "Dockerfile", // Updated path
4
4
  "features": {
5
5
  "ghcr.io/devcontainers/features/common-utils:2": {
6
6
  "username": "vscode"
@@ -96,6 +96,7 @@ jobs:
96
96
  uses: actions/checkout@v4
97
97
  with:
98
98
  persist-credentials: false
99
+
99
100
  - name: Setup Node.js
100
101
  uses: actions/setup-node@v4
101
102
  with:
@@ -105,8 +106,27 @@ jobs:
105
106
  - name: Install all dependencies
106
107
  run: npm ci --include=dev
107
108
 
109
+ # Docker setup steps (Still needed for the environment where the action runs)
110
+ - name: Set up QEMU
111
+ uses: docker/setup-qemu-action@v3
112
+ - name: Set up Docker Buildx
113
+ uses: docker/setup-buildx-action@v3
114
+ - name: Log in to Docker Hub
115
+ uses: docker/login-action@v3
116
+ with:
117
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
118
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
119
+
108
120
  - name: Semantic Release
109
121
  uses: cycjimmy/semantic-release-action@v4
122
+ with:
123
+ # Add the docker plugin to extra_plugins
124
+ extra_plugins: |
125
+ @semantic-release/changelog
126
+ @semantic-release/exec
127
+ @semantic-release/git
128
+ @codedependant/semantic-release-docker
110
129
  env:
111
- GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
130
+ GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} # Use dedicated release token if needed
112
131
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
132
+ # Docker login is handled by the login-action step above
package/.husky/pre-commit CHANGED
@@ -1,6 +1,3 @@
1
1
  #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- # Format all staged files
5
2
  prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown
6
3
  git update-index --again
package/.releaserc.json CHANGED
@@ -18,6 +18,14 @@
18
18
  "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
19
19
  }
20
20
  ],
21
+ [
22
+ "@codedependant/semantic-release-docker",
23
+ {
24
+ "dockerProject": "kadykov",
25
+ "dockerImage": "mcp-openapi-schema-explorer",
26
+ "dockerLogin": false
27
+ }
28
+ ],
21
29
  "@semantic-release/github"
22
30
  ]
23
31
  }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## [1.2.1](https://github.com/kadykov/mcp-openapi-schema-explorer/compare/v1.2.0...v1.2.1) (2025-04-13)
2
+
3
+ ### Bug Fixes
4
+
5
+ - update Node.js setup to match Dockerfile version and include dev dependencies ([8658705](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/86587059268ad4c18d219729b39e4e4f990e05e9))
6
+
7
+ # [1.2.0](https://github.com/kadykov/mcp-openapi-schema-explorer/compare/v1.1.0...v1.2.0) (2025-04-13)
8
+
9
+ ### Bug Fixes
10
+
11
+ - remove husky.sh sourcing from pre-commit hook ([2cf9455](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/2cf9455f1432cb0c6cbda71d61cad9f2f87031ab))
12
+ - update Docker Hub login to use secrets for credentials ([ab2136b](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/ab2136bd8c052d7287ef1fd6d2768a9fd93148c8))
13
+
14
+ ### Features
15
+
16
+ - implement Docker support with multi-stage builds and CI integration ([910dc02](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/910dc021b3e203574dee93198ce5896a9e8aa16d))
17
+
18
+ # [1.1.0](https://github.com/kadykov/mcp-openapi-schema-explorer/compare/v1.0.2...v1.1.0) (2025-04-13)
19
+
20
+ ### Features
21
+
22
+ - enhance component and path item rendering with descriptions and examples in hints ([6989159](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/698915972338b4a16419c9cea3e2377b7701f50b))
23
+
1
24
  ## [1.0.2](https://github.com/kadykov/mcp-openapi-schema-explorer/compare/v1.0.1...v1.0.2) (2025-04-13)
2
25
 
3
26
  ### Bug Fixes
package/Dockerfile CHANGED
@@ -1,3 +1,32 @@
1
- FROM node:22-alpine3.21
1
+ # Stage 1: Builder
2
+ FROM node:22-alpine AS builder
2
3
 
3
- WORKDIR /workspaces/mcp-openapi-schema-explorer
4
+ WORKDIR /app
5
+
6
+ # Copy necessary files for installation and build
7
+ COPY package.json package-lock.json ./
8
+ COPY tsconfig.json ./
9
+ COPY src ./src
10
+
11
+ # Install all dependencies (including devDependencies needed for build)
12
+ RUN npm ci
13
+
14
+ # Build the project
15
+ RUN npm run build
16
+
17
+ # Stage 2: Release
18
+ FROM node:22-alpine AS release
19
+
20
+ WORKDIR /app
21
+
22
+ # Copy only necessary files from the builder stage
23
+ COPY --from=builder /app/package.json ./package.json
24
+ COPY --from=builder /app/package-lock.json ./package-lock.json
25
+ COPY --from=builder /app/dist ./dist
26
+
27
+ # Install only production dependencies
28
+ RUN npm ci --omit=dev --ignore-scripts
29
+
30
+ # Set the entrypoint to run the compiled server
31
+ # Corrected path based on tsconfig.json ("rootDir": ".", "outDir": "dist")
32
+ ENTRYPOINT ["node", "dist/src/index.js"]
package/README.md CHANGED
@@ -33,28 +33,112 @@ This server is designed to be run by MCP clients. The recommended way to configu
33
33
  {
34
34
  "mcpServers": {
35
35
  "My API Spec": {
36
- // Choose a descriptive name for this server instance
37
36
  "command": "npx",
38
37
  "args": [
39
- "-y", // Auto-confirm npx installation if needed the first time
38
+ "-y",
40
39
  "mcp-openapi-schema-explorer",
41
- "/path/to/your/local/openapi.json" // Or "https://remote/url/spec.json"
42
- // Optional: Specify output format for detail views (defaults to 'json')
43
- // "--output-format", "yaml" // Other options: "json", "json-minified"
40
+ "/path/to/your/local/openapi.json",
41
+ "--output-format",
42
+ "yaml"
44
43
  ],
45
- "env": {} // No environment variables needed currently
44
+ "env": {}
46
45
  }
47
46
  }
48
47
  }
49
48
  ```
50
49
 
50
+ **Configuration Details:**
51
+
52
+ - **`"My API Spec"`:** Choose a descriptive name for this server instance. This is how you'll identify it within your MCP client.
53
+ - **`command`:** Use `"npx"` to run the package directly.
54
+ - **`args`:**
55
+ - `"-y"`: Auto-confirms the `npx` installation prompt if needed the first time.
56
+ - `"mcp-openapi-schema-explorer"`: The name of the package to execute.
57
+ - `"/path/to/your/local/openapi.json"`: **Required.** The absolute path to your local spec file or the full URL to a remote spec (e.g., `"https://remote/url/spec.json"`).
58
+ - `"--output-format", "yaml"`: **Optional.** Specifies the output format for detailed resource views. Defaults to `"json"`. Other options are `"yaml"` and `"json-minified"`.
59
+ - **`env`:** Currently, no environment variables are needed for this server.
60
+
51
61
  **Notes:**
52
62
 
53
- - Replace `/path/to/your/local/openapi.json` with the actual **absolute path** to your local spec file or the full URL to a remote spec.
54
- - The server name (`"My API Spec"` in the example) is how you'll identify this specific server instance within your MCP client.
55
- - This server handles one specification per instance. To explore multiple specifications simultaneously, configure multiple entries under `mcpServers` in your client's configuration file, each pointing to a different spec file or URL.
63
+ - This server handles one specification per instance. To explore multiple specifications simultaneously, configure multiple entries under `mcpServers` in your client's configuration file, each pointing to a different spec file or URL and using a unique server name.
64
+
65
+ ## Usage with Docker
66
+
67
+ As an alternative to `npx` or global installation, you can run the server using Docker. The official image is available on Docker Hub: `kadykov/mcp-openapi-schema-explorer`.
68
+
69
+ **Running the Container:**
70
+
71
+ The container expects the path or URL to the OpenAPI specification as a command-line argument, similar to the `npx` usage.
72
+
73
+ - **Remote URL:** Pass the URL directly to `docker run`.
74
+
75
+ ```bash
76
+ docker run --rm -i kadykov/mcp-openapi-schema-explorer:latest https://petstore3.swagger.io/api/v3/openapi.json
77
+ ```
78
+
79
+ - **Local File:** Mount the local file into the container using the `-v` flag and provide the path _inside the container_ as the argument.
80
+
81
+ ```bash
82
+ # Example: Mount local file ./my-spec.yaml to /spec/api.yaml inside the container
83
+ docker run --rm -i -v "$(pwd)/my-spec.yaml:/spec/api.yaml" kadykov/mcp-openapi-schema-explorer:latest /spec/api.yaml
84
+ ```
85
+
86
+ _(Note: Replace `$(pwd)/my-spec.yaml` with the actual path to your local file)_
87
+
88
+ - **Output Format:** You can still use the `--output-format` flag:
89
+ ```bash
90
+ docker run --rm -i kadykov/mcp-openapi-schema-explorer:latest https://petstore3.swagger.io/api/v3/openapi.json --output-format yaml
91
+ ```
56
92
 
57
- ## Alternative: Global Installation
93
+ **Example MCP Client Configuration (Docker):**
94
+
95
+ Here's how you might configure this in a client like Claude Desktop (`claude_desktop_config.json`):
96
+
97
+ - **Using a Remote URL:**
98
+
99
+ ```json
100
+ {
101
+ "mcpServers": {
102
+ "My API Spec (Docker Remote)": {
103
+ "command": "docker",
104
+ "args": [
105
+ "run",
106
+ "--rm",
107
+ "-i",
108
+ "kadykov/mcp-openapi-schema-explorer:latest",
109
+ "https://petstore3.swagger.io/api/v3/openapi.json"
110
+ ],
111
+ "env": {}
112
+ }
113
+ }
114
+ }
115
+ ```
116
+
117
+ - **Using a Local File:**
118
+ ```json
119
+ {
120
+ "mcpServers": {
121
+ "My API Spec (Docker Local)": {
122
+ "command": "docker",
123
+ "args": [
124
+ "run",
125
+ "--rm",
126
+ "-i",
127
+ "-v",
128
+ "/full/path/to/your/local/openapi.yaml:/spec/api.yaml",
129
+ "kadykov/mcp-openapi-schema-explorer:latest",
130
+ "/spec/api.yaml",
131
+ "--output-format",
132
+ "yaml"
133
+ ],
134
+ "env": {}
135
+ }
136
+ }
137
+ }
138
+ ```
139
+ _(Remember to replace `/full/path/to/your/local/openapi.yaml` with the correct absolute path on your host machine)_
140
+
141
+ ## Alternative: Global Installation (Less Common)
58
142
 
59
143
  If you prefer, you can install the server globally:
60
144
 
@@ -79,40 +163,56 @@ If installed globally, your MCP client configuration would change:
79
163
 
80
164
  ## Available MCP Resources
81
165
 
82
- This server exposes the following MCP resource templates for exploring the OpenAPI specification:
166
+ This server exposes the following MCP resource templates for exploring the OpenAPI specification.
167
+
168
+ **Understanding Multi-Value Parameters (`*`)**
169
+
170
+ Some resource templates include parameters ending with an asterisk (`*`), like `{method*}` or `{name*}`. This indicates that the parameter accepts **multiple comma-separated values**. For example, to request details for both the `GET` and `POST` methods of a path, you would use a URI like `openapi://paths/users/get,post`. This allows fetching details for multiple items in a single request.
171
+
172
+ **Resource Templates:**
83
173
 
84
174
  - **`openapi://{field}`**
85
175
 
86
- - **Description:** Accesses top-level fields of the OpenAPI document (`info`, `servers`, `tags`, etc.) or lists the contents of `paths` or `components`.
87
- - **Parameter:** `{field}` - The name of the top-level field (e.g., `info`, `paths`, `components`).
176
+ - **Description:** Accesses top-level fields of the OpenAPI document (e.g., `info`, `servers`, `tags`) or lists the contents of `paths` or `components`. The specific available fields depend on the loaded specification.
177
+ - **Example:** `openapi://info`
88
178
  - **Output:** `text/plain` list for `paths` and `components`; configured format (JSON/YAML/minified JSON) for other fields.
179
+ - **Completions:** Provides dynamic suggestions for `{field}` based on the actual top-level keys found in the loaded spec.
89
180
 
90
181
  - **`openapi://paths/{path}`**
91
182
 
92
183
  - **Description:** Lists the available HTTP methods (operations) for a specific API path.
93
184
  - **Parameter:** `{path}` - The API path string. **Must be URL-encoded** (e.g., `/users/{id}` becomes `users%2F%7Bid%7D`).
185
+ - **Example:** `openapi://paths/users%2F%7Bid%7D`
94
186
  - **Output:** `text/plain` list of methods.
187
+ - **Completions:** Provides dynamic suggestions for `{path}` based on the paths found in the loaded spec (URL-encoded).
95
188
 
96
189
  - **`openapi://paths/{path}/{method*}`**
97
190
 
98
191
  - **Description:** Gets the detailed specification for one or more operations (HTTP methods) on a specific API path.
99
192
  - **Parameters:**
100
193
  - `{path}` - The API path string. **Must be URL-encoded**.
101
- - `{method*}` - One or more HTTP methods (e.g., `GET`, `POST`). Can be a single method or multiple separated by a comma (e.g., `GET,POST`).
194
+ - `{method*}` - One or more HTTP methods (e.g., `get`, `post`, `get,post`). Case-insensitive.
195
+ - **Example (Single):** `openapi://paths/users%2F%7Bid%7D/get`
196
+ - **Example (Multiple):** `openapi://paths/users%2F%7Bid%7D/get,post`
102
197
  - **Output:** Configured format (JSON/YAML/minified JSON).
198
+ - **Completions:** Provides dynamic suggestions for `{path}`. Provides static suggestions for `{method*}` (common HTTP verbs like GET, POST, PUT, DELETE, etc.).
103
199
 
104
200
  - **`openapi://components/{type}`**
105
201
 
106
- - **Description:** Lists the names of all defined components of a specific type.
107
- - **Parameter:** `{type}` - The component type (e.g., `schemas`, `responses`, `parameters`, `examples`, `requestBodies`, `headers`, `securitySchemes`, `links`, `callbacks`).
108
- - **Output:** `text/plain` list of component names.
202
+ - **Description:** Lists the names of all defined components of a specific type (e.g., `schemas`, `responses`, `parameters`). The specific available types depend on the loaded specification. Also provides a short description for each listed type.
203
+ - **Example:** `openapi://components/schemas`
204
+ - **Output:** `text/plain` list of component names with descriptions.
205
+ - **Completions:** Provides dynamic suggestions for `{type}` based on the component types found in the loaded spec.
109
206
 
110
207
  - **`openapi://components/{type}/{name*}`**
111
208
  - **Description:** Gets the detailed specification for one or more named components of a specific type.
112
209
  - **Parameters:**
113
210
  - `{type}` - The component type.
114
- - `{name*}` - One or more component names. Can be a single name or multiple separated by a comma (e.g., `SchemaA,SchemaB`).
211
+ - `{name*}` - One or more component names (e.g., `User`, `Order`, `User,Order`). Case-sensitive.
212
+ - **Example (Single):** `openapi://components/schemas/User`
213
+ - **Example (Multiple):** `openapi://components/schemas/User,Order`
115
214
  - **Output:** Configured format (JSON/YAML/minified JSON).
215
+ - **Completions:** Provides dynamic suggestions for `{type}`. Provides dynamic suggestions for `{name*}` _only if_ the loaded spec contains exactly one component type overall (e.g., only `schemas`). This limitation exists because the MCP SDK currently doesn't support providing completions scoped to the selected `{type}`; providing all names across all types could be misleading.
116
216
 
117
217
  ## Contributing
118
218
 
@@ -124,4 +224,4 @@ This project uses [`semantic-release`](https://github.com/semantic-release/seman
124
224
 
125
225
  ## Future Plans
126
226
 
127
- - Docker container support for easier deployment.
227
+ (Future plans to be determined)
package/dist/src/index.js CHANGED
@@ -54,7 +54,16 @@ async function main() {
54
54
  const operationHandler = new OperationHandler(specLoader, formatter);
55
55
  const componentMapHandler = new ComponentMapHandler(specLoader, formatter);
56
56
  const componentDetailHandler = new ComponentDetailHandler(specLoader, formatter);
57
- // Register new resources
57
+ // --- Define Resource Templates and Register Handlers ---
58
+ // Helper to get dynamic field list for descriptions
59
+ const getFieldList = () => Object.keys(transformedSpec).join(', ');
60
+ // Helper to get dynamic component type list for descriptions
61
+ const getComponentTypeList = () => {
62
+ if (isOpenAPIV3(transformedSpec) && transformedSpec.components) {
63
+ return Object.keys(transformedSpec.components).join(', ');
64
+ }
65
+ return ''; // Return empty if no components or not V3
66
+ };
58
67
  // 1. openapi://{field}
59
68
  const fieldTemplate = new ResourceTemplate('openapi://{field}', {
60
69
  list: undefined, // List is handled by the handler logic based on field value
@@ -64,8 +73,8 @@ async function main() {
64
73
  });
65
74
  server.resource('openapi-field', // Unique ID for the resource registration
66
75
  fieldTemplate, {
67
- // MimeType varies (text/plain for lists, JSON/YAML for details) - SDK might handle this? Or maybe set a default? Let's omit for now.
68
- description: 'Access top-level fields (info, servers, tags), list paths, or list component types.',
76
+ // MimeType varies (text/plain for lists, JSON/YAML for details)
77
+ description: `Access top-level fields like ${getFieldList()}. (e.g., openapi://info)`,
69
78
  name: 'OpenAPI Field/List', // Generic name
70
79
  }, topLevelFieldHandler.handleRequest);
71
80
  // 2. openapi://paths/{path}
@@ -77,7 +86,7 @@ async function main() {
77
86
  });
78
87
  server.resource('openapi-path-methods', pathTemplate, {
79
88
  mimeType: 'text/plain', // This always returns a list
80
- description: 'List available HTTP methods for a specific path. (Note: {path} must be URL-encoded, e.g., /users/{id} becomes users%2F%7Bid%7D)',
89
+ description: 'List methods for a specific path (URL encode paths with slashes). (e.g., openapi://paths/users%2F%7Bid%7D)',
81
90
  name: 'Path Methods List',
82
91
  }, pathItemHandler.handleRequest);
83
92
  // 3. openapi://paths/{path}/{method*}
@@ -100,7 +109,7 @@ async function main() {
100
109
  });
101
110
  server.resource('openapi-operation-detail', operationTemplate, {
102
111
  mimeType: formatter.getMimeType(), // Detail view uses formatter
103
- description: 'Get details for one or more specific API operations (methods). (Note: {path} must be URL-encoded, e.g., /users/{id} becomes users%2F%7Bid%7D)',
112
+ description: 'Get details for one or more operations (comma-separated). (e.g., openapi://paths/users%2F%7Bid%7D/get,post)',
104
113
  name: 'Operation Detail',
105
114
  }, operationHandler.handleRequest);
106
115
  // 4. openapi://components/{type}
@@ -118,7 +127,7 @@ async function main() {
118
127
  });
119
128
  server.resource('openapi-component-list', componentMapTemplate, {
120
129
  mimeType: 'text/plain', // This always returns a list
121
- description: 'List available components of a specific type (e.g., schemas, parameters).',
130
+ description: `List components of a specific type like ${getComponentTypeList()}. (e.g., openapi://components/schemas)`,
122
131
  name: 'Component List',
123
132
  }, componentMapHandler.handleRequest);
124
133
  // 5. openapi://components/{type}/{name*}
@@ -131,7 +140,7 @@ async function main() {
131
140
  return Object.keys(transformedSpec.components ?? {});
132
141
  }
133
142
  return []; // Return empty array if not V3
134
- }, // <<< Added missing closing brace
143
+ },
135
144
  name: () => {
136
145
  // Provide names only if there's exactly one component type defined
137
146
  if (isOpenAPIV3(transformedSpec) &&
@@ -157,7 +166,7 @@ async function main() {
157
166
  });
158
167
  server.resource('openapi-component-detail', componentDetailTemplate, {
159
168
  mimeType: formatter.getMimeType(), // Detail view uses formatter
160
- description: 'Get details for one or more specific components (e.g., schemas, parameters).',
169
+ description: 'Get details for one or more components (comma-separated). (e.g., openapi://components/schemas/User,Task)',
161
170
  name: 'Component Detail',
162
171
  }, componentDetailHandler.handleRequest);
163
172
  // Start server
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,gBAAgB,E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,EAAE,CAAC;QAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CACX,yBAAyB,EACzB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,iBAAiB;AACjB,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -11,6 +11,21 @@ export const VALID_COMPONENT_TYPES = [
11
11
  'callbacks',
12
12
  // 'pathItems' is technically allowed but we handle paths separately
13
13
  ];
14
+ // Simple descriptions for component types
15
+ const componentTypeDescriptions = {
16
+ schemas: 'Reusable data structures (models)',
17
+ responses: 'Reusable API responses',
18
+ parameters: 'Reusable request parameters (query, path, header, cookie)',
19
+ examples: 'Reusable examples of media type payloads',
20
+ requestBodies: 'Reusable request body definitions',
21
+ headers: 'Reusable header definitions for responses',
22
+ securitySchemes: 'Reusable security scheme definitions (e.g., API keys, OAuth2)',
23
+ links: 'Reusable descriptions of links between responses and operations',
24
+ callbacks: 'Reusable descriptions of callback operations',
25
+ // pathItems: 'Reusable path item definitions (rarely used directly here)' // Excluded as per comment above
26
+ };
27
+ // Use a Map for safer lookups against prototype pollution
28
+ const componentDescriptionsMap = new Map(Object.entries(componentTypeDescriptions));
14
29
  /**
15
30
  * Wraps an OpenAPIV3.ComponentsObject to make it renderable.
16
31
  * Handles listing the available component types.
@@ -33,10 +48,15 @@ export class RenderableComponents {
33
48
  }
34
49
  let listText = 'Available Component Types:\n\n';
35
50
  availableTypes.sort().forEach(type => {
36
- listText += `- ${type}\n`;
51
+ const description = componentDescriptionsMap.get(type) ?? 'Unknown component type'; // Removed unnecessary 'as ComponentType'
52
+ listText += `- ${type}: ${description}\n`;
53
+ });
54
+ // Use the new hint generator structure, providing the first type as an example
55
+ const firstTypeExample = availableTypes.length > 0 ? availableTypes[0] : undefined;
56
+ listText += generateListHint(context, {
57
+ itemType: 'componentType',
58
+ firstItemExample: firstTypeExample,
37
59
  });
38
- // Use the new hint generator structure
39
- listText += generateListHint(context, { itemType: 'componentType' });
40
60
  return [
41
61
  {
42
62
  uriSuffix: 'components',
@@ -92,10 +112,12 @@ export class RenderableComponentMap {
92
112
  names.forEach(name => {
93
113
  listText += `- ${name}\n`;
94
114
  });
95
- // Use the new hint generator structure, providing parent type
115
+ // Use the new hint generator structure, providing parent type and first name as example
116
+ const firstNameExample = names.length > 0 ? names[0] : undefined;
96
117
  listText += generateListHint(context, {
97
118
  itemType: 'componentName',
98
119
  parentComponentType: this.componentType,
120
+ firstItemExample: firstNameExample,
99
121
  });
100
122
  return [
101
123
  {
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../../../src/rendering/components.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC,CAAC,UAAU;AAI5E,MAAM,CAAC,MAAM,qBAAqB,GAAoB;IACpD,SAAS;IACT,WAAW;IACX,YAAY;IACZ,UAAU;IACV,eAAe;IACf,SAAS;IACT,iBAAiB;IACjB,OAAO;IACP,WAAW;IACX,oEAAoE;CACrE,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAC/B,YAAoB,UAAkD;QAAlD,eAAU,GAAV,UAAU,CAAwC;IAAG,CAAC;IAE1E;;;OAGG;IACH,UAAU,CAA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;iBACnB,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,0DAA0D;gBAC1D,OAAO,CAAC,IAAI,CAAC;oBACX,SAAS,EAAE,kBAAkB;oBAC7B,IAAI,EAAE,SAAS;iBAChB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,YAAY,CACV,IAAY;QAaZ,0BAA0B;QAC1B,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAC9D,2EAA2E;QAC3E,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF"}
@@ -36,14 +36,19 @@ export class RenderablePathItem {
36
36
  },
37
37
  ];
38
38
  }
39
- // Generate hint first using the new structure
39
+ // Sort methods first to get the correct example
40
+ methods.sort();
41
+ const firstMethodExample = methods.length > 0 ? methods[0] : undefined;
42
+ // Generate hint using the new structure, providing the first *sorted* method as an example
40
43
  const hint = generateListHint(context, {
41
44
  itemType: 'pathMethod',
42
45
  parentPath: this.path, // Use the stored raw path
46
+ firstItemExample: firstMethodExample,
43
47
  });
44
48
  // Hint includes leading newline, so start output with it directly
45
49
  let outputLines = [hint.trim(), '']; // Trim leading newline from hint for first line
46
- methods.sort().forEach(method => {
50
+ // Iterate over the already sorted methods
51
+ methods.forEach(method => {
47
52
  const operation = this.getOperation(method);
48
53
  // Use summary or operationId (via getOperationSummary)
49
54
  const summaryText = getOperationSummary(operation);
@@ -1 +1 @@
1
- {"version":3,"file":"path-item.js","sourceRoot":"","sources":["../../../src/rendering/path-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,iB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I,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,WAAoC,CAAC,EAAE,CAAC;YACxF,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,WAA6C,CAAC,CAAC;YAC/E,0DAA0D;YAC1D,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,IAAI,WAAW,IAAI,SAAS,EAAE,CAAC;gBACpF,wEAAwE;gBACxE,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC,CAAC,gDAAgD;IACpE,CAAC;CACF"}
@@ -3,6 +3,7 @@ import { RenderContext, RenderResultItem } from './types.js';
3
3
  type ListItemType = 'componentType' | 'componentName' | 'pathMethod';
4
4
  interface HintContext {
5
5
  itemType: ListItemType;
6
+ firstItemExample?: string;
6
7
  parentComponentType?: string;
7
8
  parentPath?: string;
8
9
  }
@@ -21,12 +21,16 @@ export function getOperationSummary(operation) {
21
21
  export function generateListHint(renderContext, hintContext) {
22
22
  let detailUriSuffixPattern;
23
23
  let itemTypeName; // User-friendly name for the item type in the hint text
24
+ let exampleUriSuffix; // To hold the generated example URI
24
25
  switch (hintContext.itemType) {
25
26
  case 'componentType':
26
27
  // Listing component types (e.g., schemas, responses) at openapi://components
27
28
  // Hint should point to openapi://components/{type}
28
29
  detailUriSuffixPattern = buildComponentMapUriSuffix('{type}'); // Use placeholder
29
30
  itemTypeName = 'component type';
31
+ if (hintContext.firstItemExample) {
32
+ exampleUriSuffix = buildComponentMapUriSuffix(hintContext.firstItemExample);
33
+ }
30
34
  break;
31
35
  case 'componentName':
32
36
  // Listing component names (e.g., MySchema, User) at openapi://components/{type}
@@ -38,6 +42,9 @@ export function generateListHint(renderContext, hintContext) {
38
42
  // Use the actual parent type and a placeholder for the name
39
43
  detailUriSuffixPattern = buildComponentDetailUriSuffix(hintContext.parentComponentType, '{name}');
40
44
  itemTypeName = hintContext.parentComponentType.slice(0, -1); // e.g., 'schema' from 'schemas'
45
+ if (hintContext.firstItemExample) {
46
+ exampleUriSuffix = buildComponentDetailUriSuffix(hintContext.parentComponentType, hintContext.firstItemExample);
47
+ }
41
48
  break;
42
49
  case 'pathMethod':
43
50
  // Listing methods (e.g., get, post) at openapi://paths/{path}
@@ -49,6 +56,10 @@ export function generateListHint(renderContext, hintContext) {
49
56
  // Use the actual parent path and a placeholder for the method
50
57
  detailUriSuffixPattern = buildOperationUriSuffix(hintContext.parentPath, '{method}');
51
58
  itemTypeName = 'operation'; // Or 'method'? 'operation' seems clearer
59
+ if (hintContext.firstItemExample) {
60
+ // Ensure the example method is valid if needed, though usually it's just 'get', 'post' etc.
61
+ exampleUriSuffix = buildOperationUriSuffix(hintContext.parentPath, hintContext.firstItemExample);
62
+ }
52
63
  break;
53
64
  default:
54
65
  // Explicitly cast to string to avoid potential 'never' type issue in template literal
@@ -57,7 +68,14 @@ export function generateListHint(renderContext, hintContext) {
57
68
  }
58
69
  // Construct the full hint URI pattern using the base URI
59
70
  const fullHintPattern = `${renderContext.baseUri}${detailUriSuffixPattern}`;
60
- return `\nHint: Use '${fullHintPattern}' to view details for a specific ${itemTypeName}.`;
71
+ const fullExampleUri = exampleUriSuffix
72
+ ? `${renderContext.baseUri}${exampleUriSuffix}`
73
+ : undefined;
74
+ let hintText = `\nHint: Use '${fullHintPattern}' to view details for a specific ${itemTypeName}.`;
75
+ if (fullExampleUri) {
76
+ hintText += ` (e.g., ${fullExampleUri})`;
77
+ }
78
+ return hintText;
61
79
  }
62
80
  /**
63
81
  * Helper to generate a standard error item for RenderResultItem arrays.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/rendering/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,uBAAuB;AACvB,oEAAoE;EACrE,MAAM,yBAAyB,CAAC,CAAC,sBAAsB;AAcxD;;;;;;GAMG;AACH,MAAM,UAAU,mBA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AC;YACJ,CAAC;YACD,MAAM;QACR;YACE,sFAAsF;YACtF,OAAO,CAAC,IAAI,CAAC,yCAAyC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YACtF,OAAO,EAAE,CAAC,CAAC,gDAAgD;IAC/D,CAAC;IAED,yDAAyD;IACzD,MAAM,eAAe,GAAG,GAAG,aAAa,CAAC,OAAO,GAAG,sBAAsB,EAAE,CAAC;IAC5E,MAAM,cAAc,GAAG,gBAAgB;QACrC,CAAC,CAAC,GAAG,aAAa,CAAC,OAAO,GAAG,gBAAgB,EAAE;QAC/C,CAAC,CAAC,SAAS,CAAC;IAEd,IAAI,QAAQ,GAAG,gBAAgB,eAAe,oCAAoC,YAAY,GAAG,CAAC;IAClG,IAAI,cAAc,EAAE,CAAC;QACnB,QAAQ,IAAI,WAAW,cAAc,GAAG,CAAC;IAC3C,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB,EAAE,OAAe;IAClE,OAAO;QACL;YACE,SAAS,EAAE,SAAS;YACpB,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,OAAO;YAClB,YAAY,EAAE,IAAI,EAAE,kCAAkC;SACvD;KACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- export declare const VERSION = "1.0.2";
1
+ export declare const VERSION = "1.2.1";
@@ -1,4 +1,4 @@
1
1
  // Auto-generated by scripts/generate-version.js during semantic-release prepare step
2
2
  // Do not edit this file manually.
3
- export const VERSION = '1.0.2';
3
+ export const VERSION = '1.2.1';
4
4
  //# sourceMappingURL=version.js.map
@@ -29,9 +29,24 @@ Completed setup of automated versioning and releases using `semantic-release` an
29
29
  - Added `extractions/setup-just@v3` action to both jobs.
30
30
  - Updated `test` job to run checks via `just all`.
31
31
  - Updated `security` job to run checks via `just security` (keeping CodeQL separate).
32
- - Added a new `release` job triggered on pushes to `main` (after `test` and `security` pass) that runs `npx semantic-release`. Configured necessary permissions and environment variables (`GITHUB_TOKEN`, placeholder for `NPM_TOKEN`).
32
+ - Added a new `release` job triggered on pushes to `main` (after `test` and `security` pass) that uses `cycjimmy/semantic-release-action@v4`. Configured necessary permissions and environment variables (`GITHUB_TOKEN`, `NPM_TOKEN`).
33
33
  5. **Memory Bank Update (✓):** Updated `activeContext.md`, `progress.md`, `systemPatterns.md`, and `techContext.md`.
34
34
 
35
+ ### Docker Support Implementation (✓)
36
+
37
+ 1. **Dockerfile Strategy:**
38
+ - Moved existing devcontainer `Dockerfile` to `.devcontainer/Dockerfile`.
39
+ - Updated `.devcontainer/devcontainer.json` to reference the new path.
40
+ - Created a new multi-stage production `Dockerfile` at the project root (`./Dockerfile`).
41
+ 2. **Docker Plugin:**
42
+ - Installed `@codedependant/semantic-release-docker` dev dependency.
43
+ - Configured the plugin in `.releaserc.json` to publish to `kadykov/mcp-openapi-schema-explorer` on Docker Hub, disabling the plugin's built-in login.
44
+ 3. **CI Workflow Update (`.github/workflows/ci.yml`):**
45
+ - Added Docker setup steps (QEMU, Buildx, Login using `docker/login-action@v3` with `DOCKERHUB_USERNAME` var and `DOCKERHUB_TOKEN` secret) to the `release` job.
46
+ - Updated the `cycjimmy/semantic-release-action@v4` step to include `@codedependant/semantic-release-docker` in `extra_plugins`.
47
+ - Removed redundant Node.js setup and `npm ci` steps from the `release` job, as the action handles plugin installation.
48
+ 4. **Documentation:** Updated `README.md` with a "Usage with Docker" section, including `docker run` examples and MCP client configuration examples for local and remote specs.
49
+
35
50
  ### Dynamic Server Name (✓)
36
51
 
37
52
  1. **Spec Loading:** Modified `src/index.ts` to load the OpenAPI spec using `createSpecLoader` _before_ initializing `McpServer`.
@@ -113,7 +128,8 @@ Completed setup of automated versioning and releases using `semantic-release` an
113
128
  - Added `json-minified` output format option.
114
129
  - Server name is now dynamically set based on the loaded spec's `info.title`.
115
130
  - **New:** Automated versioning and release process implemented using `semantic-release`.
116
- - **New:** CI workflow adapted for Node 22, uses `just` for checks, and includes a release job.
131
+ - **New:** CI workflow adapted for Node 22, uses `just` for checks, and includes a `release` job using `cycjimmy/semantic-release-action@v4`.
132
+ - **New:** Docker support added, including a production `Dockerfile`, integration with `semantic-release` via `@codedependant/semantic-release-docker`, and updated CI workflow for automated Docker Hub publishing.
117
133
  - Dependencies correctly categorized (`swagger2openapi` in `dependencies`, types in `devDependencies`).
118
134
  - Resource completion logic implemented.
119
135
  - Dynamic server name implemented.
@@ -125,10 +141,10 @@ Completed setup of automated versioning and releases using `semantic-release` an
125
141
 
126
142
  ## Next Actions / Immediate Focus
127
143
 
128
- 1. **README Update:** Enhance `README.md` with:
129
- - Details about the automated release process and the requirement for Conventional Commits.
130
- - Instructions for setting up the `NPM_TOKEN` secret for publishing.
131
- - Updated usage examples and explanations (including `json-minified` format).
144
+ 1. **README Update (Partially Done):**
145
+ - **Done:** Added Docker usage instructions.
146
+ - **TODO:** Add details about the automated release process (npm + Docker) and Conventional Commits requirement.
147
+ - **TODO:** Add instructions for setting up `NPM_TOKEN`, `DOCKERHUB_USERNAME`, and `DOCKERHUB_TOKEN` secrets/variables.
132
148
  2. **Handler Unit Tests:** Implement comprehensive unit tests for each handler class (`TopLevelFieldHandler`, `PathItemHandler`, etc.), mocking `SpecLoaderService` and `IFormatter`.
133
149
  3. **Refactor Helpers:** Consolidate duplicated helper functions (`formatResults`, `isOpenAPIV3`) fully into `handler-utils.ts` and remove from individual handlers.
134
150
  4. **Code Cleanup:** Address remaining TODOs (e.g., checking warnings in `spec-loader.ts`) and minor ESLint warnings.
@@ -22,18 +22,20 @@ An MCP server that:
22
22
 
23
23
  ## User Experience Goals
24
24
 
25
- 1. Easy installation via npm.
25
+ 1. Easy installation/usage via npm (`npx`) or Docker.
26
26
  2. Simple configuration via a single command-line argument (path or URL).
27
27
  3. Intuitive resource URIs for exploring API parts.
28
28
  4. Clear and consistent response formats.
29
29
 
30
30
  ## Usage Workflow
31
31
 
32
- 1. User installs MCP server via `npm install -g mcp-openapi-schema-explorer`.
33
- 2. User runs the server providing the path or URL to the spec file via CLI argument (e.g., `mcp-openapi-schema-explorer ./spec.yaml` or `mcp-openapi-schema-explorer https://.../spec.json`).
34
- 3. Server loads the spec (from file or URL), converts v2.0 to v3.0 if necessary, and transforms internal references to MCP URIs.
35
- 4. LLM explores API structure through exposed resources:
32
+ 1. User configures the server in their MCP client using either:
33
+ - `npx mcp-openapi-schema-explorer <path-or-url-to-spec> [options]` (Recommended for most users)
34
+ - `docker run kadykov/mcp-openapi-schema-explorer:latest <path-or-url-to-spec> [options]` (Requires Docker, local files need volume mounting)
35
+ - Global installation (`npm i -g ...` then `mcp-openapi-schema-explorer ...`) (Less common)
36
+ 2. Server loads the spec (from file or URL), converts v2.0 to v3.0 if necessary, and transforms internal references to MCP URIs.
37
+ 3. LLM explores API structure through exposed resources:
36
38
  - List paths, components, methods.
37
39
  - View details for info, operations, components, etc.
38
40
  - Follow transformed reference URIs (`openapi://components/...`) to view component details without loading the whole spec initially.
39
- 5. Server restarts required if the source specification file/URL content changes.
41
+ 4. Server restarts required if the source specification file/URL content changes.
@@ -45,6 +45,13 @@
45
45
  - Created new E2E test file (`spec-loading.test.ts`) to verify loading from local v2 and remote v3 sources.
46
46
  - Added v2.0 test fixture (`sample-v2-api.json`).
47
47
 
48
+ ### Docker Support (✓)
49
+
50
+ 1. **Dockerfile:** Added a multi-stage production `Dockerfile` at the root. Moved the devcontainer Dockerfile to `.devcontainer/`.
51
+ 2. **Release Integration:** Added `@codedependant/semantic-release-docker` plugin to `.releaserc.json` to automate Docker image building and publishing to Docker Hub (`kadykov/mcp-openapi-schema-explorer`).
52
+ 3. **CI Workflow:** Updated the `release` job in `.github/workflows/ci.yml` to set up Docker environment (QEMU, Buildx, Login) and use `cycjimmy/semantic-release-action@v4` with the Docker plugin included in `extra_plugins`. Removed redundant Node setup/install steps from the release job.
53
+ 4. **Documentation:** Updated `README.md` with instructions and examples for running the server via Docker.
54
+
48
55
  ## Technical Features (✓)
49
56
 
50
57
  ### Codebase Organization (Updated)
@@ -106,7 +113,7 @@
106
113
  1. **Dependency Correction:** Correctly categorized runtime (`swagger2openapi`) vs. development (`@types/*`) dependencies in `package.json`. Removed unused types.
107
114
  2. **Automated Releases:** Implemented `semantic-release` with conventional commit analysis, changelog generation, npm publishing, and GitHub releases.
108
115
  3. **Dynamic Versioning:** Server version is now dynamically injected via `src/version.ts`, which is generated during the release process by `semantic-release` using `scripts/generate-version.js`. A default version file is tracked in Git for local builds.
109
- 4. **CI Workflow:** Updated `.github/workflows/ci.yml` to use Node 22, remove Docker Compose, use `just` for running checks (`just all`, `just security`), and added a `release` job to automate publishing on pushes to `main`.
116
+ 4. **CI Workflow:** Updated `.github/workflows/ci.yml` to use Node 22, use `just` for running checks (`just all`, `just security`), and includes a `release` job using `cycjimmy/semantic-release-action@v4` to automate npm and Docker Hub publishing on pushes to `main`.
110
117
 
111
118
  ## Planned Features (⏳)
112
119
 
@@ -118,6 +125,7 @@
118
125
  - **Enhanced Component Support:** Ensure all component types listed in `VALID_COMPONENT_TYPES` are fully handled if present in spec. (Reference transformation now supports all types).
119
126
  - **Parameter Validation:** Add validation logic if needed. (Current Map-based approach handles key validation).
120
127
  - **Further Token Optimizations:** Explore more ways to reduce token usage in list/detail views.
128
+ - **README Enhancements:** Add details on release process, secrets/vars setup. (Partially done).
121
129
 
122
130
  ## Technical Improvements (Ongoing)
123
131
 
@@ -133,7 +141,7 @@
133
141
  - Unit tests updated for URI builder, reference transformer, and path item rendering.
134
142
  - E2E tests updated for new structure and complex fixture. Added tests for resource completion.
135
143
  - Unit tests for `SpecLoaderService` updated for `swagger2openapi`.
136
- - CI workflow updated to use `just` and includes automated release job.
144
+ - CI workflow updated to use `just` and includes automated release job for npm and Docker.
137
145
 
138
146
  3. API Design
139
147
  - New URI structure implemented, aligned with OpenAPI spec.
@@ -128,8 +128,11 @@ graph TD
128
128
  4. `@semantic-release/npm`: Updates `version` in `package.json`.
129
129
  5. `@semantic-release/exec`: Runs `scripts/generate-version.js` to create/update `src/version.ts` with the new version.
130
130
  6. `@semantic-release/git`: Commits `package.json`, `package-lock.json`, `CHANGELOG.md`, and `src/version.ts`. Creates Git tag.
131
- 7. `@semantic-release/github`: Creates GitHub Release.
132
- - **Trigger:** Executed by the `release` job in the GitHub Actions workflow (`.github/workflows/ci.yml`) on pushes to the `main` branch.
131
+ 7. `@codedependant/semantic-release-docker`: Builds the Docker image using `./Dockerfile` and pushes it to Docker Hub (`kadykov/mcp-openapi-schema-explorer`) with `latest` and version tags.
132
+ 8. `@semantic-release/github`: Creates GitHub Release.
133
+ - **Trigger:** Executed by the `release` job in the GitHub Actions workflow (`.github/workflows/ci.yml`) on pushes to the `main` branch, using `cycjimmy/semantic-release-action@v4`.
134
+ - **CI Action:** The `cycjimmy/semantic-release-action` handles installing `semantic-release` and the plugins listed in its `extra_plugins` input (`@semantic-release/changelog`, `@semantic-release/exec`, `@semantic-release/git`, `@codedependant/semantic-release-docker`).
135
+ - **Docker Environment:** The CI job sets up Docker QEMU, Buildx, and logs into Docker Hub before running the semantic-release action.
133
136
  - **Versioning:** The server version in `src/index.ts` is dynamically imported from the generated `src/version.ts`. A default `src/version.ts` (with `0.0.0-dev`) is kept in the repository for local builds.
134
137
 
135
138
  ## Resource Design Patterns
@@ -221,4 +224,4 @@ graph TD
221
224
  4. **CI Integration (`.github/workflows/ci.yml`):**
222
225
  - **`test` Job:** Runs on push/PR to `main`. Uses Node 22, installs `just`, runs `npm ci`, then `just all` (format, lint, build, test). Uploads coverage.
223
226
  - **`security` Job:** Runs on push/PR to `main`. Uses Node 22, installs `just`, runs `npm ci`, then `just security` (audit, licenses). Runs CodeQL analysis separately.
224
- - **`release` Job:** Runs _only_ on push to `main` after `test` and `security` pass. Checks out full history, installs dependencies, runs `npx semantic-release` using `GITHUB_TOKEN` and `NPM_TOKEN`.
227
+ - **`release` Job:** Runs _only_ on push to `main` after `test` and `security` pass. Checks out full history, sets up Docker (QEMU, Buildx, Login), then runs `cycjimmy/semantic-release-action@v4` with necessary `extra_plugins` and environment variables (`GITHUB_TOKEN`, `NPM_TOKEN`, Docker Hub credentials handled by login action).
@@ -19,7 +19,7 @@
19
19
  - `jest`: Testing framework (devDependency)
20
20
  - `eslint`: Code linting (devDependency)
21
21
  - `prettier`: Code formatting (devDependency)
22
- - `semantic-release` & plugins (`@semantic-release/*`): Automated releases (devDependencies)
22
+ - `semantic-release` & plugins (`@semantic-release/*`, `@codedependant/semantic-release-docker`): Automated releases (devDependencies)
23
23
  - `just`: Task runner (Used locally, installed via action in CI)
24
24
 
25
25
  ## Technical Requirements
@@ -71,6 +71,7 @@
71
71
  - CI Integration (`.github/workflows/ci.yml`):
72
72
  - Runs checks (`just all`, `just security`, CodeQL) on pushes/PRs to `main`.
73
73
  - Uses Node 22 environment.
74
+ - Includes automated release job using `cycjimmy/semantic-release-action@v4`.
74
75
 
75
76
  ## Response Formats
76
77
 
@@ -99,10 +100,12 @@
99
100
 
100
101
  ## Deployment / Release Process
101
102
 
102
- - Automated publishing to npm via `semantic-release` triggered by pushes to `main` branch in GitHub Actions.
103
+ - Automated publishing to npm **and Docker Hub** (`kadykov/mcp-openapi-schema-explorer`) via `semantic-release` triggered by pushes to `main` branch in GitHub Actions.
104
+ - Uses `cycjimmy/semantic-release-action@v4` in the CI workflow.
103
105
  - Relies on Conventional Commits to determine version bumps.
106
+ - Uses `@codedependant/semantic-release-docker` plugin for Docker build and push.
104
107
  - Creates version tags (e.g., `v1.2.3`) and GitHub Releases automatically.
105
- - Requires `NPM_TOKEN` secret configured in GitHub repository for publishing.
108
+ - Requires `NPM_TOKEN`, `DOCKERHUB_USERNAME`, and `DOCKERHUB_TOKEN` secrets/variables configured in GitHub repository.
106
109
  - `CHANGELOG.md` is automatically generated and updated.
107
110
  - Server version is dynamically set at runtime based on the release version.
108
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-openapi-schema-explorer",
3
- "version": "1.0.2",
3
+ "version": "1.2.1",
4
4
  "description": "MCP OpenAPI schema explorer",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -43,6 +43,7 @@
43
43
  "zod": "^3.24.2"
44
44
  },
45
45
  "devDependencies": {
46
+ "@codedependant/semantic-release-docker": "^5.1.0",
46
47
  "@eslint/js": "^9.24.0",
47
48
  "@semantic-release/changelog": "^6.0.3",
48
49
  "@semantic-release/commit-analyzer": "^13.0.1",
package/src/index.ts CHANGED
@@ -64,7 +64,18 @@ async function main(): Promise<void> {
64
64
  const componentMapHandler = new ComponentMapHandler(specLoader, formatter);
65
65
  const componentDetailHandler = new ComponentDetailHandler(specLoader, formatter);
66
66
 
67
- // Register new resources
67
+ // --- Define Resource Templates and Register Handlers ---
68
+
69
+ // Helper to get dynamic field list for descriptions
70
+ const getFieldList = (): string => Object.keys(transformedSpec).join(', ');
71
+ // Helper to get dynamic component type list for descriptions
72
+ const getComponentTypeList = (): string => {
73
+ if (isOpenAPIV3(transformedSpec) && transformedSpec.components) {
74
+ return Object.keys(transformedSpec.components).join(', ');
75
+ }
76
+ return ''; // Return empty if no components or not V3
77
+ };
78
+
68
79
  // 1. openapi://{field}
69
80
  const fieldTemplate = new ResourceTemplate('openapi://{field}', {
70
81
  list: undefined, // List is handled by the handler logic based on field value
@@ -76,9 +87,8 @@ async function main(): Promise<void> {
76
87
  'openapi-field', // Unique ID for the resource registration
77
88
  fieldTemplate,
78
89
  {
79
- // MimeType varies (text/plain for lists, JSON/YAML for details) - SDK might handle this? Or maybe set a default? Let's omit for now.
80
- description:
81
- 'Access top-level fields (info, servers, tags), list paths, or list component types.',
90
+ // MimeType varies (text/plain for lists, JSON/YAML for details)
91
+ description: `Access top-level fields like ${getFieldList()}. (e.g., openapi://info)`,
82
92
  name: 'OpenAPI Field/List', // Generic name
83
93
  },
84
94
  topLevelFieldHandler.handleRequest
@@ -97,7 +107,7 @@ async function main(): Promise<void> {
97
107
  {
98
108
  mimeType: 'text/plain', // This always returns a list
99
109
  description:
100
- 'List available HTTP methods for a specific path. (Note: {path} must be URL-encoded, e.g., /users/{id} becomes users%2F%7Bid%7D)',
110
+ 'List methods for a specific path (URL encode paths with slashes). (e.g., openapi://paths/users%2F%7Bid%7D)',
101
111
  name: 'Path Methods List',
102
112
  },
103
113
  pathItemHandler.handleRequest
@@ -127,7 +137,7 @@ async function main(): Promise<void> {
127
137
  {
128
138
  mimeType: formatter.getMimeType(), // Detail view uses formatter
129
139
  description:
130
- 'Get details for one or more specific API operations (methods). (Note: {path} must be URL-encoded, e.g., /users/{id} becomes users%2F%7Bid%7D)',
140
+ 'Get details for one or more operations (comma-separated). (e.g., openapi://paths/users%2F%7Bid%7D/get,post)',
131
141
  name: 'Operation Detail',
132
142
  },
133
143
  operationHandler.handleRequest
@@ -151,7 +161,7 @@ async function main(): Promise<void> {
151
161
  componentMapTemplate,
152
162
  {
153
163
  mimeType: 'text/plain', // This always returns a list
154
- description: 'List available components of a specific type (e.g., schemas, parameters).',
164
+ description: `List components of a specific type like ${getComponentTypeList()}. (e.g., openapi://components/schemas)`,
155
165
  name: 'Component List',
156
166
  },
157
167
  componentMapHandler.handleRequest
@@ -167,7 +177,7 @@ async function main(): Promise<void> {
167
177
  return Object.keys(transformedSpec.components ?? {});
168
178
  }
169
179
  return []; // Return empty array if not V3
170
- }, // <<< Added missing closing brace
180
+ },
171
181
  name: (): string[] => {
172
182
  // Provide names only if there's exactly one component type defined
173
183
  if (
@@ -197,7 +207,8 @@ async function main(): Promise<void> {
197
207
  componentDetailTemplate,
198
208
  {
199
209
  mimeType: formatter.getMimeType(), // Detail view uses formatter
200
- description: 'Get details for one or more specific components (e.g., schemas, parameters).',
210
+ description:
211
+ 'Get details for one or more components (comma-separated). (e.g., openapi://components/schemas/User,Task)',
201
212
  name: 'Component Detail',
202
213
  },
203
214
  componentDetailHandler.handleRequest
@@ -17,6 +17,22 @@ export const VALID_COMPONENT_TYPES: ComponentType[] = [
17
17
  // 'pathItems' is technically allowed but we handle paths separately
18
18
  ];
19
19
 
20
+ // Simple descriptions for component types
21
+ const componentTypeDescriptions: Record<ComponentType, string> = {
22
+ schemas: 'Reusable data structures (models)',
23
+ responses: 'Reusable API responses',
24
+ parameters: 'Reusable request parameters (query, path, header, cookie)',
25
+ examples: 'Reusable examples of media type payloads',
26
+ requestBodies: 'Reusable request body definitions',
27
+ headers: 'Reusable header definitions for responses',
28
+ securitySchemes: 'Reusable security scheme definitions (e.g., API keys, OAuth2)',
29
+ links: 'Reusable descriptions of links between responses and operations',
30
+ callbacks: 'Reusable descriptions of callback operations',
31
+ // pathItems: 'Reusable path item definitions (rarely used directly here)' // Excluded as per comment above
32
+ };
33
+ // Use a Map for safer lookups against prototype pollution
34
+ const componentDescriptionsMap = new Map(Object.entries(componentTypeDescriptions));
35
+
20
36
  /**
21
37
  * Wraps an OpenAPIV3.ComponentsObject to make it renderable.
22
38
  * Handles listing the available component types.
@@ -43,11 +59,16 @@ export class RenderableComponents implements RenderableSpecObject {
43
59
 
44
60
  let listText = 'Available Component Types:\n\n';
45
61
  availableTypes.sort().forEach(type => {
46
- listText += `- ${type}\n`;
62
+ const description = componentDescriptionsMap.get(type) ?? 'Unknown component type'; // Removed unnecessary 'as ComponentType'
63
+ listText += `- ${type}: ${description}\n`;
47
64
  });
48
65
 
49
- // Use the new hint generator structure
50
- listText += generateListHint(context, { itemType: 'componentType' });
66
+ // Use the new hint generator structure, providing the first type as an example
67
+ const firstTypeExample = availableTypes.length > 0 ? availableTypes[0] : undefined;
68
+ listText += generateListHint(context, {
69
+ itemType: 'componentType',
70
+ firstItemExample: firstTypeExample,
71
+ });
51
72
 
52
73
  return [
53
74
  {
@@ -126,10 +147,12 @@ export class RenderableComponentMap implements RenderableSpecObject {
126
147
  listText += `- ${name}\n`;
127
148
  });
128
149
 
129
- // Use the new hint generator structure, providing parent type
150
+ // Use the new hint generator structure, providing parent type and first name as example
151
+ const firstNameExample = names.length > 0 ? names[0] : undefined;
130
152
  listText += generateListHint(context, {
131
153
  itemType: 'componentName',
132
154
  parentComponentType: this.componentType,
155
+ firstItemExample: firstNameExample,
133
156
  });
134
157
 
135
158
  return [
@@ -43,15 +43,21 @@ export class RenderablePathItem implements RenderableSpecObject {
43
43
  ];
44
44
  }
45
45
 
46
- // Generate hint first using the new structure
46
+ // Sort methods first to get the correct example
47
+ methods.sort();
48
+ const firstMethodExample = methods.length > 0 ? methods[0] : undefined;
49
+
50
+ // Generate hint using the new structure, providing the first *sorted* method as an example
47
51
  const hint = generateListHint(context, {
48
52
  itemType: 'pathMethod',
49
53
  parentPath: this.path, // Use the stored raw path
54
+ firstItemExample: firstMethodExample,
50
55
  });
51
56
  // Hint includes leading newline, so start output with it directly
52
57
  let outputLines: string[] = [hint.trim(), '']; // Trim leading newline from hint for first line
53
58
 
54
- methods.sort().forEach(method => {
59
+ // Iterate over the already sorted methods
60
+ methods.forEach(method => {
55
61
  const operation = this.getOperation(method);
56
62
  // Use summary or operationId (via getOperationSummary)
57
63
  const summaryText = getOperationSummary(operation);
@@ -14,6 +14,7 @@ type ListItemType = 'componentType' | 'componentName' | 'pathMethod';
14
14
  // Define context needed for generating the correct detail URI suffix
15
15
  interface HintContext {
16
16
  itemType: ListItemType;
17
+ firstItemExample?: string; // Example value from the first item in the list
17
18
  // For componentName hints, the parent component type is needed
18
19
  parentComponentType?: string;
19
20
  // For pathMethod hints, the parent path is needed
@@ -43,6 +44,7 @@ export function getOperationSummary(
43
44
  export function generateListHint(renderContext: RenderContext, hintContext: HintContext): string {
44
45
  let detailUriSuffixPattern: string;
45
46
  let itemTypeName: string; // User-friendly name for the item type in the hint text
47
+ let exampleUriSuffix: string | undefined; // To hold the generated example URI
46
48
 
47
49
  switch (hintContext.itemType) {
48
50
  case 'componentType':
@@ -50,6 +52,9 @@ export function generateListHint(renderContext: RenderContext, hintContext: Hint
50
52
  // Hint should point to openapi://components/{type}
51
53
  detailUriSuffixPattern = buildComponentMapUriSuffix('{type}'); // Use placeholder
52
54
  itemTypeName = 'component type';
55
+ if (hintContext.firstItemExample) {
56
+ exampleUriSuffix = buildComponentMapUriSuffix(hintContext.firstItemExample);
57
+ }
53
58
  break;
54
59
  case 'componentName':
55
60
  // Listing component names (e.g., MySchema, User) at openapi://components/{type}
@@ -64,6 +69,12 @@ export function generateListHint(renderContext: RenderContext, hintContext: Hint
64
69
  '{name}'
65
70
  );
66
71
  itemTypeName = hintContext.parentComponentType.slice(0, -1); // e.g., 'schema' from 'schemas'
72
+ if (hintContext.firstItemExample) {
73
+ exampleUriSuffix = buildComponentDetailUriSuffix(
74
+ hintContext.parentComponentType,
75
+ hintContext.firstItemExample
76
+ );
77
+ }
67
78
  break;
68
79
  case 'pathMethod':
69
80
  // Listing methods (e.g., get, post) at openapi://paths/{path}
@@ -75,6 +86,13 @@ export function generateListHint(renderContext: RenderContext, hintContext: Hint
75
86
  // Use the actual parent path and a placeholder for the method
76
87
  detailUriSuffixPattern = buildOperationUriSuffix(hintContext.parentPath, '{method}');
77
88
  itemTypeName = 'operation'; // Or 'method'? 'operation' seems clearer
89
+ if (hintContext.firstItemExample) {
90
+ // Ensure the example method is valid if needed, though usually it's just 'get', 'post' etc.
91
+ exampleUriSuffix = buildOperationUriSuffix(
92
+ hintContext.parentPath,
93
+ hintContext.firstItemExample
94
+ );
95
+ }
78
96
  break;
79
97
  default:
80
98
  // Explicitly cast to string to avoid potential 'never' type issue in template literal
@@ -84,8 +102,16 @@ export function generateListHint(renderContext: RenderContext, hintContext: Hint
84
102
 
85
103
  // Construct the full hint URI pattern using the base URI
86
104
  const fullHintPattern = `${renderContext.baseUri}${detailUriSuffixPattern}`;
105
+ const fullExampleUri = exampleUriSuffix
106
+ ? `${renderContext.baseUri}${exampleUriSuffix}`
107
+ : undefined;
108
+
109
+ let hintText = `\nHint: Use '${fullHintPattern}' to view details for a specific ${itemTypeName}.`;
110
+ if (fullExampleUri) {
111
+ hintText += ` (e.g., ${fullExampleUri})`;
112
+ }
87
113
 
88
- return `\nHint: Use '${fullHintPattern}' to view details for a specific ${itemTypeName}.`;
114
+ return hintText;
89
115
  }
90
116
 
91
117
  /**
package/src/version.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  // Auto-generated by scripts/generate-version.js during semantic-release prepare step
2
2
  // Do not edit this file manually.
3
3
 
4
- export const VERSION = '1.0.2';
4
+ export const VERSION = '1.2.1';
@@ -40,13 +40,18 @@ describe('RenderableComponents (List Types)', () => {
40
40
  expect(result[0].renderAsList).toBe(true);
41
41
  expect(result[0].isError).toBeUndefined();
42
42
  expect(result[0].data).toContain('Available Component Types:');
43
- // Check sorted types
44
- expect(result[0].data).toMatch(/-\s+examples\n/); // Empty but present
45
- expect(result[0].data).toMatch(/-\s+parameters\n/);
46
- expect(result[0].data).toMatch(/-\s+responses\n/);
47
- expect(result[0].data).toMatch(/-\s+schemas\n/);
43
+ // Check sorted types with descriptions
44
+ expect(result[0].data).toMatch(/-\s+examples: Reusable examples of media type payloads\n/);
45
+ expect(result[0].data).toMatch(
46
+ /-\s+parameters: Reusable request parameters \(query, path, header, cookie\)\n/
47
+ );
48
+ expect(result[0].data).toMatch(/-\s+responses: Reusable API responses\n/);
49
+ expect(result[0].data).toMatch(/-\s+schemas: Reusable data structures \(models\)\n/);
48
50
  expect(result[0].data).not.toContain('- securitySchemes'); // Missing type
49
- expect(result[0].data).toContain("Hint: Use 'openapi://components/{type}'");
51
+ // Check hint with example
52
+ expect(result[0].data).toContain(
53
+ "Hint: Use 'openapi://components/{type}' to view details for a specific component type. (e.g., openapi://components/examples)"
54
+ );
50
55
  });
51
56
 
52
57
  it('should handle empty components object', () => {
@@ -121,7 +126,10 @@ describe('RenderableComponentMap (List/Detail Names)', () => {
121
126
  expect(result[0].data).toContain('Available schemas:');
122
127
  expect(result[0].data).toMatch(/-\s+Error\n/); // Sorted
123
128
  expect(result[0].data).toMatch(/-\s+User\n/);
124
- expect(result[0].data).toContain("Hint: Use 'openapi://components/schemas/{name}'");
129
+ // Check hint with example
130
+ expect(result[0].data).toContain(
131
+ "Hint: Use 'openapi://components/schemas/{name}' to view details for a specific schema. (e.g., openapi://components/schemas/Error)"
132
+ );
125
133
  });
126
134
 
127
135
  it('should list component names correctly (parameters)', () => {
@@ -131,7 +139,10 @@ describe('RenderableComponentMap (List/Detail Names)', () => {
131
139
  expect(result[0].uriSuffix).toBe(paramsUriSuffix);
132
140
  expect(result[0].data).toContain('Available parameters:');
133
141
  expect(result[0].data).toMatch(/-\s+userIdParam\n/);
134
- expect(result[0].data).toContain("Hint: Use 'openapi://components/parameters/{name}'");
142
+ // Check hint with example
143
+ expect(result[0].data).toContain(
144
+ "Hint: Use 'openapi://components/parameters/{name}' to view details for a specific parameter. (e.g., openapi://components/parameters/userIdParam)"
145
+ );
135
146
  });
136
147
 
137
148
  it('should handle empty component map', () => {
@@ -49,8 +49,9 @@ describe('RenderablePathItem', () => {
49
49
  // Define expected output lines based on the new format and builder logic
50
50
  // generateListHint uses buildOperationUriSuffix which encodes the path
51
51
  // Since rawPath is '/items', encoded is 'items'.
52
+ // The first sorted method is 'delete'.
52
53
  const expectedHint =
53
- "Hint: Use 'openapi://paths/items/{method}' to view details for a specific operation.";
54
+ "Hint: Use 'openapi://paths/items/{method}' to view details for a specific operation. (e.g., openapi://paths/items/delete)";
54
55
  const expectedLineDelete = 'DELETE'; // No summary/opId
55
56
  const expectedLineGet = 'GET: Get Item'; // Summary exists
56
57
  const expectedLinePost = 'POST: Create Item'; // Summary exists