How to Supercharge Your Rails App with MCP Server and Copilot for AI-Driven Translation

Visnupriya

3 min read

rails app with mcp server and copilot for AI driven translation

Ruby on Rails has always been about developer happiness — helping us turn ideas into real, working applications with speed, elegance, and clarity. It follows the philosophy of “Convention over Configuration”, allowing developers to focus on logic and creativity instead of repetitive setup and boilerplate code.

It’s the framework that makes building software feel joyful, not painful.

But as AI becomes an essential part of modern development, a new question arises:
Can Rails preserve its simplicity and magic while embracing AI-powered capabilities?

Just as Rails thrives on “Convention over Configuration”, Model Context Protocol (MCP) brings a similar philosophy to AI integration. MCP provides a standardized, convention-based way for applications to expose their data and tools, allowing AI models like GitHub Copilot to interact seamlessly without requiring complex setup.

Recently, I came across Paweł Strzałkowski’s talk — Make Rails AI-Ready by Design with the Model Context Protocol (MCP) at RubyConf. The session was inspiring and demonstrated how Rails applications can expose their functionality directly to AI assistants, such as GitHub Copilot.

From that inspiration, I decided to create my own MCP server inside a Rails application. To keep things simple, I started with a small Translate app that demonstrates:

  • How to expose custom MCP tools in Rails
  • How to connect them with VS Code Copilot
  • How to make Rails apps AI-ready by design

👉 By the end, you’ll see how a Rails app can not only serve users via web UI but also act as an AI backend for tools like Copilot.

What is the Model Context Protocol (MCP)?

Model Context Protocol (MCP) is an open standard introduced by Anthropic that allows applications to securely expose their data, actions, and tools to AI assistants like GitHub Copilot or Claude.

In simpler terms, MCP acts as a bridge between your app and AI models, enabling the AI to “understand” your application’s capabilities and interact with it directly — whether that means reading data, creating records, or running actions.

Instead of the AI hallucinating responses, MCP gives it a structured and controlled way to access real information and safely perform operations.

🚀 Setting Up the Rails App with MCP

1. Install the MCP Gem

Clone the MCP on Rails template:

git clone https://github.com/pstrzalk/mcp-on-rails.git

2. Create a Rails Application with MCP Server

Generate a new Rails app using the MCP template:

rails new translate_app -m mcp-on-rails/mcp

This will scaffold a Rails CRUD application with MCP tools preconfigured.

3. Add a Translation Scaffold

Now, create the scaffold for translations:

rails g scaffold translation input_text:text output_text:text from_lang:string to_lang:string

This generates the Rails model, controller, views, and automatically hooks into the MCP tool setup.

🔍 Inspecting the MCP Tools

The scaffold command creates all the required Rails files along with the MCP tool definitions.

Next, install the MCP Inspector and run it:

npx @modelcontextprotocol/inspector

🎉 And that’s it — you should now see your Rails MCP server up and running in the inspector!

With the Inspector, you can:

  • View the list of available MCP tools (like CreateTranslation, ListTranslations, etc.)
  • Explore the schema and parameters each tool accepts
  • Test CRUD operations directly from the interface without touching the Rails console
  • Verify that your Rails app is correctly exposing tools to any AI client (like VS Code Copilot)

This is a great way to debug and confirm your MCP setup before moving on to the Copilot integration.

⚙️ Connecting MCP Inspector to Your Rails Server

To connect the Inspector with your local Rails MCP server:

  1. Open MCP Inspector Settings.
  2. Under Transport Type, select Streamable HTTP.
  3. In the URL field, paste your local Rails MCP endpoint:
    http://localhost:3000/mcp
  4. Save the settings and go back to the Tools tab.

🎉 Now you’ll see the MCP tools exposed by your Rails application! From here, you can:

  • Browse the tools (e.g., CreateTranslation, ListTranslations).
  • Run a tool directly in the Inspector.
  • Confirm that a new record is successfully created in your Rails database via the MCP server.

⚙️ Connecting with VS Code Copilot Chat

Now that the MCP server is running, let’s integrate it with GitHub Copilot Chat to supercharge our Rails app with AI.

Instead of building the translation logic from scratch, we can leverage an LLM by connecting our Rails MCP server directly to VS Code Copilot.

Since I already have Copilot set up in my VS Code, the next step is to install the Copilot MCP Server from the VS Code Extensions Marketplace.

Click Ctrl + Shift + P, it opens the search bar and search word with MCP., It shows the “MCP: Add Server” option. Click it.

Click “MCP: Add Server” Option from the list and click HTTP Option from the list, and enter your Rails MCP path here

✅ Done! Your Rails MCP server is now connected to Copilot Chat.

Open Copilot Chat and perform CRUD operations on your Rails application directly through AI-powered prompts. 🎉 Your Rails app has now leveled up into an AI-powered web application—ready to impress and inspire!

Now I can create a translation and get the result instantly in the desired language.

> https://drive.google.com/file/d/1agSD1ZsGUllIFliYgw6tLvINSZBGf5Qd/view?usp=sharing

🚀 Conclusion

We’ve just seen how easy it is to transform a traditional Rails app into an AI-powered experience using the Model Context Protocol (MCP) and GitHub Copilot Chat.

What started as a simple Translate app quickly became more than just a CRUD project:

  • Rails gave us the foundation.
  • 🔧 MCP exposed our app’s features as AI-ready tools.
  • 🤖 Copilot Chat turned natural language into real actions inside our Rails app.

This shift changes how we think about building applications. Rails is no longer just serving HTML or APIs — it’s becoming an AI-native platform, capable of working side by side with LLMs and developer tools.

The possibilities are massive:

  • 🌍 AI-driven translation services.
  • 🛒 Smarter e-commerce platforms.
  • 💬 Real-time AI chat systems.
  • 📊 Intelligent dashboards and assistants built right on top of Rails.

🔒 Of course, as we make Rails apps AI-ready, security must remain a top concern. When exposing tools through MCP, we should:

  • Add authentication & authorization for sensitive endpoints.
  • Ensure rate limiting to prevent misuse.
  • Validate and sanitize user inputs before passing them to LLMs or backend logic.
  • Use environment-based access controls so only trusted agents (like Copilot) can reach your MCP server.

✨ The bottom line? Your Rails app can now be both a secure web application and an AI backend — ready to inspire, impress, and push the limits of what developers can build.

The future of Rails isn’t just full-stack. It’s securely AI-ready by design. 🚀

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *