foobara-mcp-connector 0.0.1 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e4048b44adee3a3ab2d8ed0092495c6cb017901be71c96bfb328aa5fbaaed29
4
- data.tar.gz: 244c334f637a11a5f78f41cb1bc26c228cf315237b8755d076bbdd3ef7653e48
3
+ metadata.gz: c7f2399bed1c8f29efdfd89bf12b38251d74eece5ece41708e5ce04bc8838fd3
4
+ data.tar.gz: e73a8e7afecf4792a62c87097b78488d52f7913e752c7d63ccc37ede25a2505d
5
5
  SHA512:
6
- metadata.gz: 213609332b4d1a02d950f6e046eb57f4d41cf91b1102a57c200dd159684e8fda53b936cfb8bf8e7bbcdd831a55db832bad3e63816ed04ccedf229319349f9110
7
- data.tar.gz: 84c7bcde7c0d0696685f886f289cecddf680bb89383c1954fa1605e4bef225b19fd85fc3c2401f3e9af4a1e37ce2154b533a8f7314f793753326865071d687b4
6
+ metadata.gz: 6f007511b3ea56495751b0d184b79190d6a07efc19e142bfa6e557f5ea039523762fb6ac0da55e67a89ffde52be40317e44a3b7a9c17ce97121122fd98139498
7
+ data.tar.gz: b2deac186cd83fd33268ca054f3d022c8ae47e60849d3f1f9347e608c709645d85a33107c4210e5b0b7dde9e07c8b610759841d1f87496fcd5f208f095063351
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [0.0.3] - 2025-04-14
2
+
3
+ - Grab version from gemspec instead of version.rb
4
+
5
+ ## [0.0.2] - 2025-04-12
6
+
7
+ - Add more examples
8
+ - Update README.md with new examples
9
+ - Add description to gem
10
+
1
11
  ## [0.0.1] - 2025-04-11
2
12
 
3
13
  - Initial release
data/README.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Foobara::McpConnector
2
2
 
3
- Exposes Foobara commands according to the Model Context Protocol specification
3
+ Exposes Foobara commands according to the Model Context Protocol (MCP) specification
4
+
5
+ <!-- TOC -->
6
+ * [Foobara::McpConnector](#foobaramcpconnector)
7
+ * [Installation](#installation)
8
+ * [Usage](#usage)
9
+ * [Super basic example](#super-basic-example)
10
+ * [An example with entities](#an-example-with-entities)
11
+ * [A destructive example](#a-destructive-example)
12
+ * [Moar examples](#moar-examples)
13
+ * [Contributing](#contributing)
14
+ * [License](#license)
15
+ <!-- TOC -->
4
16
 
5
17
  ## Installation
6
18
 
@@ -11,6 +23,8 @@ Typical stuff: add `gem "foobara-mcp-connector` to your Gemfile or .gemspec file
11
23
 
12
24
  You can find examples in `examples/`
13
25
 
26
+ ### Super basic example
27
+
14
28
  Let's create a simple Foobara command:
15
29
 
16
30
  ```ruby
@@ -96,18 +110,133 @@ $ claude
96
110
  ● 125
97
111
  > Thanks!
98
112
  ● You're welcome!
99
- ╭───────────────────────────────────────────────────────────────────────╮
100
- │ > │
101
- ╰───────────────────────────────────────────────────────────────────────╯
102
113
  ```
103
114
 
104
- Please see the examples/ directory for more examples
115
+ ### An example with entities
116
+
117
+ Let's say we have a model (see examples/capybaras.rb):
118
+
119
+ ```ruby
120
+ class Capybara < Foobara::Entity
121
+ attributes do
122
+ id :integer
123
+ name :string, :required
124
+ year_of_birth :integer, :required
125
+ end
126
+
127
+ primary_key :id
128
+ end
129
+ ```
130
+
131
+ As well as some commands like `FindAllCapybaras`, `CreateCapybara`, and `UpdateCapybara`
132
+ (see examples/capybara_commands.rb)
133
+
134
+ We can write an MCP connector to expose those commands so we can ask questions that require
135
+ running those commands to answer:
136
+
137
+ ```ruby
138
+ require "foobara/mcp_connector"
139
+ require_relative "capybara_commands"
140
+
141
+ CreateCapybara.run!(name: "Fumiko", year_of_birth: 2020)
142
+ CreateCapybara.run!(name: "Barbara", year_of_birth: 2019)
143
+ CreateCapybara.run!(name: "Basil", year_of_birth: 2021)
144
+
145
+ mcp_connector = Foobara::McpConnector.new
146
+ mcp_connector.connect(FindAllCapybaras)
147
+
148
+ mcp_connector.run_stdio_server
149
+ ```
150
+
151
+ We can now ask a tool like claude a relevant question:
152
+
153
+ ```
154
+ $ claude
155
+ > Which Capybara is the oldest?
156
+ ● mcp-test:FindAllCapybaras (MCP)()…
157
+ ⎿ [
158
+ {
159
+ "name": "Fumiko",
160
+ "year_of_birth": 2020,
161
+ "id": 1
162
+
163
+ … +7 lines (ctrl+r to expand)
164
+
165
+ "name": "Basil",
166
+ "year_of_birth": 2021,
167
+ "id": 3
168
+ }
169
+ ]
170
+
171
+ ● Barbara (born in 2019)
172
+ > Thanks!
173
+ ● You're welcome!
174
+ ```
175
+
176
+ ### A destructive example
177
+
178
+ Let's say we would like to mutate data. Let's pretend we've accidentally entered a year-of-birth
179
+ in a 2-digit format where a 4-digit format was expected. Let's do that and also expose our UpdateCapybara
180
+ command:
181
+
182
+ ```ruby
183
+ # We will simulate a year accidentally being entered with a 2-digit format where a 4-digit format was expected
184
+ UpdateCapybara.run!(id: barbara.id, year_of_birth: 19)
185
+
186
+ mcp_connector = Foobara::McpConnector.new
187
+
188
+ mcp_connector.connect(FindAllCapybaras)
189
+ mcp_connector.connect(UpdateCapybara)
190
+
191
+ mcp_connector.run_stdio_server
192
+ ```
193
+
194
+ Now we can ask a tool like claude to find and fix our data:
195
+
196
+ ```
197
+ $ claude
198
+ > Hi! There's a Capybara whose birth year was entered incorrectly. Can you find which one
199
+ and fix it? Thanks!
200
+ ● I'll help find and fix the capybara with the incorrect birth year. Let me search for the
201
+ capybaras first.
202
+ ● mcp-test:FindAllCapybaras (MCP)()…
203
+ ⎿ [
204
+ {
205
+ "name": "Fumiko",
206
+ "year_of_birth": 2020,
207
+ "id": 1
208
+
209
+ … +7 lines (ctrl+r to expand)
210
+
211
+ "name": "Basil",
212
+ "year_of_birth": 2021,
213
+ "id": 3
214
+ }
215
+ ]
216
+ ● It looks like Barbara (id 2) has an incorrect birth year of 19, which is too low. Let me
217
+ fix that to 2019.
218
+ ● mcp-test:UpdateCapybara (MCP)(id: 2, year_of_birth: 2019)…
219
+ ⎿ {
220
+ "name": "Barbara",
221
+ "year_of_birth": 2019,
222
+ "id": 2
223
+ }
224
+ ● Fixed! Barbara's birth year has been updated from 19 to 2019.
225
+ > Great! Thanks!
226
+ ● You're welcome!
227
+ ```
228
+
229
+ ### Moar examples
230
+
231
+ Please see the examples/ directory for executable scripts of these examples.
105
232
 
106
233
  ## Contributing
107
234
 
108
235
  Bug reports and pull requests are welcome on GitHub
109
236
  at https://github.com/foobara/mcp-connector
110
237
 
238
+ Feel free to reach out if you'd like help with this gem or if you'd like to help with this gem!
239
+
111
240
  ## License
112
241
 
113
242
  This project is licensed under the MPL-2.0 license. Please see LICENSE.txt for more info.
data/src/mcp_connector.rb CHANGED
@@ -25,9 +25,7 @@ module Foobara
25
25
  end
26
26
 
27
27
  def default_server_version
28
- require_relative "../version"
29
-
30
- Foobara::McpConnectorVersion::VERSION
28
+ Gem.loaded_specs["foobara-mcp-connector"].version.to_s
31
29
  end
32
30
 
33
31
  def default_instructions
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-mcp-connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.0.97
18
+ version: 0.0.101
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.0.97
25
+ version: 0.0.101
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: foobara-json-schema-generator
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -56,7 +56,6 @@ files:
56
56
  - src/request.rb
57
57
  - src/session.rb
58
58
  - src/stdio_runner.rb
59
- - version.rb
60
59
  homepage: https://github.com/foobara/mcp-connector
61
60
  licenses:
62
61
  - MPL-2.0
@@ -81,5 +80,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
80
  requirements: []
82
81
  rubygems_version: 3.6.7
83
82
  specification_version: 4
84
- summary: No description. Add one.
83
+ summary: Gives an easy way to expose your Foobara commands to tools like Claude Code
84
+ via the Model Context Protocol (MCP)
85
85
  test_files: []
data/version.rb DELETED
@@ -1,9 +0,0 @@
1
- module Foobara
2
- module McpConnectorVersion
3
- VERSION = "0.0.1".freeze
4
-
5
- local_ruby_version = File.read("#{__dir__}/.ruby-version").chomp
6
- local_ruby_version_minor = local_ruby_version[/\A(\d+\.\d+)\.\d+\z/, 1]
7
- MINIMUM_RUBY_VERSION = ">= #{local_ruby_version_minor}.0".freeze
8
- end
9
- end