Summarized using AI

Make Rails AI-Ready by Design with the Model Context Protocol

Paweł Strzałkowski • September 05, 2025 • Amsterdam, Netherlands • Talk

Introduction

This talk, presented by Paweł Strzałkowski at Rails World 2025, introduces how Ruby on Rails can be made AI-ready by design through the adoption of the Model Context Protocol (MCP). It explores how developers can seamlessly integrate AI agents and large language models (LLMs) with traditional Rails applications, enabling AI-driven interactions and workflows out-of-the-box.

Key Points

  • Motivation and Vision:

    • Envisions a future where users interact with web applications through LLMs, such as ChatGPT or Claude, using natural language prompts to perform complex tasks like booking trips.
    • Highlights the current gap between LLMs and traditional web applications, noting LLMs cannot access real-time application data or functionality directly.
  • What is MCP (Model Context Protocol)?

    • MCP is an open standard (introduced by Anthropic and backed by Google, OpenAI, and others) designed to provide real-time, dynamic context to LLMs from applications.
    • Standardizes how LLMs can interact with applications through primitives: tools (executable functions), resources (data, files), and prompts (instructions).
    • Solves the M*N integration issue by allowing applications to expose functionality in a reusable format, avoiding repetitive custom integrations.
  • MCP Architecture and Interactions:

    • Architecture includes MCP hosts (user-facing LLM applications), MCP servers (applications exposing context), and MCP clients (libraries to fetch context).
    • Demonstrated with an example involving an LLM booking a romantic European trip, coordinating between a travel agency and weather forecast MCP servers.
    • The LLM interacts through a series of tool calls, using current context to achieve multi-step user goals.
  • Making a Rails App AI-Ready:

    • Demonstrates how to scaffold a classic Rails blog application and make it AI-native with minimal changes.
    • A special MCP-ready template is applied, adding the official Ruby MCP SDK, custom routes, controllers, and scaffolding additional tool files for models.
    • Shows live MCP server validation, tool generation for CRUD actions, and usability through MCP Inspector.
  • Integrating with LLM Hosts and AI Agents:

    • Connects the MCP-enabled Rails app with LLM hosts like Claude desktop, enabling real-time, AI-driven creation of posts and comments.
    • Demonstrates a user prompting an AI agent to create posts and comments, showing seamless end-to-end functionality.
    • Adds AI-specific tools (e.g., weather check) and demonstrates personalized, context-driven content creation.
  • Extensibility and Best Practices:

    • Emphasizes that MCP tools can and should go beyond CRUD operations, enabling complex, aggregated business functions.
    • Provides generators for more advanced tool creation and encourages building richer AI-native features.
  • Deployment and Production Readiness:

    • Illustrates fast deployment of the AI-ready Rails app to production with real-time LLM integrations using tools like Kamal.
    • Stresses the ease of making Rails apps AI-native with minimal friction, thanks to the maturity and flexibility of the Rails framework and existing open-source MCP tools/gems.

Examples and Illustrations

  • Live demonstration of a Rails blog scaffold with MCP integration, showing tool generation, real-time AI content creation, and contextual logic (e.g., weather-based posting).
  • Case study of LLM (via Claude desktop) interacting naturally with the blog app using MCP tools.

Conclusion & Takeaways

  • Rails is inherently ready for the AI era—with a simple gem and template, developers can make their apps natively accessible to LLMs via MCP.
  • The talk encourages creativity and growth from simple CRUD tools to sophisticated, AI-driven interfaces and functionalities.
  • The integration of MCP exemplifies Rails’ continued emphasis on convention over configuration and positions it strongly for future AI-centric application development.

Make Rails AI-Ready by Design with the Model Context Protocol
Paweł Strzałkowski • Amsterdam, Netherlands • Talk

Date: September 05, 2025
Published: Mon, 15 Sep 2025 00:00:00 +0000
Announced: Tue, 20 May 2025 00:00:00 +0000

Remember the joy of Rails scaffold creating web interfaces in DHH's demos? Let's make it just as simple for AI integrations!

Imagine Rails scaffolding not just views for humans, but a parallel, AI interaction layer - out of the box!

How? By embracing convention over configuration with the Model Context Protocol (MCP), the emerging standard (backed by Google & OpenAI) for AI-app interactions.
Example: Scaffold a ReservationsController and instantly let an AI agent book a room via MCP - just like agents may use it with GitHub or JIRA today.

I'll show:
- A full-stack AI-ready app scaffolded live
- An AI agent using it
- How backend, frontend, and AI layers cooperate
- How to make your app speak AI natively

Ultimately, this talk shows Rails' competitive advantage for the AI era.

Rails World 2025

00:00:00.000 Imagine
00:00:08.400 being a customer of a website for
00:00:10.320 booking amazing trips.
00:00:15.280 But it's 2025, right? So you open your
00:00:17.920 favorite LLM chat, your chat GPT, your
00:00:20.560 cloud AI or desktop.
00:00:24.640 You quickly authorize your favorite
00:00:26.800 website and you add a prompt. I want to
00:00:29.679 go to Spain and spend a romantic weekend
00:00:31.920 around the middle of July. Book me a
00:00:34.559 spot in a fivestar hotel. Just make sure
00:00:37.760 the weather is great,
00:00:40.640 please.
00:00:44.000 You wait a second for the assistant to
00:00:46.800 do its magic and it's done.
00:00:50.559 You hear a sound of an email message
00:00:53.760 incoming.
00:00:55.280 It's a booking confirmation for your
00:00:57.280 next trip to Barcelona.
00:01:00.399 Well, wouldn't that be amazing?
00:01:03.680 Wouldn't it be even better if the
00:01:05.840 website could run on Ruby on Rails?
00:01:09.920 To make this dream come true, today I'm
00:01:12.720 going to tell you how to make Rails AI
00:01:14.560 ready by design with model context
00:01:17.600 protocol.
00:01:20.080 Hi, I'm Pavl Strokovski. By day, I'm the
00:01:23.680 CTO of Visuality, a Ruby agency from
00:01:26.799 Warso, Poland. And I've been a web
00:01:30.400 developer for well more than 20 years.
00:01:33.360 But I love adding a creative spark to
00:01:35.920 whatever I do. So, for example, last
00:01:37.680 year in Toronto, I've given a lightning
00:01:40.880 talk on Rails World about using Rails as
00:01:44.400 a multiplayer real-time game engine,
00:01:46.560 which was kind of fun.
00:01:48.960 And depending whether you your heart
00:01:52.159 lays with code or business, you can find
00:01:54.880 me on GitHub and or LinkedIn. Let's get
00:01:57.759 it on.
00:01:59.759 So let's start with a brief introduction
00:02:01.680 to what model context protocol is in
00:02:04.560 general. So the internet is full of
00:02:08.000 applications, server, websites. Well,
00:02:10.479 you know it. You are the ones who build
00:02:12.400 those, right?
00:02:14.080 On the other hand, we have an explosion
00:02:15.920 of LLMbacked
00:02:18.000 solutions from online assistance through
00:02:20.800 desktop solutions up until the developer
00:02:24.560 tooling like Corsor or Cloud Code. Yet
00:02:28.319 there is a thick wall between LLM
00:02:32.319 and normal websites. It's because LLMs
00:02:36.640 have no power of accessing the
00:02:40.640 content in the real life world in the
00:02:43.440 current world in the uh in the classical
00:02:45.440 applications.
00:02:47.040 So a prompt asking to book a European
00:02:50.800 romantic trip has no chance of
00:02:54.239 succeeding because again LLMs have no
00:02:57.519 access to real world data.
00:03:00.959 Of course, we can work around. We can
00:03:03.519 build an application which on one hand
00:03:06.560 converses with LLM using prompt and
00:03:10.159 response and on the other hand uses API
00:03:12.720 endpoints that we all know and love and
00:03:15.120 just translates it back and forth and it
00:03:17.680 can be done and it's done over and over
00:03:20.480 again and sometimes it is a way to go.
00:03:23.280 However, when you do it on scale, when
00:03:25.280 you do a lot of models and a lot of
00:03:26.959 solutions, you quickly get to something
00:03:29.200 called M* N integration problem where
00:03:31.840 you have M models and N solutions. And
00:03:34.959 whenever you want to add a model, you
00:03:36.640 have to program it n times and whenever
00:03:38.560 you want to add the solution, you have
00:03:40.319 to add again do it m times. It just adds
00:03:43.599 up very quickly and it just feels like a
00:03:46.799 wrong tool for the job. It's not doesn't
00:03:48.799 feel AI native, whatever it means. So in
00:03:52.959 order to make it right, to make it work,
00:03:56.080 large language model needs to be given
00:04:00.000 real life current context over an AI
00:04:03.439 native protocol.
00:04:06.000 The only thing naming is hard but if
00:04:08.959 model needs to be given context over an
00:04:11.439 protocol, let's call it model context
00:04:13.840 protocol.
00:04:15.599 So what is it? What is MCP? It's an open
00:04:18.959 standard. Open means it can be used by
00:04:21.440 all of you any of you and it can be used
00:04:24.800 implemented by everyone. It has been
00:04:27.919 introduced by entropic last year in
00:04:30.560 November and it was so well accepted
00:04:33.360 that it was backed by Google, OpenAI and
00:04:36.000 others among around the world. There are
00:04:38.880 so many oneliners that say what MCP is
00:04:42.720 as none of them is true. None of them is
00:04:44.880 accurate. But allow me to do my attempt.
00:04:47.600 MCP is something that standardizes the
00:04:49.919 way of providing providing additional
00:04:52.000 context for LLMs and that additional
00:04:54.720 context means also dynamic real world
00:04:57.759 up-to-date current context.
00:05:00.400 So knowing what MCP is let's take a look
00:05:03.280 at the architecture of a system using
00:05:05.520 MCP. So the central piece is called MCP
00:05:08.479 host. It's the userfacing application
00:05:10.720 like your chat GPT or cloud your Google
00:05:13.600 AI studio.
00:05:18.000 The host application communicates with
00:05:20.720 uh LLM using prompts and responses as we
00:05:23.600 all know and love. On the other hand,
00:05:26.080 MCP servers provide additional context.
00:05:30.479 This context is either provided by over
00:05:33.039 HTTP which we're going to do today or if
00:05:36.000 MCP server runs on the same machines as
00:05:38.560 MCP host it can be provided over a
00:05:41.120 standard input output but not that's not
00:05:43.840 today's subject. MCP host, the central
00:05:46.720 piece of this architecture, fetches
00:05:48.800 context from MCP servers using MCP
00:05:51.759 clients libraries. And whenever it sends
00:05:55.199 uh a prompt, the prompt is enriched with
00:05:59.360 the context from MCP servers. We'll do
00:06:01.919 an exercise in a second. So I've said
00:06:05.680 that MCP servers expose context so many
00:06:08.960 times already, but what MCP context is?
00:06:11.840 What's this additional context is? Well,
00:06:14.560 context is built of so-called primitives
00:06:18.639 uh which in some all those primitives
00:06:21.039 add together and form this entire
00:06:22.880 context of a server. And there are a few
00:06:24.960 basic primitives. The first and foremost
00:06:27.600 are the tools. This is what got the
00:06:30.639 attention of people and got them into
00:06:33.280 MCP for the most part. Tools are
00:06:36.400 executable functionalities basically
00:06:39.280 what a server can do for you. So we can
00:06:42.000 for example forecast weather for a given
00:06:43.919 location or error date can list you can
00:06:46.720 list your trips can publish your article
00:06:49.520 whatever the server can do is exposed
00:06:52.560 within tools.
00:06:54.639 The next primitive primitives are
00:06:57.440 resources basically data images logs
00:07:01.280 entries files whatever is needed for
00:07:04.000 this addition for this additional
00:07:05.599 context for the LLM. And the last on
00:07:08.800 this list are prompts. So those are
00:07:12.000 standardized instructions
00:07:14.400 which MCP hosts get from server and
00:07:18.160 shows to the user. So the user can
00:07:20.639 choose a kind of recipe part of
00:07:22.880 conversation.
00:07:24.800 So knowing the primitives and the
00:07:27.759 architecture, let's go over a single use
00:07:30.319 case of uh MCP interaction between MCP
00:07:34.960 host LLM travel agency application and
00:07:38.639 weather forecast application.
00:07:42.560 So it all starts by enabling the
00:07:45.759 application right
00:07:48.479 during in initialization
00:07:50.880 the MCP host fetches MCP MCP primitives
00:07:54.800 from the servers. So first of all from
00:07:57.120 travel agency MCP server and from the
00:07:59.680 water forecast MCP server we get tools
00:08:02.160 we got resources and now they are all
00:08:04.240 loaded into host.
00:08:06.879 Here comes user saying, "Book me a
00:08:10.080 romantic European trick. Just make sure
00:08:12.479 the weather is good." So we take that
00:08:14.879 prompt. The MCP host takes that prompt.
00:08:17.440 Tells takes all the tools and maybe
00:08:19.919 resources and sends to LLM. Now LLM
00:08:23.120 responds doesn't respond with I don't
00:08:25.280 know what you mean. Responses with a
00:08:27.440 tool call saying list romantic trips.
00:08:30.160 This comes back to MCP host and MCP host
00:08:32.719 ask MCP server the travel industry one
00:08:35.360 to list all the trips. Now with this
00:08:39.519 list of trips we go back to asking LLM.
00:08:44.320 We take the initial prompt the initial
00:08:46.720 response from LLM and the response from
00:08:48.880 the server and all the tools and we send
00:08:50.959 it once again to LLM. Now it has
00:08:54.320 additional context. With this additional
00:08:57.120 context, LLM responses with three tool
00:09:00.240 calls requests for checking weather in
00:09:02.959 three different cities at a given date.
00:09:08.000 So MCP host ask the MCP server three
00:09:11.279 times for the weather forecast.
00:09:14.640 Having this information, all the list of
00:09:17.040 the list, the initial prompt, the list
00:09:19.040 of the trips and the weather forecast,
00:09:21.120 we send it once again to LLM. And
00:09:23.279 finally, LLM answers with a tool call of
00:09:26.240 for booking actual trip to Barcelona.
00:09:30.560 The example ends here.
00:09:33.200 But can you see the magic already?
00:09:37.839 For me, the ability ability to control
00:09:41.440 applications using plain language and
00:09:44.160 having LLM doing all the complex
00:09:46.399 multi-step procedure logic is just pure
00:09:49.440 awesome.
00:09:51.760 One additional thing, the LLM within
00:09:54.880 this conversation has shortterm memory
00:09:57.920 of whatever it was was done before.
00:10:02.399 So
00:10:03.920 how can it be how can we build such an
00:10:06.880 AI ready website? First of all, we need
00:10:10.320 a new age framework, right? So let's use
00:10:14.240 this one. It's as upto-date as ever.
00:10:19.440 And let's today recreate the most famous
00:10:24.160 Rails application ever.
00:10:30.000 Let's once again build the blog engine,
00:10:33.839 but this time let's also make it AI
00:10:37.519 native and ready. So it all starts with
00:10:40.800 Rails new.
00:10:45.519 It would be the best to have an option
00:10:47.360 within Rails framework just to put it in
00:10:50.240 MCP mode.
00:10:52.959 But we don't need the framework to
00:10:54.800 provide a single recipe. We have
00:10:56.560 templated templating engine. So I just
00:10:59.519 apply a template which adds a few
00:11:02.480 additional things to the the framework.
00:11:04.560 We add the official Ruby SDK for model
00:11:06.959 context protocol. We add additional
00:11:09.200 route. We we add additional controller
00:11:11.360 and some application some uh some
00:11:13.519 configuration. And we'll go over that in
00:11:16.399 just a few slides.
00:11:19.120 So what I applied is this repository.
00:11:21.440 This is a template. It's of of course
00:11:23.040 available to you as well and will be
00:11:24.560 linked uh within this uh QR code
00:11:27.839 throughout the presentation on on
00:11:29.600 multiple slides. So what it adds it adds
00:11:32.800 of course route. It adds a controller
00:11:35.200 with a small fix because I needed it for
00:11:38.079 some of the MCP host applications. And a
00:11:41.519 big part of the application that we're
00:11:43.760 going to build, you know the how to
00:11:45.600 build a blog engine, right? You scaffold
00:11:47.440 application record. We're going to do
00:11:49.040 the same. However, what the template
00:11:51.680 does, it additionally scaffold tools as
00:11:54.880 you scaffold application record. So
00:11:58.079 again, I had to extend the scaffold
00:11:59.839 controller generator uh with some
00:12:02.240 additional templates for the tools. And
00:12:05.279 well not all tools have to come from uh
00:12:07.440 from scaffolding application record or
00:12:10.240 even shouldn't. So we have uh MCP MCP
00:12:13.839 tool generator we're going to use later
00:12:16.480 on as well. So we have we had Rails new.
00:12:20.639 Now let's start the server.
00:12:23.839 So we start just classic classical
00:12:25.920 classical Rails server. Nothing new in
00:12:28.240 here. Let's open it. Yeah, it works. But
00:12:31.680 apart from this, we can run another
00:12:33.839 program. It's called MCP inspector. Once
00:12:37.519 you start building MCP, you're going to
00:12:39.600 use it for sure. You can validate your
00:12:41.920 servers. You just put URL of our new
00:12:44.639 server/MCP.
00:12:46.240 We select the HTTP HTTP method of
00:12:48.720 transport and we hit connect. And guys,
00:12:52.160 we are connected.
00:12:54.399 There are no tools, no prompts, not
00:12:56.720 whatever. But just having our Rails
00:12:59.839 server as MCP server out of the box
00:13:03.600 seems promising.
00:13:07.360 To follow the classic story of the block
00:13:11.360 application, we should now scaffold
00:13:13.360 posts. So let's do it again. Almost
00:13:17.519 nothing new in here. We have we hit
00:13:19.760 rails g scaffold. A post has a title and
00:13:23.839 has some probably a body. We run this
00:13:27.519 scaffold and we can see additional files
00:13:30.320 generated. So we have a tool for each
00:13:33.040 CRT action.
00:13:35.600 Let's just uh run the migration
00:13:41.120 and let's see
00:13:46.639 there's nothing nothing new in here,
00:13:48.399 right? We just need to create one post
00:13:50.160 for future reference.
00:13:55.519 Once it's ready, let's review scaffolded
00:13:58.880 MCP tools. With the template comes a
00:14:03.199 very simple rake task that lists all the
00:14:05.839 tools defined within Rails. So again, we
00:14:08.880 have a tool for each uh for each CR
00:14:11.519 action of post. So uh each tool comes
00:14:14.800 with description and some input schema.
00:14:19.600 We can also
00:14:21.680 see those tools in MCP inspector. So
00:14:24.320 let's do that.
00:14:27.760 Let's connect once again. And now when
00:14:30.639 if we go to tools and we list them, we
00:14:32.959 can see all the tools available. Let's
00:14:35.120 start with indexing. It lists the last
00:14:38.560 10 posts.
00:14:41.040 Let's update one.
00:14:43.920 It feels like API, right? It's just
00:14:46.800 looks like a normal post normal form,
00:14:50.160 normal race form and API. But in fact,
00:14:53.199 it works over MCP.
00:14:58.000 Okay, updated.
00:15:01.360 Let's go. Let's go forward. So, here's
00:15:04.160 one of the tools generated from the
00:15:06.000 scaffold is a post create tool. You can
00:15:09.040 see all the properties that we defined
00:15:11.600 for active record and some basic logic.
00:15:15.120 It just pretty much runs post new and
00:15:19.519 post save. It handles the basic uh basic
00:15:23.360 errors as well.
00:15:26.399 But the most famous application doesn't
00:15:28.399 end here. We should now scaffold
00:15:30.560 comments. So let's do that again. We
00:15:33.760 just run rails generate scaffold. And a
00:15:37.519 comment references a post and has some
00:15:40.480 context. Uh context content. Yeah.
00:15:47.839 Just like before, the tools are
00:15:50.000 generated alongside the the model.
00:15:54.399 Once we run migrations, we can also run
00:15:57.519 the same rake task with MCP tools.
00:16:02.399 Now you can see both tools for posts and
00:16:05.360 for comments.
00:16:08.720 Again for every CR action
00:16:13.440 we can review some of the some of the
00:16:15.600 created scaffolded uh tools but you can
00:16:19.759 see this one is for creating a tool uh
00:16:21.920 to creating a comment you can see post
00:16:24.240 ID because to create a comment we need
00:16:27.920 this post ID. So this scaffolding works
00:16:30.480 in here as well. And for listing
00:16:33.120 comments, we can provide post ID
00:16:35.600 property to filter by a comment which
00:16:38.560 might come in handy for the later usage.
00:16:41.440 And the last but not least, showing a
00:16:43.600 single tool, a single comment, sorry.
00:16:46.000 You just need to provide an ID and you
00:16:48.480 can you can run it.
00:16:51.600 Now hot wire wasn't in the original
00:16:54.320 application but well there was no hot
00:16:57.279 wire at all back then but I want to show
00:16:59.839 it through hotwire so that you can see
00:17:02.240 the power that you can get in production
00:17:04.559 as well. So what I'll do is I'll put at
00:17:10.079 the post index endpoint I'll just ch
00:17:14.160 change it and I'll add a post stream.
00:17:17.439 It's going to be fast forward and I'll
00:17:19.679 create a single partial to list all the
00:17:22.959 posts with all the comments in one
00:17:25.919 partial one view.
00:17:28.000 uh I'll just make sure post has comments
00:17:30.240 and I will make sure that whenever a
00:17:32.240 post changes it will be broadcasted to
00:17:34.799 the post stream
00:17:37.760 and I want to make sure that post
00:17:40.080 updates when a comment updates and I
00:17:42.720 exposed all the post with comments at
00:17:45.840 the route at the uh at the main uh route
00:17:50.240 and that's it added hot wire quickly
00:17:52.160 we'll use it later on so now it's time
00:17:54.720 to use our MCP server with an LLM LM
00:17:57.440 host with an LLM application. There are
00:18:01.280 many LLMs applications that we can use
00:18:03.679 and there are many LLMs applications
00:18:05.760 with uh any many MCP hosts that could
00:18:09.280 connect to a local host server
00:18:13.280 but those are mostly developer tools
00:18:15.679 like cloak like corser or maybe not
00:18:20.000 developer tool but a more niche tool
00:18:22.400 like goose for example maybe some of you
00:18:25.200 use that
00:18:27.600 but I wanted to show you the production
00:18:30.799 value some this element of showing this
00:18:34.480 to your mom and so that she can say it's
00:18:37.120 great right not a developer tool so I've
00:18:39.840 chosen cloud desktop however to run our
00:18:44.400 server in cloud desktop
00:18:47.280 we need a public URL and we need a
00:18:50.240 secure connection that would be a
00:18:53.039 problem if we didn't have rails right so
00:18:57.120 a quick deployment All I've done updated
00:19:00.559 the deploy ammo. I already had a domain
00:19:04.000 which is my wedding anniversary
00:19:06.799 and a VM at digital ocean. I just
00:19:09.039 updated camel configuration. This is all
00:19:10.960 of it. And sub pushed my change to
00:19:14.880 GitHub and run camel setup.
00:19:19.200 Within seconds, well, barely minutes,
00:19:26.799 it's deployed to production. And now
00:19:29.840 it's showtime.
00:19:32.240 So this is our page in production.
00:19:35.440 I open clo desktop, sorry. And I ask it
00:19:39.039 to write a post.
00:19:42.480 This time about a weird animal. And
00:19:46.799 of course it does
00:19:48.960 and not through the MCP server because
00:19:51.280 we haven't connected that yet. So let's
00:19:54.080 do it right now. We open configuration.
00:19:57.120 We go to manage uh connectors
00:20:01.840 and we add a custom one. So we put it as
00:20:06.400 block. We put the address
00:20:12.960 slashmcp of course and now it's
00:20:16.799 connected.
00:20:18.880 We can see all the tools that we've
00:20:21.360 created so far.
00:20:26.799 Let's ask it again.
00:20:29.919 This time create three short posts about
00:20:35.360 interesting animals.
00:20:41.520 Now you can see it actually runs one of
00:20:43.840 our tools.
00:20:46.640 Here it is. We have a first post about
00:20:49.280 an octopus. The second
00:20:55.039 about an I I whatever that that could be
00:21:00.480 should be interesting.
00:21:03.120 And about a shrimp. This is real time.
00:21:05.760 So, it's one to one real real time
00:21:09.440 just pre-recorded. Let's comment on the
00:21:13.360 post, but make it let's make it a bit
00:21:15.520 more difficult. Let's comment on two
00:21:17.840 posts at the same time. So, let's
00:21:19.919 comment on the post about the octopus
00:21:21.520 and about the shrimp.
00:21:25.039 Again, it uses the tool that we've
00:21:27.200 provided.
00:21:28.880 And here we have it.
00:21:33.600 Here we have it as well.
00:21:36.080 As no one knows what II is, let's delete
00:21:38.799 this post.
00:21:46.080 You can see that it remembers which post
00:21:48.400 it is because once it was created, the
00:21:51.360 LLM remembers the idea of that well
00:21:54.480 through the through the protocol.
00:21:57.120 And let's update one of the comment.
00:21:59.200 Let's make it more intense
00:22:01.679 or how I call it LinkedIn ready.
00:22:11.919 Yeah. Yeah. Yeah. Yeah. Here it is.
00:22:15.840 All right.
00:22:18.080 So guys, that's how you turn your rail
00:22:21.440 server into MCP1 in five minutes.
00:22:25.919 But should MCP tools be CRAT?
00:22:30.159 Well, no.
00:22:32.640 But actually
00:22:35.200 the magic of Rails began with CRAT
00:22:39.760 to reach IPO ready applications.
00:22:43.600 Let's allow let's allow ourselves to go
00:22:47.120 through that same path. Let's learn MCP
00:22:51.120 through simple tools so we can later on
00:22:54.720 model a more bigger more complex
00:22:58.000 functionality.
00:23:01.039 So the tools in general shouldn't be
00:23:03.520 CRUD only. You should actually aggregate
00:23:06.480 bigger functionalities into tools when
00:23:08.799 you want to build more complex systems.
00:23:12.000 But let's start with CRT and learn as we
00:23:16.720 go.
00:23:18.640 However, if you reach this point where
00:23:20.400 you actually want to build your own
00:23:22.480 bigger tools, let's show let's uh allow
00:23:25.360 me to show how it's done. So, we have
00:23:29.200 yet another generator,
00:23:31.520 a generic one called MCP tool generator.
00:23:34.400 We just write Rails G MCP tool
00:23:39.360 check weather tool. We can also provide
00:23:41.760 parameters because tools can have
00:23:44.000 parameters. And that's it. We get a
00:23:46.240 single file. This is how it looks one to
00:23:49.280 one generated from the scaffold. All we
00:23:52.320 need to do is put our logic
00:23:55.760 in here. I'm using a API. So I get the
00:23:59.760 weather from third party service.
00:24:05.760 All right, let's see in it action. I've
00:24:08.960 deployed it again. So now it's available
00:24:12.559 for the cloud desktop as well. And let's
00:24:15.679 write one more post. This time let's
00:24:19.200 compare the weather at two Railsword
00:24:22.640 venues in Amsterdam and in Toronto.
00:24:29.120 So what it does at first it asks for the
00:24:32.240 weather the current weather in
00:24:33.840 Amsterdam.
00:24:35.760 As next step of course checks the
00:24:37.679 weather in Toronto, Canada. And now we
00:24:40.880 write the post.
00:24:45.120 It's still going.
00:24:49.360 Here we have it. The tail of two cities.
00:24:55.520 And we are ready. We generated
00:24:58.000 application, scaffolded models and
00:24:59.840 tools, deployed with Camal and used a
00:25:03.120 customerf facing application cloud code.
00:25:07.679 So why is so easy?
00:25:11.279 I'd say it's about flexibility,
00:25:13.679 flexibility of Ruby on Rails and thanks
00:25:16.480 to the giants of the community. So,
00:25:18.159 open-source software maintainers. I I
00:25:21.200 couldn't thank enough the creator of
00:25:23.760 fast MCP, Action MCP, and Ruby MCP
00:25:26.960 client as well. I've spent hours if not
00:25:30.159 days talking to them so that they they
00:25:32.960 taught me what what MCP is and how it
00:25:35.919 interferes with how it interacts with
00:25:38.080 Ruby and Rails. And of course the
00:25:41.440 official Ruby SDK
00:25:44.480 uh is maintained by yet another team and
00:25:47.440 this is in fact the official Rub the
00:25:49.360 official MCP Ruby SDK is what powers the
00:25:52.080 template that I've showed you. So big
00:25:53.760 thanks to them as well.
00:25:56.080 So what's next? Of course we we are just
00:26:00.320 playing around with a blog application.
00:26:02.559 But what comes next is authorization.
00:26:05.600 MCP says use O. But well rolling out O
00:26:12.159 is something for the entire application
00:26:14.799 not for a template of MCP.
00:26:17.679 And of course there are many different
00:26:19.200 primitives. I also told you about
00:26:21.120 resources and prompts, but there are
00:26:23.279 more like uh completions or sampling and
00:26:26.240 more, but I leave it as an exercise to
00:26:28.559 you to add to raves. I promise it's
00:26:31.120 going to be fun.
00:26:35.039 Before I end, I have probably a
00:26:37.840 confession to make because I promised a
00:26:40.240 presentation about MCP. But how I've how
00:26:44.720 I see this presentation, it's not really
00:26:47.360 about MCP, but it's about the Rails
00:26:50.559 framework itself.
00:26:52.880 Because Rails is ready for AI by
00:26:57.279 default. All it took was adding a single
00:27:01.120 gem and a single template which isn't
00:27:04.240 that big and we are kind of by design
00:27:07.279 ready for AI and no matter whether it's
00:27:10.640 MCP or any other protocol
00:27:13.600 just just with a bit of creativity you
00:27:16.960 can put it in Rails and make it as easy
00:27:20.320 as you've just think just seen because
00:27:24.159 with Rails we have all the tools that we
00:27:28.480 Just
00:27:30.320 just stay creative,
00:27:33.039 please.
00:27:35.360 It's more fun to be creative.
00:27:38.480 Thank you.
Explore all talks recorded at Rails World 2025
+19