Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#
# Published Images:
# ----------------
# - GitHub Container Registry: ghcr.io/OWNER/solr-mcp-server:TAG
# - Docker Hub: DOCKERHUB_USERNAME/solr-mcp-server:TAG
# - GitHub Container Registry: ghcr.io/OWNER/solr-mcp:TAG
# - Docker Hub: DOCKERHUB_USERNAME/solr-mcp:TAG
#
# Image Tagging Strategy:
# ----------------------
Expand Down Expand Up @@ -114,8 +114,8 @@ jobs:
- name: Upload JAR artifact
uses: actions/upload-artifact@v4
with:
name: solr-mcp-server-jar
path: build/libs/solr-mcp-server-*.jar
name: solr-mcp-jar
path: build/libs/solr-mcp-*.jar
retention-days: 7

# Upload JUnit test results
Expand Down Expand Up @@ -200,7 +200,7 @@ jobs:
# Get version from build.gradle.kts
VERSION=$(grep '^version = ' build.gradle.kts | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT

# Determine image tags based on trigger type
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
# For version tags (e.g., v1.0.0), use semantic version
Expand Down Expand Up @@ -271,13 +271,13 @@ jobs:
run: |
TAGS="${{ steps.meta.outputs.tags }}"
IFS=',' read -ra TAG_ARRAY <<< "$TAGS"

# Build and push each tag to GHCR
# Jib automatically handles multi-platform builds (amd64, arm64)
for TAG in "${TAG_ARRAY[@]}"; do
echo "Building and pushing ghcr.io/${{ steps.repo.outputs.owner_lc }}/solr-mcp-server:$TAG"
echo "Building and pushing ghcr.io/${{ steps.repo.outputs.owner_lc }}/solr-mcp:$TAG"
./gradlew jib \
-Djib.to.image=ghcr.io/${{ steps.repo.outputs.owner_lc }}/solr-mcp-server:$TAG \
-Djib.to.image=ghcr.io/${{ steps.repo.outputs.owner_lc }}/solr-mcp:$TAG \
-Djib.to.auth.username=${{ github.actor }} \
-Djib.to.auth.password=${{ secrets.GITHUB_TOKEN }}
done
Expand All @@ -290,12 +290,12 @@ jobs:
run: |
TAGS="${{ steps.meta.outputs.tags }}"
IFS=',' read -ra TAG_ARRAY <<< "$TAGS"

# Build and push each tag to Docker Hub
for TAG in "${TAG_ARRAY[@]}"; do
echo "Building and pushing ${{ secrets.DOCKERHUB_USERNAME }}/solr-mcp-server:$TAG"
echo "Building and pushing ${{ secrets.DOCKERHUB_USERNAME }}/solr-mcp:$TAG"
./gradlew jib \
-Djib.to.image=${{ secrets.DOCKERHUB_USERNAME }}/solr-mcp-server:$TAG \
-Djib.to.image=${{ secrets.DOCKERHUB_USERNAME }}/solr-mcp:$TAG \
-Djib.to.auth.username=${{ secrets.DOCKERHUB_USERNAME }} \
-Djib.to.auth.password=${{ secrets.DOCKERHUB_TOKEN }}
done
Expand All @@ -311,14 +311,14 @@ jobs:
TAGS="${{ steps.meta.outputs.tags }}"
IFS=',' read -ra TAG_ARRAY <<< "$TAGS"
for TAG in "${TAG_ARRAY[@]}"; do
echo "- \`ghcr.io/${{ steps.repo.outputs.owner_lc }}/solr-mcp-server:$TAG\`" >> $GITHUB_STEP_SUMMARY
echo "- \`ghcr.io/${{ steps.repo.outputs.owner_lc }}/solr-mcp:$TAG\`" >> $GITHUB_STEP_SUMMARY
done

# Only show Docker Hub section if secrets are configured
if [[ "${{ secrets.DOCKERHUB_USERNAME }}" != "" ]]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "#### Docker Hub" >> $GITHUB_STEP_SUMMARY
for TAG in "${TAG_ARRAY[@]}"; do
echo "- \`${{ secrets.DOCKERHUB_USERNAME }}/solr-mcp-server:$TAG\`" >> $GITHUB_STEP_SUMMARY
echo "- \`${{ secrets.DOCKERHUB_USERNAME }}/solr-mcp:$TAG\`" >> $GITHUB_STEP_SUMMARY
done
fi
fi
2 changes: 1 addition & 1 deletion .run/SolrMcpServerHttp.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration default="false" name="SolrMcpServerHttp" type="SpringBootApplicationConfigurationType"
factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="http"/>
<module name="solr-mcp-server.main"/>
<module name="solr-mcp.main"/>
<option name="SPRING_BOOT_MAIN_CLASS" value="org.apache.solr.mcp.server.Main"/>
<method v="2">
<option name="Make" enabled="true"/>
Expand Down
2 changes: 1 addition & 1 deletion .run/SolrMcpServerStdio.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration default="false" name="SolrMcpServerStdio" type="SpringBootApplicationConfigurationType"
factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="stdio"/>
<module name="solr-mcp-server.main"/>
<module name="solr-mcp.main"/>
<option name="SPRING_BOOT_MAIN_CLASS" value="org.apache.solr.mcp.server.Main"/>
<method v="2">
<option name="Make" enabled="true"/>
Expand Down
137 changes: 129 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,129 @@ centrally managed in `gradle/libs.versions.toml`.

The build produces two JAR files in `build/libs/`:

- `solr-mcp-server-0.0.1-SNAPSHOT.jar` - Executable JAR with all dependencies (fat JAR)
- `solr-mcp-server-0.0.1-SNAPSHOT-plain.jar` - Plain JAR without dependencies
- `solr-mcp-0.0.1-SNAPSHOT.jar` - Executable JAR with all dependencies (fat JAR)
- `solr-mcp-0.0.1-SNAPSHOT-plain.jar` - Plain JAR without dependencies

### 4. Building Docker Images (Optional)

This project uses [Jib](https://github.com/GoogleContainerTools/jib) to build optimized Docker images without requiring
Docker installed. Jib creates layered images for faster rebuilds and smaller image sizes.

#### Option 1: Build to Docker Daemon (Recommended)

Build directly to your local Docker daemon (requires Docker installed):

```bash
./gradlew jibDockerBuild
```

This creates a local Docker image: `solr-mcp:0.0.1-SNAPSHOT`

Verify the image:

```bash
docker images | grep solr-mcp
```

#### Option 2: Build to Tar File (No Docker Required)

Build to a tar file without Docker installed:

```bash
./gradlew jibBuildTar
```

This creates `build/jib-image.tar`. Load it into Docker:

```bash
docker load < build/jib-image.tar
```

#### Option 3: Push to Docker Hub

Authenticate with Docker Hub and push:

```bash
# Login to Docker Hub
docker login

# Build and push
./gradlew jib -Djib.to.image=YOUR_DOCKERHUB_USERNAME/solr-mcp:0.0.1-SNAPSHOT
```

#### Option 4: Push to GitHub Container Registry

Authenticate with GitHub Container Registry and push:

```bash
# Create a Personal Access Token (classic) with write:packages scope at:
# https://github.com/settings/tokens

# Login to GitHub Container Registry
export GITHUB_TOKEN=YOUR_GITHUB_TOKEN
echo $GITHUB_TOKEN | docker login ghcr.io -u YOUR_GITHUB_USERNAME --password-stdin

# Build and push
./gradlew jib -Djib.to.image=ghcr.io/YOUR_GITHUB_USERNAME/solr-mcp:0.0.1-SNAPSHOT
```

#### Multi-Platform Support

The Docker images are built with multi-platform support for:

- `linux/amd64` (Intel/AMD 64-bit)
- `linux/arm64` (Apple Silicon M1/M2/M3)

#### Automated Builds with GitHub Actions

This project includes a GitHub Actions workflow that automatically builds and publishes Docker images to both GitHub
Container Registry and Docker Hub.

**Triggers:**

- Push to `main` branch - Builds and publishes images tagged with `version-SHA` and `latest`
- Version tags (e.g., `v1.0.0`) - Builds and publishes images tagged with the version number and `latest`
- Pull requests - Builds and tests only (no publishing)

**Published Images:**

- GitHub Container Registry: `ghcr.io/OWNER/solr-mcp:TAG`
- Docker Hub: `DOCKERHUB_USERNAME/solr-mcp:TAG`

**Setup for Docker Hub Publishing:**

To enable Docker Hub publishing, configure these repository secrets:

1. Go to your GitHub repository Settings > Secrets and variables > Actions
2. Add the following secrets:
- `DOCKERHUB_USERNAME`: Your Docker Hub username
- `DOCKERHUB_TOKEN`: Docker Hub access token (create at https://hub.docker.com/settings/security)

**Note:** GitHub Container Registry publishing works automatically using the `GITHUB_TOKEN` provided by GitHub Actions.

#### Running the Docker Container

Run the container with STDIO mode:

```bash
docker run -i --rm solr-mcp:0.0.1-SNAPSHOT
```

Or with custom Solr URL:

```bash
docker run -i --rm \
-e SOLR_URL=http://your-solr-host:8983/solr/ \
solr-mcp:0.0.1-SNAPSHOT
```

**Note for Linux users:** If you need to connect to Solr running on the host machine, add the `--add-host` flag:

```bash
docker run -i --rm \
--add-host=host.docker.internal:host-gateway \
solr-mcp:0.0.1-SNAPSHOT
```

### 4. Building Docker Images (Optional)

Expand Down Expand Up @@ -343,7 +464,7 @@ You can add this MCP server to Claude Desktop using either the JAR file or Docke
"command": "java",
"args": [
"-jar",
"/absolute/path/to/solr-mcp-server/build/libs/solr-mcp-server-0.0.1-SNAPSHOT.jar"
"/absolute/path/to/solr-mcp/build/libs/solr-mcp-0.0.1-SNAPSHOT.jar"
],
"env": {
"SOLR_URL": "http://localhost:8983/solr/",
Expand All @@ -354,7 +475,7 @@ You can add this MCP server to Claude Desktop using either the JAR file or Docke
}
```

**Note:** Replace `/absolute/path/to/solr-mcp-server` with the actual path to your project directory.
**Note:** Replace `/absolute/path/to/solr-mcp` with the actual path to your project directory.

### Option 2: Using Docker Container

Expand All @@ -377,7 +498,7 @@ You can add this MCP server to Claude Desktop using either the JAR file or Docke
"run",
"-i",
"--rm",
"solr-mcp-server:0.0.1-SNAPSHOT"
"solr-mcp:0.0.1-SNAPSHOT"
],
"env": {
"SOLR_URL": "http://localhost:8983/solr/"
Expand All @@ -403,7 +524,7 @@ host:
"-i",
"--rm",
"--add-host=host.docker.internal:host-gateway",
"solr-mcp-server:0.0.1-SNAPSHOT"
"solr-mcp:0.0.1-SNAPSHOT"
],
"env": {
"SOLR_URL": "http://host.docker.internal:8983/solr/"
Expand All @@ -428,7 +549,7 @@ If you've pushed the image to Docker Hub or GitHub Container Registry, you can u
"run",
"-i",
"--rm",
"YOUR_DOCKERHUB_USERNAME/solr-mcp-server:0.0.1-SNAPSHOT"
"YOUR_DOCKERHUB_USERNAME/solr-mcp:0.0.1-SNAPSHOT"
],
"env": {
"SOLR_URL": "http://localhost:8983/solr/"
Expand All @@ -449,7 +570,7 @@ If you've pushed the image to Docker Hub or GitHub Container Registry, you can u
"run",
"-i",
"--rm",
"ghcr.io/YOUR_GITHUB_USERNAME/solr-mcp-server:0.0.1-SNAPSHOT"
"ghcr.io/YOUR_GITHUB_USERNAME/solr-mcp:0.0.1-SNAPSHOT"
],
"env": {
"SOLR_URL": "http://localhost:8983/solr/"
Expand Down
12 changes: 6 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ dependencyManagement {

// Configures Spring Boot plugin to generate build metadata at build time
// This creates META-INF/build-info.properties containing:
// - build.artifact: The artifact name (e.g., "solr-mcp-server")
// - build.artifact: The artifact name (e.g., "solr-mcp")
// - build.group: The group ID (e.g., "org.apache.solr")
// - build.name: The project name
// - build.version: The version (e.g., "0.0.1-SNAPSHOT")
Expand Down Expand Up @@ -256,7 +256,7 @@ tasks.register<Test>("dockerIntegrationTest") {
// ----------------
// 1. Build to Docker daemon (requires Docker installed):
// ./gradlew jibDockerBuild
// Creates image: solr-mcp-server:0.0.1-SNAPSHOT
// Creates image: solr-mcp:0.0.1-SNAPSHOT
//
// 2. Build to local tar file (no Docker required):
// ./gradlew jibBuildTar
Expand All @@ -265,11 +265,11 @@ tasks.register<Test>("dockerIntegrationTest") {
//
// 3. Push to Docker Hub (requires authentication):
// docker login
// ./gradlew jib -Djib.to.image=dockerhub-username/solr-mcp-server:0.0.1-SNAPSHOT
// ./gradlew jib -Djib.to.image=dockerhub-username/solr-mcp:0.0.1-SNAPSHOT
//
// 4. Push to GitHub Container Registry (requires authentication):
// echo $GITHUB_TOKEN | docker login ghcr.io -u GITHUB_USERNAME --password-stdin
// ./gradlew jib -Djib.to.image=ghcr.io/github-username/solr-mcp-server:0.0.1-SNAPSHOT
// ./gradlew jib -Djib.to.image=ghcr.io/github-username/solr-mcp:0.0.1-SNAPSHOT
//
// Authentication:
// ---------------
Expand All @@ -293,7 +293,7 @@ tasks.register<Test>("dockerIntegrationTest") {
// - SOLR_URL=http://host.docker.internal:8983/solr/ (default Solr connection)
//
// These can be overridden at runtime:
// docker run -e SOLR_URL=http://custom-solr:8983/solr/ solr-mcp-server:0.0.1-SNAPSHOT
// docker run -e SOLR_URL=http://custom-solr:8983/solr/ solr-mcp:0.0.1-SNAPSHOT
jib {
from {
// Use Eclipse Temurin JRE 25 as the base image
Expand All @@ -317,7 +317,7 @@ jib {
to {
// Default image name (can be overridden with -Djib.to.image=...)
// Format: repository/image-name:tag
image = "solr-mcp-server:$version"
image = "solr-mcp:$version"

// Tags to apply to the image
// The version tag is applied by default, plus "latest" tag
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
* limitations under the License.
*/

rootProject.name = "solr-mcp-server"
rootProject.name = "solr-mcp"
12 changes: 0 additions & 12 deletions sonar-project.properties

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
spring.application.name=solr-mcp-server
spring.application.name=solr-mcp
spring.profiles.active=${PROFILES:stdio}
spring.ai.mcp.server.instructions=This server provides tools to interact with Apache Solr using Model Context Protocol (MCP) over STDIO and/or HTTP.
spring.ai.mcp.server.name=${spring.application.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* ./gradlew jibDockerBuild
* }</pre>
*
* <p>This will create the image: {@code solr-mcp-server:0.0.1-SNAPSHOT}
* <p>This will create the image: {@code solr-mcp:0.0.1-SNAPSHOT}
*
* <p><strong>Test Architecture:</strong>
*
Expand All @@ -86,7 +86,7 @@ class DockerImageHttpIntegrationTest {
LoggerFactory.getLogger(DockerImageHttpIntegrationTest.class);

// Docker image name and tag from build.gradle.kts
private static final String DOCKER_IMAGE = "solr-mcp-server:0.0.1-SNAPSHOT";
private static final String DOCKER_IMAGE = "solr-mcp:0.0.1-SNAPSHOT";
private static final String SOLR_IMAGE = "solr:9.9-slim";
private static final int HTTP_PORT = 8080;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* ./gradlew jibDockerBuild
* }</pre>
*
* <p>This will create the image: {@code solr-mcp-server:0.0.1-SNAPSHOT}
* <p>This will create the image: {@code solr-mcp:0.0.1-SNAPSHOT}
*
* <p><strong>Test Architecture:</strong>
*
Expand All @@ -77,7 +77,7 @@ class DockerImageStdioIntegrationTest {
LoggerFactory.getLogger(DockerImageStdioIntegrationTest.class);

// Docker image name and tag from build.gradle.kts
private static final String DOCKER_IMAGE = "solr-mcp-server:0.0.1-SNAPSHOT";
private static final String DOCKER_IMAGE = "solr-mcp:0.0.1-SNAPSHOT";
private static final String SOLR_IMAGE = "solr:9.9-slim";

// Network for container communication
Expand Down
Loading