How tidewave-ai/tidewave_rails works
Project type and purpose
• Tidewave is an open-source Ruby gem that plugs into a Rails application via a Railtie.
• It implements the Model Context Protocol (MCP) to let an AI assistant (your LLM in the editor) inspect and manipulate the running web app (logs, DB, code, gem sources, etc.) at development time.
File structure
• Top-level directories:
• bin/ (developer tooling scripts, e.g. rubocop)
• config/ (database.yml and Railtie configuration hooks)
• lib/tidewave/ (the core library: configuration, file_tracker, railtie, tool_resolver)
• lib/tidewave/tools/ (one class per “tool”: execute_sql_query, grep_project_files, etc.)
• spec/ (unit tests for each component and tool)
• Key files:
• lib/tidewave/railtie.rb registers routes (MCP endpoint) and initializers
• lib/tidewave/tool_resolver.rb dynamically picks the right tool class for each MCP request
• lib/tidewave/file_tracker.rb tracks file changes in the host app
• configuration.rb for user-customizable options (allowed_ips, origins)
README for additional insights
• Describes how Tidewave is mounted at /tidewave/mcp on the Rails server
• Emphasizes development-only use on a threaded server (Puma)
• References FastMCP as the underlying protocol for JSON-over-HTTP messaging