An MCP server that provides search functionality for Rails API documentation, supporting all major Rails framework components.
The server provides access to Rails API documentation through:
- Custom
rails-api://URI scheme - Documentation content served as text/html mimetype
- Support for all major Rails framework sections and core extensions:
- AbstractController
- ActionCable
- ActionController
- ActionDispatch
- ActionMailbox
- ActionMailer
- ActionText
- ActionView
- ActiveJob
- ActiveModel
- ActiveRecord
- ActiveStorage
- ActiveSupport
- Arel
- Mime
- Minitest
- Rails
- Array
- Benchmark
- BigDecimal
- Class
- Date
- DateAndTime
- Calculations
- Compatibility
- Zones
- DateTime
- Delegator
- Digest
- UUID
- ERB
- Util
- Enumerable
- Exception
- FalseClass
- File
- Float
- Hash
- IO
- Integer
- Kernel
- LoadError
- Method
- Module
- Concerning
- NameError
- NilClass
- Numeric
- Object
- Pathname
- Process
- Range
- Regexp
- SecureRandom
- Singleton
- String
- Symbol
- Thread
- Backtrace
- Time
- TrueClass
- URI
- UnboundMethod
The server implements a powerful search tool with the following capabilities:
{
"query": "string", // Required: Search term
"section": "string", // Optional: Documentation section (if omitted, searches all sections)
"limit": "integer" // Optional: Max results to return (default: 10)
}Returns JSON formatted results including:
- Matched sections with titles and content
- Section identification
- Relevance scores
- Direct path links to sections
- Timestamp of search
- Total number of matches
Example response:
{
"matches": [
{
"title": "Section Title",
"content": "Matched content...",
"path": "#section-id",
"section": "activerecord",
"relevance": 0.75
}
],
"total": 1,
"query": "search term",
"section": "activerecord",
"timestamp": "2024-03-21T10:00:00.000Z"
}- Python 3.12 or higher
- Rails API documentation files in the
docs/directory:rails_api.html(complete documentation)- Individual section files (e.g.,
activerecord.html,actionview.html, etc.)
dependencies = [
"httpx",
"beautifulsoup4",
"python-dotenv",
"mcp>=0.1.0",
]On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
Development Configuration
{
"mcpServers": {
"rails_api_search": {
"command": "uv",
"args": [
"--directory",
"/path/to/rails_api_search",
"run",
"rails_api_search"
]
}
}
}Production Configuration
{
"mcpServers": {
"rails_api_search": {
"command": "uvx",
"args": [
"rails_api_search"
]
}
}
}RAILS_API_SEARCH/
├── docs/
│ ├── rails_api.html # Complete documentation
│ ├── activerecord.html # ActiveRecord section
│ ├── actionview.html # ActionView section
│ └── ... # Other section files
├── src/
│ └── rails_api_search/
│ ├── __init__.py
│ └── server.py
├── tests/
│ └── test_server.py
├── pyproject.toml
└── README.md
- Sync dependencies:
uv sync- Build package:
uv build- Publish to PyPI:
uv publishRequired PyPI credentials:
- Token:
--tokenorUV_PUBLISH_TOKEN - Or username/password:
--username/UV_PUBLISH_USERNAMEand--password/UV_PUBLISH_PASSWORD
Run tests with:
pytestTest coverage includes:
- Section-specific searches
- Multi-section searches
- Resource listing
- Error handling
- File operations
For debugging, use the MCP Inspector:
npx @modelcontextprotocol/inspector uv --directory /path/to/rails_api_search run rails-api-searchThe inspector provides a web interface for:
- Monitoring server communication
- Testing search queries
- Verifying section detection
- Debugging issues
result = await call_tool("search", {
"query": "migrations",
"section": "activerecord",
"limit": 5
})result = await call_tool("search", {
"query": "mvc",
"limit": 10
})resources = await list_resources()