mcp_on_ruby 0.3.0 → 2.0.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +90 -26
  3. data/LICENSE.txt +2 -2
  4. data/README.md +308 -462
  5. data/config/routes.rb +5 -0
  6. data/lib/generators/mcp_on_ruby/expose/expose_generator.rb +108 -0
  7. data/lib/generators/mcp_on_ruby/install/install_generator.rb +37 -0
  8. data/lib/generators/mcp_on_ruby/install/templates/initializer.rb +22 -0
  9. data/lib/mcp_on_ruby/call_context.rb +29 -0
  10. data/lib/mcp_on_ruby/configuration.rb +78 -0
  11. data/lib/mcp_on_ruby/controller.rb +60 -0
  12. data/lib/mcp_on_ruby/declaration.rb +24 -0
  13. data/lib/mcp_on_ruby/dispatcher.rb +97 -0
  14. data/lib/mcp_on_ruby/doctor.rb +67 -0
  15. data/lib/mcp_on_ruby/endpoint.rb +43 -0
  16. data/lib/mcp_on_ruby/engine.rb +29 -0
  17. data/lib/mcp_on_ruby/registry.rb +146 -0
  18. data/lib/mcp_on_ruby/result.rb +83 -0
  19. data/lib/mcp_on_ruby/rspec.rb +8 -0
  20. data/lib/mcp_on_ruby/schema.rb +149 -0
  21. data/lib/mcp_on_ruby/server_factory.rb +66 -0
  22. data/lib/mcp_on_ruby/stdio.rb +42 -0
  23. data/lib/mcp_on_ruby/test_helper.rb +86 -0
  24. data/lib/mcp_on_ruby/tool_spec.rb +87 -0
  25. data/lib/mcp_on_ruby/tool_table.rb +31 -0
  26. data/lib/mcp_on_ruby/version.rb +5 -0
  27. data/lib/mcp_on_ruby/warden_hook.rb +21 -0
  28. data/lib/mcp_on_ruby.rb +64 -0
  29. data/lib/tasks/mcp_on_ruby.rake +20 -0
  30. metadata +63 -245
  31. data/CODE_OF_CONDUCT.md +0 -84
  32. data/CONTRIBUTING.md +0 -92
  33. data/lib/ruby_mcp/client.rb +0 -43
  34. data/lib/ruby_mcp/configuration.rb +0 -90
  35. data/lib/ruby_mcp/errors.rb +0 -17
  36. data/lib/ruby_mcp/models/context.rb +0 -52
  37. data/lib/ruby_mcp/models/engine.rb +0 -31
  38. data/lib/ruby_mcp/models/message.rb +0 -60
  39. data/lib/ruby_mcp/providers/anthropic.rb +0 -269
  40. data/lib/ruby_mcp/providers/base.rb +0 -57
  41. data/lib/ruby_mcp/providers/openai.rb +0 -265
  42. data/lib/ruby_mcp/schemas.rb +0 -56
  43. data/lib/ruby_mcp/server/app.rb +0 -84
  44. data/lib/ruby_mcp/server/base_controller.rb +0 -49
  45. data/lib/ruby_mcp/server/content_controller.rb +0 -68
  46. data/lib/ruby_mcp/server/contexts_controller.rb +0 -67
  47. data/lib/ruby_mcp/server/controller.rb +0 -29
  48. data/lib/ruby_mcp/server/engines_controller.rb +0 -34
  49. data/lib/ruby_mcp/server/generate_controller.rb +0 -140
  50. data/lib/ruby_mcp/server/messages_controller.rb +0 -30
  51. data/lib/ruby_mcp/server/router.rb +0 -84
  52. data/lib/ruby_mcp/storage/active_record.rb +0 -414
  53. data/lib/ruby_mcp/storage/base.rb +0 -43
  54. data/lib/ruby_mcp/storage/error.rb +0 -8
  55. data/lib/ruby_mcp/storage/memory.rb +0 -69
  56. data/lib/ruby_mcp/storage/redis.rb +0 -197
  57. data/lib/ruby_mcp/storage_factory.rb +0 -43
  58. data/lib/ruby_mcp/validator.rb +0 -45
  59. data/lib/ruby_mcp/version.rb +0 -6
  60. data/lib/ruby_mcp.rb +0 -71
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04166e9711a0a9c233c43a2f1bba53b27d0a716a7cc996c52f597433e559909d
4
- data.tar.gz: 588bbbd27e9bc620e4cf4ea14b97b4e8c5cd869b672f8956a2a17b16b179afdb
3
+ metadata.gz: 611ceb54904a193a5ac06d7fc7d223d835067a3d2232b05fc8a46dd1b14b96ac
4
+ data.tar.gz: 8d368c37165bf816104cb32345f7576b95e6e36ff5a01e3b2ecf7a07e497172a
5
5
  SHA512:
6
- metadata.gz: c22a5a6e40162c8754975bb89288ee5147314e41564a97ea25ab7b85fae03eecfcdc7246a0567520d6813ead8bc22e88ffcfa265ccf16653c2da8f06da8adb28
7
- data.tar.gz: e16b57bd9c57d50f1f9f46328d29b94986e54785b166cbf321db1d06366fcd0fa2d43dd7206468ac3671219be7800c8a1f8ccbaaea2eaa77ca4e95217c32da2f
6
+ metadata.gz: 1c0528601bea68540a356a143abc104267e3b3bd8972c38544f13d0a1dd49696ab2d62d571ca6f51a9bdc0b5088e8f0eac4bebd18cef307759babfeaadc1e4d0
7
+ data.tar.gz: 183338a617d68e0e7fd963d627439e62cfdf66045f80f621b778cd12294ab34bf015f2ccf813ca3b747ce74c7bf1ef01e193e785423f6e94e4fac2e8b7918804
data/CHANGELOG.md CHANGED
@@ -1,41 +1,105 @@
1
1
  # Changelog
2
2
 
3
- ## [0.3.0] - 2023-05-01
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [2.0.0] - 2026-10-31
11
+
12
+ MCP on Ruby is now a Rails engine that exposes existing controller actions as MCP tools,
13
+ built on the official [`mcp`](https://github.com/modelcontextprotocol/ruby-sdk) gem.
4
14
 
5
15
  ### Added
6
- - ActiveRecord storage backend for database persistence
7
- - Support for Rails integration with ActiveRecord storage
8
- - Auto-creation of database tables with configurable prefixes
9
- - Proper handling of different data types (text, binary, JSON)
10
- - Symbolization of hash keys for consistent API
11
- - Comprehensive test suite for ActiveRecord storage
16
+
17
+ - `mcp_tool` controller macro with a compact parameter schema DSL (nested objects, arrays, unions, nullable)
18
+ - Route-aware registry: path params become required arguments, annotations come from the HTTP verb, and
19
+ misconfiguration (unrouted declarations, unflagged writes, duplicate names) raises at boot
20
+ - Dispatch of tool calls as in-process requests through the full middleware stack, forwarding the caller's
21
+ `Authorization` header and cookies
22
+ - Result mapping from HTTP responses to MCP tool results, including structured JSON and agent-readable errors
23
+ - Stateless Streamable HTTP endpoint via `mount McpOnRuby::Engine, at: "/mcp"`
24
+ - `bin/rails mcp:stdio` with `stdio_user` (Devise/Warden) and `stdio_headers` (token auth) identities
25
+ - `bin/rails mcp:tools` and `bin/rails mcp:doctor`
26
+ - `mcp_on_ruby:install` and `mcp_on_ruby:expose` generators
27
+ - `McpOnRuby::TestHelper` (`mcp_call`, `mcp_tools`) and `mcp_on_ruby/rspec`
28
+ - `tool_call.mcp_on_ruby` instrumentation event
29
+ - `allow_writes` kill switch and `allowed_origins` for browser clients
12
30
 
13
31
  ### Changed
14
- - Enhanced `StorageFactory` to support ActiveRecord backend
15
- - Updated configuration system with ActiveRecord options
16
- - Improved documentation with ActiveRecord storage examples
17
32
 
18
- ## [0.2.0] - 2025-04-21
33
+ - Requires Ruby 3.2+ and Rails 7.1+
34
+ - The protocol layer is provided by the official `mcp` gem
35
+
36
+ ### Removed
37
+
38
+ - The hand-written JSON-RPC server, Rack middleware, SSE transport, and `app/tools`/`app/resources` classes
39
+
40
+ ## [1.0.0] - 2025-01-28
19
41
 
20
42
  ### Added
21
- - Redis storage backend with comprehensive test coverage
22
- - Configurable TTL and namespace support for Redis keys
23
- - Rails integration with Redis storage examples
24
- - Wiki documentation for Redis storage setup and usage
43
+ - Production-ready MCP server implementation for Rails applications
44
+ - Rails-native integration with generators, middleware, and Railtie
45
+ - Full JSON-RPC 2.0 protocol support over HTTP transport
46
+ - Rails generators for quick setup:
47
+ - `rails generate mcp_on_ruby:install` - Complete MCP server setup
48
+ - `rails generate mcp_on_ruby:tool` - Create new tools with templates
49
+ - `rails generate mcp_on_ruby:resource` - Create new resources with URI templates
50
+ - Comprehensive security features:
51
+ - Bearer token authentication
52
+ - Rate limiting (configurable per minute)
53
+ - CORS support with configurable origins
54
+ - DNS rebinding protection
55
+ - Localhost-only mode for development
56
+ - Automatic tool and resource discovery in Rails apps
57
+ - JSON Schema validation for tool inputs
58
+ - URI templating for resources
59
+ - Error handling with proper JSON-RPC error codes
60
+ - Claude Desktop integration with stdio bridge example
61
+ - Extensive documentation and examples
25
62
 
26
63
  ### Changed
27
- - Enhanced storage factory to support different backend types
28
- - Improved configuration API for more intuitive setup
29
- - Updated README with Redis storage documentation
64
+ - Complete architectural rewrite focused on Rails integration
65
+ - Simplified API following Rails conventions
66
+ - Improved error handling and logging
67
+ - Better security defaults
68
+
69
+ ### Fixed
70
+ - Rails 8 compatibility issues with frozen arrays
71
+ - Middleware initialization timing issues
72
+ - Tool auto-registration in development mode
73
+ - PostgreSQL parameter binding in tool examples
74
+
75
+ ### Removed
76
+ - Standalone client implementation (focus on server-side)
77
+ - STDIO transport (HTTP-only, with bridge examples for stdio clients)
78
+ - Prompts and roots features (not commonly used in Rails context)
30
79
 
31
- ## [0.1.0] - 2025-04-18
80
+ ## [0.2.0] - 2024-07-24
32
81
 
33
- Initial release of version 0.1.0 of the Ruby Gem.
82
+ ### Added
83
+ - OAuth 2.1 authentication for secure remote connections
84
+ - Permission-based access control for MCP methods
85
+ - JWT token validation and management
86
+ - Automatic token refresh mechanism
87
+ - HTTP transport authentication integration
88
+ - Middleware architecture for server authentication
89
+ - Authentication examples and documentation
90
+
91
+ ## [0.1.0] - 2024-06-15
34
92
 
35
93
  ### Added
36
- - Core MCP implementation with Rack server
37
- - Provider support for OpenAI and Anthropic
38
- - In-memory storage backend
39
- - Context, message, and content management
40
- - Basic authentication support
41
- - Comprehensive test suite
94
+ - Initial implementation of core MCP protocol
95
+ - JSON-RPC 2.0 message format
96
+ - HTTP and STDIO transports
97
+ - Basic server and client functionality
98
+ - Tool definition and execution
99
+ - Resource management
100
+ - Prompt handling
101
+ - Root filesystem access
102
+
103
+ [Unreleased]: https://github.com/nagstler/mcp_on_ruby/compare/v2.0.0...HEAD
104
+ [2.0.0]: https://github.com/nagstler/mcp_on_ruby/compare/v1.0.0...v2.0.0
105
+ [1.0.0]: https://github.com/nagstler/mcp_on_ruby/releases/tag/v1.0.0
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2025 Nagendra Dhanakeerthi
3
+ Copyright (c) 2024
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
21
+ THE SOFTWARE.