mcp-openapi-schema-explorer 1.0.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/.devcontainer/devcontainer.json +24 -0
- package/.github/dependabot.yml +13 -0
- package/.github/workflows/ci.yml +111 -0
- package/.husky/pre-commit +6 -0
- package/.prettierignore +3 -0
- package/.prettierrc.json +12 -0
- package/.releaserc.json +23 -0
- package/CHANGELOG.md +32 -0
- package/CONTRIBUTING.md +67 -0
- package/Dockerfile +3 -0
- package/LICENSE +21 -0
- package/README.md +127 -0
- package/dist/src/config.d.ts +15 -0
- package/dist/src/config.js +19 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/handlers/component-detail-handler.d.ts +14 -0
- package/dist/src/handlers/component-detail-handler.js +87 -0
- package/dist/src/handlers/component-detail-handler.js.map +1 -0
- package/dist/src/handlers/component-map-handler.d.ts +14 -0
- package/dist/src/handlers/component-map-handler.js +63 -0
- package/dist/src/handlers/component-map-handler.js.map +1 -0
- package/dist/src/handlers/handler-utils.d.ts +69 -0
- package/dist/src/handlers/handler-utils.js +180 -0
- package/dist/src/handlers/handler-utils.js.map +1 -0
- package/dist/src/handlers/operation-handler.d.ts +14 -0
- package/dist/src/handlers/operation-handler.js +86 -0
- package/dist/src/handlers/operation-handler.js.map +1 -0
- package/dist/src/handlers/path-item-handler.d.ts +14 -0
- package/dist/src/handlers/path-item-handler.js +66 -0
- package/dist/src/handlers/path-item-handler.js.map +1 -0
- package/dist/src/handlers/top-level-field-handler.d.ts +14 -0
- package/dist/src/handlers/top-level-field-handler.js +72 -0
- package/dist/src/handlers/top-level-field-handler.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +177 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/rendering/components.d.ts +67 -0
- package/dist/src/rendering/components.js +177 -0
- package/dist/src/rendering/components.js.map +1 -0
- package/dist/src/rendering/document.d.ts +36 -0
- package/dist/src/rendering/document.js +147 -0
- package/dist/src/rendering/document.js.map +1 -0
- package/dist/src/rendering/path-item.d.ts +45 -0
- package/dist/src/rendering/path-item.js +141 -0
- package/dist/src/rendering/path-item.js.map +1 -0
- package/dist/src/rendering/paths.d.ts +26 -0
- package/dist/src/rendering/paths.js +78 -0
- package/dist/src/rendering/paths.js.map +1 -0
- package/dist/src/rendering/types.d.ts +50 -0
- package/dist/src/rendering/types.js +12 -0
- package/dist/src/rendering/types.js.map +1 -0
- package/dist/src/rendering/utils.d.ts +31 -0
- package/dist/src/rendering/utils.js +79 -0
- package/dist/src/rendering/utils.js.map +1 -0
- package/dist/src/services/formatters.d.ts +36 -0
- package/dist/src/services/formatters.js +52 -0
- package/dist/src/services/formatters.js.map +1 -0
- package/dist/src/services/reference-transform.d.ts +27 -0
- package/dist/src/services/reference-transform.js +75 -0
- package/dist/src/services/reference-transform.js.map +1 -0
- package/dist/src/services/spec-loader.d.ts +27 -0
- package/dist/src/services/spec-loader.js +77 -0
- package/dist/src/services/spec-loader.js.map +1 -0
- package/dist/src/types.d.ts +11 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/uri-builder.d.ts +81 -0
- package/dist/src/utils/uri-builder.js +121 -0
- package/dist/src/utils/uri-builder.js.map +1 -0
- package/dist/src/version.d.ts +1 -0
- package/dist/src/version.js +4 -0
- package/dist/src/version.js.map +1 -0
- package/eslint.config.js +88 -0
- package/jest.config.js +32 -0
- package/justfile +66 -0
- package/memory-bank/activeContext.md +139 -0
- package/memory-bank/productContext.md +39 -0
- package/memory-bank/progress.md +141 -0
- package/memory-bank/projectbrief.md +50 -0
- package/memory-bank/systemPatterns.md +224 -0
- package/memory-bank/techContext.md +131 -0
- package/package.json +76 -0
- package/scripts/generate-version.js +49 -0
- package/src/config.ts +33 -0
- package/src/handlers/component-detail-handler.ts +121 -0
- package/src/handlers/component-map-handler.ts +92 -0
- package/src/handlers/handler-utils.ts +230 -0
- package/src/handlers/operation-handler.ts +114 -0
- package/src/handlers/path-item-handler.ts +88 -0
- package/src/handlers/top-level-field-handler.ts +92 -0
- package/src/index.ts +222 -0
- package/src/rendering/components.ts +228 -0
- package/src/rendering/document.ts +167 -0
- package/src/rendering/path-item.ts +157 -0
- package/src/rendering/paths.ts +87 -0
- package/src/rendering/types.ts +63 -0
- package/src/rendering/utils.ts +107 -0
- package/src/services/formatters.ts +71 -0
- package/src/services/reference-transform.ts +105 -0
- package/src/services/spec-loader.ts +88 -0
- package/src/types.ts +17 -0
- package/src/utils/uri-builder.ts +134 -0
- package/src/version.ts +4 -0
- package/test/__tests__/e2e/format.test.ts +224 -0
- package/test/__tests__/e2e/resources.test.ts +369 -0
- package/test/__tests__/e2e/spec-loading.test.ts +172 -0
- package/test/__tests__/unit/config.test.ts +39 -0
- package/test/__tests__/unit/handlers/component-detail-handler.test.ts +241 -0
- package/test/__tests__/unit/handlers/component-map-handler.test.ts +187 -0
- package/test/__tests__/unit/handlers/handler-utils.test.ts +255 -0
- package/test/__tests__/unit/handlers/operation-handler.test.ts +202 -0
- package/test/__tests__/unit/handlers/path-item-handler.test.ts +153 -0
- package/test/__tests__/unit/handlers/top-level-field-handler.test.ts +182 -0
- package/test/__tests__/unit/rendering/components.test.ts +269 -0
- package/test/__tests__/unit/rendering/document.test.ts +172 -0
- package/test/__tests__/unit/rendering/path-item.test.ts +197 -0
- package/test/__tests__/unit/rendering/paths.test.ts +115 -0
- package/test/__tests__/unit/services/formatters.test.ts +109 -0
- package/test/__tests__/unit/services/reference-transform.test.ts +320 -0
- package/test/__tests__/unit/services/spec-loader.test.ts +214 -0
- package/test/__tests__/unit/utils/uri-builder.test.ts +103 -0
- package/test/fixtures/complex-endpoint.json +146 -0
- package/test/fixtures/empty-api.json +8 -0
- package/test/fixtures/multi-component-types.json +55 -0
- package/test/fixtures/paths-test.json +61 -0
- package/test/fixtures/sample-api.json +68 -0
- package/test/fixtures/sample-v2-api.json +39 -0
- package/test/setup.ts +32 -0
- package/test/utils/console-helpers.ts +48 -0
- package/test/utils/mcp-test-helpers.ts +66 -0
- package/test/utils/test-types.ts +54 -0
- package/tsconfig.json +25 -0
- package/tsconfig.test.json +5 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "MCP OpenAPI Schema Explorer",
|
|
3
|
+
"dockerFile": "../Dockerfile",
|
|
4
|
+
"features": {
|
|
5
|
+
"ghcr.io/devcontainers/features/common-utils:2": {
|
|
6
|
+
"username": "vscode"
|
|
7
|
+
},
|
|
8
|
+
"ghcr.io/guiyomh/features/just:0": {}
|
|
9
|
+
},
|
|
10
|
+
"remoteUser": "vscode",
|
|
11
|
+
"postCreateCommand": "just install",
|
|
12
|
+
"customizations": {
|
|
13
|
+
"vscode": {
|
|
14
|
+
"extensions": [
|
|
15
|
+
"ms-azuretools.vscode-docker",
|
|
16
|
+
"GitHub.vscode-github-actions",
|
|
17
|
+
"saoudrizwan.claude-dev",
|
|
18
|
+
"dbaeumer.vscode-eslint",
|
|
19
|
+
"rvest.vs-code-prettier-eslint",
|
|
20
|
+
"ms-vscode.vscode-typescript-next"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: 'npm'
|
|
4
|
+
directory: '/'
|
|
5
|
+
schedule:
|
|
6
|
+
interval: 'weekly'
|
|
7
|
+
open-pull-requests-limit: 10
|
|
8
|
+
|
|
9
|
+
- package-ecosystem: 'github-actions'
|
|
10
|
+
directory: '/'
|
|
11
|
+
schedule:
|
|
12
|
+
interval: 'weekly'
|
|
13
|
+
open-pull-requests-limit: 10
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
permissions: # Add default permissions, release job will override if needed
|
|
4
|
+
contents: read
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
tags:
|
|
10
|
+
- 'v*'
|
|
11
|
+
pull_request:
|
|
12
|
+
branches: [main]
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout code
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Setup Node.js
|
|
22
|
+
uses: actions/setup-node@v4
|
|
23
|
+
with:
|
|
24
|
+
node-version: 22 # Match Dockerfile
|
|
25
|
+
cache: 'npm'
|
|
26
|
+
|
|
27
|
+
- name: Setup Just
|
|
28
|
+
uses: extractions/setup-just@v3
|
|
29
|
+
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: npm ci
|
|
32
|
+
|
|
33
|
+
- name: Run all checks (format, lint, build, test)
|
|
34
|
+
run: just all # Uses justfile for consistency
|
|
35
|
+
|
|
36
|
+
- name: Upload coverage reports artifact
|
|
37
|
+
uses: actions/upload-artifact@v4
|
|
38
|
+
with:
|
|
39
|
+
name: coverage-report-${{ github.run_id }} # Unique name per run
|
|
40
|
+
path: coverage/
|
|
41
|
+
if: always() # Upload even if previous steps fail
|
|
42
|
+
|
|
43
|
+
- name: Upload coverage to Codecov
|
|
44
|
+
uses: codecov/codecov-action@v5
|
|
45
|
+
with:
|
|
46
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
47
|
+
# fail_ci_if_error: true # Optional: fail CI if upload fails
|
|
48
|
+
|
|
49
|
+
security:
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
permissions:
|
|
52
|
+
contents: read # Needed for checkout and CodeQL
|
|
53
|
+
security-events: write # Needed for CodeQL alert uploads
|
|
54
|
+
steps:
|
|
55
|
+
- name: Checkout code
|
|
56
|
+
uses: actions/checkout@v4
|
|
57
|
+
|
|
58
|
+
- name: Setup Node.js
|
|
59
|
+
uses: actions/setup-node@v4
|
|
60
|
+
with:
|
|
61
|
+
node-version: 22 # Match Dockerfile and test job
|
|
62
|
+
cache: 'npm'
|
|
63
|
+
|
|
64
|
+
- name: Setup Just
|
|
65
|
+
uses: extractions/setup-just@v3
|
|
66
|
+
|
|
67
|
+
- name: Install dependencies
|
|
68
|
+
run: npm ci
|
|
69
|
+
|
|
70
|
+
- name: Run Security Checks (Audit, Licenses)
|
|
71
|
+
run: just security # Uses justfile, includes npm audit and license-checker
|
|
72
|
+
continue-on-error: true # Allow workflow to continue even if npm audit finds vulnerabilities
|
|
73
|
+
|
|
74
|
+
# Static code analysis with CodeQL (Keep separate as it's not in justfile)
|
|
75
|
+
- name: Initialize CodeQL
|
|
76
|
+
uses: github/codeql-action/init@v3
|
|
77
|
+
# Auto-detect languages: javascript, typescript
|
|
78
|
+
# queries: +security-extended # Optional: run more queries
|
|
79
|
+
|
|
80
|
+
- name: Perform CodeQL Analysis
|
|
81
|
+
uses: github/codeql-action/analyze@v3
|
|
82
|
+
|
|
83
|
+
release:
|
|
84
|
+
name: Release
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
needs: [test, security] # Run after test and security checks pass
|
|
87
|
+
# Run only on pushes to main, not on tags (semantic-release creates tags)
|
|
88
|
+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
89
|
+
permissions:
|
|
90
|
+
contents: write # Allow tagging, committing package.json/changelog/version.ts
|
|
91
|
+
issues: write # Allow commenting on issues/PRs
|
|
92
|
+
pull-requests: write # Allow commenting on issues/PRs
|
|
93
|
+
id-token: write # Needed for provenance publishing to npm (alternative to NPM_TOKEN)
|
|
94
|
+
steps:
|
|
95
|
+
- name: Checkout
|
|
96
|
+
uses: actions/checkout@v4
|
|
97
|
+
|
|
98
|
+
- name: Setup Node.js
|
|
99
|
+
uses: actions/setup-node@v4
|
|
100
|
+
with:
|
|
101
|
+
node-version: 22 # Match Dockerfile and other jobs
|
|
102
|
+
cache: 'npm'
|
|
103
|
+
|
|
104
|
+
- name: Install all dependencies
|
|
105
|
+
run: npm ci --include=dev
|
|
106
|
+
|
|
107
|
+
- name: Semantic Release
|
|
108
|
+
uses: cycjimmy/semantic-release-action@v4
|
|
109
|
+
env:
|
|
110
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
111
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/.prettierignore
ADDED
package/.prettierrc.json
ADDED
package/.releaserc.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branches": ["main"],
|
|
3
|
+
"plugins": [
|
|
4
|
+
"@semantic-release/commit-analyzer",
|
|
5
|
+
"@semantic-release/release-notes-generator",
|
|
6
|
+
"@semantic-release/changelog",
|
|
7
|
+
"@semantic-release/npm",
|
|
8
|
+
[
|
|
9
|
+
"@semantic-release/exec",
|
|
10
|
+
{
|
|
11
|
+
"prepareCmd": "node ./scripts/generate-version.js ${nextRelease.version}"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
"@semantic-release/git",
|
|
16
|
+
{
|
|
17
|
+
"assets": ["package.json", "package-lock.json", "CHANGELOG.md", "src/version.ts"],
|
|
18
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"@semantic-release/github"
|
|
22
|
+
]
|
|
23
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# 1.0.0 (2025-04-12)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- add codecov badge to README for improved visibility of test coverage ([ed7bf93](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/ed7bf93de6c6efbf3a890551b67321b0d003c3cf))
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- add CI workflow and dependabot configuration for automated updates ([2d0b22e](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/2d0b22ea20afd58297b2169d3761db32b4c92606))
|
|
10
|
+
- Add configuration management for OpenAPI Explorer ([b9f4771](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/b9f47712e754983d292bd6d53c82fa7e344b45a6))
|
|
11
|
+
- add CONTRIBUTING.md and enhance README with detailed project information ([1f4b2d5](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/1f4b2d59d7a19e54556cf8933fc4e4952d8f438c))
|
|
12
|
+
- Add end-to-end tests for OpenAPI resource handling ([d1ba7ab](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/d1ba7ab5db84717ed6c326d0c7d625906572be2c))
|
|
13
|
+
- Add pre-commit hook to format staged files with Prettier ([af58250](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/af582509fadbffd52afcd36d6113a1965a2bfcef))
|
|
14
|
+
- Add SchemaListHandler and implement schema listing resource with error handling ([873bbee](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/873bbee9cee5233e97202458a6b261e6ac58b651))
|
|
15
|
+
- Add support for minified JSON output format and related enhancements ([f0cb5b8](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/f0cb5b80eeb73d2656b1d8fb37ab8fe21dacf12a))
|
|
16
|
+
- Enhance endpoint features and add endpoint list handler with improved error handling ([32082ac](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/32082acd3f187bb0611a2adbbfb107f0c153aae2))
|
|
17
|
+
- Enhance OpenAPI resource handling with new templates and completion tests ([45e4938](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/45e4938b226dc6e1baeb506b8c23c615fef78065))
|
|
18
|
+
- Enhance output formatting with JSON and YAML support, including formatter implementations and configuration updates ([e63fafe](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/e63fafe82abb36a56bbb976ff3098f2d4d6a7d6c))
|
|
19
|
+
- Implement dynamic server name based on OpenAPI spec title ([aaa691f](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/aaa691fa2c545a433e09fb3f1faa0d31d4e8624d))
|
|
20
|
+
- Implement EndpointListHandler and add endpoint list resource to server ([b81a606](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/b81a60645eeec9b2e9bd7eb46914cdf3178f9457))
|
|
21
|
+
- Implement Map-based validation helpers to enhance security and error handling ([a4394c9](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/a4394c9846482d53436019a0498ca5d91fddefdf))
|
|
22
|
+
- Implement resource completion logic and add related tests ([de8f297](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/de8f29785882a6bd68d4fcaf38de971de4bad222))
|
|
23
|
+
- Implement SchemaHandler and add schema resource support with error handling ([2fae461](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/2fae461e5de51b7610135922b4a4c9a55cd5b126))
|
|
24
|
+
- initialize MCP OpenAPI schema explorer project ([fd64242](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/fd642421274172e5ca330c9b85015f597f4a96c1))
|
|
25
|
+
- Introduce suppressExpectedConsoleError utility to manage console.error during tests ([ef088c2](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/ef088c2f98bacd0dd7ae3f4aa75e44ba52a41712))
|
|
26
|
+
- Update dependencies to include swagger2openapi and @types/js-yaml ([8acb951](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/8acb951eb88843c72f8eb7d6d7feff681b56ff84))
|
|
27
|
+
- update descriptions in API methods to include URL-encoding notes ([b71dbdf](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/b71dbdfd8c5f0c02d9a47f99143416787f76bf50))
|
|
28
|
+
- Update endpoint URI template to support wildcard parameters ([ce1281f](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/ce1281f16f81a0fd7a74b20fe6bb92e7ed19e158))
|
|
29
|
+
- Update EndpointHandler to return detailed operation responses for GET and POST methods ([af55400](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/af554008c35c9be5bdbf53e51b791e90d135e283))
|
|
30
|
+
- Update license compliance check to include Python-2.0 ([e00c5e2](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/e00c5e23cca6070d6833017b567d7c5402276f45))
|
|
31
|
+
- Update MCP inspector command to support YAML output format ([f7fb551](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/f7fb551cc3a9d7e84fb47100cf8e0430c2634070))
|
|
32
|
+
- update release job to match Node.js version and include dev dependencies ([f3aeb87](https://github.com/kadykov/mcp-openapi-schema-explorer/commit/f3aeb87dcd8bed9920fe2eccdcd8f253b310f761))
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Contributing to MCP OpenAPI Schema Explorer
|
|
2
|
+
|
|
3
|
+
Thank you for considering contributing to this project! We welcome improvements and bug fixes.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
- **Devcontainer:** The easiest way to get a consistent development environment is to use the provided [Dev Container](https://code.visualstudio.com/docs/devcontainers/containers) configuration (`.devcontainer/`). If you have Docker and the VS Code Dev Containers extension installed, simply reopen the project folder in a container.
|
|
8
|
+
- **Manual Setup:** If you prefer not to use the devcontainer, ensure you have Node.js (v22 or later recommended) and npm installed. Clone the repository and run `npm install` to install dependencies.
|
|
9
|
+
|
|
10
|
+
## Development Workflow
|
|
11
|
+
|
|
12
|
+
This project uses [`just`](https://github.com/casey/just) as a command runner for common development tasks. See the `justfile` for all available commands. Key commands include:
|
|
13
|
+
|
|
14
|
+
- `just install`: Install dependencies (`npm install`).
|
|
15
|
+
- `just format`: Format code using Prettier.
|
|
16
|
+
- `just lint`: Check code for linting errors using ESLint.
|
|
17
|
+
- `just build`: Compile TypeScript code (`npx tsc`).
|
|
18
|
+
- `just test`: Run unit and end-to-end tests using Jest.
|
|
19
|
+
- `just test-coverage`: Run tests and generate a coverage report.
|
|
20
|
+
- `just security`: Run security checks (npm audit, license check).
|
|
21
|
+
- `just all`: Run format, lint, build, test-coverage, and security checks sequentially.
|
|
22
|
+
|
|
23
|
+
Please ensure `just all` passes before submitting a pull request.
|
|
24
|
+
|
|
25
|
+
## Code Style
|
|
26
|
+
|
|
27
|
+
- **Formatting:** We use [Prettier](https://prettier.io/) for automatic code formatting. Please run `just format` before committing.
|
|
28
|
+
- **Linting:** We use [ESLint](https://eslint.org/) for code analysis. Please run `just lint` to check for issues.
|
|
29
|
+
|
|
30
|
+
## Commit Messages
|
|
31
|
+
|
|
32
|
+
This project uses [`semantic-release`](https://github.com/semantic-release/semantic-release) to automate versioning and releases. Therefore, commit messages **must** follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. This allows the release process to automatically determine the version bump (patch, minor, major) and generate changelogs.
|
|
33
|
+
|
|
34
|
+
Common commit types include:
|
|
35
|
+
|
|
36
|
+
- `feat`: A new feature
|
|
37
|
+
- `fix`: A bug fix
|
|
38
|
+
- `docs`: Documentation only changes
|
|
39
|
+
- `style`: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
|
40
|
+
- `refactor`: A code change that neither fixes a bug nor adds a feature
|
|
41
|
+
- `perf`: A code change that improves performance
|
|
42
|
+
- `test`: Adding missing tests or correcting existing tests
|
|
43
|
+
- `build`: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
|
44
|
+
- `ci`: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
|
45
|
+
- `chore`: Other changes that don't modify src or test files
|
|
46
|
+
|
|
47
|
+
Example: `feat: add support for YAML output format`
|
|
48
|
+
Example: `fix: correct handling of remote URL loading errors`
|
|
49
|
+
Example: `docs: update README with client configuration examples`
|
|
50
|
+
|
|
51
|
+
## Cline & Memory Bank
|
|
52
|
+
|
|
53
|
+
This project utilizes [Cline](https://github.com/cline/cline) for AI-assisted development. The `memory-bank/` directory contains documentation specifically for Cline's context. Maintaining this memory bank helps ensure Cline can effectively assist with development tasks.
|
|
54
|
+
|
|
55
|
+
If you make significant changes to the project's architecture, features, or development process, please consider updating the relevant files in `memory-bank/`. You can learn more about the Cline Memory Bank [here](https://docs.cline.bot/improving-your-prompting-skills/cline-memory-bank).
|
|
56
|
+
|
|
57
|
+
## Submitting Changes
|
|
58
|
+
|
|
59
|
+
1. Fork the repository.
|
|
60
|
+
2. Create a new branch for your feature or fix (`git checkout -b feat/my-new-feature` or `git checkout -b fix/my-bug-fix`).
|
|
61
|
+
3. Make your changes.
|
|
62
|
+
4. Ensure all checks pass (`just all`).
|
|
63
|
+
5. Commit your changes using the Conventional Commits format.
|
|
64
|
+
6. Push your branch to your fork (`git push origin feat/my-new-feature`).
|
|
65
|
+
7. Open a pull request against the `main` branch of the original repository.
|
|
66
|
+
|
|
67
|
+
Thank you for your contribution!
|
package/Dockerfile
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Aleksandr Kadykov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# MCP OpenAPI Schema Explorer
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/mcp-openapi-schema-explorer)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://codecov.io/gh/kadykov/mcp-openapi-schema-explorer)
|
|
6
|
+
|
|
7
|
+
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
|
+
## Project Goal
|
|
10
|
+
|
|
11
|
+
The primary goal of this project is to allow 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. It achieves this by exposing parts of the specification through MCP Resources, which are well-suited for read-only data exploration.
|
|
12
|
+
|
|
13
|
+
This server supports loading specifications from both local file paths and remote HTTP/HTTPS URLs. Swagger v2.0 specifications are automatically converted to OpenAPI v3.0 upon loading.
|
|
14
|
+
|
|
15
|
+
## Why MCP Resources?
|
|
16
|
+
|
|
17
|
+
The Model Context Protocol defines both **Resources** and **Tools**.
|
|
18
|
+
|
|
19
|
+
- **Resources:** Represent data sources (like files, API responses). They are ideal for read-only access and exploration by MCP clients (e.g., browsing API paths in Claude Desktop).
|
|
20
|
+
- **Tools:** Represent executable actions or functions, often used by LLMs to perform tasks or interact with external systems.
|
|
21
|
+
|
|
22
|
+
While other MCP servers exist that provide access to OpenAPI specs via _Tools_, this project specifically focuses on providing access via _Resources_. This makes it particularly useful for direct exploration within MCP client applications.
|
|
23
|
+
|
|
24
|
+
For more details on MCP clients and their capabilities, see the [MCP Client Documentation](https://modelcontextprotocol.io/clients).
|
|
25
|
+
|
|
26
|
+
## Usage with MCP Clients (Recommended)
|
|
27
|
+
|
|
28
|
+
This server is designed to be run by MCP clients. The recommended way to configure it is using `npx`, which downloads and runs the package without requiring a global installation.
|
|
29
|
+
|
|
30
|
+
**Example Configuration (Claude Desktop - `claude_desktop_config.json`):**
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"My API Spec": {
|
|
36
|
+
// Choose a descriptive name for this server instance
|
|
37
|
+
"command": "npx",
|
|
38
|
+
"args": [
|
|
39
|
+
"-y", // Auto-confirm npx installation if needed the first time
|
|
40
|
+
"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"
|
|
44
|
+
],
|
|
45
|
+
"env": {} // No environment variables needed currently
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Notes:**
|
|
52
|
+
|
|
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.
|
|
56
|
+
|
|
57
|
+
## Alternative: Global Installation
|
|
58
|
+
|
|
59
|
+
If you prefer, you can install the server globally:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install -g mcp-openapi-schema-explorer
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
If installed globally, your MCP client configuration would change:
|
|
66
|
+
|
|
67
|
+
- `command`: Likely `mcp-openapi-schema-explorer` (or the full path if needed).
|
|
68
|
+
- `args`: Would only contain the `<path-or-url-to-spec>` and optional `--output-format` flag (omit `npx` and `-y`).
|
|
69
|
+
|
|
70
|
+
## Features
|
|
71
|
+
|
|
72
|
+
- **MCP Resource Access:** Explore OpenAPI specs via intuitive URIs (`openapi://info`, `openapi://paths/...`, `openapi://components/...`).
|
|
73
|
+
- **OpenAPI v3.0 & Swagger v2.0 Support:** Loads both formats, automatically converting v2.0 to v3.0.
|
|
74
|
+
- **Local & Remote Files:** Load specs from local file paths or HTTP/HTTPS URLs.
|
|
75
|
+
- **Token-Efficient:** Designed to minimize token usage for LLMs by providing structured access.
|
|
76
|
+
- **Multiple Output Formats:** Get detailed views in JSON (default), YAML, or minified JSON (`--output-format`).
|
|
77
|
+
- **Dynamic Server Name:** Server name in MCP clients reflects the `info.title` from the loaded spec.
|
|
78
|
+
- **Reference Transformation:** Internal `$ref`s (`#/components/...`) are transformed into clickable MCP URIs.
|
|
79
|
+
|
|
80
|
+
## Available MCP Resources
|
|
81
|
+
|
|
82
|
+
This server exposes the following MCP resource templates for exploring the OpenAPI specification:
|
|
83
|
+
|
|
84
|
+
- **`openapi://{field}`**
|
|
85
|
+
|
|
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`).
|
|
88
|
+
- **Output:** `text/plain` list for `paths` and `components`; configured format (JSON/YAML/minified JSON) for other fields.
|
|
89
|
+
|
|
90
|
+
- **`openapi://paths/{path}`**
|
|
91
|
+
|
|
92
|
+
- **Description:** Lists the available HTTP methods (operations) for a specific API path.
|
|
93
|
+
- **Parameter:** `{path}` - The API path string. **Must be URL-encoded** (e.g., `/users/{id}` becomes `users%2F%7Bid%7D`).
|
|
94
|
+
- **Output:** `text/plain` list of methods.
|
|
95
|
+
|
|
96
|
+
- **`openapi://paths/{path}/{method*}`**
|
|
97
|
+
|
|
98
|
+
- **Description:** Gets the detailed specification for one or more operations (HTTP methods) on a specific API path.
|
|
99
|
+
- **Parameters:**
|
|
100
|
+
- `{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`).
|
|
102
|
+
- **Output:** Configured format (JSON/YAML/minified JSON).
|
|
103
|
+
|
|
104
|
+
- **`openapi://components/{type}`**
|
|
105
|
+
|
|
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.
|
|
109
|
+
|
|
110
|
+
- **`openapi://components/{type}/{name*}`**
|
|
111
|
+
- **Description:** Gets the detailed specification for one or more named components of a specific type.
|
|
112
|
+
- **Parameters:**
|
|
113
|
+
- `{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`).
|
|
115
|
+
- **Output:** Configured format (JSON/YAML/minified JSON).
|
|
116
|
+
|
|
117
|
+
## Contributing
|
|
118
|
+
|
|
119
|
+
Contributions are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on setting up the development environment, running tests, and submitting changes.
|
|
120
|
+
|
|
121
|
+
## Releases
|
|
122
|
+
|
|
123
|
+
This project uses [`semantic-release`](https://github.com/semantic-release/semantic-release) for automated version management and package publishing based on [Conventional Commits](https://www.conventionalcommits.org/).
|
|
124
|
+
|
|
125
|
+
## Future Plans
|
|
126
|
+
|
|
127
|
+
- Docker container support for easier deployment.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration management for the OpenAPI Explorer MCP server
|
|
3
|
+
*/
|
|
4
|
+
import { OutputFormat } from './services/formatters.js';
|
|
5
|
+
/** Server configuration */
|
|
6
|
+
export interface ServerConfig {
|
|
7
|
+
/** Path to OpenAPI specification file */
|
|
8
|
+
specPath: string;
|
|
9
|
+
/** Output format for responses */
|
|
10
|
+
outputFormat: OutputFormat;
|
|
11
|
+
}
|
|
12
|
+
/** Load server configuration from command line arguments */
|
|
13
|
+
export declare function loadConfig(specPath?: string, options?: {
|
|
14
|
+
outputFormat?: string;
|
|
15
|
+
}): ServerConfig;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration management for the OpenAPI Explorer MCP server
|
|
3
|
+
*/
|
|
4
|
+
/** Load server configuration from command line arguments */
|
|
5
|
+
export function loadConfig(specPath, options) {
|
|
6
|
+
if (!specPath) {
|
|
7
|
+
throw new Error('OpenAPI spec path is required. Usage: npx mcp-openapi-schema-explorer <path-to-spec> [--output-format json|yaml]');
|
|
8
|
+
}
|
|
9
|
+
const format = options?.outputFormat || 'json';
|
|
10
|
+
if (format !== 'json' && format !== 'yaml' && format !== 'json-minified') {
|
|
11
|
+
throw new Error('Invalid output format. Supported formats: json, yaml, json-minified');
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
specPath,
|
|
15
|
+
// Cast is safe here due to the validation above
|
|
16
|
+
outputFormat: format,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,4DAA4D;AAC5D,MAAM,UAAU,UAAU,CAAC,QAAiB,EAAE,OAAmC;IAC/E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,kHAAkH,CACnH,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,EAAE,YAAY,IAAI,MAAM,CAAC;IAC/C,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,eAAe,EAAE,CAAC;QACzE,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IAED,OAAO;QACL,QAAQ;QACR,gDAAgD;QAChD,YAAY,EAAE,MAAsB;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReadResourceTemplateCallback, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { SpecLoaderService } from '../types.js';
|
|
3
|
+
import { IFormatter } from '../services/formatters.js';
|
|
4
|
+
/**
|
|
5
|
+
* Handles requests for specific component details.
|
|
6
|
+
* Corresponds to the `openapi://components/{type}/{name*}` template.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ComponentDetailHandler {
|
|
9
|
+
private specLoader;
|
|
10
|
+
private formatter;
|
|
11
|
+
constructor(specLoader: SpecLoaderService, formatter: IFormatter);
|
|
12
|
+
getTemplate(): ResourceTemplate;
|
|
13
|
+
handleRequest: ReadResourceTemplateCallback;
|
|
14
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ResourceTemplate, } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { RenderableComponentMap, VALID_COMPONENT_TYPES, } from '../rendering/components.js';
|
|
3
|
+
import { createErrorResult } from '../rendering/utils.js';
|
|
4
|
+
// Import shared handler utils
|
|
5
|
+
import { formatResults, isOpenAPIV3, getValidatedComponentMap, // Import helper
|
|
6
|
+
getValidatedComponentDetails, // Import helper
|
|
7
|
+
} from './handler-utils.js'; // Already has .js
|
|
8
|
+
const BASE_URI = 'openapi://';
|
|
9
|
+
// Removed duplicated FormattedResultItem type - now imported from handler-utils
|
|
10
|
+
// Removed duplicated formatResults function - now imported from handler-utils
|
|
11
|
+
// Removed duplicated isOpenAPIV3 function - now imported from handler-utils
|
|
12
|
+
/**
|
|
13
|
+
* Handles requests for specific component details.
|
|
14
|
+
* Corresponds to the `openapi://components/{type}/{name*}` template.
|
|
15
|
+
*/
|
|
16
|
+
export class ComponentDetailHandler {
|
|
17
|
+
constructor(specLoader, formatter) {
|
|
18
|
+
this.specLoader = specLoader;
|
|
19
|
+
this.formatter = formatter;
|
|
20
|
+
this.handleRequest = async (uri, variables) => {
|
|
21
|
+
const type = variables.type;
|
|
22
|
+
// Correct variable access key: 'name', not 'name*'
|
|
23
|
+
const nameVar = variables['name']; // Can be string or string[]
|
|
24
|
+
const mapUriSuffix = `components/${type}`;
|
|
25
|
+
const context = { formatter: this.formatter, baseUri: BASE_URI };
|
|
26
|
+
let resultItems;
|
|
27
|
+
try {
|
|
28
|
+
if (!VALID_COMPONENT_TYPES.includes(type)) {
|
|
29
|
+
throw new Error(`Invalid component type: ${type}`);
|
|
30
|
+
}
|
|
31
|
+
const componentType = type;
|
|
32
|
+
// Normalize names: Handle string for single value, array for multiple.
|
|
33
|
+
let names = [];
|
|
34
|
+
if (Array.isArray(nameVar)) {
|
|
35
|
+
names = nameVar.map(n => String(n).trim()); // Ensure elements are strings
|
|
36
|
+
}
|
|
37
|
+
else if (typeof nameVar === 'string') {
|
|
38
|
+
names = [nameVar.trim()]; // Treat as single item array
|
|
39
|
+
}
|
|
40
|
+
names = names.filter(n => n.length > 0); // Remove empty strings
|
|
41
|
+
if (names.length === 0) {
|
|
42
|
+
throw new Error('No valid component name specified.');
|
|
43
|
+
}
|
|
44
|
+
const spec = await this.specLoader.getTransformedSpec({
|
|
45
|
+
resourceType: 'schema', // Use 'schema' for now
|
|
46
|
+
format: 'openapi',
|
|
47
|
+
});
|
|
48
|
+
// Use imported type guard
|
|
49
|
+
if (!isOpenAPIV3(spec)) {
|
|
50
|
+
throw new Error('Only OpenAPI v3 specifications are supported');
|
|
51
|
+
}
|
|
52
|
+
// --- Use helper to get validated component map ---
|
|
53
|
+
const componentMapObj = getValidatedComponentMap(spec, componentType);
|
|
54
|
+
// --- Create Map and use helper to get validated component names/details ---
|
|
55
|
+
// Create the Map from the validated object
|
|
56
|
+
const detailsMap = new Map(Object.entries(componentMapObj));
|
|
57
|
+
// Pass the Map to the helper
|
|
58
|
+
const validDetails = getValidatedComponentDetails(detailsMap, names, componentType);
|
|
59
|
+
const validNames = validDetails.map(detail => detail.name); // Extract names
|
|
60
|
+
// Instantiate RenderableComponentMap with the validated map object
|
|
61
|
+
const renderableMap = new RenderableComponentMap(componentMapObj, // componentMapObj retrieved safely via helper
|
|
62
|
+
componentType, mapUriSuffix);
|
|
63
|
+
// Pass the validated names to the rendering function
|
|
64
|
+
resultItems = renderableMap.renderComponentDetail(context, validNames);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
// Catch errors from helpers (e.g., type/name not found) or rendering
|
|
68
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
69
|
+
console.error(`Error handling request ${uri.href}: ${message}`);
|
|
70
|
+
// Create a single error item representing the overall request failure
|
|
71
|
+
resultItems = createErrorResult(uri.href.substring(BASE_URI.length), // Use request URI suffix
|
|
72
|
+
message);
|
|
73
|
+
}
|
|
74
|
+
// Use imported formatResults
|
|
75
|
+
const contents = formatResults(context, resultItems);
|
|
76
|
+
return { contents };
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
getTemplate() {
|
|
80
|
+
// TODO: Add completion logic if needed
|
|
81
|
+
return new ResourceTemplate(`${BASE_URI}components/{type}/{name*}`, {
|
|
82
|
+
list: undefined,
|
|
83
|
+
complete: undefined,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=component-detail-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-detail-handler.js","sourceRoot":"","sources":["../../../src/handlers/component-detail-handler.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReadResourceTemplateCallback, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { SpecLoaderService } from '../types.js';
|
|
3
|
+
import { IFormatter } from '../services/formatters.js';
|
|
4
|
+
/**
|
|
5
|
+
* Handles requests for listing component names of a specific type.
|
|
6
|
+
* Corresponds to the `openapi://components/{type}` template.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ComponentMapHandler {
|
|
9
|
+
private specLoader;
|
|
10
|
+
private formatter;
|
|
11
|
+
constructor(specLoader: SpecLoaderService, formatter: IFormatter);
|
|
12
|
+
getTemplate(): ResourceTemplate;
|
|
13
|
+
handleRequest: ReadResourceTemplateCallback;
|
|
14
|
+
}
|