Skip to content

Better MCP module interface rails support#39

Merged
patvice merged 7 commits intomainfrom
better-mcp-interface-rails-support
Jul 7, 2025
Merged

Better MCP module interface rails support#39
patvice merged 7 commits intomainfrom
better-mcp-interface-rails-support

Conversation

@patvice
Copy link
Owner

@patvice patvice commented Jul 7, 2025

🚀 Rails Integration, Module Interface improvements and Transport Layer Refactoring

This PR adds comprehensive Rails support to the RubyLLM MCP library and refactors the transport layer for better extensibility.

✨ What's New

Rails Integration

  • Rails Railtie: Automatic MCP client lifecycle management

    • Starts all configured MCP clients when Rails initializes (configurable)
    • Gracefully shuts down clients when Rails application exits
    • Automatic generator registration
  • Rails Generator: Easy setup with rails generate ruby_llm:mcp:install

    • Creates config/initializers/ruby_llm_mcp.rb with comprehensive configuration
    • Generates config/mcps.yml with sample MCP server configuration
    • Includes setup instructions and usage examples

MCP module interface

  • Added some support methods to MCP to make it easy to work with multiple MCPs.
  • Added a global tools method to more easily work with tools across multiple MCPs.

Transport Layer Improvements

  • New Transport Factory Pattern: Centralized transport type registration and management
  • Better Process Management: Improved handling of transport instances across process boundaries
  • Enhanced Configuration: Support for YAML configuration files with ERB templating

Configuration Enhancements

  • YAML Support: Use .yml files instead of JSON for more readable configuration
  • Rails-Specific Options:
    • launch_control: :automatic or :manual MCP client management
    • config_path: Rails-aware configuration file paths
  • Template Support: ERB processing in configuration files (e.g., <%= Rails.root %>)

patvice added 7 commits July 4, 2025 17:28
- Add Rails Railtie for automatic MCP client lifecycle management
- Create Rails generator for easy MCP setup with templates
- Refactor transport layer: move files to transports/ directory
- Add Transport factory class with type registration system
- Support YAML configuration files with ERB templating
- Add Rails-specific configuration options (launch_control, config_path)
- Update file structure and corresponding specs
- Improve process management for transport instances
@patvice patvice merged commit c0ef3fe into main Jul 7, 2025
5 of 12 checks passed
@patvice patvice deleted the better-mcp-interface-rails-support branch July 7, 2025 14:23
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