Module: ClaudeOnRails::MCPSupport
- Defined in:
- lib/claude_on_rails/mcp_support.rb
Overview
Support module for Rails MCP Server integration
Class Method Summary collapse
-
.available? ⇒ Boolean
Check if Rails MCP Server gem is available on the system.
-
.available_resources ⇒ Object
Get available resources that can be downloaded.
-
.common_resources_setup? ⇒ Boolean
Check if common resources are set up.
-
.download_resource?(_resource_name) ⇒ Boolean
Check if we can download a resource (always true for gem-based server).
-
.downloaded_resources ⇒ Object
Check which resources are currently downloaded.
-
.installation_instructions ⇒ Object
Generate installation instructions.
-
.missing_resources ⇒ Object
Check which resources are missing.
-
.resource_available?(_resource_name) ⇒ Boolean
Check if a specific resource is downloaded.
-
.server_config(rails_env = 'development') ⇒ Object
Get the MCP server configuration for swarm.
Class Method Details
.available? ⇒ Boolean
Check if Rails MCP Server gem is available on the system
8 9 10 11 12 13 14 15 |
# File 'lib/claude_on_rails/mcp_support.rb', line 8 def available? # Check if the gem is installed system('gem list -i rails-mcp-server > /dev/null 2>&1') || # Also check if the executable is available system('which rails-mcp-server > /dev/null 2>&1') rescue StandardError false end |
.available_resources ⇒ Object
Get available resources that can be downloaded
44 45 46 |
# File 'lib/claude_on_rails/mcp_support.rb', line 44 def available_resources %w[rails turbo stimulus kamal] end |
.common_resources_setup? ⇒ Boolean
Check if common resources are set up
61 62 63 64 |
# File 'lib/claude_on_rails/mcp_support.rb', line 61 def common_resources_setup? # No separate resource setup needed available? end |
.download_resource?(_resource_name) ⇒ Boolean
Check if we can download a resource (always true for gem-based server)
35 36 37 38 39 40 41 |
# File 'lib/claude_on_rails/mcp_support.rb', line 35 def download_resource?(_resource_name) return false unless available? # Rails MCP Server doesn't require separate resource downloads # Documentation is built-in to the gem true end |
.downloaded_resources ⇒ Object
Check which resources are currently downloaded
49 50 51 52 |
# File 'lib/claude_on_rails/mcp_support.rb', line 49 def downloaded_resources # All resources are included in the gem available? ? available_resources : [] end |
.installation_instructions ⇒ Object
Generate installation instructions
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/claude_on_rails/mcp_support.rb', line 67 def installation_instructions instructions = [] unless available? instructions << "Install Rails MCP Server:" instructions << " gem install rails-mcp-server --no-document" instructions << "" end instructions end |
.missing_resources ⇒ Object
Check which resources are missing
55 56 57 58 |
# File 'lib/claude_on_rails/mcp_support.rb', line 55 def missing_resources # No resources are missing if the gem is installed available? ? [] : available_resources end |
.resource_available?(_resource_name) ⇒ Boolean
Check if a specific resource is downloaded
18 19 20 21 |
# File 'lib/claude_on_rails/mcp_support.rb', line 18 def resource_available?(_resource_name) # Rails MCP Server includes all resources in the gem available? end |
.server_config(rails_env = 'development') ⇒ Object
Get the MCP server configuration for swarm
24 25 26 27 28 29 30 31 32 |
# File 'lib/claude_on_rails/mcp_support.rb', line 24 def server_config(rails_env = 'development') { name: 'rails', type: 'stdio', command: 'rails-mcp-server', args: [], env: { 'RAILS_ENV' => rails_env } } end |