Skip to content

Deployment: Dockerfile and Smithery config #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

calclavia
Copy link

@calclavia calclavia commented Apr 3, 2025

This PR adds files for deploying your MCP server on Smithery. After deployment, users can use your server over WebSockets (hosted on Smithery) without needing to install any dependencies.

Changes

  • Added Dockerfile to package your server for deployment.
  • Added Smithery Configuration file to specify how to start your server. See documentation.
  • Updated README to include installation command via Smithery. Note that the command only works after the server is deployed on Smithery.

Server Details

Action Items

  • Build Passing: We verified that the Docker builds and your server starts up using an automated test.
  • Code Review: Please review the changes to ensure the configuration is accurate for your server.
  • Claim Server: Head to your server page to claim your server. This will let you edit your server listing on Smithery and deploy new versions of your server.

Copy link

coderabbitai bot commented Apr 3, 2025

Summary by CodeRabbit

  • New Features
    • Rolled out a containerized deployment option for the Python application, ensuring a streamlined setup and reliable service communication.
  • Documentation
    • Enhanced the installation guide with an automated setup command for a smoother onboarding experience.
  • Chores
    • Introduced a flexible configuration approach to support dynamic command generation and effective service management.

Walkthrough

This pull request introduces three new files to enhance the deployment and installation process of the MCP server. A new Dockerfile is provided to containerize a Python environment based on python:3.11-slim, including essential system dependencies, environment configurations, and a command to launch the MCP server. The README.md is updated with instructions for installing DevDocs via the Smithery CLI. Additionally, a new smithery.yaml configuration file has been added to define the startup command, its schema, and an example configuration for running the MCP server.

Changes

File(s) Change Summary
Dockerfile New file for containerizing the Python-based MCP server environment. Sets the working directory, installs system dependencies, copies application code, creates storage directories, exposes port 8765, and specifies the server start command.
README.md Added a new section "Installing via Smithery" with a command (npx -y @smithery/cli install @cyberagiinc/DevDocs --client claude) for automated installation; added a newline at the file's end.
smithery.yaml New configuration file defining a startCommand with properties: a type (stdio), a JSON schema (configSchema), a JavaScript command function (commandFunction) returning the startup command for the MCP server, and an empty exampleConfig.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant DockerEngine as Docker Engine
  participant Container as App Container
  participant Python as Python Interpreter
  participant Storage as Markdown Storage

  User->>DockerEngine: Build & run container using Dockerfile
  DockerEngine->>Container: Create container environment and set working directory
  Container->>Python: Execute "python -m fast_markdown_mcp.server /app/storage/markdown"
  Python->>Storage: Access /app/storage/markdown for markdown file storage
Loading
sequenceDiagram
  participant User
  participant CLI as Smithery CLI
  participant Config as smithery.yaml
  participant CommandFunc as Command Function
  participant Python as Python Interpreter

  User->>CLI: Execute installation command (npx -y @smithery/cli install @cyberagiinc/DevDocs --client claude)
  CLI->>Config: Load configuration settings
  Config->>CommandFunc: Invoke command generation function
  CommandFunc-->>CLI: Return command: "python -m fast_markdown_mcp.server /app/storage/markdown"
  CLI->>Python: Execute the startup command to run the MCP server
Loading

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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 or @cyberagi-AI summarize to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @cyberagi-AI 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

@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

🔭 Outside diff range comments (1)
Dockerfile (1)

28-29: 🧹 Nitpick (assertive)

Consistent Command Execution: Confirm Module Path
The CMD instruction correctly launches the MCP server with the module fast_markdown_mcp.server. Please verify that the folder copied from fast-markdown-mcp/ (with a hyphen) aligns with the module import naming (which uses an underscore) as set up by the pip installation. This naming convention is common in Python packaging, but it is important to ensure the paths and module names match as expected in your project.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 88b0517 and a15d7b1.

📒 Files selected for processing (3)
  • Dockerfile (1 hunks)
  • README.md (2 hunks)
  • smithery.yaml (1 hunks)
🧰 Additional context used
🪛 Hadolint (2.12.0)
Dockerfile

[warning] 7-7: Pin versions in apt get install. Instead of apt-get install <package> use apt-get install <package>=<version>

(DL3008)


[info] 22-22: Multiple consecutive RUN instructions. Consider consolidation.

(DL3059)

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

96-102: New Installation Instructions Section: Clear and Useful!
The new "Installing via Smithery" section provides concise and clear instructions to install DevDocs via the Smithery CLI. The command is formatted correctly and its placement in the README offers intuitive guidance for users deploying the MCP server via Smithery.

smithery.yaml (1)

1-17: New Smithery Configuration File: Structure is Solid
The smithery.yaml file clearly defines the startup command configuration with a type, a minimal JSON Schema, and a JavaScript function to generate the CLI command. The inline comments help clarify each section’s purpose. In the future, if more configuration options are required, consider extending the configSchema accordingly.

Dockerfile (1)

7-9:

❓ Verification inconclusive

Suggestion to Pin Package Versions in APT Install
The installation of system dependencies via apt-get install would benefit from version pinning to ensure build consistency and reproducibility. For instance, specifying a fixed version for build-essential (if applicable) could prevent unexpected issues when the base image is updated.


Action Required: Consider Pinning APT Package Versions

The Dockerfile currently installs build-essential without specifying a version, which might lead to inconsistent builds over time if the base image's repositories are updated. To ensure reproducibility, explicitly pin the package version (e.g., build-essential=<version>) or use an alternative mechanism (like apt preferences) as appropriate for your environment.

  • File: Dockerfile (Lines 7–9)
  • Current snippet:
    RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential \
        && rm -rf /var/lib/apt/lists/*
  • Suggestion: Modify the installation command to include a specific version for build-essential if applicable, ensuring that the version is compatible with the base image.
🧰 Tools
🪛 Hadolint (2.12.0)

[warning] 7-7: Pin versions in apt get install. Instead of apt-get install <package> use apt-get install <package>=<version>

(DL3008)

Comment on lines +19 to +22
RUN pip install --no-cache-dir -e .

# Create necessary directories
RUN mkdir -p /app/storage/markdown
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider Consolidating RUN Commands
Currently, there are separate RUN instructions for installing dependencies and creating directories. Consolidating these steps (when it does not negatively affect layer caching) could help reduce the final image size by cutting down on the number of layers. Review whether merging these commands fits your build strategy.

🧰 Tools
🪛 Hadolint (2.12.0)

[info] 22-22: Multiple consecutive RUN instructions. Consider consolidation.

(DL3059)

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.

1 participant