rails-informant 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +32 -22
- data/lib/generators/rails_informant/install_generator.rb +23 -12
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b66bd1a6283f2a349a57994f529a0b57b71053c979c874268283d97477928873
|
|
4
|
+
data.tar.gz: d17e62d7ba21318f94205d9365d293ce1110fe58e9c56b4c82cc0c334e4f65bf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cf7f02ec548bbd755dc411b3f08a9a74807d45e333ccd3aedaf99b02be909ec4b4a046146ca913943dc41b88dc3e78cafcdf140163cdb1de2537c5d3f5a5b170
|
|
7
|
+
data.tar.gz: dd582dce1ccee4a3e6eaa3678c118416f9dff50afeafc00ad0a9a65a59e50760188541817f859d374f8aec5d139b5febb3024c54340b2b5fd98e36aa47fcfcf1
|
data/README.md
CHANGED
|
@@ -70,33 +70,28 @@ RailsInformant.capture(exception, context: { order_id: 42 })
|
|
|
70
70
|
|
|
71
71
|
End-to-end path for AI agents (Claude Code, Devin) to start triaging errors:
|
|
72
72
|
|
|
73
|
-
1. **Install the gem** -- follow [Quick Start](#quick-start) above
|
|
73
|
+
1. **Install the gem** -- follow [Quick Start](#quick-start) above. The install generator creates `.mcp.json` automatically.
|
|
74
74
|
2. **Set an authentication token** in your Rails credentials or env var:
|
|
75
75
|
```ruby
|
|
76
76
|
# config/initializers/rails_informant.rb
|
|
77
77
|
config.api_token = Rails.application.credentials.dig(:rails_informant, :api_token)
|
|
78
78
|
```
|
|
79
|
-
3. **
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"command": "informant-mcp",
|
|
85
|
-
"env": {
|
|
86
|
-
"INFORMANT_PRODUCTION_URL": "https://myapp.com",
|
|
87
|
-
"INFORMANT_PRODUCTION_TOKEN": "your-api-token"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
79
|
+
3. **Set env vars** for the MCP server (e.g., via `.envrc` + [direnv](https://direnv.net)):
|
|
80
|
+
```sh
|
|
81
|
+
# .envrc
|
|
82
|
+
export INFORMANT_PRODUCTION_URL=https://myapp.com
|
|
83
|
+
export INFORMANT_PRODUCTION_TOKEN=your-api-token
|
|
92
84
|
```
|
|
85
|
+
The MCP server process inherits environment variables from your shell, so `INFORMANT_*` vars set via `.envrc` (or any other method) are picked up automatically -- no need to inline them in `.mcp.json`.
|
|
93
86
|
4. **Install the Claude Code skill** (optional but recommended):
|
|
94
87
|
```sh
|
|
95
88
|
bin/rails generate rails_informant:skill
|
|
96
89
|
```
|
|
97
90
|
5. **Use `/informant`** in Claude Code to triage and fix errors, or let Devin handle them autonomously with the [Devin integration](#devin-ai).
|
|
98
91
|
|
|
99
|
-
> **
|
|
92
|
+
> **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.
|
|
93
|
+
|
|
94
|
+
> **Secrets hygiene:** `.envrc` contains secrets and should be in `.gitignore`. `.mcp.json` is safe to commit -- it only contains the command name, no tokens.
|
|
100
95
|
|
|
101
96
|
## Configuration
|
|
102
97
|
|
|
@@ -153,23 +148,21 @@ The bundled `informant-mcp` executable connects Claude Code to your error data v
|
|
|
153
148
|
|
|
154
149
|
### Setup
|
|
155
150
|
|
|
156
|
-
|
|
151
|
+
The install generator creates `.mcp.json` for you. To set it up manually:
|
|
157
152
|
|
|
158
153
|
```json
|
|
159
154
|
{
|
|
160
155
|
"mcpServers": {
|
|
161
156
|
"informant": {
|
|
162
|
-
"command": "informant-mcp"
|
|
163
|
-
"env": {
|
|
164
|
-
"INFORMANT_PRODUCTION_URL": "https://myapp.com",
|
|
165
|
-
"INFORMANT_PRODUCTION_TOKEN": "your-api-token"
|
|
166
|
-
}
|
|
157
|
+
"command": "informant-mcp"
|
|
167
158
|
}
|
|
168
159
|
}
|
|
169
160
|
}
|
|
170
161
|
```
|
|
171
162
|
|
|
172
|
-
|
|
163
|
+
Set `INFORMANT_PRODUCTION_URL` and `INFORMANT_PRODUCTION_TOKEN` as environment variables (e.g., via `.envrc` + direnv). The MCP server inherits env vars from your shell -- no need to put secrets in `.mcp.json`.
|
|
164
|
+
|
|
165
|
+
For multi-environment setups, create `~/.config/informant-mcp.yml`:
|
|
173
166
|
|
|
174
167
|
```yaml
|
|
175
168
|
environments:
|
|
@@ -198,6 +191,23 @@ environments:
|
|
|
198
191
|
| `get_informant_status` | Summary with counts and top errors |
|
|
199
192
|
| `list_occurrences` | List occurrences with filtering |
|
|
200
193
|
|
|
194
|
+
### Local Development
|
|
195
|
+
|
|
196
|
+
The MCP server enforces HTTPS by default. When pointing at a local HTTP URL (e.g., `http://localhost:3000`), pass `--allow-insecure`:
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"mcpServers": {
|
|
201
|
+
"informant": {
|
|
202
|
+
"command": "informant-mcp",
|
|
203
|
+
"args": ["--allow-insecure"]
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
This is only needed for local development/testing. Production setups over HTTPS don't need it.
|
|
210
|
+
|
|
201
211
|
## Claude Code Skill
|
|
202
212
|
|
|
203
213
|
Use `/informant` in Claude Code to triage and fix errors interactively. The skill:
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "json"
|
|
1
2
|
require "rails/generators"
|
|
2
3
|
require "rails/generators/active_record"
|
|
3
4
|
|
|
@@ -21,6 +22,22 @@ module RailsInformant
|
|
|
21
22
|
route "mount RailsInformant::Engine => '/informant'"
|
|
22
23
|
end
|
|
23
24
|
|
|
25
|
+
def create_or_update_mcp_json
|
|
26
|
+
mcp_path = File.join(destination_root, ".mcp.json")
|
|
27
|
+
informant_entry = { "command" => "informant-mcp" }
|
|
28
|
+
|
|
29
|
+
if File.exist?(mcp_path)
|
|
30
|
+
existing = JSON.parse(File.read(mcp_path))
|
|
31
|
+
existing["mcpServers"] ||= {}
|
|
32
|
+
existing["mcpServers"]["informant"] = informant_entry
|
|
33
|
+
create_file ".mcp.json", JSON.pretty_generate(existing) + "\n", force: true
|
|
34
|
+
else
|
|
35
|
+
create_file ".mcp.json", JSON.pretty_generate(
|
|
36
|
+
"mcpServers" => { "informant" => informant_entry }
|
|
37
|
+
) + "\n"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
24
41
|
def print_next_steps
|
|
25
42
|
say ""
|
|
26
43
|
say "Rails Informant installed!", :green
|
|
@@ -34,18 +51,12 @@ module RailsInformant
|
|
|
34
51
|
say " # Add: rails_informant:"
|
|
35
52
|
say " # api_token: #{SecureRandom.hex 32}"
|
|
36
53
|
say ""
|
|
37
|
-
say " 3.
|
|
38
|
-
say "
|
|
39
|
-
say "
|
|
40
|
-
say "
|
|
41
|
-
say "
|
|
42
|
-
say "
|
|
43
|
-
say " \"INFORMANT_PRODUCTION_URL\": \"https://your-app.com\","
|
|
44
|
-
say " \"INFORMANT_PRODUCTION_TOKEN\": \"your-api-token\""
|
|
45
|
-
say " }"
|
|
46
|
-
say " }"
|
|
47
|
-
say " }"
|
|
48
|
-
say " }"
|
|
54
|
+
say " 3. Configure env vars for the MCP server (e.g., via .envrc + direnv):"
|
|
55
|
+
say " export INFORMANT_PRODUCTION_URL=https://your-app.com"
|
|
56
|
+
say " export INFORMANT_PRODUCTION_TOKEN=your-api-token"
|
|
57
|
+
say ""
|
|
58
|
+
say " The token must match the api_token in your Rails credentials."
|
|
59
|
+
say " Add .envrc to .gitignore — it contains secrets."
|
|
49
60
|
say ""
|
|
50
61
|
say " 4. Optional — install the Claude Code skill:"
|
|
51
62
|
say " bin/rails generate rails_informant:skill"
|