This guide covers development workflows, testing, and building the Solr MCP Server.
This project uses Gradle with version catalogs for dependency management. All dependencies and their versions are centrally managed in gradle/libs.versions.toml.
# Build the project and run tests ./gradlew build # Build without tests (faster) ./gradlew assemble # Clean and rebuild ./gradlew clean build # Run tests only ./gradlew test # Run Docker integration tests ./gradlew dockerIntegrationTest # Check code formatting ./gradlew spotlessCheck # Apply code formatting ./gradlew spotlessApply
The build produces an executable JAR in build/libs/:
solr-mcp-1.0.0-SNAPSHOT.jar — Spring Boot executable (fat) JARdocker compose up -d
This starts a Solr instance in SolrCloud mode with ZooKeeper and creates two sample collections:
books - Collection with sample book datafilms - Collection with sample film data./gradlew bootRun
Or using the JAR:
java -jar build/libs/solr-mcp-1.0.0-SNAPSHOT.jar
./gradlew bootRun --args='--spring.profiles.active=http'
The server will start on http://localhost:8080
SOLR_URL: Solr instance URL (default: http://localhost:8983/solr/)PROFILES: Transport mode (stdio or http)SPRING_DOCKER_COMPOSE_ENABLED: Enable/disable Docker Compose integration (default: true)Example:
SOLR_URL=http://my-solr:8983/solr/ ./gradlew bootRun
Unit tests use mocked dependencies for fast, isolated testing:
# Run all unit tests ./gradlew test # Run specific test class ./gradlew test --tests SearchServiceTest # Run with coverage ./gradlew test jacocoTestReport
Integration tests use Testcontainers to spin up real Solr instances:
# Run integration tests ./gradlew test --tests "*IntegrationTest"
These tests verify the Docker images built by Jib:
# Build Docker image first ./gradlew jibDockerBuild # Run Docker integration tests ./gradlew dockerIntegrationTest
This runs tests tagged with @Tag("docker-integration") which verify:
The MCP Inspector provides a web UI for testing:
# Start the server in HTTP mode ./gradlew bootRun --args='--spring.profiles.active=http' # In another terminal, start MCP Inspector npx @modelcontextprotocol/inspector
Then open the browser URL provided (typically http://localhost:6274) and connect to http://localhost:8080/mcp
This project uses Spotless for consistent code formatting:
# Check if code is formatted correctly ./gradlew spotlessCheck # Auto-format all code ./gradlew spotlessApply
Important: Always run spotlessApply before committing. The CI will reject PRs with formatting issues.
Error Prone is configured to catch common Java mistakes at compile time. It will fail the build if issues are found.
The project generates build metadata at build time via the Spring Boot Gradle plugin. This creates META-INF/build-info.properties containing:
build.artifact: Artifact name (e.g., “solr-mcp”)build.group: Group ID (e.g., “org.apache.solr”)build.name: Project namebuild.version: Version (e.g., “1.0.0-SNAPSHOT”)build.time: Build timestampThis metadata is used by:
/actuator/info endpoint)BuildInfoReader)See DEPLOYMENT.md for detailed Docker build instructions.
# Build to local Docker daemon ./gradlew jibDockerBuild # Run the image docker run -i --rm solr-mcp:1.0.0-SNAPSHOT
Jib needs to find the Docker executable. The build auto-detects based on your OS:
/usr/local/bin/docker/usr/bin/dockerC:\Program Files\Docker\Docker\resources\bin\docker.exeOverride if needed:
export DOCKER_EXECUTABLE=/custom/path/to/docker ./gradlew jibDockerBuild
Since STDIO uses stdin/stdout for protocol communication, traditional debugging can interfere. Use these approaches:
Log to file:
System.setOut(new PrintStream(new FileOutputStream("debug.log")));
Use IDE remote debugging:
./gradlew bootRun --debug-jvm
Then attach your IDE debugger to port 5005
Standard debugging works normally:
@McpTool:@McpTool( name = "tool_name", description = "What this tool does" ) public String myTool( @McpToolParameter(description = "Parameter description") String param ) { // Implementation }
IndexingDocumentCreatorSolrDocumentCreator factoryapplication.properties for defaultsSolrConfigurationProperties if adding new propertiesUse tools like Apache JMeter or wrk:
# Install wrk brew install wrk # Run load test wrk -t4 -c100 -d30s http://localhost:8080/mcp
Use Java Flight Recorder:
java -XX:StartFlightRecording=duration=60s,filename=recording.jfr \ -jar build/libs/solr-mcp-1.0.0-SNAPSHOT.jar
Analyze with Java Mission Control.
The project uses GitHub Actions for CI/CD. See:
.github/workflows/build-and-publish.yml - Build, test, and publish Docker images.github/workflows/publish-mcp.yml - Publish to the MCP Registry on version tagsLocal CI simulation:
# Approximate what CI runs ./gradlew clean build spotlessCheck