Skip to content

Conversation

@tpayet
Copy link
Member

@tpayet tpayet commented Jun 20, 2025

Summary

This PR adds Docker support to meilisearch-mcp, enabling users to run the MCP server in containerized environments like n8n workflows, Kubernetes, or any Docker-compatible platform.

Motivation

Fixes #47 - User requested Docker support for integration with n8n workflows.

Changes Made

🐳 Docker Configuration

  • Dockerfile: Uses Python 3.12-slim base image with uv for fast dependency installation
  • docker-compose.yml: Provides complete setup with Meilisearch and MCP server
  • .dockerignore: Excludes unnecessary files from the Docker build context

📚 Documentation

  • Added "Using Docker" section to README with:
    • Quick start with docker-compose
    • Standalone Docker usage
    • n8n integration example

🧪 Testing

  • Created test_docker_integration.py with tests for:
    • Docker image build
    • Container connectivity to Meilisearch
    • MCP server module imports
    • Environment variable configuration

How to Test

  1. Using Docker Compose (includes Meilisearch):

    docker-compose up -d
  2. Standalone Docker:

    docker build -t meilisearch-mcp .
    docker run -it \
      -e MEILI_HTTP_ADDR=http://your-meilisearch:7700 \
      -e MEILI_MASTER_KEY=your-key \
      meilisearch-mcp
  3. Run integration tests:

    python -m pytest tests/test_docker_integration.py -v

n8n Integration

The Docker image can be easily integrated into n8n workflows as shown in the README example.

Notes

  • The MCP server runs with stdio transport inside the container
  • Environment variables MEILI_HTTP_ADDR and MEILI_MASTER_KEY configure the connection
  • The docker-compose setup includes both Meilisearch and the MCP server for easy testing

Summary by CodeRabbit

  • New Features

    • Added Docker support for running the Meilisearch MCP Server, including Dockerfile and Docker Compose configuration for development and production.
    • Provided example Docker Compose setup for seamless integration with Meilisearch and n8n workflows.
  • Documentation

    • Updated the README with detailed instructions for using Docker and Docker Compose to deploy the server.
  • Tests

    • Introduced integration tests to verify Docker builds, service connectivity, module imports, and environment variable configuration.
  • Chores

    • Added a .dockerignore file to optimize Docker build context by excluding unnecessary and sensitive files.
  • CI/CD

    • Enhanced GitHub Actions workflow to build and publish multi-platform Docker images to Docker Hub alongside PyPI releases.
    • Added a dedicated GitHub Actions job to run Docker integration tests separately from the main test suite.

- Add Dockerfile with Python 3.12 slim base image
- Install dependencies using uv for faster builds
- Create docker-compose.yml for easy setup with Meilisearch
- Add .dockerignore to exclude unnecessary files
- Add Docker integration tests
- Update README with Docker usage instructions
- Support for n8n and other containerized environments

Fixes #47
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 20, 2025

Warning

Rate limit exceeded

@tpayet has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 44 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 52862fa and 7f41370.

📒 Files selected for processing (3)
  • .dockerignore (1 hunks)
  • README.md (1 hunks)
  • tests/test_docker_integration.py (1 hunks)

"""

Walkthrough

A Docker-based deployment setup for the Meilisearch MCP server is introduced. This includes a Dockerfile, docker-compose configuration, Docker ignore rules, integration tests for the Docker environment, and updated documentation providing usage instructions for containerized workflows, particularly for n8n integration.

Changes

File(s) Change Summary
.dockerignore Added to exclude unnecessary files and directories from Docker build context.
Dockerfile Added to define a container image for the Meilisearch MCP server using Python 3.12 and uv for package install.
docker-compose.yml, docker-compose.prod.yml Added to orchestrate Meilisearch and MCP server containers with persistent storage, shared networking, and prod config.
README.md Updated with a "Using Docker" section, providing Docker and Docker Compose usage instructions.
tests/test_docker_integration.py Added integration tests to verify Docker image build, service connectivity, environment variables, and imports.
.github/workflows/publish.yml Modified to add Docker image build and publish job to Docker Hub alongside PyPI publishing.
.github/workflows/test.yml Modified to add a separate job for Docker integration tests with conditional execution.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Docker Compose
    participant Meilisearch MCP Container
    participant Meilisearch Container

    User->>Docker Compose: docker-compose up
    Docker Compose->>Meilisearch Container: Start Meilisearch
    Docker Compose->>Meilisearch MCP Container: Build & start MCP server
    Meilisearch MCP Container->>Meilisearch Container: Connect via MEILI_HTTP_ADDR
    Meilisearch Container-->>Meilisearch MCP Container: Respond to health checks/requests
    User->>Meilisearch MCP Container: Access MCP server (e.g., via n8n)
Loading

Assessment against linked issues

Objective Addressed Explanation
Add a Dockerfile for deployment (#47)
Enable deployment for n8n workflows via Docker (#47)
Provide documentation for Docker-based usage (#47)
Supply Docker Compose setup for Meilisearch + MCP (#47)

Poem

In a Docker burrow, I hop with glee,
MCP and Meilisearch, containers set free!
Compose spins a warren, volumes persist,
Now n8n workflows can never be missed.
With tests and docs, this rabbit is proud—
Our server's in Docker, fluffy and cloud! 🐇🐳
"""

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
docker-compose.yml (1)

1-31: Fix missing newline at end of file.

The Docker Compose configuration is well-structured with proper service orchestration, networking, and environment variable setup. However, there's a formatting issue that should be addressed.

 networks:
   meilisearch-network:
     driver: bridge
+
tests/test_docker_integration.py (1)

7-7: Remove unused import.

The os module is imported but never used in this file.

-import os
 import subprocess
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c71ac74 and 9e0afea.

📒 Files selected for processing (5)
  • .dockerignore (1 hunks)
  • Dockerfile (1 hunks)
  • README.md (1 hunks)
  • docker-compose.yml (1 hunks)
  • tests/test_docker_integration.py (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
docker-compose.yml

[error] 31-31: no new line character at the end of file

(new-line-at-end-of-file)

🪛 Ruff (0.11.9)
tests/test_docker_integration.py

7-7: os imported but unused

Remove unused import: os

(F401)

🪛 GitHub Actions: Test and Lint
tests/test_docker_integration.py

[error] 33-33: FileNotFoundError: 'docker-compose' command not found. The test setup failed when trying to run 'docker-compose up -d'.


[error] 33-33: FileNotFoundError: 'docker-compose' command not found. The test setup failed when trying to run 'docker-compose up -d'.


[error] 33-33: FileNotFoundError: 'docker-compose' command not found. The test setup failed when trying to run 'docker-compose up -d'.

🔇 Additional comments (4)
README.md (1)

140-164: Excellent Docker documentation section!

The Docker usage instructions are comprehensive and well-structured, covering multiple deployment scenarios including n8n integration. The examples align well with the provided Docker configuration files.

Dockerfile (1)

1-28: Well-structured Dockerfile with modern practices!

The Dockerfile follows Docker best practices:

  • Uses slim base image for smaller size
  • Installs minimal system dependencies
  • Leverages uv for faster package management
  • Sets appropriate default environment variables
  • Uses proper module execution syntax

The implementation looks solid and production-ready.

.dockerignore (1)

1-69: Comprehensive and well-organized .dockerignore file!

The exclusion list is thorough and covers all the necessary categories:

  • Python cache and build artifacts
  • Development environments and IDE files
  • CI/CD and documentation files
  • System-specific files

This will effectively optimize the Docker build context size and security.

tests/test_docker_integration.py (1)

62-69: I’d like to verify the exact Dockerfile commands to ensure dependencies are actually installed. Let’s dump the relevant sections:

#!/bin/bash
set -e

echo ">>> Dockerfile: lines 1–30 <<<"
sed -n '1,30p' Dockerfile || echo "Could not read Dockerfile"

echo
echo ">>> Dockerfile: lines 31–60 <<<"
sed -n '31,60p' Dockerfile || echo "Could not read Dockerfile"

- Update publish.yml workflow to build and push Docker images on release
- Add multi-platform support (linux/amd64 and linux/arm64)
- Update README with Docker Hub installation instructions
- Update docker-compose.yml to use Docker Hub image by default
- Images will be tagged with version number and 'latest'
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (5)
docker-compose.yml (3)

1-2: Specify Docker Compose file version
It's recommended to include a top-level version: '3.9' (or the appropriate schema version) to ensure clarity and compatibility across Compose implementations.


15-17: Avoid using the latest tag for image
Pin the meilisearch/meilisearch-mcp image to a specific version (e.g., vX.Y.Z) for reproducible builds and to prevent unexpected changes when upstream publishes new tags.


33-33: Add newline at end of file
Ensure the file ends with a newline to satisfy POSIX conventions and remove the YAMLlint warning.

.github/workflows/publish.yml (2)

63-66: Remove trailing spaces
Multiple lines contain trailing whitespace, causing YAMLlint errors. Please strip the trailing spaces on these lines to improve readability and pass lint checks.

Also applies to: 69-72, 78-87


97-97: Add newline at end of file
The workflow file should end with a newline to comply with standard file formatting and silence the linter.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e0afea and e02a948.

📒 Files selected for processing (3)
  • .github/workflows/publish.yml (3 hunks)
  • README.md (1 hunks)
  • docker-compose.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/publish.yml

65-65: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.37.1)
.github/workflows/publish.yml

[error] 63-63: trailing spaces

(trailing-spaces)


[error] 66-66: trailing spaces

(trailing-spaces)


[error] 69-69: trailing spaces

(trailing-spaces)


[error] 72-72: trailing spaces

(trailing-spaces)


[error] 78-78: trailing spaces

(trailing-spaces)


[error] 87-87: trailing spaces

(trailing-spaces)


[error] 97-97: no new line character at the end of file

(new-line-at-end-of-file)


[error] 97-97: trailing spaces

(trailing-spaces)

docker-compose.yml

[error] 33-33: no new line character at the end of file

(new-line-at-end-of-file)

tpayet added 4 commits June 20, 2025 16:33
- Replace legacy 'docker-compose' with 'docker compose' (no hyphen)
- Ensures compatibility with CI environments where legacy command may not be available
- Updates all subprocess.run calls to use ['docker', 'compose', ...] format
- Add docker_available() function to check if Docker is installed and working
- Check for docker-compose.yml file existence
- Skip all Docker integration tests when Docker is not available
- Prevents test failures in CI environments without Docker
- Change docker-compose.yml to build image locally for tests
- Add docker-compose.prod.yml for production use with Docker Hub image
- Update README to show both options (pre-built vs build from source)
- Update .dockerignore to exclude docker-compose files from build
- This fixes CI failures due to non-existent Docker Hub image
- Exclude test_docker_integration.py from regular CI test runs
- Add separate docker-test job that runs only on main or with 'docker' label
- Remove CI-specific skips from Docker tests since they're excluded
- This prevents port conflicts with CI's existing Meilisearch service
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (5)
.github/workflows/test.yml (3)

55-56: Remove trailing spaces.
Lines 55–56 contain unnecessary whitespace at the end. Please trim trailing spaces to avoid YAMLlint errors.


61-61: Remove trailing spaces.
Line 61 has trailing whitespace. Please remove it.


78-78: Add newline at end of file.
EOF missing a trailing newline, which YAMLlint flags as an error.

docker-compose.yml (1)

33-33: Add newline at end of file.
Please ensure the file ends with a newline to satisfy YAML linting rules.

docker-compose.prod.yml (1)

31-31: Add newline at end of file.
A trailing newline is needed to comply with YAML standards.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e02a948 and 52862fa.

📒 Files selected for processing (6)
  • .dockerignore (1 hunks)
  • .github/workflows/test.yml (1 hunks)
  • README.md (1 hunks)
  • docker-compose.prod.yml (1 hunks)
  • docker-compose.yml (1 hunks)
  • tests/test_docker_integration.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tests/test_docker_integration.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • README.md
  • .dockerignore
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/test.yml

63-63: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


66-66: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 YAMLlint (1.37.1)
.github/workflows/test.yml

[error] 56-56: trailing spaces

(trailing-spaces)


[error] 61-61: trailing spaces

(trailing-spaces)


[warning] 63-63: wrong indentation: expected 6 but found 4

(indentation)


[error] 64-64: trailing spaces

(trailing-spaces)


[error] 69-69: trailing spaces

(trailing-spaces)


[error] 75-75: trailing spaces

(trailing-spaces)


[error] 78-78: no new line character at the end of file

(new-line-at-end-of-file)

docker-compose.prod.yml

[error] 31-31: no new line character at the end of file

(new-line-at-end-of-file)

docker-compose.yml

[error] 33-33: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (3)
.github/workflows/test.yml (1)

63-66: Static analysis hint is a false positive.
The actions/checkout@v3 and actions/setup-python@v4 references are current and valid; no update required.

docker-compose.yml (1)

1-33: Docker Compose configuration looks good.
Services, volumes, and networks are well-defined and align with containerized deployment goals.

docker-compose.prod.yml (1)

1-31: Production Compose setup is solid.
The meilisearch and meilisearch-mcp services, along with the volume and network definitions, correctly mirror the development file for production usage.

- Remove docker-compose.yml and docker-compose.prod.yml files
- Simplify Docker tests to only test image build and basic run
- Update README to remove all docker-compose references
- Remove docker-test job from CI workflow
- Update .dockerignore to remove docker-compose references

The repository now focuses solely on providing the Docker image.
Users can run it directly with 'docker run' against their existing
Meilisearch instances.
@tpayet tpayet merged commit 009849e into main Jun 20, 2025
2 checks passed
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 a docker file

2 participants