mcp-openapi-schema-explorer 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/dependabot.yml +12 -0
- package/.tokeignore +1 -0
- package/CHANGELOG.md +10 -0
- package/DOCKERHUB_README.md +126 -0
- package/README.md +112 -54
- package/assets/logo-400.png +0 -0
- package/assets/logo-full.png +0 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/justfile +1 -1
- package/llms-install.md +210 -0
- package/memory-bank/activeContext.md +86 -148
- package/memory-bank/progress.md +1 -0
- package/package.json +6 -6
- package/src/index.ts +12 -4
- package/src/version.ts +1 -1
- package/test/__tests__/unit/handlers/component-detail-handler.test.ts +7 -1
- package/test/__tests__/unit/handlers/component-map-handler.test.ts +7 -1
- package/test/__tests__/unit/handlers/operation-handler.test.ts +7 -1
- package/test/__tests__/unit/handlers/path-item-handler.test.ts +7 -1
- package/test/__tests__/unit/handlers/top-level-field-handler.test.ts +4 -5
package/.github/dependabot.yml
CHANGED
|
@@ -5,9 +5,21 @@ updates:
|
|
|
5
5
|
schedule:
|
|
6
6
|
interval: 'weekly'
|
|
7
7
|
open-pull-requests-limit: 10
|
|
8
|
+
groups:
|
|
9
|
+
# Group all development dependencies together
|
|
10
|
+
dev-dependencies:
|
|
11
|
+
dependency-type: 'development'
|
|
12
|
+
|
|
13
|
+
# Group production dependencies together
|
|
14
|
+
production-dependencies:
|
|
15
|
+
dependency-type: 'production'
|
|
8
16
|
|
|
9
17
|
- package-ecosystem: 'github-actions'
|
|
10
18
|
directory: '/'
|
|
11
19
|
schedule:
|
|
12
20
|
interval: 'weekly'
|
|
13
21
|
open-pull-requests-limit: 10
|
|
22
|
+
groups:
|
|
23
|
+
github-actions:
|
|
24
|
+
patterns:
|
|
25
|
+
- '*'
|
package/.tokeignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
package-lock.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# [1.3.0](https://github.com/kadykov/mcp-openapi-schema-explorer/compare/v1.2.1...v1.3.0) (2025-08-12)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- Use more generic instructions ([1372aae](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/1372aaea824f2b9eb5d4c3569acc4f38c82550fd))
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- add brief instructions so LLMs can better understand how to use the server ([c55c4ec](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/c55c4ec029a7603746bf506340d8e3ffd54a6532))
|
|
10
|
+
|
|
1
11
|
## [1.2.1](https://github.com/kadykov/mcp-openapi-schema-explorer/compare/v1.2.0...v1.2.1) (2025-04-13)
|
|
2
12
|
|
|
3
13
|
### Bug Fixes
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# MCP OpenAPI Schema Explorer
|
|
2
|
+
|
|
3
|
+
[](https://hub.docker.com/r/kadykov/mcp-openapi-schema-explorer)
|
|
4
|
+
[](https://github.com/kadykov/mcp-openapi-schema-explorer)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
This Docker image runs the **MCP OpenAPI Schema Explorer**, an MCP (Model Context Protocol) server that provides token-efficient access to OpenAPI (v3.0) and Swagger (v2.0) specifications via **MCP Resources**.
|
|
8
|
+
|
|
9
|
+
It allows MCP clients (like Cline or Claude Desktop) to explore the structure and details of large OpenAPI specifications without needing to load the entire file into an LLM's context window.
|
|
10
|
+
|
|
11
|
+
**Source Code & Full Documentation:** [https://github.com/kadykov/mcp-openapi-schema-explorer](https://github.com/kadykov/mcp-openapi-schema-explorer)
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **MCP Resource Access:** Explore OpenAPI specs via intuitive URIs (`openapi://info`, `openapi://paths/...`, `openapi://components/...`).
|
|
16
|
+
- **OpenAPI v3.0 & Swagger v2.0 Support:** Loads both formats, automatically converting v2.0 to v3.0.
|
|
17
|
+
- **Local & Remote Files:** Load specs from local file paths (via volume mount) or HTTP/HTTPS URLs.
|
|
18
|
+
- **Token-Efficient:** Designed to minimize token usage for LLMs.
|
|
19
|
+
- **Multiple Output Formats:** Get detailed views in JSON (default), YAML, or minified JSON (`--output-format`).
|
|
20
|
+
- **Dynamic Server Name:** Server name in MCP clients reflects the `info.title` from the loaded spec.
|
|
21
|
+
- **Reference Transformation:** Internal `$ref`s (`#/components/...`) are transformed into clickable MCP URIs.
|
|
22
|
+
|
|
23
|
+
## How to Run
|
|
24
|
+
|
|
25
|
+
Pull the image:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
docker pull kadykov/mcp-openapi-schema-explorer:latest
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The container expects the path or URL to the OpenAPI specification as a command-line argument.
|
|
32
|
+
|
|
33
|
+
### Using a Remote Specification URL
|
|
34
|
+
|
|
35
|
+
Pass the URL directly to `docker run`:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
docker run --rm -i kadykov/mcp-openapi-schema-explorer:latest https://petstore3.swagger.io/api/v3/openapi.json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Using a Local Specification File
|
|
42
|
+
|
|
43
|
+
Mount your local file into the container using the `-v` flag and provide the path _inside the container_ as the argument:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Example: Mount local file ./my-spec.yaml to /spec/api.yaml inside the container
|
|
47
|
+
docker run --rm -i -v "$(pwd)/my-spec.yaml:/spec/api.yaml" kadykov/mcp-openapi-schema-explorer:latest /spec/api.yaml
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
_(Note: Replace `$(pwd)/my-spec.yaml` with the actual absolute path to your local file on the host machine)_
|
|
51
|
+
|
|
52
|
+
### Specifying Output Format
|
|
53
|
+
|
|
54
|
+
Use the `--output-format` flag (optional, defaults to `json`):
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Using YAML output with a remote URL
|
|
58
|
+
docker run --rm -i kadykov/mcp-openapi-schema-explorer:latest https://petstore3.swagger.io/api/v3/openapi.json --output-format yaml
|
|
59
|
+
|
|
60
|
+
# Using minified JSON with a local file
|
|
61
|
+
docker run --rm -i -v "$(pwd)/my-spec.yaml:/spec/api.yaml" kadykov/mcp-openapi-schema-explorer:latest /spec/api.yaml --output-format json-minified
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Supported formats: `json`, `yaml`, `json-minified`.
|
|
65
|
+
|
|
66
|
+
## Tags
|
|
67
|
+
|
|
68
|
+
- `latest`: Points to the most recent stable release.
|
|
69
|
+
- Specific version tags (e.g., `1.2.1`) are available corresponding to the npm package versions.
|
|
70
|
+
|
|
71
|
+
## Usage with MCP Clients
|
|
72
|
+
|
|
73
|
+
You can configure your MCP client (like Cline or Claude Desktop) to run this Docker image as an MCP server.
|
|
74
|
+
|
|
75
|
+
### Example: Remote URL Specification
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
// Example: ~/.config/cline/mcp_config.json
|
|
79
|
+
{
|
|
80
|
+
"mcpServers": {
|
|
81
|
+
"My API Spec (Docker Remote)": {
|
|
82
|
+
"command": "docker",
|
|
83
|
+
"args": [
|
|
84
|
+
"run",
|
|
85
|
+
"--rm",
|
|
86
|
+
"-i", // Required for MCP communication
|
|
87
|
+
"kadykov/mcp-openapi-schema-explorer:latest",
|
|
88
|
+
"https://petstore3.swagger.io/api/v3/openapi.json"
|
|
89
|
+
// Optional: Add "--output-format", "yaml" here if needed
|
|
90
|
+
],
|
|
91
|
+
"env": {}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Example: Local File Specification
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
// Example: ~/.config/cline/mcp_config.json
|
|
101
|
+
{
|
|
102
|
+
"mcpServers": {
|
|
103
|
+
"My API Spec (Docker Local)": {
|
|
104
|
+
"command": "docker",
|
|
105
|
+
"args": [
|
|
106
|
+
"run",
|
|
107
|
+
"--rm",
|
|
108
|
+
"-i", // Required for MCP communication
|
|
109
|
+
"-v",
|
|
110
|
+
"/full/path/to/your/local/openapi.yaml:/spec/api.yaml", // Host path : Container path
|
|
111
|
+
"kadykov/mcp-openapi-schema-explorer:latest",
|
|
112
|
+
"/spec/api.yaml", // Path inside the container
|
|
113
|
+
"--output-format",
|
|
114
|
+
"yaml" // Optional format
|
|
115
|
+
],
|
|
116
|
+
"env": {}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
_(Remember to replace `/full/path/to/your/local/openapi.yaml` with the correct absolute path on your host machine)_
|
|
123
|
+
|
|
124
|
+
## Support
|
|
125
|
+
|
|
126
|
+
For issues or questions, please refer to the [GitHub repository](https://github.com/kadykov/mcp-openapi-schema-explorer) or open an [issue](https://github.com/kadykov/mcp-openapi-schema-explorer/issues).
|
package/README.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/logo-400.png" alt="MCP OpenAPI Schema Explorer Logo" width="200">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# MCP OpenAPI Schema Explorer
|
|
2
6
|
|
|
3
7
|
[](https://badge.fury.io/js/mcp-openapi-schema-explorer)
|
|
8
|
+
[](https://badge.fury.io/js/mcp-openapi-schema-explorer)
|
|
9
|
+
[](https://hub.docker.com/r/kadykov/mcp-openapi-schema-explorer)
|
|
4
10
|
[](https://opensource.org/licenses/MIT)
|
|
5
11
|
[](https://codecov.io/gh/kadykov/mcp-openapi-schema-explorer)
|
|
12
|
+
[](https://mseep.ai/app/819a3ba3-ad54-4657-9241-648497e57d7b)
|
|
13
|
+
[](https://github.com/kadykov/mcp-openapi-schema-explorer)
|
|
6
14
|
|
|
7
15
|
An MCP (Model Context Protocol) server that provides token-efficient access to OpenAPI (v3.0) and Swagger (v2.0) specifications via **MCP Resources**.
|
|
8
16
|
|
|
@@ -23,21 +31,52 @@ While other MCP servers exist that provide access to OpenAPI specs via _Tools_,
|
|
|
23
31
|
|
|
24
32
|
For more details on MCP clients and their capabilities, see the [MCP Client Documentation](https://modelcontextprotocol.io/clients).
|
|
25
33
|
|
|
26
|
-
##
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
For the recommended usage methods (`npx` and Docker, described below), **no separate installation step is required**. Your MCP client will download the package or pull the Docker image automatically based on the configuration you provide.
|
|
37
|
+
|
|
38
|
+
However, if you prefer or need to install the server explicitly, you have two options:
|
|
39
|
+
|
|
40
|
+
1. **Global Installation:** You can install the package globally using npm:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install -g mcp-openapi-schema-explorer
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
See **Method 3** below for how to configure your MCP client to use a globally installed server.
|
|
47
|
+
|
|
48
|
+
2. **Local Development/Installation:** You can clone the repository and build it locally:
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/kadykov/mcp-openapi-schema-explorer.git
|
|
51
|
+
cd mcp-openapi-schema-explorer
|
|
52
|
+
npm install
|
|
53
|
+
npm run build
|
|
54
|
+
```
|
|
55
|
+
See **Method 4** below for how to configure your MCP client to run the server from your local build using `node`.
|
|
27
56
|
|
|
28
|
-
|
|
57
|
+
## Adding the Server to your MCP Client
|
|
29
58
|
|
|
30
|
-
|
|
59
|
+
This server is designed to be run by MCP clients (like Claude Desktop, Windsurf, Cline, etc.). To use it, you add a configuration entry to your client's settings file (often a JSON file). This entry tells the client how to execute the server process (e.g., using `npx`, `docker`, or `node`). The server itself doesn't require separate configuration beyond the command-line arguments specified in the client settings entry.
|
|
60
|
+
|
|
61
|
+
Below are the common methods for adding the server entry to your client's configuration.
|
|
62
|
+
|
|
63
|
+
### Method 1: npx (Recommended)
|
|
64
|
+
|
|
65
|
+
Using `npx` is recommended as it avoids global/local installation and ensures the client uses the latest published version.
|
|
66
|
+
|
|
67
|
+
**Example Client Configuration Entry (npx Method):**
|
|
68
|
+
|
|
69
|
+
Add the following JSON object to the `mcpServers` section of your MCP client's configuration file. This entry instructs the client on how to run the server using `npx`:
|
|
31
70
|
|
|
32
71
|
```json
|
|
33
72
|
{
|
|
34
73
|
"mcpServers": {
|
|
35
|
-
"My API Spec": {
|
|
74
|
+
"My API Spec (npx)": {
|
|
36
75
|
"command": "npx",
|
|
37
76
|
"args": [
|
|
38
77
|
"-y",
|
|
39
|
-
"mcp-openapi-schema-explorer",
|
|
40
|
-
"
|
|
78
|
+
"mcp-openapi-schema-explorer@latest",
|
|
79
|
+
"<path-or-url-to-spec>",
|
|
41
80
|
"--output-format",
|
|
42
81
|
"yaml"
|
|
43
82
|
],
|
|
@@ -47,53 +86,23 @@ This server is designed to be run by MCP clients. The recommended way to configu
|
|
|
47
86
|
}
|
|
48
87
|
```
|
|
49
88
|
|
|
50
|
-
**Configuration
|
|
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
|
-
|
|
61
|
-
**Notes:**
|
|
89
|
+
**Configuration Notes:**
|
|
62
90
|
|
|
63
|
-
-
|
|
91
|
+
- Replace `"My API Spec (npx)"` with a unique name for this server instance in your client.
|
|
92
|
+
- Replace `<path-or-url-to-spec>` with the absolute local file path or full remote URL of your specification.
|
|
93
|
+
- The `--output-format` is optional (`json`, `yaml`, `json-minified`), defaulting to `json`.
|
|
94
|
+
- To explore multiple specifications, add separate entries in `mcpServers`, each with a unique name and pointing to a different spec.
|
|
64
95
|
|
|
65
|
-
|
|
96
|
+
### Method 2: Docker
|
|
66
97
|
|
|
67
|
-
|
|
98
|
+
You can instruct your MCP client to run the server using the official Docker image: `kadykov/mcp-openapi-schema-explorer`.
|
|
68
99
|
|
|
69
|
-
**
|
|
100
|
+
**Example Client Configuration Entries (Docker Method):**
|
|
70
101
|
|
|
71
|
-
|
|
102
|
+
Add one of the following JSON objects to the `mcpServers` section of your MCP client's configuration file. These entries instruct the client on how to run the server using `docker run`:
|
|
72
103
|
|
|
73
104
|
- **Remote URL:** Pass the URL directly to `docker run`.
|
|
74
105
|
|
|
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
|
-
```
|
|
92
|
-
|
|
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
106
|
- **Using a Remote URL:**
|
|
98
107
|
|
|
99
108
|
```json
|
|
@@ -106,7 +115,7 @@ Here's how you might configure this in a client like Claude Desktop (`claude_des
|
|
|
106
115
|
"--rm",
|
|
107
116
|
"-i",
|
|
108
117
|
"kadykov/mcp-openapi-schema-explorer:latest",
|
|
109
|
-
"
|
|
118
|
+
"<remote-url-to-spec>"
|
|
110
119
|
],
|
|
111
120
|
"env": {}
|
|
112
121
|
}
|
|
@@ -114,7 +123,7 @@ Here's how you might configure this in a client like Claude Desktop (`claude_des
|
|
|
114
123
|
}
|
|
115
124
|
```
|
|
116
125
|
|
|
117
|
-
- **Using a Local File:**
|
|
126
|
+
- **Using a Local File:** (Requires mounting the file into the container)
|
|
118
127
|
```json
|
|
119
128
|
{
|
|
120
129
|
"mcpServers": {
|
|
@@ -125,7 +134,7 @@ Here's how you might configure this in a client like Claude Desktop (`claude_des
|
|
|
125
134
|
"--rm",
|
|
126
135
|
"-i",
|
|
127
136
|
"-v",
|
|
128
|
-
"/full/path/to/
|
|
137
|
+
"/full/host/path/to/spec.yaml:/spec/api.yaml",
|
|
129
138
|
"kadykov/mcp-openapi-schema-explorer:latest",
|
|
130
139
|
"/spec/api.yaml",
|
|
131
140
|
"--output-format",
|
|
@@ -136,20 +145,69 @@ Here's how you might configure this in a client like Claude Desktop (`claude_des
|
|
|
136
145
|
}
|
|
137
146
|
}
|
|
138
147
|
```
|
|
139
|
-
|
|
148
|
+
**Important:** Replace `/full/host/path/to/spec.yaml` with the correct absolute path on your host machine. The path `/spec/api.yaml` is the corresponding path inside the container.
|
|
140
149
|
|
|
141
|
-
|
|
150
|
+
### Method 3: Global Installation (Less Common)
|
|
142
151
|
|
|
143
|
-
If you
|
|
152
|
+
If you have installed the package globally using `npm install -g`, you can configure your client to run it directly.
|
|
144
153
|
|
|
145
154
|
```bash
|
|
155
|
+
# Run this command once in your terminal
|
|
146
156
|
npm install -g mcp-openapi-schema-explorer
|
|
147
157
|
```
|
|
148
158
|
|
|
149
|
-
|
|
159
|
+
**Example Client Configuration Entry (Global Install Method):**
|
|
160
|
+
|
|
161
|
+
Add the following entry to your MCP client's configuration file. This assumes the `mcp-openapi-schema-explorer` command is accessible in the client's execution environment PATH.
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"mcpServers": {
|
|
166
|
+
"My API Spec (Global)": {
|
|
167
|
+
"command": "mcp-openapi-schema-explorer",
|
|
168
|
+
"args": ["<path-or-url-to-spec>", "--output-format", "yaml"],
|
|
169
|
+
"env": {}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
- Ensure the `command` (`mcp-openapi-schema-explorer`) is accessible in the PATH environment variable used by your MCP client.
|
|
176
|
+
|
|
177
|
+
### Method 4: Local Development/Installation
|
|
178
|
+
|
|
179
|
+
This method is useful if you have cloned the repository locally for development or to run a modified version.
|
|
180
|
+
|
|
181
|
+
**Setup Steps (Run once in your terminal):**
|
|
182
|
+
|
|
183
|
+
1. Clone the repository: `git clone https://github.com/kadykov/mcp-openapi-schema-explorer.git`
|
|
184
|
+
2. Navigate into the directory: `cd mcp-openapi-schema-explorer`
|
|
185
|
+
3. Install dependencies: `npm install`
|
|
186
|
+
4. Build the project: `npm run build` (or `just build`)
|
|
187
|
+
|
|
188
|
+
**Example Client Configuration Entry (Local Development Method):**
|
|
189
|
+
|
|
190
|
+
Add the following entry to your MCP client's configuration file. This instructs the client to run the locally built server using `node`.
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"mcpServers": {
|
|
195
|
+
"My API Spec (Local Dev)": {
|
|
196
|
+
"command": "node",
|
|
197
|
+
"args": [
|
|
198
|
+
"/full/path/to/cloned/mcp-openapi-schema-explorer/dist/src/index.js",
|
|
199
|
+
"<path-or-url-to-spec>",
|
|
200
|
+
"--output-format",
|
|
201
|
+
"yaml"
|
|
202
|
+
],
|
|
203
|
+
|
|
204
|
+
"env": {}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
```
|
|
150
209
|
|
|
151
|
-
|
|
152
|
-
- `args`: Would only contain the `<path-or-url-to-spec>` and optional `--output-format` flag (omit `npx` and `-y`).
|
|
210
|
+
**Important:** Replace `/full/path/to/cloned/mcp-openapi-schema-explorer/dist/src/index.js` with the correct absolute path to the built `index.js` file in your cloned repository.
|
|
153
211
|
|
|
154
212
|
## Features
|
|
155
213
|
|
|
Binary file
|
|
Binary file
|
package/dist/src/index.js
CHANGED
|
@@ -42,10 +42,14 @@ async function main() {
|
|
|
42
42
|
const serverName = spec.info?.title
|
|
43
43
|
? `Schema Explorer for ${spec.info.title}`
|
|
44
44
|
: defaultServerName;
|
|
45
|
+
// Brief help content for LLMs
|
|
46
|
+
const helpContent = `Use resorces/templates/list to get a list of available resources. Use openapi://paths to get a list of all endpoints.`;
|
|
45
47
|
// Create MCP server with dynamic name
|
|
46
48
|
const server = new McpServer({
|
|
47
49
|
name: serverName,
|
|
48
50
|
version: VERSION, // Use the imported version
|
|
51
|
+
}, {
|
|
52
|
+
instructions: helpContent,
|
|
49
53
|
});
|
|
50
54
|
// Set up formatter and new handlers
|
|
51
55
|
const formatter = createFormatter(config.outputFormat);
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC,CAAC,0BAA0B;AACjH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,sBAAsB;AACtB,OAAO,EAAE,oBAAoB,EA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aAAa,CACrC,CAAC;QAEF,eAAe;QACf,MAAM,SAAS,GAAG,IAAI,oBAAoB,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"}
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.3.0";
|
package/dist/src/version.js
CHANGED
package/justfile
CHANGED
package/llms-install.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# MCP OpenAPI Schema Explorer Usage Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how to add the MCP OpenAPI Schema Explorer server to your MCP client (e.g., Claude Desktop, Windsurf, Cline). This involves adding a configuration entry to your client's settings file that tells the client how to run the server process. The server itself doesn't require separate configuration beyond the command-line arguments specified in the client settings.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
1. Node.js (Latest LTS version recommended) OR Docker installed.
|
|
8
|
+
2. Access to an OpenAPI v3.0 or Swagger v2.0 specification file, either via a local file path or a remote HTTP/HTTPS URL.
|
|
9
|
+
3. An MCP client application (e.g., Claude Desktop, Windsurf, Cline, etc.).
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
For the recommended usage methods (`npx` and Docker, described below), **no separate installation step is required**. Your MCP client will download the package or pull the Docker image automatically based on the configuration you provide in its settings.
|
|
14
|
+
|
|
15
|
+
If you prefer to install the server explicitly:
|
|
16
|
+
|
|
17
|
+
- **Global Install:** Run `npm install -g mcp-openapi-schema-explorer`. See **Usage Method 3** for how to configure your client to use this.
|
|
18
|
+
- **Local Install (for Development):** Clone the repository (`git clone ...`), install dependencies (`npm install`), and build (`npm run build`). See **Usage Method 4** for how to configure your client to use this.
|
|
19
|
+
|
|
20
|
+
## Usage Method 1: npx (Recommended)
|
|
21
|
+
|
|
22
|
+
This is the recommended method as it avoids global/local installation and ensures you use the latest published version.
|
|
23
|
+
|
|
24
|
+
### Client Configuration Entry (npx Method)
|
|
25
|
+
|
|
26
|
+
Add the following JSON object to the `mcpServers` section of your MCP client's configuration file (e.g., `claude_desktop_config.json`). This entry instructs the client on how to run the server using `npx`:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"My API Spec (npx)": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": [
|
|
34
|
+
"-y",
|
|
35
|
+
"mcp-openapi-schema-explorer@latest",
|
|
36
|
+
"<path-or-url-to-spec>",
|
|
37
|
+
"--output-format",
|
|
38
|
+
"yaml"
|
|
39
|
+
],
|
|
40
|
+
"env": {}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Configuration Details:**
|
|
47
|
+
|
|
48
|
+
1. **Replace `"My API Spec (npx)"`:** Choose a descriptive name for this server instance.
|
|
49
|
+
2. **Replace `<path-or-url-to-spec>`:** Provide the **required** absolute local file path (e.g., `/path/to/your/api.yaml`) or the full remote URL (e.g., `https://petstore3.swagger.io/api/v3/openapi.json`).
|
|
50
|
+
3. **(Optional)** Adjust the `--output-format` value (`yaml`, `json`, `json-minified`). Defaults to `json`.
|
|
51
|
+
|
|
52
|
+
## Usage Method 2: Docker
|
|
53
|
+
|
|
54
|
+
You can instruct your MCP client to run the server using the official Docker image: `kadykov/mcp-openapi-schema-explorer`.
|
|
55
|
+
|
|
56
|
+
### Client Configuration Entry (Docker Method)
|
|
57
|
+
|
|
58
|
+
- **Using a Remote URL:**
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"mcpServers": {
|
|
63
|
+
"My API Spec (Docker Remote)": {
|
|
64
|
+
"command": "docker",
|
|
65
|
+
"args": [
|
|
66
|
+
"run",
|
|
67
|
+
"--rm",
|
|
68
|
+
"-i",
|
|
69
|
+
"kadykov/mcp-openapi-schema-explorer:latest",
|
|
70
|
+
"<remote-url-to-spec>"
|
|
71
|
+
],
|
|
72
|
+
"env": {}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
- **Using a Local File:** (Requires mounting the file into the container)
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"My API Spec (Docker Local)": {
|
|
83
|
+
"command": "docker",
|
|
84
|
+
"args": [
|
|
85
|
+
"run",
|
|
86
|
+
"--rm",
|
|
87
|
+
"-i",
|
|
88
|
+
"-v",
|
|
89
|
+
"/full/host/path/to/spec.yaml:/spec/api.yaml",
|
|
90
|
+
"kadykov/mcp-openapi-schema-explorer:latest",
|
|
91
|
+
"/spec/api.yaml",
|
|
92
|
+
"--output-format",
|
|
93
|
+
"yaml"
|
|
94
|
+
],
|
|
95
|
+
"env": {}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
**Important:** Replace `/full/host/path/to/spec.yaml` with the correct absolute path on your host machine. The path `/spec/api.yaml` is the corresponding path inside the container.
|
|
101
|
+
|
|
102
|
+
## Usage Method 3: Global Installation (Less Common)
|
|
103
|
+
|
|
104
|
+
You can install the package globally, although `npx` is generally preferred.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Run this command once in your terminal
|
|
108
|
+
npm install -g mcp-openapi-schema-explorer
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Client Configuration Entry (Global Install Method)
|
|
112
|
+
|
|
113
|
+
Add the following entry to your MCP client's configuration file. This assumes the `mcp-openapi-schema-explorer` command is accessible in the client's execution environment PATH.
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"mcpServers": {
|
|
118
|
+
"My API Spec (Global)": {
|
|
119
|
+
"command": "mcp-openapi-schema-explorer",
|
|
120
|
+
"args": ["<path-or-url-to-spec>", "--output-format", "yaml"],
|
|
121
|
+
"env": {}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
- **`command`:** Use the globally installed command name. You might need the full path if it's not in your system's PATH environment variable accessible by the MCP client.
|
|
128
|
+
|
|
129
|
+
## Usage Method 4: Local Development/Installation
|
|
130
|
+
|
|
131
|
+
This method is useful for development or running a locally modified version of the server.
|
|
132
|
+
|
|
133
|
+
### Setup Steps (Run once in your terminal)
|
|
134
|
+
|
|
135
|
+
1. Clone the repository: `git clone https://github.com/kadykov/mcp-openapi-schema-explorer.git`
|
|
136
|
+
2. Navigate into the directory: `cd mcp-openapi-schema-explorer`
|
|
137
|
+
3. Install dependencies: `npm install`
|
|
138
|
+
4. Build the project: `npm run build` (or `just build`)
|
|
139
|
+
|
|
140
|
+
### Client Configuration Entry (Local Development Method)
|
|
141
|
+
|
|
142
|
+
Add the following entry to your MCP client's configuration file. This instructs the client to run the locally built server using `node`.
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"My API Spec (Local Dev)": {
|
|
148
|
+
"command": "node",
|
|
149
|
+
"args": [
|
|
150
|
+
"/full/path/to/cloned/mcp-openapi-schema-explorer/dist/src/index.js",
|
|
151
|
+
"<path-or-url-to-spec>",
|
|
152
|
+
"--output-format",
|
|
153
|
+
"yaml"
|
|
154
|
+
],
|
|
155
|
+
|
|
156
|
+
"env": {}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Important:** Replace `/full/path/to/cloned/mcp-openapi-schema-explorer/dist/src/index.js` with the correct absolute path to the built `index.js` file in your cloned repository.
|
|
163
|
+
|
|
164
|
+
## Verification
|
|
165
|
+
|
|
166
|
+
After adding the server entry to your MCP client's configuration:
|
|
167
|
+
|
|
168
|
+
1. The server should appear in the list of available MCP servers within your client (e.g., named "My API Spec (npx)" or whatever key you used). The server name might dynamically update based on the spec's `info.title` (e.g., "Schema Explorer for Petstore API").
|
|
169
|
+
2. Test the connection by accessing a basic resource, for example (using your chosen server name):
|
|
170
|
+
```
|
|
171
|
+
/mcp "My API Spec (npx)" access openapi://info
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Troubleshooting
|
|
175
|
+
|
|
176
|
+
Common issues and solutions:
|
|
177
|
+
|
|
178
|
+
1. **Server Fails to Start:**
|
|
179
|
+
- Verify the `<path-or-url-to-spec>` is correct, accessible, and properly quoted in the JSON configuration.
|
|
180
|
+
- Ensure the specification file is a valid OpenAPI v3.0 or Swagger v2.0 document (JSON or YAML).
|
|
181
|
+
- Check Node.js version (LTS recommended) if using `npx`, global, or local install.
|
|
182
|
+
- Check Docker installation and permissions if using Docker.
|
|
183
|
+
- For remote URLs, check network connectivity.
|
|
184
|
+
- For Docker with local files, ensure the volume mount path (`-v` flag) is correct and the host path exists.
|
|
185
|
+
- For Local Development, ensure the path to `dist/src/index.js` is correct and the project has been built (`npm run build`).
|
|
186
|
+
2. **Resources Not Loading or Errors:**
|
|
187
|
+
- Double-check the resource URI syntax (e.g., `openapi://paths`, `openapi://components/schemas/MySchema`). Remember that path segments in URIs need URL encoding (e.g., `/users/{id}` becomes `users%2F%7Bid%7D`).
|
|
188
|
+
- Ensure the requested path, method, or component exists in the specification.
|
|
189
|
+
|
|
190
|
+
## Environment Variables
|
|
191
|
+
|
|
192
|
+
No environment variables are required for the server to operate.
|
|
193
|
+
|
|
194
|
+
## Additional Notes
|
|
195
|
+
|
|
196
|
+
- The server automatically handles loading specs from local files or remote URLs.
|
|
197
|
+
- Swagger v2.0 specifications are automatically converted to OpenAPI v3.0 internally.
|
|
198
|
+
- Internal references (`#/components/...`) are transformed into clickable MCP URIs (`openapi://components/...`).
|
|
199
|
+
- The server name displayed in the client might be dynamically generated from the specification's title.
|
|
200
|
+
|
|
201
|
+
## Support
|
|
202
|
+
|
|
203
|
+
If you encounter any issues:
|
|
204
|
+
|
|
205
|
+
1. Check the project's main README for more details: [https://github.com/kadykov/mcp-openapi-schema-explorer#readme](https://github.com/kadykov/mcp-openapi-schema-explorer#readme)
|
|
206
|
+
2. Submit an issue on GitHub: [https://github.com/kadykov/mcp-openapi-schema-explorer/issues](https://github.com/kadykov/mcp-openapi-schema-explorer/issues)
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
This guide provides instructions for adding the server to your MCP client using various execution methods. Refer to the main project README for comprehensive documentation on features and resource usage.
|
|
@@ -2,154 +2,92 @@
|
|
|
2
2
|
|
|
3
3
|
## Current Focus
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Recent Progress
|
|
8
|
-
|
|
9
|
-
### Dependency Cleanup & Release Automation (✓)
|
|
10
|
-
|
|
11
|
-
1. **Dependency Correction:**
|
|
12
|
-
- Moved `swagger2openapi` from `devDependencies` to `dependencies` in `package.json`.
|
|
13
|
-
- Moved `@types/js-yaml` from `dependencies` to `devDependencies` in `package.json`.
|
|
14
|
-
- Removed unused `@types/swagger-parser` from `devDependencies` in `package.json`.
|
|
15
|
-
- Ran `npm install` to update `package-lock.json`.
|
|
16
|
-
2. **Semantic Release Setup:**
|
|
17
|
-
- Installed `semantic-release` and plugins (`@semantic-release/commit-analyzer`, `@semantic-release/release-notes-generator`, `@semantic-release/changelog`, `@semantic-release/npm`, `@semantic-release/github`, `@semantic-release/git`, `@semantic-release/exec`) as dev dependencies.
|
|
18
|
-
- Created `scripts/generate-version.js` to write the release version to `src/version.ts`.
|
|
19
|
-
- Created `.releaserc.json` configuring the release workflow, including using `@semantic-release/exec` to run the generation script and `@semantic-release/git` to commit `src/version.ts`.
|
|
20
|
-
- Updated `eslint.config.js` to correctly lint the `generate-version.js` script.
|
|
21
|
-
3. **Dynamic Versioning:**
|
|
22
|
-
- Created a default `src/version.ts` file (with version `0.0.0-dev`) tracked by Git to ensure local/CI builds work.
|
|
23
|
-
- Updated `src/index.ts` to import `VERSION` from `src/version.ts` and use it in the `McpServer` constructor.
|
|
24
|
-
- The default `src/version.ts` will be overwritten with the correct release version by `semantic-release` during the release process.
|
|
25
|
-
4. **CI Workflow Adaptation:**
|
|
26
|
-
- Updated `.github/workflows/ci.yml`.
|
|
27
|
-
- Removed Docker Compose dependency from the `test` job.
|
|
28
|
-
- Standardized on Node 22 for `test` and `security` jobs.
|
|
29
|
-
- Added `extractions/setup-just@v3` action to both jobs.
|
|
30
|
-
- Updated `test` job to run checks via `just all`.
|
|
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 uses `cycjimmy/semantic-release-action@v4`. Configured necessary permissions and environment variables (`GITHUB_TOKEN`, `NPM_TOKEN`).
|
|
33
|
-
5. **Memory Bank Update (✓):** Updated `activeContext.md`, `progress.md`, `systemPatterns.md`, and `techContext.md`.
|
|
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
|
-
|
|
50
|
-
### Dynamic Server Name (✓)
|
|
51
|
-
|
|
52
|
-
1. **Spec Loading:** Modified `src/index.ts` to load the OpenAPI spec using `createSpecLoader` _before_ initializing `McpServer`.
|
|
53
|
-
2. **Name Generation:** Extracted `info.title` from the loaded spec and constructed a dynamic server name (`Schema Explorer for {title}`) with a fallback to `'OpenAPI Schema Explorer'`.
|
|
54
|
-
3. **Server Initialization:** Updated `McpServer` constructor in `src/index.ts` to use the generated dynamic name.
|
|
55
|
-
4. **Dependency Injection:** Confirmed handlers already receive the shared `specLoader` instance correctly, requiring no changes to handler constructors.
|
|
56
|
-
5. **Memory Bank Update (✓):** Updated `activeContext.md` and `progress.md`.
|
|
57
|
-
|
|
58
|
-
### Resource Completion Logic (✓)
|
|
59
|
-
|
|
60
|
-
1. **Implementation:** Modified `src/index.ts` to define `ResourceTemplate` objects directly within `server.resource()` calls. Added `complete` property with functions providing suggestions for `{field}`, `{path}`, `{method*}`, and `{type}` based on the loaded `transformedSpec`.
|
|
61
|
-
2. **Conditional Name Completion:** Implemented logic for the `{name*}` completion in the `openapi://components/{type}/{name*}` template. It now provides component names only if the spec contains exactly one component type (e.g., only `schemas`). Otherwise, it returns an empty list. Used `getValidatedComponentMap` helper for safe access.
|
|
62
|
-
3. **Testing:**
|
|
63
|
-
- Added new E2E test suite (`Completion Tests`) to `test/__tests__/e2e/resources.test.ts` using the `client.complete()` method.
|
|
64
|
-
- Added new test fixture `test/fixtures/multi-component-types.json` to cover the multi-type scenario for name completion.
|
|
65
|
-
- Verified all tests pass.
|
|
66
|
-
4. **Memory Bank Update (✓):** Updated `activeContext.md`, `progress.md`, `systemPatterns.md`, and `projectbrief.md`.
|
|
67
|
-
|
|
68
|
-
### Dynamic Server Name (✓)
|
|
69
|
-
|
|
70
|
-
1. **Spec Loading:** Modified `src/index.ts` to load the OpenAPI spec using `createSpecLoader` _before_ initializing `McpServer`.
|
|
71
|
-
2. **Name Generation:** Extracted `info.title` from the loaded spec and constructed a dynamic server name (`Schema Explorer for {title}`) with a fallback to `'OpenAPI Schema Explorer'`.
|
|
72
|
-
3. **Server Initialization:** Updated `McpServer` constructor in `src/index.ts` to use the generated dynamic name.
|
|
73
|
-
4. **Dependency Injection:** Confirmed handlers already receive the shared `specLoader` instance correctly, requiring no changes to handler constructors.
|
|
74
|
-
5. **Memory Bank Update (✓):** Updated `activeContext.md` and `progress.md`.
|
|
75
|
-
|
|
76
|
-
### Minified JSON Output Format (✓)
|
|
77
|
-
|
|
78
|
-
1. **Formatter:** Added `MinifiedJsonFormatter` to `src/services/formatters.ts` and updated `OutputFormat` type and `createFormatter` function.
|
|
79
|
-
2. **Configuration:** Updated `src/config.ts` to accept `--output-format json-minified`.
|
|
80
|
-
3. **Unit Tests:** Added unit tests for `MinifiedJsonFormatter` in `test/__tests__/unit/services/formatters.test.ts`.
|
|
81
|
-
4. **E2E Tests:** Added E2E tests for the `json-minified` format in `test/__tests__/e2e/format.test.ts`.
|
|
82
|
-
5. **Test Helpers:** Updated `StartServerOptions` type in `test/utils/mcp-test-helpers.ts`.
|
|
83
|
-
6. **Memory Bank Update (✓):** Updated `techContext.md`, `systemPatterns.md`, `progress.md`, and `activeContext.md`.
|
|
84
|
-
|
|
85
|
-
### Remote Spec & Swagger v2.0 Support (✓)
|
|
86
|
-
|
|
87
|
-
1. **Remote Loading:** Added support for loading specifications via HTTP/HTTPS URLs using `swagger2openapi` in `SpecLoaderService`.
|
|
88
|
-
2. **Swagger v2.0 Conversion:** Added support for automatically converting Swagger v2.0 specifications to OpenAPI v3.0 using `swagger2openapi` in `SpecLoaderService`.
|
|
89
|
-
3. **Dependency Change:** Replaced `@apidevtools/swagger-parser` with `swagger2openapi`. Added `@types/swagger2openapi`. Reinstalled `openapi-types`.
|
|
90
|
-
4. **Configuration:** Confirmed configuration uses CLI arguments (`<path-or-url-to-spec>`).
|
|
91
|
-
5. **Testing:**
|
|
92
|
-
- Updated `SpecLoaderService` unit tests (`spec-loader.test.ts`) to mock `swagger2openapi` and cover new scenarios (local/remote, v2/v3). Fixed linting/hoisting issues in mocks.
|
|
93
|
-
- Created new E2E test file (`spec-loading.test.ts`) to verify loading from local v2 and remote v3 sources. Added necessary helpers and fixed linting issues.
|
|
94
|
-
- Added v2.0 test fixture (`sample-v2-api.json`).
|
|
95
|
-
6. **Memory Bank Update (✓):** Updated `productContext.md`, `techContext.md`, `systemPatterns.md`, `progress.md`, and `activeContext.md` to reflect these changes.
|
|
96
|
-
|
|
97
|
-
### Major Refactor (Previously Completed - ✓)
|
|
98
|
-
|
|
99
|
-
1. **Unified URI Structure:** Implemented consistent URIs based on OpenAPI spec hierarchy (`openapi://{field}`, `openapi://paths/...`, `openapi://components/...`).
|
|
100
|
-
2. **OOP Rendering Layer:** Created `Renderable*` classes for modular rendering logic (`src/rendering/`).
|
|
101
|
-
3. **Refactored Handlers:** Replaced old handlers with new, focused handlers (`src/handlers/`).
|
|
102
|
-
- `TopLevelFieldHandler`
|
|
103
|
-
- `PathItemHandler`
|
|
104
|
-
- `OperationHandler`
|
|
105
|
-
- `ComponentMapHandler`
|
|
106
|
-
- `ComponentDetailHandler`
|
|
107
|
-
4. **Shared Utilities:** Extracted common logic into `src/rendering/utils.ts` and `src/handlers/handler-utils.ts`.
|
|
108
|
-
5. **Multi-Value Handling:** Correctly implemented handling for `*` variables (`method*`, `name*`).
|
|
109
|
-
6. **Testing:**
|
|
110
|
-
- Added/passed unit tests for all `Renderable*` classes.
|
|
111
|
-
- Added/passed E2E tests for the new URI structure using `complex-endpoint.json`.
|
|
112
|
-
7. **Documentation:** Updated `systemPatterns.md` and `progress.md`.
|
|
113
|
-
8. **Archived Old Code:** Moved previous implementations to `local-docs/old-implementation/`.
|
|
114
|
-
9. **URI Generation Refactor (✓):**
|
|
115
|
-
- Created centralized URI builder utility (`src/utils/uri-builder.ts`).
|
|
116
|
-
- Updated `$ref` transformation (`src/services/reference-transform.ts`) to use the builder and support all component types (`openapi://components/{type}/{name}`).
|
|
117
|
-
- Updated hint generation (`src/rendering/utils.ts`, `components.ts`, `path-item.ts`) to use the builder.
|
|
118
|
-
- Corrected path encoding in builder (removed leading slash encoding).
|
|
119
|
-
- Updated relevant unit tests (`uri-builder.test.ts`, `reference-transform.test.ts`, `path-item.test.ts`).
|
|
120
|
-
- Fixed `RenderablePathItem` instantiation in handlers (`path-item-handler.ts`, `operation-handler.ts`).
|
|
121
|
-
10. **Security Fix (✓):** Resolved `security/detect-object-injection` warnings by implementing Map-based validation helpers (`getValidatedPathItem`, `getValidatedOperations`, `getValidatedComponentMap`, `getValidatedComponentDetails`) in `handler-utils.ts` and refactoring handlers (`operation-handler`, `path-item-handler`, `component-map-handler`, `component-detail-handler`) and rendering classes (`RenderablePaths`, `RenderableComponents`, `RenderableComponentMap`) to use safe access patterns inspired by the old implementation.
|
|
5
|
+
Successfully upgraded @modelcontextprotocol/sdk from 1.10.1 to 1.11.0 and addressed breaking changes in test mocks.
|
|
122
6
|
|
|
123
7
|
## Implementation Status
|
|
124
8
|
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
##
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
9
|
+
- @modelcontextprotocol/sdk updated from 1.10.1 to 1.11.0
|
|
10
|
+
- Updated all test mocks to include new `RequestHandlerExtra` property (`requestId`).
|
|
11
|
+
- Corrected import path for `RequestId` to `@modelcontextprotocol/sdk/types.js`.
|
|
12
|
+
- Modified test files:
|
|
13
|
+
- component-map-handler.test.ts
|
|
14
|
+
- component-detail-handler.test.ts
|
|
15
|
+
- operation-handler.test.ts
|
|
16
|
+
- path-item-handler.test.ts
|
|
17
|
+
- top-level-field-handler.test.ts
|
|
18
|
+
- All tests passing successfully
|
|
19
|
+
- Server now loads OpenAPI v3.0 and Swagger v2.0 specs from local files or remote URLs
|
|
20
|
+
- Swagger v2.0 specs are automatically converted to v3.0
|
|
21
|
+
- Internal references are transformed to MCP URIs
|
|
22
|
+
- Added `json-minified` output format option
|
|
23
|
+
- Server name is now dynamically set based on the loaded spec's `info.title`
|
|
24
|
+
- Automated versioning and release process implemented using `semantic-release`
|
|
25
|
+
- CI workflow adapted for Node 22, uses `just` for checks, and includes a `release` job
|
|
26
|
+
- Docker support added with automated Docker Hub publishing
|
|
27
|
+
- Dependencies correctly categorized
|
|
28
|
+
- Resource completion logic implemented
|
|
29
|
+
- Dynamic server name implemented
|
|
30
|
+
- Minified JSON output format added
|
|
31
|
+
- Remote spec loading and Swagger v2.0 conversion support added
|
|
32
|
+
- Core resource exploration functionality remains operational
|
|
33
|
+
- Unit tests updated for latest SDK version
|
|
34
|
+
- E2E tests cover all main functionality
|
|
35
|
+
|
|
36
|
+
## Recent Changes
|
|
37
|
+
|
|
38
|
+
### SDK Update to v1.11.0 & Test Fixes (✓)
|
|
39
|
+
|
|
40
|
+
1. **Dependency Update:**
|
|
41
|
+
|
|
42
|
+
- Updated @modelcontextprotocol/sdk from 1.10.1 to 1.11.0 in `package.json`.
|
|
43
|
+
- Identified breaking change in `RequestHandlerExtra` type requiring a new `requestId` property.
|
|
44
|
+
|
|
45
|
+
2. **Test Suite Updates:**
|
|
46
|
+
- Added the `requestId` property to `mockExtra` objects in all handler unit tests:
|
|
47
|
+
- `test/__tests__/unit/handlers/top-level-field-handler.test.ts`
|
|
48
|
+
- `test/__tests__/unit/handlers/component-map-handler.test.ts`
|
|
49
|
+
- `test/__tests__/unit/handlers/path-item-handler.test.ts`
|
|
50
|
+
- `test/__tests__/unit/handlers/operation-handler.test.ts`
|
|
51
|
+
- `test/__tests__/unit/handlers/component-detail-handler.test.ts`
|
|
52
|
+
- Corrected the import path for `RequestId` to `import { RequestId } from '@modelcontextprotocol/sdk/types.js';` in these files. This resolved previous TypeScript import errors and an ESLint warning regarding unsafe assignment also disappeared.
|
|
53
|
+
- Confirmed all test fixes by running `just build && just test` successfully.
|
|
54
|
+
|
|
55
|
+
## Next Actions
|
|
56
|
+
|
|
57
|
+
1. **Continue with Previous Plans:**
|
|
58
|
+
|
|
59
|
+
- Complete README updates with release process details
|
|
60
|
+
- Clean up any remaining TODOs in codebase
|
|
61
|
+
- Address minor ESLint warnings
|
|
62
|
+
|
|
63
|
+
2. **Documentation:**
|
|
64
|
+
|
|
65
|
+
- Document the SDK upgrade in CHANGELOG.md
|
|
66
|
+
- Update dependencies section in relevant documentation
|
|
67
|
+
|
|
68
|
+
3. **Testing:**
|
|
69
|
+
|
|
70
|
+
- Monitor for any new breaking changes in future SDK updates
|
|
71
|
+
- Consider adding test utilities to simplify mock creation
|
|
72
|
+
|
|
73
|
+
4. **Code Cleanup:**
|
|
74
|
+
- Refactor duplicated mock setup code in tests
|
|
75
|
+
- Consider creating shared test fixtures for common mocks
|
|
76
|
+
|
|
77
|
+
## Future Considerations
|
|
78
|
+
|
|
79
|
+
1. **SDK Integration:**
|
|
80
|
+
|
|
81
|
+
- Stay updated with MCP SDK releases
|
|
82
|
+
- Plan for future breaking changes
|
|
83
|
+
- Consider automated dependency update checks
|
|
84
|
+
|
|
85
|
+
2. **Testing Infrastructure:**
|
|
86
|
+
|
|
87
|
+
- Improve test mock reusability
|
|
88
|
+
- Add test coverage for edge cases
|
|
89
|
+
- Consider adding integration tests
|
|
90
|
+
|
|
91
|
+
3. **Previous Future Considerations:**
|
|
92
|
+
- Implement reference traversal/resolution service
|
|
93
|
+
- Enhance support for all component types
|
package/memory-bank/progress.md
CHANGED
|
@@ -142,6 +142,7 @@
|
|
|
142
142
|
- E2E tests updated for new structure and complex fixture. Added tests for resource completion.
|
|
143
143
|
- Unit tests for `SpecLoaderService` updated for `swagger2openapi`.
|
|
144
144
|
- CI workflow updated to use `just` and includes automated release job for npm and Docker.
|
|
145
|
+
- Handler unit tests updated to accommodate `@modelcontextprotocol/sdk` v1.11.0 changes (`RequestHandlerExtra` now requires `requestId`, and `RequestId` import path corrected to `@modelcontextprotocol/sdk/types.js`).
|
|
145
146
|
|
|
146
147
|
3. API Design
|
|
147
148
|
- New URI structure implemented, aligned with OpenAPI spec.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-openapi-schema-explorer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "MCP OpenAPI schema explorer",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/kadykov/mcp-openapi-schema-explorer#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
39
|
+
"@modelcontextprotocol/sdk": "^1.10.1",
|
|
40
40
|
"js-yaml": "^4.1.0",
|
|
41
41
|
"openapi-types": "^12.1.3",
|
|
42
42
|
"swagger2openapi": "7.0.8",
|
|
43
|
-
"zod": "^
|
|
43
|
+
"zod": "^4.0.5"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@codedependant/semantic-release-docker": "^5.1.0",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@semantic-release/github": "^11.0.1",
|
|
53
53
|
"@semantic-release/npm": "^12.0.1",
|
|
54
54
|
"@semantic-release/release-notes-generator": "^14.0.3",
|
|
55
|
-
"@types/jest": "^
|
|
55
|
+
"@types/jest": "^30.0.0",
|
|
56
56
|
"@types/js-yaml": "^4.0.9",
|
|
57
|
-
"@types/node": "^
|
|
57
|
+
"@types/node": "^24.0.3",
|
|
58
58
|
"@types/node-fetch": "^2.6.12",
|
|
59
59
|
"@types/swagger2openapi": "^7.0.4",
|
|
60
60
|
"@typescript-eslint/eslint-plugin": "^8.29.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"eslint-plugin-security": "^3.0.1",
|
|
65
65
|
"globals": "^16.0.0",
|
|
66
66
|
"husky": "^9.1.7",
|
|
67
|
-
"jest": "^
|
|
67
|
+
"jest": "^30.0.2",
|
|
68
68
|
"jest-silent-reporter": "^0.6.0",
|
|
69
69
|
"license-checker": "^25.0.1",
|
|
70
70
|
"msw": "^2.7.4",
|
package/src/index.ts
CHANGED
|
@@ -50,11 +50,19 @@ async function main(): Promise<void> {
|
|
|
50
50
|
? `Schema Explorer for ${spec.info.title}`
|
|
51
51
|
: defaultServerName;
|
|
52
52
|
|
|
53
|
+
// Brief help content for LLMs
|
|
54
|
+
const helpContent = `Use resorces/templates/list to get a list of available resources. Use openapi://paths to get a list of all endpoints.`;
|
|
55
|
+
|
|
53
56
|
// Create MCP server with dynamic name
|
|
54
|
-
const server = new McpServer(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
const server = new McpServer(
|
|
58
|
+
{
|
|
59
|
+
name: serverName,
|
|
60
|
+
version: VERSION, // Use the imported version
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
instructions: helpContent,
|
|
64
|
+
}
|
|
65
|
+
);
|
|
58
66
|
|
|
59
67
|
// Set up formatter and new handlers
|
|
60
68
|
const formatter = createFormatter(config.outputFormat);
|
package/src/version.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import { RequestId } from '@modelcontextprotocol/sdk/types.js';
|
|
2
3
|
import { ComponentDetailHandler } from '../../../../src/handlers/component-detail-handler';
|
|
3
4
|
import { SpecLoaderService } from '../../../../src/types';
|
|
4
5
|
import { IFormatter, JsonFormatter } from '../../../../src/services/formatters';
|
|
@@ -62,7 +63,12 @@ describe('ComponentDetailHandler', () => {
|
|
|
62
63
|
});
|
|
63
64
|
|
|
64
65
|
describe('handleRequest', () => {
|
|
65
|
-
const mockExtra = {
|
|
66
|
+
const mockExtra = {
|
|
67
|
+
signal: new AbortController().signal,
|
|
68
|
+
sendNotification: jest.fn(),
|
|
69
|
+
sendRequest: jest.fn(),
|
|
70
|
+
requestId: 'test-request-id' as RequestId,
|
|
71
|
+
};
|
|
66
72
|
|
|
67
73
|
it('should return detail for a single valid component (schema)', async () => {
|
|
68
74
|
const variables: Variables = { type: 'schemas', name: 'User' }; // Use 'name' key
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import { RequestId } from '@modelcontextprotocol/sdk/types.js';
|
|
2
3
|
import { ComponentMapHandler } from '../../../../src/handlers/component-map-handler';
|
|
3
4
|
import { SpecLoaderService } from '../../../../src/types';
|
|
4
5
|
import { IFormatter, JsonFormatter } from '../../../../src/services/formatters';
|
|
@@ -48,7 +49,12 @@ describe('ComponentMapHandler', () => {
|
|
|
48
49
|
});
|
|
49
50
|
|
|
50
51
|
describe('handleRequest (List Component Names)', () => {
|
|
51
|
-
const mockExtra = {
|
|
52
|
+
const mockExtra = {
|
|
53
|
+
signal: new AbortController().signal,
|
|
54
|
+
sendNotification: jest.fn(),
|
|
55
|
+
sendRequest: jest.fn(),
|
|
56
|
+
requestId: 'test-request-id' as RequestId,
|
|
57
|
+
};
|
|
52
58
|
|
|
53
59
|
it('should list names for a valid component type (schemas)', async () => {
|
|
54
60
|
const variables: Variables = { type: 'schemas' };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import { RequestId } from '@modelcontextprotocol/sdk/types.js';
|
|
2
3
|
import { OperationHandler } from '../../../../src/handlers/operation-handler';
|
|
3
4
|
import { SpecLoaderService } from '../../../../src/types';
|
|
4
5
|
import { IFormatter, JsonFormatter } from '../../../../src/services/formatters';
|
|
@@ -58,7 +59,12 @@ describe('OperationHandler', () => {
|
|
|
58
59
|
});
|
|
59
60
|
|
|
60
61
|
describe('handleRequest', () => {
|
|
61
|
-
const mockExtra = {
|
|
62
|
+
const mockExtra = {
|
|
63
|
+
signal: new AbortController().signal,
|
|
64
|
+
sendNotification: jest.fn(),
|
|
65
|
+
sendRequest: jest.fn(),
|
|
66
|
+
requestId: 'test-request-id' as RequestId,
|
|
67
|
+
};
|
|
62
68
|
|
|
63
69
|
it('should return detail for a single valid method', async () => {
|
|
64
70
|
const variables: Variables = { path: encodedPathItems, method: 'get' }; // Use 'method' key
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import { RequestId } from '@modelcontextprotocol/sdk/types.js';
|
|
2
3
|
import { PathItemHandler } from '../../../../src/handlers/path-item-handler';
|
|
3
4
|
import { SpecLoaderService } from '../../../../src/types';
|
|
4
5
|
import { IFormatter, JsonFormatter } from '../../../../src/services/formatters';
|
|
@@ -50,7 +51,12 @@ describe('PathItemHandler', () => {
|
|
|
50
51
|
});
|
|
51
52
|
|
|
52
53
|
describe('handleRequest (List Methods)', () => {
|
|
53
|
-
const mockExtra = {
|
|
54
|
+
const mockExtra = {
|
|
55
|
+
signal: new AbortController().signal,
|
|
56
|
+
sendNotification: jest.fn(),
|
|
57
|
+
sendRequest: jest.fn(),
|
|
58
|
+
requestId: 'test-request-id' as RequestId,
|
|
59
|
+
};
|
|
54
60
|
|
|
55
61
|
it('should list methods for a valid path', async () => {
|
|
56
62
|
const variables: Variables = { path: encodedPathItems };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import { RequestId } from '@modelcontextprotocol/sdk/types.js';
|
|
2
3
|
import { TopLevelFieldHandler } from '../../../../src/handlers/top-level-field-handler';
|
|
3
4
|
import { SpecLoaderService } from '../../../../src/types';
|
|
4
5
|
import { IFormatter, JsonFormatter } from '../../../../src/services/formatters';
|
|
@@ -40,14 +41,12 @@ describe('TopLevelFieldHandler', () => {
|
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
describe('handleRequest', () => {
|
|
43
|
-
// Create a mock extra object with the required signal property
|
|
44
44
|
const mockExtra = {
|
|
45
45
|
signal: new AbortController().signal,
|
|
46
|
+
sendNotification: jest.fn(),
|
|
47
|
+
sendRequest: jest.fn(),
|
|
48
|
+
requestId: 'test-request-id' as RequestId,
|
|
46
49
|
};
|
|
47
|
-
// Cast to the expected type for the handler call signature if needed,
|
|
48
|
-
// but the object structure itself is simpler.
|
|
49
|
-
// Note: We might need to cast this later if strict type checks complain,
|
|
50
|
-
// but let's try the minimal structure first.
|
|
51
50
|
|
|
52
51
|
it('should handle request for "info" field', async () => {
|
|
53
52
|
mockGetTransformedSpec.mockResolvedValue(sampleSpec);
|