AI Skill Hub 推荐使用:Rails AI 桥接工具 是一款优质的MCP工具。AI 综合评分 7.5 分,在同类工具中表现稳健。如果你正在寻找可靠的MCP工具解决方案,这是一个值得深入了解的选择。
Rails AI 桥接工具:为您的 Rails 应用程序提供深入、实时的 AI 知识,通过 MCP 开源工具。
Rails AI 桥接工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
Rails AI 桥接工具:为您的 Rails 应用程序提供深入、实时的 AI 知识,通过 MCP 开源工具。
Rails AI 桥接工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/igmarin/rails-ai-bridge
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"rails-ai-----": {
"command": "npx",
"args": ["-y", "rails-ai-bridge"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 Rails AI 桥接工具 执行以下任务... Claude: [自动调用 Rails AI 桥接工具 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"rails_ai_____": {
"command": "npx",
"args": ["-y", "rails-ai-bridge"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
Turn any Rails app into an AI-ready system — with real context, not guesswork.
One command. Zero config. Structured context + live introspection for AI assistants via compact project files and an MCP server.
---
listen gem for watch mode, ripgrep for fast code search---
The generator prompts you to pick a profile (or pass --profile to skip the prompt):
| Profile | What it generates | Split rule dirs |
|---|---|---|
custom *(default)* | Per-format prompts — pick exactly what you need | Yes |
minimal | Claude, Cursor, Windsurf, Copilot, Gemini shims | No |
full | Every format | Yes |
mcp | Only .mcp.json — generate files later with rails ai:bridge | — |
```bash
The install generator creates .mcp.json for MCP-capable clients. Claude Code and Cursor can auto-detect it, while Codex can use the generated AGENTS.md plus your local Codex configuration.
This project keeps server.json aligned with GitHub metadata for MCP registry packaging when you choose to publish a release artifact.
To start manually: rails ai:serve
<details> <summary><strong>Claude Desktop setup</strong></summary>
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"rails-ai-bridge": {
"command": "bundle",
"args": ["exec", "rails", "ai:serve"],
"cwd": "/path/to/your/rails/app"
}
}
} </details>
<details> <summary><strong>HTTP transport (for remote clients)</strong></summary>
rails ai:serve_http # Starts at http://127.0.0.1:6029/mcp
Or auto-mount inside your Rails app:
RailsAiBridge.configure do |config|
config.auto_mount = true
config.http_mcp_token = "generate-a-long-random-secret" # or ENV["RAILS_AI_BRIDGE_MCP_TOKEN"]
# Production only: explicit opt-in + token required (see SECURITY.md)
# config.allow_auto_mount_in_production = true
config.http_path = "/mcp"
# Optional: reject HTTP requests when no Bearer/JWT/static auth is configured (safer beyond localhost)
# config.mcp.require_http_auth = true
end
Clients must send Authorization: Bearer <token> when a token is configured.
Security note: keep the HTTP transport bound to 127.0.0.1 unless you add your own network and authentication controls. The tools are read-only, but they can still expose sensitive application structure. Generated context and the built-in conventions resource filter secret-bearing config paths, but MCP access should still be treated as internal. In production, rails ai:serve_http and auto_mount require a configured MCP token; auto_mount also requires allow_auto_mount_in_production = true. For operational hardening (tokens, proxies, require_http_auth, stdio threat model), see docs/mcp-security.md and SECURITY.md. </details>
---
Codex support is centered on AGENTS.md at the repository root.
rails ai:bridge:codex to regenerate AGENTS.md and .codex/README.md.AGENTS.md committed so Codex sees project-specific instructions.~/.codex/AGENTS.md; use the repository AGENTS.md for shared guidance.rails_* tools and start with detail:"summary".---
From RubyGems (once published):
bundle add rails-ai-bridge
rails generate rails_ai_bridge:install
From GitHub (before or alongside RubyGems):
bundle add rails-ai-bridge --github=igmarin/rails-ai-bridge
rails generate rails_ai_bridge:install
Or add to your Gemfile:
gem "rails-ai-bridge", github: "igmarin/rails-ai-bridge"
Then bundle install and run the generator as above.
The install generator creates .mcp.json (MCP auto-discovery), sets up config/initializers/rails_ai_bridge.rb, and interactively guides you through generating your first bridge files.
```ruby
RailsAiBridge.configure do |config| # Presets: :standard (9 introspectors, default) or :full (27). Add opt-in extras as needed. config.preset = :standard
# Cherry-pick on top of a preset # config.introspectors += %i[non_ar_models views turbo auth api database_stats]
# Context mode: :compact (≤150 lines, default) or :full (dump everything) # config.context_mode = :compact
# Exclude models from introspection config.excluded_models += %w[AdminUser InternalAuditLog]
# Tag primary domain models as core_entity (semantic context for AI + Claude rules) # config.core_models += %w[User Order Project]
# Exclude paths from code search config.excluded_paths += %w[vendor/bundle]
# Cache TTL for MCP tool responses (seconds) config.cache_ttl = 30 end ```
<details> <summary><strong>All configuration options</strong></summary>
| Option | Default | Description |
|---|---|---|
preset | :standard | Introspector preset (:standard or :full) |
introspectors | 9 core | Array of introspector symbols |
context_mode | :compact | :compact (≤150 lines) or :full (dump everything) |
claude_max_lines | 150 | Max lines for CLAUDE.md in compact mode |
max_tool_response_chars | 120_000 | Safety cap for MCP tool responses |
excluded_models | internal Rails models | Models to skip during introspection |
core_models | [] | Model names tagged as core_entity in introspection and .claude/rules/ |
excluded_paths | node_modules tmp log vendor .git | Paths excluded from code search |
auto_mount | false | Auto-mount HTTP MCP endpoint |
allow_auto_mount_in_production | false | Allow auto_mount in production (requires MCP token) |
http_mcp_token | nil | Bearer token for HTTP MCP; ENV["RAILS_AI_BRIDGE_MCP_TOKEN"] overrides when set |
search_code_allowed_file_types | [] | Extra extensions allowed for rails_search_code file_type |
search_code_pattern_max_bytes | 2048 | Maximum pattern size (bytes) for rails_search_code |
search_code_timeout_seconds | 5.0 | Wall-clock limit per search (0 disables); mitigates runaway regex / CPU |
require_http_auth | false | When true, HTTP MCP returns 401 if no Bearer/JWT/static auth is configured |
rate_limit_max_requests | nil (profile default) | Per-IP sliding window ceiling (0 disables); not shared across workers |
rate_limit_window_seconds | 60 | Sliding window length for HTTP rate limiting |
http_log_json | false | One JSON log line per HTTP MCP response when enabled |
expose_credentials_key_names | false | Include credentials_keys in config introspection / rails://config |
additional_introspectors | {} | Optional custom introspector classes keyed by symbol |
additional_tools | [] | Optional MCP tool classes appended to the built-in toolset |
additional_resources | {} | Optional MCP resources merged with the built-in rails://... resources |
http_path | "/mcp" | HTTP endpoint path |
http_port | 6029 | HTTP server port |
cache_ttl | 30 | Cache TTL in seconds |
watcher_formats | :all | Formats regenerated by rails ai:watch (e.g. %i[claude cursor] to limit churn) |
parallel_introspection | false | Run introspectors concurrently (requires concurrent-ruby, which is already a Rails dependency) |
parallel_pool_size | 4 | Max threads in the parallel pool; capped at the number of active introspectors so no idle threads are created |
parallel_timeout_seconds | 10 | Per-introspector future timeout (seconds); timed-out introspectors return { error: "timed out after Ns" } without blocking the others |
Other HTTP MCP knobs live only on the nested object, for example RailsAiBridge.configuration.mcp.authorize, mcp.mode, mcp.security_profile, and mcp.require_auth_in_production — see docs/GUIDE.md and docs/mcp-security.md. </details>
bundle install must finish cleanly — until it does, bundle exec rails -T and rails ai:serve (from .mcp.json) cannot be verified. Merging this gem to main does not fix a broken or incomplete bundle on the host app.rails ai:bridge (not only a single format) so route/controller summaries and relevance ordering stay consistent across CLAUDE.md, .cursor/rules/, and .github/instructions/.config/rails_ai_bridge/overrides.md for org-specific constraints (merged only after you delete the first-line ` stub). Until then, the gem does not inject placeholder text into Copilot/Codex. See **overrides.md.example** for an outline. Alternatively re-merge into generated files after each rails ai:bridge (see .codex/README.md`).RailsAiBridge.configure { |c| c.copilot_compact_model_list_limit = 5 } (and codex_compact_model_list_limit); set 0 to list no model names and point only to MCP.rails ai:doctor prints a 0–100 score and flags anything missing after first install.---
Rubydex is Shopify's high-performance Ruby static analysis toolkit. rails-ai-bridge leverages rubydex out-of-the-box for semantic code understanding.
Setup:
Rubydex is installed automatically as a core dependency and is enabled by default.
To customize it in your initializer (config/initializers/rails_ai_bridge.rb):
RailsAiBridge.configure do |config|
# config.rubydex_enabled = false # Set to false to disable semantic analysis
# Optional: enable the semantic introspector (adds :semantic to introspectors)
config.semantic_introspector_enabled = true
config.introspectors += %i[semantic]
# Optional: control semantic context depth in generated files
# config.semantic_context_depth = :standard # :summary, :standard, or :full
# Optional: incremental re-indexing (skip unchanged files on subsequent runs)
# config.rubydex_incremental_threshold = 0.3 # full rebuild if >30% of files changed
# config.rubydex_persist_index = true # survive process restarts
end
What you get:
| Feature | Description |
|---|---|
rails_search_semantic MCP tool | Fuzzy search for classes, modules, methods, and constants with type info and locations |
| Enhanced model introspection | Semantic summaries, similar model discovery, and complexity scores for each model |
| Semantic introspector | Codebase-wide pattern detection, inheritance analysis, and complexity hotspots |
rails://semantic/analysis resource | Full semantic analysis accessible via MCP resource read |
| Context file enrichment | Semantic insights automatically included in generated AI context files |
| Incremental re-indexing | Only changed files are re-parsed on subsequent calls; unchanged files are skipped |
Internal architecture: The RubydexAdapter wraps the rubydex API as a thin coordinator delegating to three single-responsibility collaborators: Serializer (hash conversion), Indexer (graph construction + source file scanning), and MethodCounter (flat method-counting pipeline). Incremental re-indexing is handled by the IncrementalIndexer service, which tracks file mtimes and triggers a full rebuild when the changed-file ratio exceeds rubydex_incremental_threshold. See CONTRIBUTING.md for the full project layout.
Configuration options:
| Option | Default | Description |
|---|---|---|
rubydex_enabled | true | Enable rubydex integration |
rubydex_index_path | "tmp/rubydex_index" | Path for the rubydex index (must stay within Rails.root) |
semantic_introspector_enabled | false | Enable the dedicated semantic introspector |
semantic_context_depth | :standard | Depth of semantic context in generated files (:summary, :standard, :full) |
rubydex_incremental_threshold | 0.3 | Fraction of changed files (0.0–1.0) above which a full rebuild replaces incremental patching |
rubydex_persist_index | false | Persist the mtime snapshot to disk so incremental re-indexing survives process restarts |
Performance considerations: Rubydex indexes your Ruby source files at startup. For large codebases, the initial indexing may take a few seconds. Subsequent calls re-use the in-memory index and only re-parse changed files, keeping re-indexing overhead proportional to churn rather than codebase size.
---
| **rails-ai-bridge** | **[rails-mcp-server](https://github.com/maquina-app/rails-mcp-server)** | **Manual context** | |
|---|---|---|---|
| Zero config | Yes — Railtie + install generator | No — per-project projects.yml | No |
| Token optimization | Yes — compact files + detail:"summary" workflow | Varies | No |
| Codex-oriented repo files | Yes — AGENTS.md, .codex/README.md | No | DIY |
| Live MCP tools | Yes — 11 read-only rails_* tools (extensible) | Yes | No |
| Auto-introspection | Yes — up to **27** domains (:full) | No — server points at projects you configure | DIY |
Comparison reflects typical documented setups; verify against each project before treating any row as absolute.
---
| Project | Approach | rails-ai-bridge |
|---|---|---|
| [Official Ruby SDK](https://github.com/modelcontextprotocol/ruby-sdk) | Low-level protocol library | We **use** this as our foundation |
| [fast-mcp](https://github.com/yjacquin/fast-mcp) | Generic MCP framework | We're a **product** — zero-config Rails introspection |
| [rails-mcp-server](https://github.com/maquina-app/rails-mcp-server) | Manual config (projects.yml) | We auto-discover everything |
---
该工具提供了实时的 AI 知识和 MCP 支持,但需要进一步的测试和优化
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
总体来看,Rails AI 桥接工具 是一款质量良好的MCP工具,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。
| 原始名称 | rails-ai-bridge |
| 原始描述 | 开源MCP工具:Give AI assistants deep, live knowledge of your Rails app via MCP。⭐9 · Ruby |
| Topics | mcpruby |
| GitHub | https://github.com/igmarin/rails-ai-bridge |
| License | MIT |
| 语言 | Ruby |
收录时间:2026-05-21 · 更新时间:2026-05-22 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端