mcp-on-rails 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9de4dca8095e1020e24bf8f70df4a28f148b2cc85ecf2768a556722da1292132
4
- data.tar.gz: c553494738ae79d5ac4409021a2f1ddd69caf1506e47d38c42e93add47c9f106
3
+ metadata.gz: d38b6e8a0b24122cb1ca1ad3c859af9ae356fea7ab33b632495c759cfc20e4e2
4
+ data.tar.gz: 0420f862f57d72c1a6b176d632e2e50a34e2522961955556413d188eba160b19
5
5
  SHA512:
6
- metadata.gz: cca8f6b8ebcdfe8ff07e50af3008d0aa50208225b127d5edddc3cb7b86b03329dcd36ae897ff079d387e2b4c7ef104932a6e5dca22b1e7da8380d029fc768ed7
7
- data.tar.gz: 7c120a4dff702bdb99be86fea3d02e02f0832bdae3e9b008a9397510a4ff7b4cff1f33319e0f038401caa007681a9f7e322c84c27e77f4b6dce4d5a1ce27a4d7
6
+ metadata.gz: 1b15d938050f2873ab2c20289a59fe0e482011edaa1952d45b09b913328f4ef4dc064af44c6ac2883b1edac204b7a66eeea28cc29ee650a43248fa1cbd3bb709
7
+ data.tar.gz: e16377c3075cff343636a69c224af02ec40c55a593c8f2e768e74d8793d6f8221c18b6c3198d39f070e80cbde5e81a7bb1cd944b14a8728eeedbf2ad8066b3d4
data/README.md CHANGED
@@ -80,20 +80,35 @@ your-rails-project/
80
80
  └── mcp-setup # Project setup script
81
81
  ```
82
82
 
83
- ## MCP Client Configuration
83
+ ## Using with AI Assistants
84
84
 
85
- ### VS Code with GitHub Copilot
85
+ ### GitHub Copilot (VS Code)
86
86
 
87
- 1. Install the MCP extension for VS Code
88
- 2. Configure your workspace settings:
87
+ GitHub Copilot doesn't directly read MCP configuration files, but you can leverage the specialized prompts by:
89
88
 
90
- ```json
91
- {
92
- "mcp.configPath": ".mcp-on-rails/mcp-config.yml"
93
- }
94
- ```
89
+ 1. **Reference prompts in your requests**:
90
+ ```
91
+ "Please check .mcp-on-rails/prompts/models.md for Rails model best practices and help me with this ActiveRecord model"
92
+ ```
93
+
94
+ 2. **Use context-aware requests**:
95
+ ```
96
+ "Looking at .mcp-on-rails/prompts/controllers.md, help me implement this API endpoint"
97
+ ```
98
+
99
+ 3. **Add to VS Code workspace settings** (optional):
100
+ ```json
101
+ {
102
+ "files.associations": {
103
+ ".mcp-on-rails/**/*.md": "markdown"
104
+ },
105
+ "explorer.fileNesting.patterns": {
106
+ ".mcp-on-rails": "mcp-config.yml,context.md"
107
+ }
108
+ }
109
+ ```
95
110
 
96
- ### Claude Desktop
111
+ ### Claude Desktop (Native MCP Support)
97
112
 
98
113
  Add to your Claude Desktop configuration:
99
114
 
@@ -110,9 +125,13 @@ Add to your Claude Desktop configuration:
110
125
  }
111
126
  ```
112
127
 
113
- ### Other MCP Clients
128
+ ### Other AI Assistants
114
129
 
115
- The generated `mcp-config.yml` is compatible with most MCP clients. Refer to your client's documentation for specific configuration steps.
130
+ For any AI assistant, you can reference the specialized prompts manually:
131
+ - **Models**: "Use .mcp-on-rails/prompts/models.md as context"
132
+ - **Controllers**: "Reference .mcp-on-rails/prompts/controllers.md"
133
+ - **Views**: "Check .mcp-on-rails/prompts/views.md for guidance"
134
+ - **Tests**: "Follow .mcp-on-rails/prompts/tests.md best practices"
116
135
 
117
136
  ## Context Areas
118
137
 
@@ -6,6 +6,8 @@ require "fileutils"
6
6
  module Mcp
7
7
  module On
8
8
  module Rails
9
+ # Generator class for creating MCP configuration files and directories
10
+ # Handles project setup with templates and customization
9
11
  class Generator
10
12
  attr_reader :project_name, :project_path
11
13
 
@@ -19,9 +21,11 @@ module Mcp
19
21
  copy_prompts
20
22
  generate_config_file
21
23
  copy_context_file
24
+ create_copilot_instructions
22
25
  create_executable
23
26
  puts "✅ MCP on Rails setup completed for '#{project_name}'"
24
- puts "📁 Files created in: #{File.join(project_path, '.mcp-on-rails')}"
27
+ puts "📁 Files created in: #{File.join(project_path, ".mcp-on-rails")}"
28
+ puts "📋 GitHub Copilot instructions: #{File.join(project_path, ".github/copilot-instructions.md")}"
25
29
  puts "🚀 Run: ./bin/mcp-setup to configure your project"
26
30
  end
27
31
 
@@ -41,10 +45,10 @@ module Mcp
41
45
  def generate_config_file
42
46
  template_file = File.join(templates_path, "mcp-config.yml.erb")
43
47
  target_file = File.join(project_path, ".mcp-on-rails", "mcp-config.yml")
44
-
48
+
45
49
  template = ERB.new(File.read(template_file))
46
50
  content = template.result(binding)
47
-
51
+
48
52
  File.write(target_file, content)
49
53
  end
50
54
 
@@ -54,14 +58,30 @@ module Mcp
54
58
  FileUtils.cp(source_file, target_file)
55
59
  end
56
60
 
61
+ def create_copilot_instructions
62
+ github_dir = File.join(project_path, ".github")
63
+ FileUtils.mkdir_p(github_dir)
64
+
65
+ source_file = File.join(templates_path, "copilot-instructions.md")
66
+ target_file = File.join(github_dir, "copilot-instructions.md")
67
+ FileUtils.cp(source_file, target_file)
68
+ end
69
+
57
70
  def create_executable
58
71
  bin_dir = File.join(project_path, "bin")
59
72
  FileUtils.mkdir_p(bin_dir)
60
-
61
- executable_content = <<~SCRIPT
73
+
74
+ executable_content = build_executable_content
75
+ executable_path = File.join(bin_dir, "mcp-setup")
76
+ File.write(executable_path, executable_content)
77
+ FileUtils.chmod(0o755, executable_path)
78
+ end
79
+
80
+ def build_executable_content
81
+ <<~SCRIPT
62
82
  #!/usr/bin/env ruby
63
83
  # frozen_string_literal: true
64
-
84
+
65
85
  puts "🔧 Setting up MCP on Rails for #{project_name}"
66
86
  puts "📋 Configuration files are ready in .mcp-on-rails/"
67
87
  puts ""
@@ -70,10 +90,6 @@ module Mcp
70
90
  puts "2. Use the prompts in .mcp-on-rails/prompts/ for context-aware AI assistance"
71
91
  puts "3. Customize the configuration as needed for your project"
72
92
  SCRIPT
73
-
74
- executable_path = File.join(bin_dir, "mcp-setup")
75
- File.write(executable_path, executable_content)
76
- FileUtils.chmod(0o755, executable_path)
77
93
  end
78
94
 
79
95
  def templates_path
@@ -0,0 +1,177 @@
1
+ # GitHub Copilot Instructions for MCP on Rails
2
+
3
+ You are working with a Rails project that has been configured with MCP on Rails, providing specialized AI assistance for Rails development. This project follows the principles of claude-on-rails but is adapted for GitHub Copilot usage.
4
+
5
+ ## Project Context
6
+
7
+ This Rails project uses **MCP on Rails** configuration located in `.mcp-on-rails/` directory. Always reference the specialized prompts and context when helping with development tasks.
8
+
9
+ ### Key Directories and Their Purpose:
10
+ - **`.mcp-on-rails/prompts/`** - Contains specialized prompts for different Rails components
11
+ - **`.mcp-on-rails/context.md`** - Project-specific context and information
12
+ - **`.mcp-on-rails/mcp-config.yml`** - MCP server configuration
13
+
14
+ ## Specialized Agent Roles
15
+
16
+ When working on different parts of the Rails application, adopt the appropriate specialist role and reference the corresponding prompt file:
17
+
18
+ ### 🏗️ **Architect Role** (Overall coordination)
19
+ **When to use**: Project-wide decisions, architecture planning, feature coordination
20
+ **Reference**: `.mcp-on-rails/prompts/architect.md`
21
+ **Focus**:
22
+ - Coordinate implementation across multiple components
23
+ - Make high-level architectural decisions
24
+ - Ensure consistency across the application
25
+ - Plan complex features that span multiple areas
26
+
27
+ ### 🗄️ **Models Specialist** (Data layer)
28
+ **When working in**: `app/models/`, `db/migrate/`, database-related tasks
29
+ **Reference**: `.mcp-on-rails/prompts/models.md`
30
+ **Focus**:
31
+ - ActiveRecord models, associations, validations
32
+ - Database migrations and schema design
33
+ - Query optimization and performance
34
+ - Data integrity and constraints
35
+
36
+ ### 🎮 **Controllers Specialist** (HTTP handling)
37
+ **When working in**: `app/controllers/`, routing, APIs
38
+ **Reference**: `.mcp-on-rails/prompts/controllers.md`
39
+ **Focus**:
40
+ - RESTful controllers and routing
41
+ - Authentication and authorization
42
+ - API design and implementation
43
+ - Request/response handling
44
+
45
+ ### 🎨 **Views Specialist** (Frontend/UI)
46
+ **When working in**: `app/views/`, `app/assets/`, frontend components
47
+ **Reference**: `.mcp-on-rails/prompts/views.md`
48
+ **Focus**:
49
+ - ERB templates and layouts
50
+ - HTML/CSS styling and responsive design
51
+ - Asset pipeline management
52
+ - UI components and partials
53
+
54
+ ### ⚡ **Stimulus Specialist** (JavaScript/Interactivity)
55
+ **When working in**: `app/javascript/`, Stimulus controllers, Turbo features
56
+ **Reference**: `.mcp-on-rails/prompts/stimulus.md`
57
+ **Focus**:
58
+ - Stimulus.js controllers and targets
59
+ - Turbo Drive, Frames, and Streams
60
+ - JavaScript behavior and DOM manipulation
61
+ - Progressive enhancement
62
+
63
+ ### 🔧 **Jobs Specialist** (Background processing)
64
+ **When working in**: `app/jobs/`, background tasks, queues
65
+ **Reference**: `.mcp-on-rails/prompts/jobs.md`
66
+ **Focus**:
67
+ - ActiveJob background processing
68
+ - Queue management and scheduling
69
+ - Async task implementation
70
+ - Performance optimization for background work
71
+
72
+ ### 🧪 **Tests Specialist** (Quality assurance)
73
+ **When working in**: `test/`, `spec/`, testing-related tasks
74
+ **Reference**: `.mcp-on-rails/prompts/tests.md`
75
+ **Focus**:
76
+ - Comprehensive test coverage
77
+ - Test-driven development (TDD)
78
+ - Factory and fixture management
79
+ - Integration and system tests
80
+
81
+ ### 🚀 **DevOps Specialist** (Infrastructure/Deployment)
82
+ **When working in**: `config/`, deployment, infrastructure
83
+ **Reference**: `.mcp-on-rails/prompts/devops.md`
84
+ **Focus**:
85
+ - Application configuration and environments
86
+ - Docker, CI/CD, and deployment strategies
87
+ - Performance monitoring and optimization
88
+ - Security and infrastructure concerns
89
+
90
+ ## How to Work with This Project
91
+
92
+ ### 1. **Always Check Context First**
93
+ Before starting any task, review:
94
+ ```
95
+ - .mcp-on-rails/context.md for project-specific information
96
+ - .mcp-on-rails/prompts/[relevant-area].md for specialized guidance
97
+ ```
98
+
99
+ ### 2. **Multi-Agent Coordination**
100
+ For complex features that span multiple areas:
101
+ 1. Start with the **Architect** role to plan the implementation
102
+ 2. Break down tasks for appropriate specialists
103
+ 3. Ensure consistency across all components
104
+ 4. Always include comprehensive tests
105
+
106
+ ### 3. **Rails Best Practices**
107
+ Always follow:
108
+ - Rails conventions and naming patterns
109
+ - RESTful design principles
110
+ - Security best practices
111
+ - Performance optimization
112
+ - Comprehensive test coverage
113
+
114
+ ### 4. **Code Quality Standards**
115
+ - Write clean, readable, and maintainable code
116
+ - Follow Ruby and Rails style guides
117
+ - Include proper documentation and comments
118
+ - Implement error handling and edge cases
119
+ - Consider performance implications
120
+
121
+ ## Implementation Workflow
122
+
123
+ ### For New Features:
124
+ 1. **Plan** (Architect): Understand requirements and design approach
125
+ 2. **Model** (Models): Design data structure and relationships
126
+ 3. **Route & Control** (Controllers): Implement HTTP endpoints
127
+ 4. **Present** (Views): Create user interface
128
+ 5. **Enhance** (Stimulus): Add interactive behavior
129
+ 6. **Process** (Jobs): Handle background tasks if needed
130
+ 7. **Test** (Tests): Ensure comprehensive coverage
131
+ 8. **Deploy** (DevOps): Configure for production
132
+
133
+ ### For Bug Fixes:
134
+ 1. **Diagnose**: Identify the problem area
135
+ 2. **Reference**: Check relevant specialist prompt
136
+ 3. **Fix**: Implement solution following best practices
137
+ 4. **Test**: Verify fix with appropriate tests
138
+ 5. **Document**: Update relevant documentation
139
+
140
+ ### For Refactoring:
141
+ 1. **Analyze**: Understand current implementation
142
+ 2. **Plan**: Design improved approach
143
+ 3. **Refactor**: Implement changes systematically
144
+ 4. **Test**: Ensure no regression
145
+ 5. **Optimize**: Improve performance where applicable
146
+
147
+ ## Special Considerations
148
+
149
+ ### Security First
150
+ - Always validate user input
151
+ - Implement proper authentication/authorization
152
+ - Follow Rails security guidelines
153
+ - Use strong parameters and CSRF protection
154
+
155
+ ### Performance Matters
156
+ - Optimize database queries (avoid N+1)
157
+ - Use appropriate caching strategies
158
+ - Monitor and profile performance
159
+ - Consider background processing for heavy tasks
160
+
161
+ ### Test Everything
162
+ - Write tests before implementing features (TDD)
163
+ - Ensure high test coverage
164
+ - Include integration and system tests
165
+ - Test edge cases and error conditions
166
+
167
+ ## Quick Reference Commands
168
+
169
+ When asked to help with Rails development:
170
+
171
+ 1. **Identify the area** of work (models, controllers, views, etc.)
172
+ 2. **Reference the appropriate prompt**: "Let me check .mcp-on-rails/prompts/[area].md for best practices"
173
+ 3. **Apply specialist knowledge** for that area
174
+ 4. **Consider dependencies** and coordination with other areas
175
+ 5. **Ensure comprehensive testing** and documentation
176
+
177
+ Remember: You are part of a coordinated development team. Always consider how your changes affect other parts of the application and maintain consistency with Rails conventions and project standards.
@@ -3,7 +3,7 @@
3
3
  module Mcp
4
4
  module On
5
5
  module Rails
6
- VERSION = "0.1.0"
6
+ VERSION = "0.2.0"
7
7
  end
8
8
  end
9
9
  end
data/lib/mcp/on/rails.rb CHANGED
@@ -5,6 +5,8 @@ require_relative "rails/generator"
5
5
 
6
6
  module Mcp
7
7
  module On
8
+ # Main module for MCP on Rails gem
9
+ # Provides setup functionality for Rails projects with MCP configuration
8
10
  module Rails
9
11
  class Error < StandardError; end
10
12
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcp-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCoder
@@ -27,6 +27,7 @@ files:
27
27
  - lib/mcp/on/rails.rb
28
28
  - lib/mcp/on/rails/generator.rb
29
29
  - lib/mcp/on/rails/templates/context.md
30
+ - lib/mcp/on/rails/templates/copilot-instructions.md
30
31
  - lib/mcp/on/rails/templates/mcp-config.yml.erb
31
32
  - lib/mcp/on/rails/templates/prompts/api.md
32
33
  - lib/mcp/on/rails/templates/prompts/architect.md