rails-ai-context 4.3.3 → 4.5.0

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +56 -1
  3. data/CLAUDE.md +8 -2
  4. data/README.md +29 -12
  5. data/docs/GUIDE.md +56 -18
  6. data/exe/rails-ai-context +311 -39
  7. data/lib/generators/rails_ai_context/install/install_generator.rb +21 -3
  8. data/lib/rails_ai_context/cli/tool_runner.rb +1 -1
  9. data/lib/rails_ai_context/configuration.rb +90 -0
  10. data/lib/rails_ai_context/fingerprinter.rb +4 -0
  11. data/lib/rails_ai_context/introspectors/accessibility_introspector.rb +50 -0
  12. data/lib/rails_ai_context/introspectors/action_mailbox_introspector.rb +8 -1
  13. data/lib/rails_ai_context/introspectors/action_text_introspector.rb +20 -1
  14. data/lib/rails_ai_context/introspectors/active_storage_introspector.rb +44 -1
  15. data/lib/rails_ai_context/introspectors/api_introspector.rb +33 -1
  16. data/lib/rails_ai_context/introspectors/asset_pipeline_introspector.rb +4 -1
  17. data/lib/rails_ai_context/introspectors/auth_introspector.rb +48 -0
  18. data/lib/rails_ai_context/introspectors/component_introspector.rb +6 -0
  19. data/lib/rails_ai_context/introspectors/config_introspector.rb +47 -3
  20. data/lib/rails_ai_context/introspectors/controller_introspector.rb +25 -3
  21. data/lib/rails_ai_context/introspectors/convention_detector.rb +23 -1
  22. data/lib/rails_ai_context/introspectors/database_stats_introspector.rb +58 -4
  23. data/lib/rails_ai_context/introspectors/design_token_introspector.rb +19 -1
  24. data/lib/rails_ai_context/introspectors/devops_introspector.rb +9 -5
  25. data/lib/rails_ai_context/introspectors/engine_introspector.rb +8 -1
  26. data/lib/rails_ai_context/introspectors/frontend_framework_introspector.rb +34 -0
  27. data/lib/rails_ai_context/introspectors/gem_introspector.rb +47 -1
  28. data/lib/rails_ai_context/introspectors/i18n_introspector.rb +47 -2
  29. data/lib/rails_ai_context/introspectors/job_introspector.rb +40 -1
  30. data/lib/rails_ai_context/introspectors/middleware_introspector.rb +20 -1
  31. data/lib/rails_ai_context/introspectors/migration_introspector.rb +2 -0
  32. data/lib/rails_ai_context/introspectors/model_introspector.rb +88 -1
  33. data/lib/rails_ai_context/introspectors/multi_database_introspector.rb +45 -6
  34. data/lib/rails_ai_context/introspectors/performance_introspector.rb +28 -6
  35. data/lib/rails_ai_context/introspectors/rake_task_introspector.rb +12 -2
  36. data/lib/rails_ai_context/introspectors/route_introspector.rb +21 -6
  37. data/lib/rails_ai_context/introspectors/schema_introspector.rb +31 -0
  38. data/lib/rails_ai_context/introspectors/seeds_introspector.rb +3 -1
  39. data/lib/rails_ai_context/introspectors/stimulus_introspector.rb +51 -2
  40. data/lib/rails_ai_context/introspectors/test_introspector.rb +42 -1
  41. data/lib/rails_ai_context/introspectors/turbo_introspector.rb +22 -2
  42. data/lib/rails_ai_context/introspectors/view_introspector.rb +38 -3
  43. data/lib/rails_ai_context/introspectors/view_template_introspector.rb +15 -2
  44. data/lib/rails_ai_context/resources.rb +1 -1
  45. data/lib/rails_ai_context/server.rb +6 -3
  46. data/lib/rails_ai_context/tasks/rails_ai_context.rake +140 -6
  47. data/lib/rails_ai_context/tools/base_tool.rb +1 -1
  48. data/lib/rails_ai_context/tools/query.rb +5 -1
  49. data/lib/rails_ai_context/tools/read_logs.rb +3 -0
  50. data/lib/rails_ai_context/version.rb +1 -1
  51. data/lib/rails_ai_context.rb +5 -0
  52. data/server.json +3 -3
  53. metadata +13 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5568327e1027266892b2514cad27a3665532acfa1405236caecda030ff313739
4
- data.tar.gz: 6be68e0d310f9a42aafc47161a676d162debba0cfe8a8f4087ee6051f79900cc
3
+ metadata.gz: 41d06a29e3165804283c9dcef76e2c1ee5625ef5ac236931fa492d76172062b6
4
+ data.tar.gz: 8f2f81c3186b2d16fa9c4ea2b84721fd519d437b4cbd8fb99a3978e45723a189
5
5
  SHA512:
6
- metadata.gz: 151fec5402860aa577e1c21af3ece8c0378a3f5b50f3e18e34236a43061d01da945a869972347e07d2748601c4e7965a449596fecb04cf1eecb0915a0ef73463
7
- data.tar.gz: 18f46e2c0c1d638c3822687f949588dc5f9874cb61cf3f827827205e472456c95d7c55f74cec6a157bfa99531ab4849a9e14a9c23fce7676fc554463a934d9d3
6
+ metadata.gz: 94ee0d646375d50942d8d3ea186a3f5faea8795f1fee1588f63304a06ab283db79e8dd07a1460284279b9edeac9bc3604e9208b847dda6ef144f9d5e68c5df2b
7
+ data.tar.gz: 838c87226b6027f62aa045c3eebd2842f82434db0b6a9fa2f20234bde75a9e0f4d6407fe4d510e129c0e192141b15a75fec5c9d0d3620a2991c2860db7ad5e42
data/CHANGELOG.md CHANGED
@@ -5,6 +5,61 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [4.4.0] — 2026-04-03
9
+
10
+ ### Added
11
+ - **33 introspector enhancements** — every introspector upgraded with new detection capabilities:
12
+ - **SchemaIntrospector**: expression indexes, column comments in static parse, `change_column_default`/`change_column_null` in migration replay
13
+ - **ModelIntrospector**: STI hierarchy detection (parent/children/type column), `attribute` API, enum `_prefix:`/`_suffix:`, `after_commit on:` parsing, inline `private def` exclusion
14
+ - **RouteIntrospector**: route parameter extraction, root route detection, RESTful action flag
15
+ - **JobIntrospector**: SolidQueue recurring job config, Sidekiq config (concurrency/queues), job callbacks (`before_perform`, `around_enqueue`, etc.)
16
+ - **GemIntrospector**: path/git gems from Gemfile, gem group extraction (dev/test/prod)
17
+ - **ConventionDetector**: multi-tenant (Apartment/ActsAsTenant), feature flags (Flipper/LaunchDarkly), error monitoring (Sentry/Bugsnag/Honeybadger), event-driven (Kafka/RabbitMQ/SNS), Zeitwerk detection, STI with type column verification
18
+ - **ControllerIntrospector**: `rate_limit` parsed into structured data (to/within/only), inline `private def` exclusion
19
+ - **StimulusIntrospector**: lifecycle hooks (connect/disconnect/initialize), outlet controller type mapping, action bindings from views (`data-action` parsing)
20
+ - **ViewIntrospector**: `yield`/`content_for` extraction from layouts, conditional layout detection with only/except
21
+ - **TurboIntrospector**: stream action semantics (append/update/remove counts), frame `src` URL extraction
22
+ - **I18nIntrospector**: locale fallback chain detection, locale coverage % per locale
23
+ - **ConfigIntrospector**: cache store options, error monitoring gem detection, job processor config (Sidekiq queues/concurrency)
24
+ - **ActiveStorageIntrospector**: attachment validations (content_type/size), variant definitions
25
+ - **ActionTextIntrospector**: Trix editor customization detection (toolbar/attachment/events)
26
+ - **AuthIntrospector**: OmniAuth provider detection, Devise settings (timeout/lockout/password_length)
27
+ - **ApiIntrospector**: GraphQL resolvers/subscriptions/dataloaders, API pagination strategy detection
28
+ - **TestIntrospector**: shared examples/contexts detection, database cleaner strategy
29
+ - **RakeTaskIntrospector**: task dependencies (`=> :prerequisite`), task arguments (`[:arg1, :arg2]`)
30
+ - **AssetPipelineIntrospector**: Bun bundler, Foundation CSS, PostCSS standalone detection
31
+ - **DevOpsIntrospector**: Fly.io/Render/Railway deployment detection, `docker-compose.yaml` support
32
+ - **ActionMailboxIntrospector**: mailbox callback detection (before/after/around_processing)
33
+ - **MigrationIntrospector**: `change_column_default`, `change_column_null`, `add_check_constraint` action detection
34
+ - **SeedsIntrospector**: CSV loader detection, seed ordering detection
35
+ - **MiddlewareIntrospector**: middleware added via initializers (`config.middleware.use/insert_before`)
36
+ - **EngineIntrospector**: route count + model count inside discovered engines
37
+ - **MultiDatabaseIntrospector**: shard names/keys/count from `connects_to`, improved YAML parsing for nested multi-db configs
38
+ - **ComponentIntrospector**: `**kwargs` splat prop detection
39
+ - **AccessibilityIntrospector**: heading hierarchy (h1-h6), skip link detection, `aria-live` regions, form input analysis (required/types)
40
+ - **PerformanceIntrospector**: polymorphic association compound index detection (`[type, id]`)
41
+ - **FrontendFrameworkIntrospector**: API client detection (Axios/Apollo/SWR/etc.), component library detection (MUI/Radix/shadcn/etc.)
42
+ - **DatabaseStatsIntrospector**: MySQL + SQLite support (was PostgreSQL-only), PostgreSQL dead row counts
43
+ - **ViewTemplateIntrospector**: slot reference detection
44
+ - **DesignTokenIntrospector**: Tailwind arbitrary value extraction
45
+
46
+ ### Fixed
47
+ - **Security: SQLite SQL injection** — `database_stats_introspector` used string interpolation for table names in COUNT queries; now uses `conn.quote_table_name`
48
+ - **Security: query column redaction bypass** — `SELECT password AS pwd` bypassed redaction; now also matches columns ending in `password`, `secret`, `token`, `key`, `digest`, `hash`
49
+ - **Security: log redaction gaps** — added AWS access key (`AKIA...`), JWT token (`eyJ...`), and SSH/TLS private key header patterns
50
+ - **Security: HTTP bind wildcard** — non-loopback warning now catches `0.0.0.0` and `::` (was only checking 3 specific addresses)
51
+ - **Thread safety: `app_size()` race condition** — `SHARED_CACHE[:context]` read without mutex; now wrapped in `SHARED_CACHE[:mutex].synchronize`
52
+ - **Crash: nil callback filter** — `model_introspector` `cb.filter.to_s` crashed on nil filters; added `cb.filter.nil?` guard
53
+ - **Crash: fingerprinter TOCTOU** — `File.mtime` after `File.exist?` could raise `Errno::ENOENT` if file deleted between calls; added rescue
54
+ - **Crash: tool_runner bounds** — `args[i+1]` access without bounds check; added `i + 1 < args.size` guard
55
+ - **Bug: server logs wrong tool list** — logged all 39 `TOOLS` instead of filtered `active_tools` after `skip_tools`; now shows correct count and names
56
+ - **Bug: STI false positive** — convention detector flagged `Admin < User` as STI even without `type` column; now verifies parent's table has `type` column via schema.rb
57
+ - **Bug: resources bare raise** — `raise "Unknown resource"` changed to `raise RailsAiContext::Error`
58
+ - **Config validation** — `http_port` (1-65535), `cache_ttl` (> 0), `max_tool_response_chars` (> 0), `query_row_limit` (1-1000) now validated on assignment
59
+
60
+ ### Changed
61
+ - Test count: 1529 (unchanged — all new features tested via integration test against sample app)
62
+
8
63
  ## [4.3.3] — 2026-04-02
9
64
 
10
65
  ### Fixed
@@ -331,7 +386,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
331
386
  - **Phase 1 improvements** — scope definitions include lambda body, controller actions show instance variables + private methods called inline, Stimulus shows HTML data-attributes + reverse view lookup.
332
387
  - **3 new validation rules** — instance variable consistency (view uses @foo but controller never sets it), Turbo Stream channel matching (broadcast without subscriber), respond_to template existence.
333
388
  - **`rails_security_scan` tool** — Brakeman static security analysis via MCP. Detects SQL injection, XSS, mass assignment, and more. Optional dependency — returns install instructions if Brakeman isn't present. Supports file filtering, confidence levels (high/medium/weak), specific check selection, and three detail levels (summary/standard/full).
334
- - **`config.skip_tools`** — users can now exclude specific built-in tools: `config.skip_tools = %w[rails_security_scan]`. Defaults to empty (all 25 tools active).
389
+ - **`config.skip_tools`** — users can now exclude specific built-in tools: `config.skip_tools = %w[rails_security_scan]`. Defaults to empty (all 39 tools active).
335
390
  - **Schema index hints** — `get_schema` standard detail now shows `[indexed]`/`[unique]` on columns, saving a round-trip to full detail.
336
391
  - **Enum backing types** — `get_model_details` now shows integer vs string backing: `status: pending(0), active(1) [integer]`.
337
392
  - **Search context lines default 2** — `search_code` now returns 2 lines of context by default (was 0). Eliminates follow-up calls for context.
data/CLAUDE.md CHANGED
@@ -21,12 +21,12 @@ structure to AI assistants via the Model Context Protocol (MCP).
21
21
  - `lib/rails_ai_context/watcher.rb` — File watcher for auto-regenerating context files
22
22
  - `lib/rails_ai_context/engine.rb` — Rails Engine for auto-integration
23
23
  - `lib/generators/rails_ai_context/install/` — Install generator (creates .mcp.json, initializer, context files)
24
- - `exe/rails-ai-context` — Standalone Thor CLI (serve, context, inspect, watch, doctor, tool, version)
24
+ - `exe/rails-ai-context` — Standalone Thor CLI (init, serve, context, inspect, watch, doctor, tool, version) — works without Gemfile entry via `gem install`
25
25
 
26
26
  ## Key Design Decisions
27
27
 
28
28
  1. **Built on official mcp SDK** — not a custom protocol implementation
29
- 2. **Zero-config** — Railtie auto-registers at boot, introspects without setup
29
+ 2. **Sensible defaults** — works standalone (`gem install` + `rails-ai-context init`) or in-Gemfile with Railtie auto-registration
30
30
  3. **Graceful degradation** — works without DB by parsing schema.rb as text
31
31
  4. **Read-only tools only** — all MCP tools are annotated as non-destructive
32
32
  5. **Sensitive pattern blocking** — search/read tools reject `.env`, `*.key`, `*.pem` and other secret files via `sensitive_patterns`
@@ -56,6 +56,12 @@ structure to AI assistants via the Model Context Protocol (MCP).
56
56
  29. **Docs search** — bundled topic index with weighted keyword search, on-demand GitHub fetch
57
57
  30. **Safe SQL queries** — defense-in-depth: regex pre-filter + SET TRANSACTION READ ONLY + timeout
58
58
  31. **Log reading** — reverse file tail with level filtering and sensitive data redaction
59
+ 32. **Config validation** — `http_port`, `cache_ttl`, `max_tool_response_chars`, `query_row_limit` validated on assignment with clear error messages
60
+ 33. **Sensitive column redaction** — query tool redacts columns by name AND by suffix pattern (password, secret, token, key, digest, hash) to prevent alias bypass
61
+ 34. **Standalone mode** — `gem install rails-ai-context && rails-ai-context init` works without Gemfile entry. CLI pre-loads gem before Rails boot, restores `$LOAD_PATH` entries stripped by `Bundler.setup`. Config from `.rails-ai-context.yml`.
62
+ 35. **YAML config** — `.rails-ai-context.yml` as alternative to initializer. Supports all config options except `custom_tools` (Ruby classes) and `excluded_concerns` (regex). Precedence: initializer > YAML > defaults.
63
+ 36. **Config auto-loading** — `Configuration.auto_load!` checks `configured_via_block?` flag. If initializer ran, YAML is skipped. Corrupted YAML degrades gracefully with a warning.
64
+ 37. **Three install paths** — In-Gemfile (`rails generate rails_ai_context:install`), Standalone (`rails-ai-context init`), Zero config (just run `rails-ai-context serve` with defaults). Users can switch between paths freely; `.mcp.json` command is updated on re-init/re-install.
59
65
 
60
66
  ## Testing
61
67
 
data/README.md CHANGED
@@ -51,6 +51,15 @@ gem "rails-ai-context", group: :development
51
51
  rails generate rails_ai_context:install
52
52
  ```
53
53
 
54
+ ### Or standalone — no Gemfile needed
55
+
56
+ ```bash
57
+ gem install rails-ai-context
58
+ cd your-rails-app
59
+ rails-ai-context init # interactive setup
60
+ rails-ai-context serve # start MCP server
61
+ ```
62
+
54
63
  <div align="center">
55
64
 
56
65
  ![Install demo](demo.gif)
@@ -341,7 +350,7 @@ Every tool is **read-only** and returns structured, token-efficient context.
341
350
 
342
351
  ┌─────────────────────────────────────────────────────────┐
343
352
  │ rails-ai-context │
344
- │ Parses everything. Caches results. Zero config.
353
+ │ Parses everything. Caches results. Sensible defaults.
345
354
  └────────┬──────────────────┬──────────────┬──────────────┘
346
355
  │ │ │
347
356
  ▼ ▼ ▼
@@ -357,27 +366,35 @@ Every tool is **read-only** and returns structured, token-efficient context.
357
366
 
358
367
  ## Install
359
368
 
369
+ **Option A — In Gemfile:**
370
+
360
371
  ```bash
361
372
  gem "rails-ai-context", group: :development
362
373
  rails generate rails_ai_context:install
363
374
  ```
364
375
 
365
- The installer asks which AI tools you use and whether you want MCP or CLI mode. That's it.
376
+ **Option B Standalone (no Gemfile entry needed):**
377
+
378
+ ```bash
379
+ gem install rails-ai-context
380
+ cd your-rails-app
381
+ rails-ai-context init
382
+ ```
366
383
 
367
- `.mcp.json` is auto-detected by Claude Code and Cursor — no manual config.
384
+ Both paths ask which AI tools you use and whether you want MCP or CLI mode. `.mcp.json` is auto-detected by Claude Code and Cursor.
368
385
 
369
386
  <br>
370
387
 
371
388
  ## Commands
372
389
 
373
- | Command | What it does |
374
- |:--------|:------------|
375
- | `rails ai:context` | Generate context files for your AI tools |
376
- | `rails 'ai:tool[NAME]'` | Run any of the 39 tools from CLI |
377
- | `rails ai:tool` | List all available tools |
378
- | `rails ai:serve` | Start MCP server (stdio) |
379
- | `rails ai:doctor` | Diagnostics + AI readiness score |
380
- | `rails ai:watch` | Auto-regenerate on file changes |
390
+ | In-Gemfile | Standalone | What it does |
391
+ |:-----------|:-----------|:------------|
392
+ | `rails ai:context` | `rails-ai-context context` | Generate context files |
393
+ | `rails 'ai:tool[NAME]'` | `rails-ai-context tool NAME` | Run any of the 39 tools |
394
+ | `rails ai:tool` | `rails-ai-context tool --list` | List all available tools |
395
+ | `rails ai:serve` | `rails-ai-context serve` | Start MCP server (stdio) |
396
+ | `rails ai:doctor` | `rails-ai-context doctor` | Diagnostics + AI readiness score |
397
+ | `rails ai:watch` | `rails-ai-context watch` | Auto-regenerate on file changes |
381
398
 
382
399
  <br>
383
400
 
@@ -427,7 +444,7 @@ end
427
444
  ## About
428
445
 
429
446
  Built by a Rails developer with 10+ years of production experience.<br>
430
- 1529 tests. 39 tools. 33 introspectors. Zero config.<br>
447
+ 1529 tests. 39 tools. 33 introspectors. Standalone or in-Gemfile.<br>
431
448
  MIT licensed. [Contributions welcome.](CONTRIBUTING.md)
432
449
 
433
450
  <br>
data/docs/GUIDE.md CHANGED
@@ -29,35 +29,35 @@
29
29
 
30
30
  ## Installation
31
31
 
32
- ### New project
32
+ ### Option A: In Gemfile
33
33
 
34
34
  ```bash
35
- bundle add rails-ai-context
35
+ gem "rails-ai-context", group: :development
36
+ bundle install
36
37
  rails generate rails_ai_context:install
37
38
  rails ai:context
38
39
  ```
39
40
 
40
41
  This creates:
41
42
  1. `config/initializers/rails_ai_context.rb` — configuration file
42
- 2. `.mcp.json` — MCP auto-discovery for Claude Code and Cursor
43
- 3. 29 context files tailored for each AI assistant
43
+ 2. `.rails-ai-context.yml` — standalone config (enables switching later)
44
+ 3. `.mcp.json` MCP auto-discovery for Claude Code and Cursor
45
+ 4. Context files — tailored for each AI assistant
44
46
 
45
- ### Existing project
47
+ ### Option B: Standalone (no Gemfile entry needed)
46
48
 
47
49
  ```bash
48
- # Add to Gemfile
49
- gem "rails-ai-context"
50
-
51
- # Install
52
- bundle install
53
- rails generate rails_ai_context:install
50
+ gem install rails-ai-context
51
+ cd your-rails-app
52
+ rails-ai-context init
53
+ ```
54
54
 
55
- # Generate context files
56
- rails ai:context
55
+ This creates:
56
+ 1. `.rails-ai-context.yml` — configuration file
57
+ 2. `.mcp.json` — MCP auto-discovery (if MCP mode selected)
58
+ 3. Context files — tailored for each AI assistant
57
59
 
58
- # Verify everything works
59
- rails ai:doctor
60
- ```
60
+ No Gemfile entry, no initializer, no files in your project besides config and context.
61
61
 
62
62
  ### What the install generator does
63
63
 
@@ -220,9 +220,10 @@ Commit **all files except `.ai-context.json`** (which is gitignored). This gives
220
220
 
221
221
  ### Standalone CLI
222
222
 
223
- The gem ships a `rails-ai-context` executable as an alternative to rake tasks. Useful for `.mcp.json` configs or when you prefer a shorter command.
223
+ The gem ships a `rails-ai-context` executable that works **without adding the gem to your Gemfile**. Install globally with `gem install rails-ai-context`, then run from any Rails app directory.
224
224
 
225
225
  ```bash
226
+ rails-ai-context init # Interactive setup (creates .rails-ai-context.yml + .mcp.json)
226
227
  rails-ai-context serve # Start MCP server (stdio)
227
228
  rails-ai-context serve --transport http # Start MCP server (HTTP, port 6029)
228
229
  rails-ai-context serve --transport http --port 8080 # Custom port
@@ -241,6 +242,8 @@ rails-ai-context help # Show all commands
241
242
 
242
243
  Must be run from your Rails app root directory (requires `config/environment.rb`).
243
244
 
245
+ **Config:** Standalone mode reads from `.rails-ai-context.yml` (created by `init`). If no config file exists, defaults are used. If the gem is also in the Gemfile, the initializer takes precedence over the YAML file.
246
+
244
247
  ### Legacy command
245
248
 
246
249
  ```bash
@@ -1042,8 +1045,9 @@ curl "https://registry.modelcontextprotocol.io/v0.1/servers?search=rails-ai-cont
1042
1045
 
1043
1046
  ### Auto-discovery (recommended)
1044
1047
 
1045
- The install generator creates `.mcp.json` in your project root:
1048
+ The install generator (or `rails-ai-context init`) creates `.mcp.json` in your project root:
1046
1049
 
1050
+ **In-Gemfile:**
1047
1051
  ```json
1048
1052
  {
1049
1053
  "mcpServers": {
@@ -1055,6 +1059,18 @@ The install generator creates `.mcp.json` in your project root:
1055
1059
  }
1056
1060
  ```
1057
1061
 
1062
+ **Standalone:**
1063
+ ```json
1064
+ {
1065
+ "mcpServers": {
1066
+ "rails-ai-context": {
1067
+ "command": "rails-ai-context",
1068
+ "args": ["serve"]
1069
+ }
1070
+ }
1071
+ }
1072
+ ```
1073
+
1058
1074
  **Claude Code** and **Cursor** auto-detect this file. No manual config needed — just open your project.
1059
1075
 
1060
1076
  ### Claude Code
@@ -1062,7 +1078,11 @@ The install generator creates `.mcp.json` in your project root:
1062
1078
  Auto-discovered via `.mcp.json`. Or add manually:
1063
1079
 
1064
1080
  ```bash
1081
+ # In-Gemfile
1065
1082
  claude mcp add rails-ai-context -- bundle exec rails ai:serve
1083
+
1084
+ # Standalone
1085
+ claude mcp add rails-ai-context -- rails-ai-context serve
1066
1086
  ```
1067
1087
 
1068
1088
  ### Claude Desktop
@@ -1081,6 +1101,8 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
1081
1101
  }
1082
1102
  ```
1083
1103
 
1104
+ Or for standalone: replace `"command": "bundle"` / `"args": ["exec", "rails", "ai:serve"]` with `"command": "rails-ai-context"` / `"args": ["serve"]`.
1105
+
1084
1106
  ### Cursor
1085
1107
 
1086
1108
  Auto-discovered via `.mcp.json`. Or add manually in **Cursor Settings > MCP**:
@@ -1097,6 +1119,9 @@ Auto-discovered via `.mcp.json`. Or add manually in **Cursor Settings > MCP**:
1097
1119
  }
1098
1120
  ```
1099
1121
 
1122
+ For standalone: use `"command": "rails-ai-context"` / `"args": ["serve"]` instead.
1123
+ ```
1124
+
1100
1125
  ### HTTP transport
1101
1126
 
1102
1127
  For browser-based or remote AI clients:
@@ -1407,6 +1432,19 @@ config.introspectors = %i[schema models routes gems auth api]
1407
1432
  }
1408
1433
  ```
1409
1434
 
1435
+ For standalone: use `"command": ["rails-ai-context", "serve"]` instead.
1436
+
1437
+ ```json
1438
+ {
1439
+ "mcp": {
1440
+ "rails-ai-context": {
1441
+ "type": "local",
1442
+ "command": ["rails-ai-context", "serve"]
1443
+ }
1444
+ }
1445
+ }
1446
+ ```
1447
+
1410
1448
  **Context files loaded:**
1411
1449
  - `AGENTS.md` — project overview + MCP tool guide, read at conversation start
1412
1450
  - `app/models/AGENTS.md` — model listing, auto-loaded when agent reads model files