Myrr — Agent-friendly content for your Rails app

myrr-rb is the Ruby/Rails client for Myrr, a protocol that makes web content natively accessible to AI agents.

Myrr Port

Myrr Port is the default, zero-configuration mode of myrr-rb. It adds agent-friendly markdown responses to your Rails app without a Go server, a database, or any configuration.

What it does

  • Counts tokens on every text/markdown response
  • Adds an X-Token-Count header so agents know the size of your content
  • Works alongside normal HTML — browsers see HTML, agents see markdown

How it works

Rails 8.1 ships native markdown support: format.md in respond_to, .md.erb template resolution, and content negotiation via Accept: text/markdown, .md extension, or ?format=md. Myrr Port defers entirely to Rails for this — we just count the tokens.

For pre-Rails-8.1 apps, the text/markdown MIME type is registered automatically.

Getting started

  1. Add the gem to your Gemfile:
gem "myrr-rb"
  1. Run the installer:
rails generate myrr:install
  1. Create markdown views alongside your HTML views. For example, if you have app/views/articles/show.html.erb, create app/views/articles/show.md.erb:
# <%= @article.title %>

<%= @article.body %>
  1. Add format.md to your controller's respond_to block:
def show
  @article = Article.find(params[:id])
  respond_to do |format|
    format.html
    format.md
  end
end
  1. An agent requesting with Accept: text/markdown now receives:
Content-Type: text/markdown
X-Token-Count: 142

No configuration needed. Everything works out of the box.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests.

License

The gem is available as open source under the terms of the MIT License.