Commit graph

60 commits

Author SHA1 Message Date
Joey Cardosi
d80b13736e
just redo all of it from scratch 2025-05-30 12:15:11 -04:00
Ateş Göral
0b49c3f711
Merge pull request #26 from koic/suppress_rubocop_info
Enable RuboCop Minitest and RuboCop Rake for development
2025-05-30 00:27:06 -04:00
Ateş Göral
a32b7d2499
Merge pull request #25 from koic/enable_rubocop_on_ci
Enable RuboCop on CI
2025-05-30 00:25:03 -04:00
Ateş Göral
8db094d300
Merge pull request #29 from koic/suppress_redundant_attributes_in_resources
Suppress redundant attributes in Resources
2025-05-30 00:22:24 -04:00
Ateş Göral
5ae86796c9
Merge pull request #30 from koic/fix_an_error_when_using_bin_console]
Fix an error when using `bin/console`
2025-05-30 00:21:40 -04:00
Koichi ITO
9a7b4a8465 Fix an error when using bin/console
Follow-up to #24.

This PR fixes the following error when using `bin/console`:

```console
$ bin/console
/Users/koic/.rbenv/versions/3.4.4/lib/ruby/3.4.0/bundled_gems.rb:82:
in 'Kernel.require': cannot load such file -- model_context_protocol (LoadError)
from /Users/koic/.rbenv/versions/3.4.4/lib/ruby/3.4.0/bundled_gems.rb:82:
in 'block (2 levels) in Kernel#replace_require'
        from bin/console:5:in '<main>'
```
2025-05-30 11:26:35 +09:00
Koichi ITO
2f354a872a Suppress redundant attributes in Resources
According to the specification, the following attributes are optional,
so using `compact` ensures consistency.

- `description`: Optional description
- `mimeType`: Optional MIME type
- `size`: Optional size in bytes

https://modelcontextprotocol.io/specification/2025-03-26/server/resources#resource
2025-05-30 10:41:18 +09:00
Topher Bullock
91219d30b7
Merge pull request #24 from modelcontextprotocol/update-gemspec
Update gemspec to reflect `mcp` naming
2025-05-29 17:45:45 -04:00
Topher Bullock
bf07d4a02c update README and cursor rule 2025-05-29 17:11:45 -04:00
Topher Bullock
9d2447b351 rename lib/{model_context_protocol => mcp} 2025-05-29 17:11:40 -04:00
Topher Bullock
a09f4786b4 update entrypoint 2025-05-29 17:11:33 -04:00
Topher Bullock
d48de195f6 update gemspec 2025-05-29 17:11:30 -04:00
Koichi ITO
a169bbd2ba Enable RuboCop Minitest and RuboCop Rake for development
Based on the following information, `rubocop-minitest` and `rubocop-rake` have been added
for development. Autocorrection has been applied for offenses detected by `rubocop-minitest`.

```console
$ bundle exec rake
(snip)

Running RuboCop...
Inspecting 40 files
........................................

40 files inspected, no offenses detected

Tip: Based on detected gems, the following RuboCop extension libraries might be helpful:
* rubocop-minitest (https://rubygems.org/gems/rubocop-minitest)
* rubocop-rake (https://rubygems.org/gems/rubocop-rake)

You can opt out of this message by adding the following to your config
(see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions for more options):
AllCops:
    SuggestExtensions: false
```

If preserving the existing behavior is preferred, it is also possible to set `SuggestExtensions: false`.
2025-05-28 11:19:32 +09:00
Koichi ITO
3477406afe Enable RuboCop on CI
When running `bundle exec rake` in the local environment, RuboCop is executed,
but it was not included in the CI workflow.

This PR enables RuboCop execution in the CI workflow. RuboCop performs static analysis
on the source code using Ruby 3.2, in accordance with the gemspec setting `spec.required_ruby_version = ">= 3.2.0"`:
6b49222edb/model_context_protocol.gemspec (L16)

In other words, it is not necessary to run RuboCop under every Ruby version from 3.2 to head,
so it is defined as a separate job from the test job.
2025-05-28 01:32:23 +09:00
Ateş Göral
6b49222edb
Merge pull request #22 from koic/fix_incorrect_capabilities_handling_for_completion_complete
Fix incorrect capabilities handling for `completion/complete`
2025-05-26 20:01:57 -04:00
Ateş Göral
1ba438feec
Merge pull request #21 from koic/remove_duplicate_require_relative
Remove redundant `require_relative`
2025-05-26 20:01:21 -04:00
Ateş Göral
34fa53c305
Merge pull request #10 from chrisbutcher/fix-sorbet-runtime-compatibility
Support Sorbet typed tools
2025-05-26 20:01:05 -04:00
Koichi ITO
d3dcde2460 Fix incorrect capabilities handling for completion/complete
This PR fixes incorrect capabilities handling for `completion/complete`.
As specified, the capability of `completion/complete` is `completions`, not `prompts`:
https://modelcontextprotocol.io/specification/2025-03-26/server/utilities/completion#capabilities

Note that in the Ruby SDK, `completion/complete`, like `logging/setLevel`, is not yet implemented.
Therefore, an empty implementation has been added to server.rb.
2025-05-26 17:37:13 +09:00
Koichi ITO
2a9926b51b Remove redundant require_relative
This PR removes a redundant require statement that is already present in the `server.rb`:
89ef9d8/lib/model_context_protocol/server.rb (L5)
2025-05-24 16:06:26 +09:00
Ateş Göral
89ef9d89e5
Merge pull request #18 from koic/remove_dot_ruby_version
Remove .ruby-version for development
2025-05-24 00:39:23 -04:00
Ateş Göral
6435de2f39
Merge pull request #17 from koic/fix_syntax_error_in_examples_of_the_readme
[Doc] Fix invalid syntax in README examples
2025-05-24 00:38:37 -04:00
Ateş Göral
a202b62b1f
Merge pull request #19 from koic/remove_unused_constant
Remove unused constant
2025-05-24 00:36:51 -04:00
Ateş Göral
097f979a30
Merge pull request #20 from koic/fix_a_typo
Fix a typo
2025-05-24 00:35:59 -04:00
Koichi ITO
8f64324f6c Fix a typo
The method that overrides `Methods::RESOURCES_READ` is named `resources_read_handler`,
not `read_resource_handler`:
18f3e87/lib/model_context_protocol/server.rb (L97-L99)
2025-05-24 01:02:04 +09:00
Koichi ITO
9bcb3bf15b Remove unused constant
This PR removes an unused constant that is not referenced anywhere
and was likely left over during development.
2025-05-24 00:53:05 +09:00
Koichi ITO
92ef9e4b63 Remove .ruby-version for development
RubyGems may be used across a wide range of Ruby versions,
from the minimum supported version to development versions.

To allow local development with any Ruby version,
the Ruby version is not locked using a `.ruby-version` file.

This enables developers to work with their preferred Ruby version and
frees repository maintainers from the need to update `.ruby-version`.

Additionally, because testing against supported Ruby versions is performed
in CI before release, the version in `.ruby-version` is not important.
2025-05-23 15:44:17 +09:00
Koichi ITO
e526009b52 [Doc] Fix invalid syntax in README examples
This PR corrects invalid syntax in the README examples.
Additionally, all lambda blocks using `->` have been consistently
formatted with `{}`.
2025-05-23 15:39:59 +09:00
Topher Bullock
18f3e8761e
Merge pull request #8 from kfischer-okarin/auto-determine-capabilities
Auto determine capabilities
2025-05-21 14:23:11 -04:00
Topher Bullock
049bac648d
Merge pull request #16 from koic/use_require_relative
Use `require_relative`
2025-05-21 14:22:44 -04:00
Topher Bullock
4b84f93375
Merge pull request #15 from koic/remove_useless_mcp_json_rpc_module
Remove useless `ModelContextProtocol::JsonRPC` module
2025-05-21 14:13:10 -04:00
Topher Bullock
6c25eec201
Merge pull request #14 from andyw8/andyw8/fix-gitignore
Fix .gitignore entry for `Gemfile.lock`
2025-05-21 14:11:14 -04:00
Koichi ITO
e8620659a6 Use require_relative
If there are many searches in the `$LOAD_PATH` in the user environment,
require will perform unnecessary searches that are not needed.
In contrast, `require_relative` is efficient because it uses a relative path.
2025-05-22 00:56:22 +09:00
Koichi ITO
5f7a5b5d7e Remove useless ModelContextProtocol::JsonRPC module
JSON-RPC is handled by https://github.com/Shopify/json-rpc-handler,
so `ModelContextProtocol::JsonRPC` module seems to have been
unintentionally left behind in the following commit:
c5591be

The files under `model_context_protocol/json_rpc/*.rb` have already been removed.
2025-05-22 00:53:21 +09:00
Andy Waite
19be50d2b9 Fix .gitignore entry for Gemfile.lock
The `Gemfile.lock` entry has a . in front which prevents it from being ignored.
2025-05-21 11:06:26 -04:00
Christopher Butcher
6e782098ec
Update ToolTest to use kwargs in example tool call methods 2025-05-21 09:03:21 -04:00
Christopher Butcher
84e83841b0
Support Sorbet typed tools 2025-05-21 09:03:19 -04:00
Topher Bullock
87cd467c58
Merge pull request #13 from modelcontextprotocol/remove-gemfile-lock
remove `Gemfile.lock`
2025-05-20 17:13:32 -04:00
Topher Bullock
032a28d660
Update lib/model_context_protocol/server.rb 2025-05-20 17:05:29 -04:00
Topher Bullock
00e1ed8fec
Merge branch 'main' into auto-determine-capabilities 2025-05-20 17:01:45 -04:00
Topher Bullock
e89af18e95
Merge pull request #7 from kfischer-okarin/specify-server-version
Allow specifying the server version
2025-05-20 16:58:17 -04:00
Topher Bullock
afa0d8b6ab remove Gemfile.lock
ci on #10 is failing due to darwin deps in the lockfile.
fix ci by removing the gemfile and adding `bundle install` to ci steps
2025-05-20 11:20:05 -04:00
Topher Bullock
bdbf015dd5
Merge pull request #6 from iberianpig/fix/use-utf8-for-stdout
fix: force UTF-8 encoding for stdio streams
2025-05-20 10:48:47 -04:00
Kevin Fischer
0f33dc05e1
Default capability determination 2025-05-14 00:25:49 +09:00
Kevin Fischer
81fa3a9efa
Move default capabilities into a private method 2025-05-14 00:10:32 +09:00
Kevin Fischer
7b390053bd
Update README and example with server version 2025-05-13 23:58:38 +09:00
Kevin Fischer
ea4828987c
Allow specifying a server version 2025-05-13 23:51:02 +09:00
iberianpig
01460b0b4f
fix: force UTF-8 encoding for stdio streams
This change forces $stdin/$stdout to use UTF-8 encoding,
similar to PR 198 in the python-sdk.
https://github.com/modelcontextprotocol/python-sdk/pull/198

It addresses platform-dependent encoding issues.
2025-05-13 17:26:10 +09:00
David Soria Parra
784b8b8548 Merge pull request #5 from modelcontextprotocol/davidsp/gem
Set Gemspec to official MCP account
2025-05-08 17:38:23 -04:00
David Soria Parra
71a2955215 Set gemspec 2025-05-08 17:38:23 -04:00
Tyler Rowsell
baeb99ffbc Internal Release 0.7.0
- add support for resource templates
- improve capability negotiation on handlers
- clean up readme
- reduce default protocol version to "2024-11-05"
- address spec compliance of resources
- add debug gem to development
- alias ModelContextProtocol to MCP
- move prompt subclasses to subdir
- improve tool and prompt definition
- improve passing of server context to tools
- improve tool input schema validation
2025-05-08 17:38:19 -04:00