feat: support URL for OpenAPI schema source#4
Open
ppspps824 wants to merge 1 commit into
Open
Conversation
- Accept http(s):// URLs in addition to local file paths - Pass URL directly to SwaggerParser.validate(); local paths still resolved - Derive schema name from info.title or URL path when using URL - Update README, help text, and example with URL usage
|
Would it be possible to add support for a full dynamic openapi spec url via chat-context? I mean I would like to have a "neutral" openapi mcp which can just fetch a openapi spec from somewhere and then work with that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Currently only local paths are supported. This change allows passing a URL as the OpenAPI schema source as well.
Changes
http://orhttps://, it is treated as a URL and passed through to SwaggerParser.path.resolve()and then passed to SwaggerParser.info.title; when using a URL, fall back to the filename (without extension) from the URL path.Testing
node index.mjs sample-petstore.yamlandnode example-usage.mjs; behavior is unchanged.node index.mjs https://petstore3.swagger.io/api/v3/openapi.json, started the server, and called MCP tools (e.g. list-endpoints); everything worked as expected.