Skip to content

Adding MCP endpoint for finding ref guide URLs - #86

Draft
jzonthemtn wants to merge 2 commits into
apache:mainfrom
jzonthemtn:85-solr-ref-guide
Draft

Adding MCP endpoint for finding ref guide URLs#86
jzonthemtn wants to merge 2 commits into
apache:mainfrom
jzonthemtn:85-solr-ref-guide

Conversation

@jzonthemtn

@jzonthemtn jzonthemtn commented Apr 2, 2026

Copy link
Copy Markdown

Creating a PR because it's easier to understand to see the code.

Closes #85

Signed-off-by: jzonthemtn <jeff.zemerick@mtnfog.com>
@jzonthemtn
jzonthemtn marked this pull request as draft April 2, 2026 19:01
…han 9.

Signed-off-by: jzonthemtn <jeff.zemerick@mtnfog.com>
@jzonthemtn
jzonthemtn marked this pull request as ready for review April 3, 2026 12:43
@jzonthemtn
jzonthemtn marked this pull request as draft April 5, 2026 23:33
@jzonthemtn

Copy link
Copy Markdown
Author

Converting back to draft for a bit.

@adityamparikh

Copy link
Copy Markdown
Contributor

Hi! A new PR-validation CI workflow recently landed on main (#117). To get this PR's tests evaluated against the new pipeline, could you rebase your branch onto current main and push? That will trigger the new ci.yml (build / unit / integration). Thanks!

@adityamparikh

Copy link
Copy Markdown
Contributor

Heads-up: this branch currently shows as conflicting against main, but the conflict surface is much smaller than the 53-commit gap suggests. I rebased it locally onto main (a57f4d9) to check, and it comes out clean — sharing what I found in case it saves you time.

The two conflicts, and how they resolve:

  1. config/SolrConfig.java — import-block collision only. main added org.springframework.util.StringUtils; this branch added org.springframework.web.client.RestClient. Keep both.
  2. McpToolRegistrationTest.javaSchemaService moved from org.apache.solr.mcp.server.metadata to org.apache.solr.mcp.server.schema on main. Switch the import to the new package and keep the refguide.RefGuideService one.

That's the whole manual resolution — two import lines.

The metadataschema package split doesn't bite. It was a pure rename in git history and this branch never touched those files, so git replays it automatically. No duplicate SchemaService, no stale metadata/ package left behind.

Result after rebase: +293 / -0 across the 4 files, and ./gradlew build is green — 359 tests, 0 failures, 0 errors (RefGuideServiceTest 6/6). RefGuideService is self-contained enough (Spring + MCP annotations + RestClient) that none of the upstream churn reached it.

One thing that will block the native path: RefGuideServiceTest is Mockito-based (@ExtendWith(MockitoExtension.class)), but doesn't carry @DisabledInNativeImage. Every other Mockito test in the repo does, because ByteBuddy proxies don't survive GraalVM's closed-world assumption — so ./gradlew nativeTest -Pnative will fail on it. One-line fix:

import org.junit.jupiter.api.condition.DisabledInNativeImage;

@DisabledInNativeImage
@ExtendWith(MockitoExtension.class)
class RefGuideServiceTest {

Two smaller review notes, take or leave:

  • The RestClient @Bean is added to SolrConfig, which is otherwise scoped to SolrJ client wiring. It works, but it might sit more naturally in the refguide package's own config.
  • getRefGuideUrl fetches https://solr.apache.org/guide/sitemap.xml on every invocation, with no caching and no explicit timeout. Might be worth a cache and a connect/read timeout given it's a remote call on a hot path.

Happy to send the rebased commits as a patch if that's useful — they preserve your authorship and sign-off.

@adityamparikh

Copy link
Copy Markdown
Contributor

Updating my earlier comment — it's gone stale, and I'd rather not have you work from it.

Back then I said this branch rebased onto main cleanly with only an import-block collision in SolrConfig.java. That is no longer true as of a84033b. Re-running the rebase now gives two conflicts, one of which is structural:

  1. McpToolRegistrationTest.java — this branch imports org.apache.solr.mcp.server.metadata.SchemaService. That package no longer exists; it was split into collection/ and schema/, so the import is now org.apache.solr.mcp.server.schema.SchemaService. RefGuideService slots in alongside it fine.

  2. SolrConfig.java — no longer just imports. buildSolrClient was rewritten in fix: correct indexing, collection-name and service defects #176 to normalise the Solr path via URI (parsing the URL's path rather than searching the whole string, so a host literally named solr stops matching the /solr/ in its own authority). Your RestClient @Bean and that rewrite land in the same region, so it needs a real resolution rather than taking one side — keep the new URI-based buildSolrClient and add the RestClient bean next to it.

No rush given this is a draft — flagging it mainly so the "it's just imports" read doesn't cost you time when you pick it back up. Happy to push a rebased branch to your fork if that's easier; just say so.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an MCP endpoint to search the Solr ref guide by version

2 participants