convez.ai
MCP ServerDevOps & InfraestruturaIntermediário
6temes

Rails Informant

6temes/rails-informant

Monitoramento de erros Rails nativo para agentes de IA, self-hosted e sem dashboard

Ver no GitHub
BomPluginScore · de 0 a 100

Monitoramento de erros self-hosted para Rails integrado com servidor MCP, permitindo que agentes de IA consultem, analisem e corrijam erros em produção diretamente. Captura exceções automaticamente via Rails.error e middleware Rack, armazenando contexto rico (stack traces, breadcrumbs, dados de requisição) no banco de dados da aplicação.

Instalação

$npx convez-ai 6temes/rails-informant

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
7
Forks
1
Acompanhando
0
Saúde
42%
Último commit
há 1 dia
Versão
v0.8.1
Issues abertas
1
Contribuidores
2

Casos de uso

  • Agentes de IA triagiem e corrijam erros em produção automaticamente
  • Monitoramento de erros mantendo dados sensíveis na infraestrutura interna
  • Integração com fluxos de IA para análise e resolução de falhas

Veredito

Solução pragmática e bem pensada para Rails: captura automática de erros com contexto rico, orientada para workflows agentic sem overhead desnecessário. Excelente para times que querem observabilidade self-hosted integrada com Claude/agentes IA.

README

A tradução para o português deste README ainda está na fila.


Captures exceptions, stores them in your app's database with rich context (backtraces, breadcrumbs, request data), sends notifications, and exposes error data via a bundled MCP server -- so AI agents can query, triage, and fix production errors directly.

No dashboard. The agent is the interface.

  • Agent-native -- 14 MCP tools let AI agents list, inspect, resolve, and fix errors without a browser.
  • Self-hosted -- Errors stay in your database. No external service, no data leaving your infrastructure.
  • Zero-config capture -- Automatic via Rails.error subscriber and Rack middleware. Breadcrumbs from ActiveSupport::Notifications provide structured debugging context.
  • Lightweight -- Two database tables, no Redis, no background workers beyond ActiveJob.

Quick Start

Add to your Gemfile:

gem "rails-informant"

Install:

bundle install
bin/rails generate rails_informant:install
bin/rails db:migrate

Set an authentication token:

bin/rails credentials:edit
rails_informant:
  api_token: your-secret-token  # generate with: openssl rand -hex 32

Install Claude Code integration:

bin/rails generate rails_informant:skill

Errors are captured automatically. To capture manually:

RailsInformant.capture(exception, context: { order_id: 42 })

Configuration

# config/initializers/rails_informant.rb
RailsInformant.configure do |config|
  config.capture_errors = !Rails.env.local?
  config.api_token = Rails.application.credentials.dig(:rails_informant, :api_token)
  config.slack_webhook_url = Rails.application.credentials.dig(:rails_informant, :slack_webhook_url)
  config.retention_days = 30
end

Every option can be set via an environment variable. The initializer takes precedence.

OptionEnv varDefaultDescription
api_tokenINFORMANT_API_TOKENnilAuthentication token for API/MCP access
capture_errorsINFORMANT_CAPTURE_ERRORStrueEnable/disable error capture
capture_user_email(none)falseCapture email from detected user (PII -- opt-in)
ignored_exceptionsINFORMANT_IGNORED_EXCEPTIONS[]Exception classes to skip (walks cause chain)
ignored_pathsINFORMANT_IGNORED_PATHS[]Request paths to skip (exact or segment match)
job_attempt_thresholdINFORMANT_JOB_ATTEMPT_THRESHOLDnilSuppress job errors until Nth retry
retention_daysINFORMANT_RETENTION_DAYSnilAuto-purge resolved errors after N days
slack_webhook_urlINFORMANT_SLACK_WEBHOOK_URLnilSlack incoming webhook URL
spike_protection(none)nilRate-limit per error group: { threshold: 50, window: 1.minute }
webhook_urlINFORMANT_WEBHOOK_URLnilGeneric webhook URL for notifications

Connecting the tokens: The api_token in your Rails credentials and INFORMANT_PRODUCTION_TOKEN must be the same value. The first authenticates incoming requests to your app; the second tells the MCP server what token to send.

Noise Suppression

Silenced Blocks

RailsInformant.silence do
  risky_operation_you_dont_care_about
end

Thread-safe via CurrentAttributes. Nesting is supported.

Before Record Callbacks

Hook into the recording pipeline to filter, modify fingerprints, or override severity:

config.before_record do |event|
  event.halt! if event.message.include?("timeout")
  event.fingerprint = "stripe-errors" if event.error_class.start_with?("Stripe::")
  event.severity = "warning" if event.error_class == "Net::ReadTimeout"
end

The event exposes: error, error_class, message, severity, controller_action, job_class, request_path, fingerprint. Callbacks that raise are logged and skipped.

Custom Exception Context

Exceptions implementing to_informant_context have their context merged into occurrences automatically:

class PaymentError < StandardError
  def to_informant_context
    { payment_id:, gateway: }
  end
end

Deploy Auto-Resolve

Notify Informant of a deploy to auto-resolve stale errors (not seen in the last hour):

curl -X POST https://myapp.com/informant/api/v1/deploy \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"sha": "abc1234"}'

Resolved errors automatically reopen on regression. Also available as the notify_deploy MCP tool.

MCP Server

The bundled informant-mcp executable connects Claude Code to your error data via Model Context Protocol.

Setup

The rails_informant:skill generator creates .mcp.json automatically. Set INFORMANT_PRODUCTION_URL and INFORMANT_PRODUCTION_TOKEN as environment variables (e.g., via .envrc + direnv).

For multi-environment setups, add env vars for each environment:

export INFORMANT_PRODUCTION_URL=https://myapp.com
export INFORMANT_PRODUCTION_TOKEN=<token>
export INFORMANT_STAGING_URL=https://staging.myapp.com
export INFORMANT_STAGING_TOKEN=<token>

Tools

ToolDescription
annotate_errorAdd investigation notes
delete_errorDelete group and occurrences
get_errorFull error detail with recent occurrences
get_informant_statusSummary with counts and top errors
ignore_errorMark as ignored
list_environmentsList configured environments
list_errorsList error groups with filtering and pagination
list_occurrencesList occurrences with filtering
mark_duplicateMark as duplicate of another group
mark_fix_pendingMark with fix SHA for auto-resolve on deploy
notify_deployNotify of a deploy to auto-resolve stale errors
reopen_errorReopen a resolved/ignored error
resolve_errorMark as resolved
verify_pending_fixesCheck deployed fixes and auto-resolve verified ones

Local Development

The MCP server enforces HTTPS by default. For local HTTP URLs, pass --allow-insecure:

{
  "mcpServers": {
    "informant": {
      "command": "informant-mcp",
      "args": ["--allow-insecure"]
    }
  }
}

Architecture

Development Machine                    Remote Servers
+-----------------------+              +-----------------------+
|  Claude Code          |              |  Production           |
|        |              |              |  /informant           |
|        | stdio        |              +-----------------------+
|        v              |  HTTPS+Token
|  MCP Server           | -----------> +-----------------------+
|  (exe/informant-mcp)  |              |  Staging              |
|                       |              |  /informant           |
+-----------------------+              +-----------------------+

Error Group Lifecycle

unresolved --> fix_pending --> resolved (auto, on deploy)
unresolved --> resolved (manual)
unresolved --> ignored
unresolved --> duplicate
resolved    --> unresolved [REGRESSION]

Data and Privacy

Occurrences store: user ID (always), email (opt-in via capture_user_email), IP address, and custom context. All context passes through ActiveSupport::ParameterFilter -- add keys to filter_parameters to suppress them.

RailsInformant::Current.user_context = { id: current_user.id }

Security

  • Token authentication (secure_compare), HTTPS enforced by default
  • All context filtered through ActiveSupport::ParameterFilter
  • Security headers: Cache-Control: no-store, X-Content-Type-Options: nosniff
  • Error capture never breaks the host application
  • No built-in rate limiting -- use Rack::Attack on /informant/

License

MIT License -- see LICENSE.


Ver o original no GitHub

Bom para

Relacionados