feat(indexing): add index-file-document tool for file uploads#88
Draft
adityamparikh wants to merge 2 commits intoapache:mainfrom
Draft
feat(indexing): add index-file-document tool for file uploads#88adityamparikh wants to merge 2 commits intoapache:mainfrom
adityamparikh wants to merge 2 commits intoapache:mainfrom
Conversation
Add a new MCP tool `index-file-document` that accepts text content extracted by AI chat clients from uploaded files (PDF, Word, Excel, etc.) and indexes it into Solr for full-text search. New components: - FileDocumentCreator: creates SolrInputDocument with id, content, and filename fields from pre-extracted text - IndexingDocumentCreator: new createSchemalessDocumentsFromFile() delegation method - IndexingService: new indexFileDocument() MCP tool Closes apache#69 Signed-off-by: Aditya Parikh <adityamparikh@gmail.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
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
Adds a new MCP tool
index-file-documentthat enables users to upload files of any format (PDF, Word, Excel, PowerPoint, etc.) through their AI chat client and have the content indexed into Solr for full-text search.Closes #69
How it works
When a user uploads a file in an AI chat client like Claude Desktop, the client handles text extraction — not the MCP server. Here's the flow:
report.pdf) in Claude Desktopindex-file-documenttool, passing the extracted text ascontentand the original filename (report.pdf) asfilenameid(auto-generated UUID),content(the full text), andfilename(for filtering/display)This design means no binary parsing library (Tika, Docling, etc.) is needed on the server side — the AI chat client already does the heavy lifting of text extraction before invoking MCP tools. This keeps the server lightweight and avoids ~100MB of transitive dependencies.
Tool signature
collectioncontentfilenamereport.pdf) — stored as a searchable fieldChanges
FileDocumentCreator(new) —@Componentthat creates aSolrInputDocumentwithid,content, andfilenamefields. Does not implementSolrDocumentCreatorbecause it requires a filename parameter in addition to content.IndexingDocumentCreator— AddedFileDocumentCreatordependency andcreateSchemalessDocumentsFromFile()delegation methodIndexingService— NewindexFileDocument()MCP tool with@PreAuthorize("isAuthenticated()")AGENTS.md— Updated architecture docsTest plan
FileDocumentCreatorTest— 9 unit tests: valid input, null/empty/blank content, null/empty filename, oversized content, unique IDs, multiline contentFileIndexingTest— Spring Boot integration test throughIndexingDocumentCreatorIndexingServiceTest— 2 new Testcontainers integration tests verifying index-then-search round-trip (search by content, search by filename)IndexingServiceTest.UnitTests— 2 new mocked unit tests for the MCP tool methodFileDocumentCreatorparameter./gradlew buildpasses with all tests green🤖 Generated with Claude Code