Seeing MCP From the Inside: An Inspector, a Warm Rails Process, and the Problem of Too Much Context

Open on YouTube ↗
Overview

Enrique Mogollan, a software engineer at Handshake, says that a year ago MCP seemed to be everywhere: in the editor, in the agent harness, in the chat. They could recite the one-line definition: MCP is how an agent pulls data from an external source into the context window without you typing it or stuffing it into the prompt. But they admit they didn't really understand how it worked or how it would benefit them. Their answer was to build things. First came an MCP inspector written in Ruby. Then came an MCP server for Rails called Coatepec. Most recently they began exploring MCP apps. Running through the talk is one argument: what you return to an agent matters as much as whether you can return it, and less context often works better.

11 min read
2:39

Night Navigation as a Framing Device

Mogollan opens with a story from home. They grew up in San Miguel de Allende, in central Mexico. Travel magazines praise its cobblestone streets and colonial architecture, but they rarely mention the semi-desert and mountains that surround it. Mogollan spent weekends there as a Boy Scout, and one activity was the navigational challenge. Scouts were dropped at a point with a map and told to reach a destination with no GPS and no phone. That wasn't a rule, they note; those things just didn't exist yet.

During the day the challenges were manageable. You found a landmark such as a hill, a church, a radio tower, or the odd tree everyone used as a marker, and you oriented the map to it. Then someone proposed doing the challenges at night, without a compass, using only a constellation map and the landmark map. Mogollan says they got lost constantly. The hard part was working out which cluster of dots in the sky matched the dots on the page. That feeling of matching dots to symbols is how they describe their first look at raw MCP messages going through an inspector, and the metaphor comes back throughout the talk.

4:32

Building an MCP Inspector in Ruby

Anthropic maintains an MCP inspector in Node with hundreds of contributors. Mogollan built one in Ruby anyway, simply to see what this MCP thing was. They had given a talk on it the previous year, and here they pull out two points from that work.

The first is transport. MCP has two transport methods. Standard input/output (stdio) works well for local development and local servers that you connect directly. Streamable HTTP combines standard HTTP with streaming over HTTP. It replaces the earlier HTTP-with-server-sent-events approach, which has been deprecated.

The second is that every message is JSON-RPC. As a result, every conversation between client and server has the same basic shape.

The demo follows the inspector's flow against a filesystem MCP server. The client initializes the connection, lists what the server offers (tools, resources, and prompts are MCP's three primitives), and then calls one. The inspector shows the request as pretty-printed JSON on top and the raw JSON underneath. Mogollan's point, delivered as a joke, is that everyone in the room has now seen raw messages pass between an MCP server and client.

They also highlight how much data is involved. The filesystem server exposes a long list of items, and each comes with a JSON schema describing how to use it. When you execute a tool, the JSON response returns a lot of headers along with the result.

7:41

Tokens as Stars, Context as Sky

Back to the night sky. Mogollan argues that points of light are a reasonable picture of how transformer-based models represent language. Each token becomes a vector with thousands of dimensions, which people can't picture. So they flatten it to two dimensions, draw it as a dot, and, "because it's Rails World," make it a star.

In this picture, related tokens cluster together. "Ocean" and "tide" sit close; "ocean" and "tax return" sit far apart. The distance carries meaning, and that mechanism is what lets you find an email from a vague memory of something written ten years ago. The sky is infinite, but you only see part of it at a time; that part is the context window. Lining stars up into a constellation is attention, which you need to find your way: locate Dubhe and Merak to find Polaris, and you have north. Their map of the analogy: stars are tokens, the visible sky is the context window, constellation lines are attention, and MCP is how you put more stars into the sky.

10:11

The Real Problem: Slow Boots and Light Pollution

The practical motivation came from a Rails upgrade at work, where Mogollan ran the test suite around 50 times a day. They show a reproduction. They downloaded the RubyEvents app, ran bundle install, and asked an agent to run the tests. One request produces a lot of output. Sometimes the agent has to bundle install first. Sometimes it shows an error, and sometimes it prints deprecation warnings and other noise.

Two problems stood out. First, every test run spent about eight seconds just booting Rails before a single spec ran. Second, all the output kept flowing into the agent's context. Mogollan calls this "light pollution": the stars are still there, but you can no longer pick them out. That led them to ask whether the agent needed all of that data in its context. Their conclusion was no; it needs only the part that matters.

11:56

Coatepec: A Warm Rails Sidecar

The result is Coatepec, an MCP server that Mogollan says helps them work faster. They are careful to say this isn't a performance talk. It uses the same protocol, tools, and resources seen in the inspector. What differs is what comes back in the responses.

Coatepec runs as a sidecar process that keeps a warm instance of the Rails app. The agent talks to the Coatepec server with requests like "run this test," "give me the routes," or "tell me about the User model." Because Rails is already loaded, these return in milliseconds instead of waiting the eight-second boot.

In the inspector, Coatepec exposes only seven tools. The one Mogollan considers most important runs specs. Its only parameter is which test to execute, and it returns a small piece of JSON. In an agent demo, they ask for a similar test run on RubyEvents. The agent calls Coatepec, and the expanded call shows a compact JSON result. Mogollan points out that because the response was small and well formatted, Claude chose on its own to present the results as a table. They hadn't asked for one.

14:10

Inside the Implementation: Locks, Worktrees, and Fork vs. Spawn

Mogollan walks through the code. The spec-running tool calls a worker manager, which dispatches the run, and dispatch goes through a lock's synchronize. The lock exists to support worktrees, so Coatepec can run several times in parallel. Each new Coatepec process duplicates the database connection, so every process has its own.

The bigger lesson involved process creation. Mogollan works on a Mac, where, as they describe it, the preferred way to start a new process is spawn. They found spawn as slow as running bin/rails directly. A chart shows the spawn approach tracking the bin/rails baseline. The performance gains only appeared after they switched to fork.

15:37

Cutting Tokens by 90%

Speed alone didn't satisfy Mogollan. They also wanted the output to be better and more token-efficient. Across several versions of the gem, they report reducing token consumption by 90%. They describe the method as ordinary engineering work: trimming the JSON headers, dropping full error paths, and reporting just which tests passed and which failed.

15:59

The Sub-Agent Experiment

They also tried using sub-agents. The plan was to ship a skill telling the agent to always run Coatepec through a sub-agent. It worked, but with a caveat. You do save tokens in the main context window. Each sub-agent, though, needs setup, and that setup ends up burning more tokens overall. Mogollan's takeaway is that unless you have unlimited tokens, you're better off not using sub-agents for this. They say they didn't expect that result.

16:55

What Coatepec Does and Deliberately Doesn't Do

A final chart compares operations. Model and route lookups are, in Mogollan's words, basically instantaneous. Spec runs take longer but remain faster than going through bin/rails. The main tools are a Minitest-compatible spec runner, a model inspection tool, and a routes query tool, and Rails engines can be included.

They stress the limits too. Coatepec has no eval, no console, and no raw SQL, and you cannot open a console through it. It is intended for development, not debugging.

The name comes from Coatepec, a mountain town in the Mexican state of Veracruz that grows one of Mogollan's favorite coffees. They were drinking it when they came up with the idea for the gem.

18:14

MCP Apps: Getting the Whole Constellation

The last section returns to an inspector, this time Anthropic's Node version, which now supports MCP apps. Mogollan points to a new UI element. As they explain it, MCP apps, which they describe as the first official MCP extension and the direction MCP is heading, let a tool declare that an interface is available. When it is, the server returns HTML meant to be placed in an iframe. That HTML includes styles and JavaScript, and the iframe can access all the tools the MCP server provides.

In their metaphor, you no longer get one star; you get the whole constellation. An MCP app is like an augmented-reality map you hold up to the sky that shows you which way to go.

The demo is a card for a coffee place. Each time Mogollan changes something in the card, it sends data to the MCP server, and the server can send back an animation. They emphasize that although the page is a Rails application, the card is not rendered by Rails. It is an MCP app embedded in the page. The setup is short: an iframe that allows scripts, an MCP client, and a call to a tool called "get coffee place card," whose returned resource supplies the content.

Mogollan anticipates the objection: we already have APIs and direct database access, so why do we need this? Their answer is that MCP is built for agents. They show the same interface working inside an agent chat. They change the rating and their favorite beverage, and a five-star rating triggers the animation, all within the chat window.

Curiosity and Learning From Mistakes

Mogollan ends by returning to the scouts. They were bad at navigation challenges: they got lost, ran out of water, and as a leader took their team the wrong way, through the hardest terrain, more than once. Over time they improved, and even learned trigonometry to read maps and estimate how far the team still had to walk.

They see the same two traits behind the work in this talk. Curiosity led to the MCP inspector. A willingness to learn from mistakes drove the iterations on Coatepec. That same curiosity is now pushing them toward MCP apps, which they present as the next thing to explore rather than a finished project. They close by saying they're curious to see what the audience will build with these tools, because "the sky is no longer the limit."