About Rubyhash
Rubyhash is a local MCP server for Ruby developers and coding agents. It compares Ruby hashes or test failure output, detects type changes, and converts Ruby literals to sorted JSON.
Key features
- 01Diff Ruby hash literals
- 02Parse Minitest and RSpec failure output
- 03Detect added and removed keys
- 04Report value and type changes
- 05Convert Ruby literals to sorted JSON
- 06Run locally without uploading data
Use cases
- 01Find differences in failing test output
- 02Inspect changes in nested hashes
- 03Convert Ruby data structures to JSON
MCP support
It exposes two tools to MCP clients: `ruby_hash_diff` for structured hash comparisons and `ruby_to_json` for converting Ruby hash or array literals to JSON. The server runs locally.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
2Saved tool list · updated 3w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| expected | string | No | Expected Ruby hash literal, e.g. {"role"=>"admin"} |
| actual | string | No | Actual Ruby hash literal, e.g. {"role"=>"editor"} |
| raw | string | No | Raw failing test output containing two hash literals (lines may be prefixed with - and +) |
Details
From the project READMErubyhash-mcp
MCP server for RubyHash. Gives any MCP-capable agent (Claude Code, Claude Desktop, Cursor, and others) two deterministic Ruby tools:
- ruby_hash_diff: compare two Ruby hash literals, or paste raw failing Minitest/RSpec output, and get a structured report of exactly what changed: changed values with before and after, added and removed keys, and explicit type changes (nil to String, Integer to Float, symbol keys vs string keys).
- ruby_to_json: convert a Ruby hash or array literal (hashrockets, symbol keys, shorthand syntax, nesting, nil/true/false) to clean JSON with sorted keys.
Everything runs locally in the server process. Nothing is uploaded, logged, or stored, the same privacy promise as rubyhash.dev.
Tools
ruby_hash_diff: Compare two Ruby hash literals, or paste raw failing Minitest/RSpec output, and get a structured report: changed values with before and after, added and removed keys, and explicit type changes (nil to String, Integer to Float, symbol keys vs string keys).ruby_to_json: Convert a Ruby hash or array literal (hashrockets, symbol keys, shorthand syntax, nesting, nil/true/false) to clean JSON with alphabetically sorted keys.
Why an agent would want this
When a Ruby test fails on two large nearly identical hashes, comparing them by reading is slow and error prone, for humans and for language models. A 40-key nested hash diff burns context and invites mistakes. This server does the comparison with a real recursive descent parser and hands back only the differences, deterministically.
Install
{
"mcpServers": {
"rubyhash": {
"command": "npx",
"args": ["-y", "rubyhash-mcp"]
}
}
}
Or for Claude Code:
claude mcp add rubyhash -- npx -y rubyhash-mcp
Example
Input (raw test output):
-{"uid"=>"[email protected]", "role"=>"admin", "seats"=>3}
+{"uid"=>"[email protected]", "role"=>"editor", "seats"=>3.0}
Output:
{
"equal": false,
"summary": "2 changed, 0 added, 0 removed, 1 type change",
"changed": [
{ "path": "role", "before": "admin", "after": "editor", "typeChanged": false },
{ "path": "seats", "before": 3, "after": 3, "beforeType": "Integer", "afterType": "Float", "typeChanged": true }
]
}
Also available as an HTTP API
If you cannot run a local MCP server, the same tools are exposed at the RubyHash Agent API, with an OpenAPI description and an x402 machine-payable catalog.
Development
npm install
npm test # 36 unit tests
License
MIT for this package. The rubyhash.dev site and its browser tool are separate, private, and all rights reserved.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.