rubygems_mcp 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: afa4ece822d5b8556b280d14c3755876420957ba7e6b080cb20aa529730bb93e
4
+ data.tar.gz: 5e96e90380d30f47fe2e2f765cf4e5831093bfefde80757a60aede6cf46f5753
5
+ SHA512:
6
+ metadata.gz: 9f07be5cde29b994821781e0350711b02df4a4f22e93ace9b860dfa6e23d81354639c6d6078da12768ba50a32d95ea89a64224c355ae39efe5486acf9af432eb
7
+ data.tar.gz: e648da457c4b257a2dabcf41e9b682825cb4d588012e8eefd0bd46c8b399578bb7ae9a50e87345228538efb2d7c5449904b4fc75f3206a28a229b1ebf9a80bbf
data/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # CHANGELOG
2
+
3
+ ## 0.1.0 (2025-01-15)
4
+
5
+ - Initial release
6
+ - RubyGems API client with comprehensive endpoint coverage:
7
+ - Gem versions: `get_latest_versions`, `get_gem_versions` with pagination, sorting, and GraphQL-like field selection
8
+ - Gem information: `get_gem_info` with field selection, `get_gem_reverse_dependencies`, `get_gem_version_downloads`
9
+ - Gem discovery: `get_latest_gems`, `get_recently_updated_gems`, `search_gems` with pagination
10
+ - Gem changelogs: `get_gem_changelog` with automatic parsing from changelog URIs
11
+ - Ruby version information from ruby-lang.org:
12
+ - `get_latest_ruby_version` - Latest stable Ruby version
13
+ - `get_ruby_versions` - All Ruby versions with download URLs and release notes URLs, supports pagination and sorting
14
+ - `get_ruby_version_changelog` - Changelog summaries parsed from release notes
15
+ - `get_ruby_maintenance_status` - Maintenance status, EOL dates, and maintenance phases for all Ruby versions
16
+ - MCP server integration with 12 tools and 4 resources:
17
+ - Tools: All client methods exposed as MCP tools with full parameter support
18
+ - Resources: Popular gems list, Ruby version compatibility, Ruby maintenance status, latest Ruby version
19
+ - Compatible with Cursor IDE, Claude Desktop, and other MCP-enabled tools
20
+ - Executable: `bundle exec rubygems_mcp` or `rubygems_mcp` (when installed globally)
21
+ - Features:
22
+ - In-memory caching with configurable TTL for improved performance
23
+ - Response size limits to protect against crawler protection pages
24
+ - Graceful error handling with custom exceptions
25
+ - GraphQL-like field selection for efficient data retrieval
26
+ - Pagination support for large result sets
27
+ - Sorting options for version and date-based queries
28
+ - No authentication required - all endpoints are public
29
+ - Complete RBS type signatures for all public APIs
30
+ - Comprehensive test suite with RSpec, VCR cassettes, and WebMock
31
+ - Requires Ruby 3.1 or higher
32
+ - All dependencies use latest compatible versions with pessimistic versioning for security
33
+
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,369 @@
1
+ # rubygems_mcp
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/rubygems_mcp.svg)](https://badge.fury.io/rb/rubygems_mcp) [![Test Status](https://github.com/amkisko/rubygems_mcp.rb/actions/workflows/test.yml/badge.svg)](https://github.com/amkisko/rubygems_mcp.rb/actions/workflows/test.yml)
4
+
5
+ Ruby gem providing RubyGems and Ruby version information via MCP (Model Context Protocol) server tools. Integrates with MCP-compatible clients like Cursor IDE, Claude Desktop, and other MCP-enabled tools.
6
+
7
+ This gem accesses public RubyGems and Ruby version information, no authentication required.
8
+
9
+ Sponsored by [Kisko Labs](https://www.kiskolabs.com).
10
+
11
+ <a href="https://www.kiskolabs.com">
12
+ <img src="kisko.svg" width="200" alt="Sponsored by Kisko Labs" />
13
+ </a>
14
+
15
+ ## Requirements
16
+
17
+ - **Ruby 3.1 or higher** (Ruby 3.0 and earlier are not supported)
18
+
19
+ ## Quick Start
20
+
21
+ ```bash
22
+ gem install rubygems_mcp
23
+ ```
24
+
25
+ ### Cursor IDE Configuration
26
+
27
+ For Cursor IDE, create or update `.cursor/mcp.json` in your project:
28
+
29
+ ```json
30
+ {
31
+ "mcpServers": {
32
+ "rubygems": {
33
+ "command": "bundle",
34
+ "args": ["exec", "rubygems_mcp"]
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ Or if installed globally:
41
+
42
+ ```json
43
+ {
44
+ "mcpServers": {
45
+ "rubygems": {
46
+ "command": "rubygems_mcp"
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### Claude Desktop Configuration
53
+
54
+ For Claude Desktop, edit the MCP configuration file:
55
+
56
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
57
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
58
+
59
+ ```json
60
+ {
61
+ "mcpServers": {
62
+ "rubygems": {
63
+ "command": "bundle",
64
+ "args": ["exec", "rubygems_mcp"],
65
+ "cwd": "/path/to/your/project"
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ Or if installed globally:
72
+
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "rubygems": {
77
+ "command": "rubygems_mcp"
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ **Note**: After updating the configuration, restart Claude Desktop for changes to take effect.
84
+
85
+ ### Testing with MCP Inspector
86
+
87
+ You can test the MCP server using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) tool:
88
+
89
+ ```bash
90
+ # Run the MCP inspector with the server
91
+ npx @modelcontextprotocol/inspector bundle exec rubygems_mcp
92
+ ```
93
+
94
+ The inspector will:
95
+ 1. Start a proxy server and open a browser interface
96
+ 2. Connect to your MCP server via STDIO
97
+ 3. Allow you to test all available tools interactively
98
+ 4. Display request/response messages and any errors
99
+
100
+ This is useful for:
101
+ - Testing tool functionality before integrating with MCP clients
102
+ - Debugging MCP protocol communication
103
+ - Exploring available tools and their parameters
104
+
105
+ ### Running the MCP Server manually
106
+
107
+ After installation, you can start the MCP server immediately:
108
+
109
+ ```bash
110
+ # With bundler
111
+ gem install rubygems_mcp && bundle exec rubygems_mcp
112
+
113
+ # Or if installed globally
114
+ rubygems_mcp
115
+ ```
116
+
117
+ The server will start and communicate via STDIN/STDOUT using the MCP protocol.
118
+
119
+ ## Features
120
+
121
+ - **RubyGems API Client**: Full-featured client for RubyGems REST API with comprehensive endpoint coverage
122
+ - **Ruby Version Information**: Fetch Ruby release information, changelogs, and maintenance status from ruby-lang.org
123
+ - **MCP Server Integration**: Ready-to-use MCP server with 12 tools and 4 resources, compatible with Cursor IDE, Claude Desktop, and other MCP-enabled tools
124
+ - **Pagination & Sorting**: Support for large result sets with customizable pagination and sorting options
125
+ - **Caching**: In-memory caching with configurable TTL for improved performance
126
+ - **Error Handling**: Graceful error handling with custom exceptions and response size limits
127
+ - **No Authentication Required**: All endpoints are public, no API keys needed
128
+ - **Comprehensive API Coverage**: Supports gem versions, latest versions, Ruby versions, gem search, gem information, reverse dependencies, download statistics, changelogs, and more
129
+
130
+ ## Basic Usage
131
+
132
+ ### API Client
133
+
134
+ ```ruby
135
+ require "rubygems_mcp"
136
+
137
+ # Create client
138
+ client = RubygemsMcp::Client.new
139
+
140
+ # Get latest versions for multiple gems
141
+ versions = client.get_latest_versions(["rails", "nokogiri", "rack"])
142
+ # => [
143
+ # { name: "rails", version: "7.1.0", release_date: #<Date>, license: "MIT" },
144
+ # { name: "nokogiri", version: "1.15.0", release_date: #<Date>, license: "MIT" },
145
+ # { name: "rack", version: "3.0.0", release_date: #<Date>, license: "MIT" }
146
+ # ]
147
+
148
+ # Get all versions for a gem
149
+ versions = client.get_gem_versions("rails")
150
+ # => [
151
+ # { version: "7.1.0", release_date: #<Date>, license: "MIT" },
152
+ # { version: "7.0.8", release_date: #<Date>, license: "MIT" },
153
+ # ...
154
+ # ]
155
+
156
+ # Get latest Ruby version
157
+ ruby_version = client.get_latest_ruby_version
158
+ # => { version: "3.3.0", release_date: #<Date> }
159
+
160
+ # Get all Ruby versions
161
+ ruby_versions = client.get_ruby_versions
162
+ # => [
163
+ # { version: "3.3.0", release_date: #<Date> },
164
+ # { version: "3.2.0", release_date: #<Date> },
165
+ # ...
166
+ # ]
167
+
168
+ # Get gem information
169
+ gem_info = client.get_gem_info("rails")
170
+ # => {
171
+ # name: "rails",
172
+ # version: "7.1.0",
173
+ # summary: "Full-stack web application framework.",
174
+ # homepage: "https://rubyonrails.org",
175
+ # source_code: "https://github.com/rails/rails",
176
+ # documentation: "https://api.rubyonrails.org",
177
+ # licenses: ["MIT"],
178
+ # authors: ["David Heinemeier Hansson", ...]
179
+ # }
180
+
181
+ # Search for gems
182
+ results = client.search_gems("rails")
183
+ # => [
184
+ # { name: "rails", version: "7.1.0", info: "...", ... },
185
+ # { name: "rails_admin", version: "3.0.0", info: "...", ... },
186
+ # ...
187
+ # ]
188
+
189
+ # Get reverse dependencies
190
+ reverse_deps = client.get_gem_reverse_dependencies("rails")
191
+ # => ["rails_admin", "activeadmin", ...]
192
+
193
+ # Get download statistics
194
+ downloads = client.get_gem_version_downloads("rails", "7.1.0")
195
+ # => { version_downloads: 123456, total_downloads: 987654321 }
196
+
197
+ # Get Ruby maintenance status
198
+ maintenance = client.get_ruby_maintenance_status
199
+ # => [
200
+ # { version: "3.4", status: "normal maintenance", release_date: "2024-12-25", ... },
201
+ # { version: "3.3", status: "normal maintenance", ... },
202
+ # ...
203
+ # ]
204
+
205
+ # Get Ruby version changelog
206
+ changelog = client.get_ruby_version_changelog("3.4.7")
207
+ # => { version: "3.4.7", summary: "...", release_notes_url: "..." }
208
+
209
+ # Get latest/recently updated gems
210
+ latest = client.get_latest_gems(limit: 10)
211
+ recently_updated = client.get_recently_updated_gems(limit: 10)
212
+ ```
213
+
214
+ ## API Methods
215
+
216
+ ### Gem Versions
217
+
218
+ - `get_latest_versions(gem_names, fields: nil)` - Get latest versions for a list of gems with release dates and licenses. Supports GraphQL-like field selection.
219
+ - `get_gem_versions(gem_name, limit: nil, offset: 0, sort: :version_desc, fields: nil)` - Get all versions for a single gem with release dates and licenses, sorted by version descending. Supports pagination, sorting, and field selection.
220
+
221
+ ### Ruby Versions
222
+
223
+ - `get_latest_ruby_version` - Get latest Ruby version with release date
224
+ - `get_ruby_versions(limit: nil, offset: 0, sort: :version_desc)` - Get all Ruby versions with release dates, download URLs, and release notes URLs, sorted by version descending. Supports pagination and sorting.
225
+ - `get_ruby_version_changelog(version)` - Get changelog summary for a specific Ruby version by fetching and parsing the release notes
226
+ - `get_ruby_maintenance_status` - Get maintenance status for all Ruby versions including EOL dates and maintenance phases
227
+
228
+ ### Gem Information
229
+
230
+ - `get_gem_info(gem_name, fields: nil)` - Get detailed information about a gem (summary, homepage, source code, documentation, licenses, authors, dependencies, downloads). Supports GraphQL-like field selection.
231
+ - `get_gem_reverse_dependencies(gem_name)` - Get reverse dependencies - list of gems that depend on the specified gem
232
+ - `get_gem_version_downloads(gem_name, version)` - Get download statistics for a specific gem version
233
+ - `get_gem_changelog(gem_name, version: nil)` - Get changelog summary for a gem by fetching and parsing the changelog from its changelog_uri
234
+ - `search_gems(query, limit: nil, offset: 0)` - Search for gems by name on RubyGems. Supports pagination.
235
+
236
+ ### Gem Discovery
237
+
238
+ - `get_latest_gems(limit: 30)` - Get latest gems - most recently added gems to RubyGems.org
239
+ - `get_recently_updated_gems(limit: 30)` - Get recently updated gems - most recently updated gem versions
240
+
241
+ ## MCP Server Integration
242
+
243
+ This gem includes a ready-to-use MCP server that can be run directly:
244
+
245
+ ```bash
246
+ # After installing the gem
247
+ bundle exec rubygems_mcp
248
+ ```
249
+
250
+ Or if installed globally:
251
+
252
+ ```bash
253
+ gem install rubygems_mcp
254
+ rubygems_mcp
255
+ ```
256
+
257
+ The server will communicate via STDIN/STDOUT using the MCP protocol. Configure it in your MCP client (e.g., Cursor IDE, Claude Desktop, or other MCP-enabled tools).
258
+
259
+ ## MCP Tools
260
+
261
+ The MCP server provides the following tools:
262
+
263
+ 1. **get_latest_versions** - Get latest versions for a list of gems with release dates and licenses. Supports GraphQL-like field selection.
264
+ - Parameters: `gem_names` (array of strings), `fields` (optional array of strings)
265
+
266
+ 2. **get_gem_versions** - Get all versions for a single gem with release dates and licenses, sorted by version descending. Supports GraphQL-like field selection.
267
+ - Parameters: `gem_name` (string), `limit` (optional integer), `offset` (optional integer), `sort` (optional string: "version_desc", "version_asc", "date_desc", "date_asc"), `fields` (optional array of strings)
268
+
269
+ 3. **get_latest_ruby_version** - Get latest Ruby version with release date
270
+ - Parameters: none
271
+
272
+ 4. **get_ruby_versions** - Get all Ruby versions with release dates, download URLs, and release notes URLs, sorted by version descending
273
+ - Parameters: `limit` (optional integer), `offset` (optional integer), `sort` (optional string: "version_desc", "version_asc", "date_desc", "date_asc")
274
+
275
+ 5. **get_ruby_version_changelog** - Get changelog summary for a specific Ruby version by fetching and parsing the release notes
276
+ - Parameters: `version` (string, e.g., "3.4.7")
277
+
278
+ 6. **get_gem_info** - Get detailed information about a gem (summary, homepage, source code, documentation, licenses, authors, dependencies, downloads). Supports GraphQL-like field selection.
279
+ - Parameters: `gem_name` (string), `fields` (optional array of strings)
280
+
281
+ 7. **get_gem_reverse_dependencies** - Get reverse dependencies - list of gems that depend on the specified gem
282
+ - Parameters: `gem_name` (string)
283
+
284
+ 8. **get_gem_version_downloads** - Get download statistics for a specific gem version
285
+ - Parameters: `gem_name` (string), `version` (string)
286
+
287
+ 9. **get_latest_gems** - Get latest gems - most recently added gems to RubyGems.org
288
+ - Parameters: `limit` (optional integer, default: 30, max: 50)
289
+
290
+ 10. **get_recently_updated_gems** - Get recently updated gems - most recently updated gem versions
291
+ - Parameters: `limit` (optional integer, default: 30, max: 50)
292
+
293
+ 11. **get_gem_changelog** - Get changelog summary for a gem by fetching and parsing the changelog from its changelog_uri
294
+ - Parameters: `gem_name` (string), `version` (optional string, uses latest if not provided)
295
+
296
+ 12. **search_gems** - Search for gems by name on RubyGems
297
+ - Parameters: `query` (string)
298
+
299
+ ## MCP Resources
300
+
301
+ The MCP server provides the following resources:
302
+
303
+ 1. **rubygems://popular** - A curated list of popular Ruby gems with their latest versions
304
+ - Resource name: "Popular Ruby Gems"
305
+ - MIME type: application/json
306
+
307
+ 2. **rubygems://ruby/compatibility** - Information about Ruby version compatibility and release dates
308
+ - Resource name: "Ruby Version Compatibility"
309
+ - MIME type: application/json
310
+
311
+ 3. **rubygems://ruby/maintenance** - Detailed maintenance status for all Ruby versions including EOL dates and maintenance phases
312
+ - Resource name: "Ruby Maintenance Status"
313
+ - MIME type: application/json
314
+
315
+ 4. **rubygems://ruby/latest** - The latest stable Ruby version with release date
316
+ - Resource name: "Latest Ruby Version"
317
+ - MIME type: application/json
318
+
319
+ ## Error Handling
320
+
321
+ The client handles errors gracefully:
322
+ - Returns empty arrays for failed requests
323
+ - Returns empty hashes for failed gem info requests
324
+ - Handles network errors and JSON parsing errors
325
+
326
+ ## Development
327
+
328
+ ```bash
329
+ # Install dependencies
330
+ bundle install
331
+
332
+ # Run tests
333
+ bundle exec rspec
334
+
335
+ # Run tests across multiple Ruby versions
336
+ bundle exec appraisal install
337
+ bundle exec appraisal rspec
338
+
339
+ # Run linting
340
+ bundle exec standardrb --fix
341
+
342
+ # Validate RBS type signatures
343
+ bundle exec rbs validate
344
+ ```
345
+
346
+ ## Contributing
347
+
348
+ Bug reports and pull requests are welcome on GitHub at https://github.com/amkisko/rubygems_mcp.rb.
349
+
350
+ Contribution policy:
351
+ - New features are not necessarily added to the gem
352
+ - Pull request should have test coverage for affected parts
353
+ - Pull request should have changelog entry
354
+
355
+ Review policy:
356
+ - It might take up to 2 calendar weeks to review and merge critical fixes
357
+ - It might take up to 6 calendar months to review and merge pull request
358
+ - It might take up to 1 calendar year to review an issue
359
+
360
+ For more information, see [CONTRIBUTING.md](CONTRIBUTING.md).
361
+
362
+ ## Security
363
+
364
+ If you discover a security vulnerability, please report it responsibly. See [SECURITY.md](SECURITY.md) for details.
365
+
366
+ ## License
367
+
368
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
369
+
data/bin/rubygems_mcp ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Suppress all output to prevent breaking JSON parsing in MCP clients
5
+ # STDOUT is used for MCP protocol communication (JSON-RPC), so we must not output anything
6
+ # STDERR is also suppressed to prevent any error messages from breaking JSON parsing
7
+ unless ENV["DEBUG"]
8
+ require "stringio"
9
+ # Redirect stderr to StringIO to suppress all error output
10
+ $stderr = StringIO.new
11
+ $stderr.set_encoding("UTF-8")
12
+ end
13
+
14
+ require "rubygems_mcp"
15
+ require "rubygems_mcp/server"
16
+
17
+ RubygemsMcp::Server.start
18
+