Purpose
rails-mcp is a self-hosted, caller-configured default-deny action registry that also provides an append-only spend-intent ledger and a CLI-only human sign-off audit trail, exposed as MCP tools. Its positioning is governance and safety, namely "preventing agents from performing irreversible operations without anyone noticing," which differs from the development-tool category to which the author's other six MCP servers (mcp-factory, rag-mcp, bus-mcp, desktop-mcp, github-mcp, discord-mcp) belong. The project was ported and generalized from an internally running registry (shared/rails/, 31 tests, running in a multi-bot cluster since 2026-07-06).
Main capabilities
- Default-deny classification: Provides a schema and pure logic that classifies an action_type string as unconditionally GATED (default deny), regardless of whether it is registered.
- Action registry: Can register the current execution information for an action type (enforcement_layer, enforcement_pointer, ceremony); it is informational only and never signifies permission.
- Spend-intent ledger: An append-only record of spend intents, paired with rolling-window budget checks.
- Human sign-off ledger: An append-only record of sign-offs, recording who approved the registry's current hash and when they approved it.
- Six mostly read-only MCP tools: None of them can write to the sign-off ledger.
Core invariant
classify_action(action_type) always returns "GATED", regardless of whether it is registered and regardless of what configuration is loaded; no parameter or configuration field can change this result. This is the core of the entire product. classify() in registry.py accepts only one action_type parameter, and there is no parameter that would let the caller make it return a permissive result. is_action_registered answers a different, purely informational question—"Do I know the execution information for this action type?"—and never feeds back into the GATED determination.
Usage
Add the following to the MCP configuration of Claude Desktop/Code:
If there is no console script in PATH, you can fall back to "command": "python", "args": ["-m", "rails_mcp"].
By default the registry is empty-loaded (honestly empty, not fail-open—classify_action remains unconditionally GATED for everything). It can be pointed at your own action type configuration:
For the configuration shape, see examples/rails.config.example.yaml (or .example.json).
The configuration file supports YAML or JSON, and supports either the full form or the compact three-element form (consistent with the internal registry's native shape). JSON usage is the same ({"actions": {"deploy_prod": [...]}}). enforcement_layer should be filled in honestly rather than ideally; "prose" (no structural guardrails yet, only documentation) is a legitimate and correct value.
Installation/connection: register it as a stdio server under mcpServers.rails-mcp in ~/.claude.json, invoking run_server.py via an absolute path (no cwd needed—the entry point adds its own directory to sys.path), or after installing from PyPI use it via the rails-mcp console script. The handshake check prints the names of the six registered tools without starting any transport.
CLI sign-off boundary
append_signoff—the function that records human approval of the registry's current hash—is deliberately not an MCP tool, and never will be. It is exposed only as a CLI command that a human runs manually:
Reason: this boundary exists to prevent an agent that holds only this server's MCP tool connection from self-approving irreversible actions. If append_signoff were accessible as an MCP tool, any agent holding a connection to this server could sign its own registry, silently destroying the sole purpose for which this boundary exists. This echoes the internal design rule followed by the original shared/rails/ implementation: the channel that builds the auditor never signs the registry it delivers. An auditor that can sign is not an auditor.
This boundary is enforced structurally rather than merely by convention: server.py and routes.py never import or call append_signoff (proven by an AST-based check, not a simple string grep); the registered MCP tool set is exactly the six read-only-oriented tools described above, and there is no sign / append_signoff / revoke_signoff tools; behavioral tests drive every registered tool and confirm the signoff ledger file is never created; run_server.py (the entry point invoked by ~/.claude.json) imports only rails_mcp.server, never rails_mcp.cli.
What this boundary does not prove: the signoff ledger has no cryptographic tamper-evidence and is not bound to a real human identity—its integrity depends entirely on filesystem ACLs and the self-hosted deployment model, not cryptography. An agent (or anyone) with shell or file-write access to the ledger path can run rails-mcp sign itself, or append a forged {"type": "signoff", ...} JSONL line directly to the file—the ledger cannot distinguish this from a genuine CLI invocation. The MCP-only boundary only blocks the narrower case of an agent that holds solely this server's MCP tool connection; it is not proof that a human reviewed anything and should not be read as such.
When to use
Suited to scenarios requiring governance and safety control over irreversible agent actions, such as setting a default-deny gate before high-risk actions like production deployments and spending, while retaining auditable spend intents and human signoff records.
Limitations
- Not an enforcer. classify_action returning GATED does not itself block any action; you must wire it into a PreToolUse hook, permission deny list, or CI gate yourself.
- record_spend_intent only records spend intent; it never calls vendors, paid APIs, or brokers, and does not prevent over-budget spending from occurring.
- Ships no action-type data; every adopter must supply their own registry (a YAML/JSON config file or a plain dict).
- Not multi-tenant. The signoff ledger assumes one operator string per registry; acceptable for v1, a known limitation going forward.
- No actual enforcement mechanism: no git hooks, no settings.json deny rules, no graduation gate.
- Does not include a coverage auditor; cannot check whether a given enforcement mechanism actually enforces what the registry claims.
- Does not support multi-tenant/multi-operator signoff; v1 has one operator string per ledger.
- Does not prevent over-budget spending; evaluate_budget only produces numbers, it does not intercept calls.
- The ledger has no rotation/cap; record_spend_intent appends permanently, with no rotation, size cap, or archiving.
Tests and CI
106 tests, all hermetic (every ledger/config path is isolated via tmp_path and an autouse environment-isolation fixture in tests/conftest.py; the real ./rails_data/ is never touched). No network, no live smoke gate required. CI (.github/workflows/ci.yml) runs the suite on every push/PR, and the build fails if the Tests badge does not match the actual report.
Commercial support
Maintained by Jaimen Bell. For production MCP integration, agent governance guardrails, or agent reliability work, see jaimenbell.dev. For building your own MCP server, see the MCP Starter Kit.
mcp-name: io.github.jaimenbell/rails-mcp