Skip to content

feat: Support External References in OpenAPI MCP Tool Converter - #2214

Merged
lbroudoux merged 2 commits into
microcks:masterfrom
dolliecoder:feat/mcp-external-refs
Sep 9, 2026
Merged

lbroudoux merged 2 commits into
microcks:masterfrom
dolliecoder:feat/mcp-external-refs

Conversation

@dolliecoder

Copy link
Copy Markdown
Contributor

Description

This PR implements the missing capability for the Microcks MCP Server to resolve and extract schemas from external $ref definitions (such as separate JSON or YAML schema files) when converting OpenAPI specifications into MCP tools.

  • Injected ResourceRepository: Updated the McpController and OpenAPIMcpToolConverter constructors to inject the ResourceRepository, allowing the converter to fetch externally attached Resource files linked to the Service.
  • Implemented External Reference Resolution: Ported the getNodeForExternalRef logic from the reshaprio/reshapr project. The algorithm correctly parses external file paths and JSON pointers (e.g., models.yaml#/components/schemas/UserModel), locates the corresponding resource in the repository, and extracts the exact schema slice required.
  • Added Caching: Implemented lazy parsing and caching of JSON/YAML ASTs via externalResourcesContent (Map<Resource, JsonNode>) to ensure high-performance schema resolution without redundant parsing on subsequent tool calls.
  • Added Integration Test: Added the testExternalReferenceResolution test case to OpenAPIMcpToolConverterTest which successfully mimics a multipart OpenAPI specification with external $refs and asserts that the final McpSchema.JsonSchema contains the correctly mapped properties.

Related issue(s)

Resolves #2210

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

👋 @dolliecoder

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

@dolliecoder

Copy link
Copy Markdown
Contributor Author

@lbroudoux PTAL when you get time

…to smaller methods and use stable cache key

Signed-off-by: dolliecoder <[email protected]>
@dolliecoder

Copy link
Copy Markdown
Contributor Author

@SebastienDegodez PTAL

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 30 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation.

There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. Microcks is a Cloud Native Computing Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this pull request forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions Bot added the stale State due to inactivity label Aug 19, 2026
@lbroudoux lbroudoux added keep-open Explicitily keep open and removed stale State due to inactivity labels Aug 19, 2026

@lbroudoux lbroudoux left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks all good! Thanks for this contribution and for your patience!

@lbroudoux lbroudoux added this to the 1.16.0 milestone Sep 9, 2026
@lbroudoux
lbroudoux merged commit c0a1969 into microcks:master Sep 9, 2026
11 of 12 checks passed
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

🎉 @dolliecoder

You are now a Microcks community contributor! 💖

Thanks and congrats 🚀 on merging your first pull request! We are delighted and very proud of you! 👏

📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌"

Kudos and please keep going, we need you 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement (TODO): Support External References in OpenAPI MCP Tool Converter

3 participants