mcp_on_ruby 0.3.0 → 1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +56 -28
- data/CODE_OF_CONDUCT.md +30 -58
- data/CONTRIBUTING.md +61 -67
- data/LICENSE.txt +2 -2
- data/README.md +159 -509
- data/bin/console +11 -0
- data/bin/setup +6 -0
- data/docs/advanced-usage.md +132 -0
- data/docs/api-reference.md +35 -0
- data/docs/testing.md +55 -0
- data/examples/claude/README.md +171 -0
- data/examples/claude/claude-bridge.js +122 -0
- data/lib/mcp_on_ruby/configuration.rb +74 -0
- data/lib/mcp_on_ruby/errors.rb +137 -0
- data/lib/mcp_on_ruby/generators/install_generator.rb +46 -0
- data/lib/mcp_on_ruby/generators/resource_generator.rb +63 -0
- data/lib/mcp_on_ruby/generators/templates/README +31 -0
- data/lib/mcp_on_ruby/generators/templates/application_resource.rb +20 -0
- data/lib/mcp_on_ruby/generators/templates/application_tool.rb +18 -0
- data/lib/mcp_on_ruby/generators/templates/initializer.rb +41 -0
- data/lib/mcp_on_ruby/generators/templates/resource.rb +50 -0
- data/lib/mcp_on_ruby/generators/templates/resource_spec.rb +67 -0
- data/lib/mcp_on_ruby/generators/templates/sample_resource.rb +57 -0
- data/lib/mcp_on_ruby/generators/templates/sample_tool.rb +59 -0
- data/lib/mcp_on_ruby/generators/templates/tool.rb +38 -0
- data/lib/mcp_on_ruby/generators/templates/tool_spec.rb +55 -0
- data/lib/mcp_on_ruby/generators/tool_generator.rb +51 -0
- data/lib/mcp_on_ruby/railtie.rb +108 -0
- data/lib/mcp_on_ruby/resource.rb +161 -0
- data/lib/mcp_on_ruby/server.rb +378 -0
- data/lib/mcp_on_ruby/tool.rb +134 -0
- data/lib/mcp_on_ruby/transport.rb +330 -0
- data/lib/mcp_on_ruby/version.rb +6 -0
- data/lib/mcp_on_ruby.rb +142 -0
- metadata +62 -173
- data/lib/ruby_mcp/client.rb +0 -43
- data/lib/ruby_mcp/configuration.rb +0 -90
- data/lib/ruby_mcp/errors.rb +0 -17
- data/lib/ruby_mcp/models/context.rb +0 -52
- data/lib/ruby_mcp/models/engine.rb +0 -31
- data/lib/ruby_mcp/models/message.rb +0 -60
- data/lib/ruby_mcp/providers/anthropic.rb +0 -269
- data/lib/ruby_mcp/providers/base.rb +0 -57
- data/lib/ruby_mcp/providers/openai.rb +0 -265
- data/lib/ruby_mcp/schemas.rb +0 -56
- data/lib/ruby_mcp/server/app.rb +0 -84
- data/lib/ruby_mcp/server/base_controller.rb +0 -49
- data/lib/ruby_mcp/server/content_controller.rb +0 -68
- data/lib/ruby_mcp/server/contexts_controller.rb +0 -67
- data/lib/ruby_mcp/server/controller.rb +0 -29
- data/lib/ruby_mcp/server/engines_controller.rb +0 -34
- data/lib/ruby_mcp/server/generate_controller.rb +0 -140
- data/lib/ruby_mcp/server/messages_controller.rb +0 -30
- data/lib/ruby_mcp/server/router.rb +0 -84
- data/lib/ruby_mcp/storage/active_record.rb +0 -414
- data/lib/ruby_mcp/storage/base.rb +0 -43
- data/lib/ruby_mcp/storage/error.rb +0 -8
- data/lib/ruby_mcp/storage/memory.rb +0 -69
- data/lib/ruby_mcp/storage/redis.rb +0 -197
- data/lib/ruby_mcp/storage_factory.rb +0 -43
- data/lib/ruby_mcp/validator.rb +0 -45
- data/lib/ruby_mcp/version.rb +0 -6
- data/lib/ruby_mcp.rb +0 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41b083ae138856bff622b5bbdcaa2112ee08961b1eda6acec5a4bb5a7a6f0b04
|
4
|
+
data.tar.gz: e67b154ece12257fd300fd4824d25392a1a103de5ef0c8b0654fe17af970dd97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3927a0dbfba3cc726868a3f05690340d90bbd6a0715be53880bec3611f861bbf1cc7f817167e4df3373d6fd76e013575745a00c625e7a119f839683c7aa9166
|
7
|
+
data.tar.gz: 4e9b2179b6c709597b0fe6d8327f8e7d1539107d32d2f76c237a82e3e1d06c86dcc0ea1d17e2f226e5524cb1772e91fc0478c7e188d977252db9de51a57708a1
|
data/CHANGELOG.md
CHANGED
@@ -1,41 +1,69 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [1.0.0] - 2025-01-28
|
4
9
|
|
5
10
|
### Added
|
6
|
-
-
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
-
|
11
|
-
-
|
11
|
+
- Production-ready MCP server implementation for Rails applications
|
12
|
+
- Rails-native integration with generators, middleware, and Railtie
|
13
|
+
- Full JSON-RPC 2.0 protocol support over HTTP transport
|
14
|
+
- Rails generators for quick setup:
|
15
|
+
- `rails generate mcp_on_ruby:install` - Complete MCP server setup
|
16
|
+
- `rails generate mcp_on_ruby:tool` - Create new tools with templates
|
17
|
+
- `rails generate mcp_on_ruby:resource` - Create new resources with URI templates
|
18
|
+
- Comprehensive security features:
|
19
|
+
- Bearer token authentication
|
20
|
+
- Rate limiting (configurable per minute)
|
21
|
+
- CORS support with configurable origins
|
22
|
+
- DNS rebinding protection
|
23
|
+
- Localhost-only mode for development
|
24
|
+
- Automatic tool and resource discovery in Rails apps
|
25
|
+
- JSON Schema validation for tool inputs
|
26
|
+
- URI templating for resources
|
27
|
+
- Error handling with proper JSON-RPC error codes
|
28
|
+
- Claude Desktop integration with stdio bridge example
|
29
|
+
- Extensive documentation and examples
|
12
30
|
|
13
31
|
### Changed
|
14
|
-
-
|
15
|
-
-
|
16
|
-
- Improved
|
32
|
+
- Complete architectural rewrite focused on Rails integration
|
33
|
+
- Simplified API following Rails conventions
|
34
|
+
- Improved error handling and logging
|
35
|
+
- Better security defaults
|
17
36
|
|
18
|
-
|
37
|
+
### Fixed
|
38
|
+
- Rails 8 compatibility issues with frozen arrays
|
39
|
+
- Middleware initialization timing issues
|
40
|
+
- Tool auto-registration in development mode
|
41
|
+
- PostgreSQL parameter binding in tool examples
|
19
42
|
|
20
|
-
###
|
21
|
-
-
|
22
|
-
-
|
23
|
-
-
|
24
|
-
- Wiki documentation for Redis storage setup and usage
|
43
|
+
### Removed
|
44
|
+
- Standalone client implementation (focus on server-side)
|
45
|
+
- STDIO transport (HTTP-only, with bridge examples for stdio clients)
|
46
|
+
- Prompts and roots features (not commonly used in Rails context)
|
25
47
|
|
26
|
-
|
27
|
-
- Enhanced storage factory to support different backend types
|
28
|
-
- Improved configuration API for more intuitive setup
|
29
|
-
- Updated README with Redis storage documentation
|
48
|
+
## [0.2.0] - 2024-07-24
|
30
49
|
|
31
|
-
|
50
|
+
### Added
|
51
|
+
- OAuth 2.1 authentication for secure remote connections
|
52
|
+
- Permission-based access control for MCP methods
|
53
|
+
- JWT token validation and management
|
54
|
+
- Automatic token refresh mechanism
|
55
|
+
- HTTP transport authentication integration
|
56
|
+
- Middleware architecture for server authentication
|
57
|
+
- Authentication examples and documentation
|
32
58
|
|
33
|
-
|
59
|
+
## [0.1.0] - 2024-06-15
|
34
60
|
|
35
61
|
### Added
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
-
|
62
|
+
- Initial implementation of core MCP protocol
|
63
|
+
- JSON-RPC 2.0 message format
|
64
|
+
- HTTP and STDIO transports
|
65
|
+
- Basic server and client functionality
|
66
|
+
- Tool definition and execution
|
67
|
+
- Resource management
|
68
|
+
- Prompt handling
|
69
|
+
- Root filesystem access
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -2,83 +2,55 @@
|
|
2
2
|
|
3
3
|
## Our Pledge
|
4
4
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our
|
6
|
-
|
7
|
-
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
10
|
+
and orientation.
|
8
11
|
|
9
12
|
## Our Standards
|
10
13
|
|
11
|
-
Examples of behavior that contributes to a positive environment
|
14
|
+
Examples of behavior that contributes to a positive environment:
|
12
15
|
|
13
|
-
*
|
14
|
-
* Being respectful of differing
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
16
|
+
* Using welcoming and inclusive language
|
17
|
+
* Being respectful of differing viewpoints and experiences
|
18
|
+
* Gracefully accepting constructive criticism
|
19
|
+
* Focusing on what is best for the community
|
20
|
+
* Showing empathy towards other community members
|
18
21
|
|
19
|
-
Examples of unacceptable behavior
|
22
|
+
Examples of unacceptable behavior:
|
20
23
|
|
21
|
-
* The use of sexualized language or imagery, and sexual attention or
|
22
|
-
advances of any kind
|
24
|
+
* The use of sexualized language or imagery, and sexual attention or advances
|
23
25
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
26
|
* Public or private harassment
|
25
|
-
* Publishing others' private information
|
26
|
-
|
27
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
-
professional setting
|
27
|
+
* Publishing others' private information without explicit permission
|
28
|
+
* Other conduct which could reasonably be considered inappropriate
|
29
29
|
|
30
30
|
## Enforcement Responsibilities
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
Project maintainers are responsible for clarifying and enforcing our standards of
|
33
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
34
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
35
|
+
or harmful.
|
35
36
|
|
36
37
|
## Scope
|
37
38
|
|
38
|
-
This Code of Conduct applies within all community spaces, and also applies when
|
39
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
40
|
+
an individual is officially representing the community in public spaces.
|
39
41
|
|
40
42
|
## Enforcement
|
41
43
|
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
## Enforcement Guidelines
|
47
|
-
|
48
|
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
-
|
50
|
-
### 1. Correction
|
51
|
-
|
52
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
-
|
54
|
-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
-
|
56
|
-
### 2. Warning
|
44
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
45
|
+
reported to the community leaders responsible for enforcement at
|
46
|
+
[INSERT EMAIL ADDRESS].
|
57
47
|
|
58
|
-
|
59
|
-
|
60
|
-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
-
|
62
|
-
### 3. Temporary Ban
|
63
|
-
|
64
|
-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
-
|
66
|
-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
-
|
68
|
-
### 4. Permanent Ban
|
69
|
-
|
70
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
-
|
72
|
-
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
48
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
73
49
|
|
74
50
|
## Attribution
|
75
51
|
|
76
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
77
|
-
available at
|
78
|
-
|
79
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
-
|
81
|
-
[homepage]: https://www.contributor-covenant.org
|
52
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
53
|
+
version 2.0, available at
|
54
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
82
55
|
|
83
|
-
|
84
|
-
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
56
|
+
[homepage]: https://www.contributor-covenant.org
|
data/CONTRIBUTING.md
CHANGED
@@ -1,92 +1,86 @@
|
|
1
|
-
# Contributing to
|
1
|
+
# Contributing to MCP on Ruby
|
2
2
|
|
3
|
-
|
3
|
+
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
|
4
4
|
|
5
|
-
|
5
|
+
- Reporting a bug
|
6
|
+
- Discussing the current state of the code
|
7
|
+
- Submitting a fix
|
8
|
+
- Proposing new features
|
9
|
+
- Becoming a maintainer
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
## How Can I Contribute?
|
10
|
-
|
11
|
-
### Reporting Bugs
|
12
|
-
|
13
|
-
This section guides you through submitting a bug report for RubyMCP.
|
14
|
-
|
15
|
-
Before creating bug reports, please check [the issue list](https://github.com/nagstler/mcp_on_ruby/issues) to avoid duplicating an existing report. When you create a bug report, include as many details as possible:
|
16
|
-
|
17
|
-
* **Use a clear and descriptive title**
|
18
|
-
* **Describe the exact steps to reproduce the bug**
|
19
|
-
* **Provide specific examples**
|
20
|
-
* **Describe the behavior you observed**
|
21
|
-
* **Explain the behavior you expected**
|
22
|
-
* **Include screenshots or animated GIFs** if possible
|
23
|
-
* **Include details about your configuration and environment**
|
24
|
-
|
25
|
-
### Suggesting Enhancements
|
26
|
-
|
27
|
-
This section guides you through submitting an enhancement suggestion for RubyMCP.
|
28
|
-
|
29
|
-
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion:
|
30
|
-
|
31
|
-
* **Use a clear and descriptive title**
|
32
|
-
* **Provide a detailed description of the suggested enhancement**
|
33
|
-
* **Explain why this enhancement would be useful**
|
34
|
-
* **Specify which version you're using**
|
35
|
-
* **Specify the name and version of the OS you're using**
|
11
|
+
## Development Process
|
36
12
|
|
37
|
-
|
13
|
+
We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.
|
38
14
|
|
39
|
-
|
40
|
-
* Follow the Ruby style guide
|
41
|
-
* Include tests for new features
|
42
|
-
* Document new code based on the rest of the codebase
|
43
|
-
* End all files with a newline
|
15
|
+
## Pull Requests
|
44
16
|
|
45
|
-
|
17
|
+
1. Fork the repo and create your branch from `main`.
|
18
|
+
2. If you've added code that should be tested, add tests.
|
19
|
+
3. If you've changed APIs, update the documentation.
|
20
|
+
4. Ensure the test suite passes.
|
21
|
+
5. Make sure your code lints.
|
22
|
+
6. Issue that pull request!
|
46
23
|
|
47
|
-
|
24
|
+
## Development Setup
|
48
25
|
|
49
26
|
```bash
|
50
|
-
#
|
51
|
-
git clone https://github.com/
|
52
|
-
cd
|
27
|
+
# Clone your fork
|
28
|
+
git clone https://github.com/nagstler/mcp_on_ruby.git
|
29
|
+
cd mcp_on_ruby
|
53
30
|
|
54
31
|
# Install dependencies
|
55
32
|
bundle install
|
56
33
|
|
57
|
-
# Run
|
58
|
-
|
34
|
+
# Run the generators to test Rails integration
|
35
|
+
mkdir test_app && cd test_app
|
36
|
+
rails new . --skip-git
|
37
|
+
echo "gem 'mcp_on_ruby', path: '..' " >> Gemfile
|
38
|
+
bundle install
|
39
|
+
rails generate mcp_on_ruby:install
|
59
40
|
|
41
|
+
# Test the gem
|
42
|
+
cd .. && ruby -e "require './lib/mcp_on_ruby'; puts 'Gem loads successfully'"
|
43
|
+
```
|
60
44
|
|
61
|
-
|
45
|
+
## Code Style
|
62
46
|
|
63
|
-
|
64
|
-
|
65
|
-
|
47
|
+
- Follow standard Ruby conventions
|
48
|
+
- Use meaningful variable and method names
|
49
|
+
- Add documentation for public APIs
|
50
|
+
- Keep methods focused and small
|
66
51
|
|
67
|
-
|
68
|
-
bundle exec rspec
|
69
|
-
```
|
52
|
+
## Testing
|
70
53
|
|
71
|
-
|
54
|
+
Currently, we use manual testing and examples. In the future, we plan to add:
|
55
|
+
- RSpec test suite
|
56
|
+
- Integration tests with Rails
|
57
|
+
- CI/CD pipeline
|
72
58
|
|
73
|
-
|
74
|
-
Run RuboCop to check your code style
|
59
|
+
## Bug Reports
|
75
60
|
|
76
|
-
|
77
|
-
|
78
|
-
|
61
|
+
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/nagstler/mcp_on_ruby/issues).
|
62
|
+
|
63
|
+
**Great Bug Reports** tend to have:
|
64
|
+
|
65
|
+
- A quick summary and/or background
|
66
|
+
- Steps to reproduce
|
67
|
+
- Be specific!
|
68
|
+
- Give sample code if you can
|
69
|
+
- What you expected would happen
|
70
|
+
- What actually happens
|
71
|
+
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
|
72
|
+
|
73
|
+
## Feature Requests
|
79
74
|
|
80
|
-
|
75
|
+
We use GitHub issues to track feature requests. Propose a feature by [opening a new issue](https://github.com/nagstler/mcp_on_ruby/issues).
|
81
76
|
|
82
|
-
|
77
|
+
**Great Feature Requests** include:
|
83
78
|
|
84
|
-
-
|
85
|
-
-
|
86
|
-
-
|
79
|
+
- Clear use case description
|
80
|
+
- Why this feature would be useful
|
81
|
+
- Proposed API or implementation approach
|
82
|
+
- Examples of how it would be used
|
87
83
|
|
88
|
-
|
89
|
-
If you're new to the project, look for issues labeled with good first issue which are ideal starting points for newcomers.
|
84
|
+
## License
|
90
85
|
|
91
|
-
|
92
|
-
By contributing to RubyMCP, you agree that your contributions will be licensed under the project's MIT License.
|
86
|
+
By contributing, you agree that your contributions will be licensed under the same MIT License that covers the project.
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
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.
|