Skip to content

Deployment: Dockerfile and Smithery config #1

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
Open
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
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use the official Node.js image with Alpine for a smaller image size
FROM node:20-alpine AS builder

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json to install dependencies
COPY package.json package-lock.json ./

# Install the dependencies
RUN npm install

# Copy the rest of the application code
COPY . .

# Build the application
RUN npm run build

# Use a separate image for the runtime to keep the image lightweight
FROM node:20-alpine

# Set the working directory
WORKDIR /app

# Copy the build output and package.json to the runtime image
COPY --from=builder /app/build ./build
COPY --from=builder /app/package.json ./

# Install only production dependencies
RUN npm install --only=production

# Set environment variables (ensure these are set as needed in a secure manner)
ENV SSH_HOST=your.remote.host \
SSH_USER=your_ssh_user \
SSH_PRIVATE_KEY_PATH=your_SSH_PRIVATE_KEY_PATH \
RAILS_WORKING_DIR=/path/to/rails/app/root

# Command to run the application
CMD ["node", "build/index.js"]
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# MCP Server: SSH Rails Runner

[![smithery badge](https://smithery.ai/badge/@tadasant/mcp-server-ssh-rails-runner)](https://smithery.ai/server/@tadasant/mcp-server-ssh-rails-runner)

An MCP server that enables secure remote execution of Rails console commands via SSH. This server provides tools for both read-only operations and carefully managed mutations in a deployed Rails environment.

This works great with Cursor. You can use Cursor Composer to pull in your Rails model files as context and then use the `execute_read_only`, `dry_run_mutate`, and `execute_mutate` tools to make changes to the database. No need to trudge through complicated Admin UI's to get your data wrangling and analysis done.
Expand All @@ -18,6 +20,15 @@ This works great with Cursor. You can use Cursor Composer to pull in your Rails

## Installation

### Installing via Smithery

To install MCP Server: SSH Rails Runner for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@tadasant/mcp-server-ssh-rails-runner):

```bash
npx -y @smithery/cli install @tadasant/mcp-server-ssh-rails-runner --client claude
```

### Manual Installation
```bash
npm install
npm run build
Expand Down
33 changes: 33 additions & 0 deletions smithery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml

startCommand:
type: stdio
configSchema:
# JSON Schema defining the configuration options for the MCP.
type: object
required:
- sshHost
- sshUser
- sshPrivateKeyPath
- railsWorkingDir
properties:
sshHost:
type: string
description: The remote host to connect to via SSH.
sshUser:
type: string
description: The SSH username.
sshPrivateKeyPath:
type: string
description: The path to the SSH private key.
railsWorkingDir:
type: string
description: The working directory of the Rails application on the remote host.
projectNameAsContext:
type: string
default: ""
description: The project name used as context.
commandFunction:
# A function that produces the CLI command to start the MCP on stdio.
|-
config => ({ command: 'node', args: ['build/index.js'], env: { SSH_HOST: config.sshHost, SSH_USER: config.sshUser, SSH_PRIVATE_KEY_PATH: config.sshPrivateKeyPath, RAILS_WORKING_DIR: config.railsWorkingDir, PROJECT_NAME_AS_CONTEXT: config.projectNameAsContext || '' } })