girb-mcp 0.1.1 → 0.1.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.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -331
  3. data/exe/girb-mcp +6 -35
  4. data/exe/girb-rails +6 -123
  5. data/lib/girb_mcp/version.rb +1 -1
  6. data/lib/girb_mcp.rb +6 -35
  7. metadata +33 -183
  8. data/.rspec +0 -3
  9. data/CHANGELOG.md +0 -27
  10. data/README.ja.md +0 -349
  11. data/examples/01_simple_bug.rb +0 -43
  12. data/examples/02_data_pipeline.rb +0 -93
  13. data/examples/03_recursion.rb +0 -96
  14. data/examples/RAILS_SCENARIOS.md +0 -350
  15. data/examples/SCENARIOS.md +0 -142
  16. data/examples/rails_test_app/setup.sh +0 -428
  17. data/examples/rails_test_app/testapp/.dockerignore +0 -10
  18. data/examples/rails_test_app/testapp/.ruby-version +0 -1
  19. data/examples/rails_test_app/testapp/Dockerfile +0 -23
  20. data/examples/rails_test_app/testapp/Gemfile +0 -17
  21. data/examples/rails_test_app/testapp/README.md +0 -65
  22. data/examples/rails_test_app/testapp/Rakefile +0 -6
  23. data/examples/rails_test_app/testapp/app/assets/images/.keep +0 -0
  24. data/examples/rails_test_app/testapp/app/assets/stylesheets/application.css +0 -1
  25. data/examples/rails_test_app/testapp/app/controllers/application_controller.rb +0 -4
  26. data/examples/rails_test_app/testapp/app/controllers/concerns/.keep +0 -0
  27. data/examples/rails_test_app/testapp/app/controllers/dashboard_controller.rb +0 -38
  28. data/examples/rails_test_app/testapp/app/controllers/health_controller.rb +0 -11
  29. data/examples/rails_test_app/testapp/app/controllers/orders_controller.rb +0 -100
  30. data/examples/rails_test_app/testapp/app/controllers/posts_controller.rb +0 -82
  31. data/examples/rails_test_app/testapp/app/controllers/sessions_controller.rb +0 -25
  32. data/examples/rails_test_app/testapp/app/controllers/users_controller.rb +0 -44
  33. data/examples/rails_test_app/testapp/app/helpers/application_helper.rb +0 -2
  34. data/examples/rails_test_app/testapp/app/models/application_record.rb +0 -3
  35. data/examples/rails_test_app/testapp/app/models/comment.rb +0 -8
  36. data/examples/rails_test_app/testapp/app/models/concerns/.keep +0 -0
  37. data/examples/rails_test_app/testapp/app/models/order.rb +0 -56
  38. data/examples/rails_test_app/testapp/app/models/order_item.rb +0 -16
  39. data/examples/rails_test_app/testapp/app/models/post.rb +0 -29
  40. data/examples/rails_test_app/testapp/app/models/user.rb +0 -34
  41. data/examples/rails_test_app/testapp/app/services/order_report_service.rb +0 -40
  42. data/examples/rails_test_app/testapp/app/views/layouts/application.html.erb +0 -28
  43. data/examples/rails_test_app/testapp/app/views/pwa/manifest.json.erb +0 -22
  44. data/examples/rails_test_app/testapp/app/views/pwa/service-worker.js +0 -26
  45. data/examples/rails_test_app/testapp/bin/ci +0 -6
  46. data/examples/rails_test_app/testapp/bin/dev +0 -2
  47. data/examples/rails_test_app/testapp/bin/rails +0 -4
  48. data/examples/rails_test_app/testapp/bin/rake +0 -4
  49. data/examples/rails_test_app/testapp/bin/setup +0 -35
  50. data/examples/rails_test_app/testapp/config/application.rb +0 -42
  51. data/examples/rails_test_app/testapp/config/boot.rb +0 -3
  52. data/examples/rails_test_app/testapp/config/ci.rb +0 -14
  53. data/examples/rails_test_app/testapp/config/database.yml +0 -32
  54. data/examples/rails_test_app/testapp/config/environment.rb +0 -5
  55. data/examples/rails_test_app/testapp/config/environments/development.rb +0 -54
  56. data/examples/rails_test_app/testapp/config/environments/production.rb +0 -67
  57. data/examples/rails_test_app/testapp/config/environments/test.rb +0 -42
  58. data/examples/rails_test_app/testapp/config/initializers/content_security_policy.rb +0 -29
  59. data/examples/rails_test_app/testapp/config/initializers/filter_parameter_logging.rb +0 -8
  60. data/examples/rails_test_app/testapp/config/initializers/inflections.rb +0 -16
  61. data/examples/rails_test_app/testapp/config/locales/en.yml +0 -31
  62. data/examples/rails_test_app/testapp/config/puma.rb +0 -39
  63. data/examples/rails_test_app/testapp/config/routes.rb +0 -34
  64. data/examples/rails_test_app/testapp/config.ru +0 -6
  65. data/examples/rails_test_app/testapp/db/migrate/20260216002916_create_users.rb +0 -12
  66. data/examples/rails_test_app/testapp/db/migrate/20260216002919_create_posts.rb +0 -13
  67. data/examples/rails_test_app/testapp/db/migrate/20260216002922_create_comments.rb +0 -11
  68. data/examples/rails_test_app/testapp/db/migrate/20260222000001_create_orders.rb +0 -14
  69. data/examples/rails_test_app/testapp/db/migrate/20260222000002_create_order_items.rb +0 -13
  70. data/examples/rails_test_app/testapp/db/schema.rb +0 -71
  71. data/examples/rails_test_app/testapp/db/seeds.rb +0 -85
  72. data/examples/rails_test_app/testapp/docker-compose.yml +0 -21
  73. data/examples/rails_test_app/testapp/docker-entrypoint.sh +0 -10
  74. data/examples/rails_test_app/testapp/lib/tasks/.keep +0 -0
  75. data/examples/rails_test_app/testapp/log/.keep +0 -0
  76. data/examples/rails_test_app/testapp/public/400.html +0 -135
  77. data/examples/rails_test_app/testapp/public/404.html +0 -135
  78. data/examples/rails_test_app/testapp/public/406-unsupported-browser.html +0 -135
  79. data/examples/rails_test_app/testapp/public/422.html +0 -135
  80. data/examples/rails_test_app/testapp/public/500.html +0 -135
  81. data/examples/rails_test_app/testapp/public/icon.png +0 -0
  82. data/examples/rails_test_app/testapp/public/icon.svg +0 -3
  83. data/examples/rails_test_app/testapp/public/robots.txt +0 -1
  84. data/examples/rails_test_app/testapp/script/.keep +0 -0
  85. data/examples/rails_test_app/testapp/storage/.keep +0 -0
  86. data/examples/rails_test_app/testapp/tmp/.keep +0 -0
  87. data/examples/rails_test_app/testapp/tmp/pids/.keep +0 -0
  88. data/examples/rails_test_app/testapp/tmp/storage/.keep +0 -0
  89. data/examples/rails_test_app/testapp/vendor/.keep +0 -0
  90. data/lib/girb_mcp/client_cleanup.rb +0 -102
  91. data/lib/girb_mcp/code_safety_analyzer.rb +0 -124
  92. data/lib/girb_mcp/debug_client.rb +0 -1143
  93. data/lib/girb_mcp/exit_message_builder.rb +0 -112
  94. data/lib/girb_mcp/pending_http_helper.rb +0 -25
  95. data/lib/girb_mcp/rails_helper.rb +0 -155
  96. data/lib/girb_mcp/server.rb +0 -363
  97. data/lib/girb_mcp/session_manager.rb +0 -436
  98. data/lib/girb_mcp/stop_event_annotator.rb +0 -152
  99. data/lib/girb_mcp/tcp_session_discovery.rb +0 -226
  100. data/lib/girb_mcp/tools/connect.rb +0 -669
  101. data/lib/girb_mcp/tools/continue_execution.rb +0 -161
  102. data/lib/girb_mcp/tools/disconnect.rb +0 -169
  103. data/lib/girb_mcp/tools/evaluate_code.rb +0 -354
  104. data/lib/girb_mcp/tools/finish.rb +0 -84
  105. data/lib/girb_mcp/tools/get_context.rb +0 -217
  106. data/lib/girb_mcp/tools/get_source.rb +0 -193
  107. data/lib/girb_mcp/tools/inspect_object.rb +0 -107
  108. data/lib/girb_mcp/tools/list_debug_sessions.rb +0 -60
  109. data/lib/girb_mcp/tools/list_files.rb +0 -189
  110. data/lib/girb_mcp/tools/list_paused_sessions.rb +0 -108
  111. data/lib/girb_mcp/tools/next.rb +0 -70
  112. data/lib/girb_mcp/tools/rails_info.rb +0 -200
  113. data/lib/girb_mcp/tools/rails_model.rb +0 -362
  114. data/lib/girb_mcp/tools/rails_routes.rb +0 -186
  115. data/lib/girb_mcp/tools/read_file.rb +0 -214
  116. data/lib/girb_mcp/tools/remove_breakpoint.rb +0 -173
  117. data/lib/girb_mcp/tools/run_debug_command.rb +0 -55
  118. data/lib/girb_mcp/tools/run_script.rb +0 -293
  119. data/lib/girb_mcp/tools/set_breakpoint.rb +0 -206
  120. data/lib/girb_mcp/tools/step.rb +0 -67
  121. data/lib/girb_mcp/tools/trigger_request.rb +0 -515
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52b798eb530b44561b3c7c15e3949e9d4c9376d719f212be7bc2aece5e1a15f4
4
- data.tar.gz: d83af060aa7dd5feb7199ffcd5902957b01db11a89daa56b268f0a9925fda888
3
+ metadata.gz: 8213f3c4f1d7f389034a135870ac3ae68cb452420d8f383d4317539899c31a81
4
+ data.tar.gz: 785eb0939caf7fa4f78947790ca2833c9bd2362b26ad00a2e64ab20f252cc9d1
5
5
  SHA512:
6
- metadata.gz: 030243a382e114faba8479096f334803124f2124f3b2111bec437a63cc7f7532b6b4688b3646900d2e20f86fb50cb3b6ec4d5354e12597e28887ed7e0dbfd68b
7
- data.tar.gz: e3d558db66f789691d84b8e52437fce620b3581a0c2aebc12f0e12d898589a2d9504432529a096fc1df529603d26fd1319e633d7f0e2e739232add675f97f903
6
+ metadata.gz: fa5704c2861680cf78b9b7d5df6a8444141c7c100529f49d9d601ed6699b2feea1ff0e7332d8c7a1fdd3b2c90ecd98413960e755e55d4f5b5e4a972ff4c8714d
7
+ data.tar.gz: f8b84758a7ce6d9fa1ba52c9d11b9e369f4a5dd18e8a2822a19dec6e0bff7cf1e58f0d2b46c310e2d0e40587019e3eb6acb9b1d8fd8bdcb9fd46a72a717f8698
data/README.md CHANGED
@@ -1,351 +1,39 @@
1
- # girb-mcp
1
+ # girb-mcp (DEPRECATED — renamed to debug-mcp)
2
2
 
3
- [日本語版 (Japanese)](README.ja.md)
3
+ > **This gem has been renamed to [`debug-mcp`](https://rubygems.org/gems/debug-mcp).**
4
+ > Recent `girb-mcp` releases on RubyGems are a deprecation shim that depends on `debug-mcp`
5
+ > and forwards all executables to it. It will receive no further updates.
4
6
 
5
- MCP (Model Context Protocol) server that gives LLM agents access to the runtime context of executing Ruby processes.
7
+ ## Migration
6
8
 
7
- LLM agents like Claude Code can connect to a paused Ruby process, inspect variables, evaluate code, set breakpoints, and control execution — all through MCP tool calls.
8
-
9
- ## What it does
10
-
11
- Existing Ruby/Rails MCP servers only provide static analysis or application-level APIs. girb-mcp goes further: it connects to **running Ruby processes** via the debug gem and exposes their runtime state to LLM agents.
12
-
13
- ```
14
- Claude Code → connect(host: "localhost", port: 12345)
15
- Claude Code → get_context()
16
- → local variables, instance variables, call stack
17
- Claude Code → evaluate_code(code: "user.valid?")
18
- → false
19
- Claude Code → evaluate_code(code: "user.errors.full_messages")
20
- → ["Email can't be blank"]
21
- Claude Code → continue_execution()
22
- ```
23
-
24
- ## Installation
9
+ Replace `girb-mcp` with `debug-mcp` in your `Gemfile`:
25
10
 
26
11
  ```ruby
27
- gem "girb-mcp"
28
- ```
29
-
30
- Or install directly:
31
-
32
- ```
33
- gem install girb-mcp
12
+ gem "debug-mcp" # was: gem "girb-mcp"
34
13
  ```
35
14
 
36
- Requires Ruby >= 3.2.0.
37
-
38
- ## Quick Start
39
-
40
- ### 1. Start a Ruby process with the debugger
41
-
42
- ```bash
43
- # Script
44
- rdbg --open --port=12345 my_script.rb
45
-
46
- # Or with environment variables
47
- RUBY_DEBUG_OPEN=true RUBY_DEBUG_PORT=12345 ruby my_script.rb
48
-
49
- # Or add `debugger` / `binding.break` in your code and run with rdbg
50
- rdbg --open my_script.rb
51
- ```
52
-
53
- ### 2. Configure Claude Code
54
-
55
- Add to your `~/.claude/settings.json` (or project `.claude/settings.json`):
15
+ And in your MCP client config:
56
16
 
57
17
  ```json
58
18
  {
59
19
  "mcpServers": {
60
- "girb-mcp": {
61
- "command": "girb-mcp",
20
+ "debug-mcp": { // was: "girb-mcp"
21
+ "command": "debug-mcp", // was: "girb-mcp"
62
22
  "args": []
63
23
  }
64
24
  }
65
25
  }
66
26
  ```
67
27
 
68
- If using Bundler:
69
-
70
- ```json
71
- {
72
- "mcpServers": {
73
- "girb-mcp": {
74
- "command": "bundle",
75
- "args": ["exec", "girb-mcp"]
76
- }
77
- }
78
- }
79
- ```
80
-
81
- ### 3. Debug with Claude Code
82
-
83
- Ask Claude Code to connect and debug:
84
-
85
- > "Connect to the debug session on port 12345 and show me the current state"
86
-
87
- > "Set a breakpoint at app/models/user.rb line 42 and send a GET request to /users/1"
88
-
89
- ## Usage
90
-
91
- ```
92
- Usage: girb-mcp [options]
93
- -t, --transport TRANSPORT Transport type: stdio (default) or http
94
- -p, --port PORT HTTP port (default: 6029, only for http transport)
95
- --host HOST HTTP host (default: 127.0.0.1, only for http transport)
96
- --session-timeout SECONDS Session timeout in seconds (default: 1800)
97
- -v, --version Show version
98
- -h, --help Show this help
99
- ```
100
-
101
- ### STDIO transport (default)
102
-
103
- Standard transport for Claude Code and other MCP clients. No additional configuration needed.
104
-
105
- ```bash
106
- girb-mcp
107
- ```
108
-
109
- ### HTTP transport (Streamable HTTP)
110
-
111
- For browser-based clients or other HTTP-compatible MCP clients.
112
-
113
- ```bash
114
- girb-mcp --transport http --port 8080
115
- ```
116
-
117
- The MCP endpoint will be available at `http://127.0.0.1:8080/mcp`.
118
-
119
- ### Session timeout
120
-
121
- Debug sessions are automatically cleaned up after 30 minutes of inactivity. Adjust with:
122
-
123
- ```bash
124
- girb-mcp --session-timeout 3600 # 1 hour
125
- ```
126
-
127
- The session manager also detects and cleans up sessions whose target process has exited.
128
-
129
- ## Tools
130
-
131
- ### Discovery & Connection
132
-
133
- | Tool | Description |
134
- |------|-------------|
135
- | `list_debug_sessions` | List available debug sessions (Unix sockets) |
136
- | `connect` | Connect to a debug session via socket path or TCP |
137
- | `list_paused_sessions` | List currently connected sessions |
138
-
139
- ### Investigation
140
-
141
- | Tool | Description |
142
- |------|-------------|
143
- | `evaluate_code` | Execute Ruby code in the stopped binding |
144
- | `inspect_object` | Get class, value, and instance variables of an object |
145
- | `get_context` | Local variables, instance variables, call stack, breakpoints |
146
- | `get_source` | Source code of a method or class |
147
- | `read_file` | Read source files with optional line range |
148
- | `list_files` | List files in a directory, with optional glob pattern |
149
-
150
- ### Execution Control
151
-
152
- | Tool | Description |
153
- |------|-------------|
154
- | `set_breakpoint` | Set a breakpoint: line (file + line), method (`User#save`), or exception class |
155
- | `remove_breakpoint` | Remove a breakpoint by file + line, method name, exception class, or number |
156
- | `continue_execution` | Resume execution until next breakpoint or exit |
157
- | `step` | Step into the next method call |
158
- | `next` | Step over to the next line |
159
- | `finish` | Run until the current method/block returns |
160
- | `run_debug_command` | Execute any raw debugger command |
161
- | `disconnect` | Disconnect from the session and terminate the process |
162
-
163
- ### Entry Points
164
-
165
- | Tool | Description |
166
- |------|-------------|
167
- | `run_script` | Start a Ruby script under rdbg and connect to it |
168
- | `trigger_request` | Send an HTTP request to a Rails app under debug |
169
-
170
- ### Rails Tools (auto-detected)
171
-
172
- These tools are automatically registered when a Rails process is detected.
173
-
174
- | Tool | Description |
175
- |------|-------------|
176
- | `rails_info` | Show app name, Rails/Ruby versions, environment, root path |
177
- | `rails_routes` | Show routes (verb, path, controller#action), filterable by controller or path |
178
- | `rails_model` | Show model structure: columns, associations, validations, enums, scopes |
179
-
180
- ## Workflows
181
-
182
- ### Debug a Ruby script
28
+ The executable `girb-rails` was likewise renamed to `debug-rails`.
183
29
 
184
- ```
185
- Agent: run_script(file: "my_script.rb")
186
- Agent: get_context()
187
- Agent: evaluate_code(code: "result")
188
- Agent: next()
189
- Agent: evaluate_code(code: "result")
190
- Agent: continue_execution()
191
- ```
192
-
193
- ### Method breakpoints
194
-
195
- ```
196
- Agent: run_script(file: "my_script.rb", breakpoints: ["DataPipeline#validate"])
197
- → Script starts and pauses at DataPipeline#validate
198
- Agent: evaluate_code(code: "records")
199
- Agent: continue_execution()
200
- ```
201
-
202
- ### Catch and debug exceptions
203
-
204
- ```
205
- Agent: run_script(file: "my_script.rb")
206
- Agent: set_breakpoint(exception_class: "NoMethodError")
207
- Agent: continue_execution()
208
- → Execution pauses BEFORE the exception propagates
209
- Agent: get_context()
210
- Agent: evaluate_code(code: "$!.message")
211
- ```
212
-
213
- ### Restart after a crash
214
-
215
- ```
216
- → Program crashed with NoMethodError
217
- Agent: run_script(file: "my_script.rb", restore_breakpoints: true)
218
- → Same breakpoints restored automatically
219
- Agent: set_breakpoint(exception_class: "NoMethodError")
220
- Agent: continue_execution()
221
- → Catches the exception before it crashes
222
- ```
223
-
224
- ### Debug a Rails request
225
-
226
- Start your Rails server with debug enabled using `girb-rails`:
227
-
228
- ```bash
229
- girb-rails # equivalent to RUBY_DEBUG_OPEN=true bin/rails server
230
- girb-rails s -p 4000 # specify port
231
- girb-rails --debug-port 3333 # use specific TCP debug port (useful in Docker)
232
- ```
233
-
234
- Then ask the agent to debug:
235
-
236
- ```
237
- Agent: connect()
238
- Agent: set_breakpoint(file: "app/controllers/users_controller.rb", line: 15)
239
- Agent: trigger_request(method: "GET", url: "http://localhost:3000/users/1")
240
- Agent: get_context()
241
- Agent: evaluate_code(code: "@user.attributes")
242
- Agent: continue_execution()
243
- ```
244
-
245
- ### Debug a Dockerized Rails app
246
-
247
- > **Security note:** The debug gem has no authentication. Anyone who can reach the debug port can execute arbitrary code inside the container. Always restrict access as shown below.
248
-
249
- #### Option A: Localhost-only TCP (simple)
250
-
251
- Expose the debug port bound to `127.0.0.1` so only local processes can connect:
252
-
253
- ```yaml
254
- services:
255
- web:
256
- build: .
257
- ports:
258
- - "3000:3000"
259
- - "127.0.0.1:12345:12345" # localhost only
260
- environment:
261
- - RUBY_DEBUG_OPEN=true
262
- - RUBY_DEBUG_HOST=0.0.0.0
263
- - RUBY_DEBUG_PORT=12345
264
- ```
265
-
266
- ```
267
- Agent: connect(port: 12345)
268
- ```
269
-
270
- The agent can read source files inside the container — no local copy of the source code is needed.
271
-
272
- #### Option B: Unix socket volume mount (recommended)
273
-
274
- Mount a shared directory for the debug socket. No port exposure needed:
275
-
276
- ```yaml
277
- services:
278
- web:
279
- build: .
280
- ports:
281
- - "3000:3000"
282
- environment:
283
- - RUBY_DEBUG_OPEN=true
284
- - RUBY_DEBUG_SOCK_PATH=/debug/rdbg.sock
285
- volumes:
286
- - debug_sock:/debug
287
-
288
- volumes:
289
- debug_sock:
290
- ```
291
-
292
- ```
293
- Agent: connect(path: "/path/to/debug_sock/rdbg.sock")
294
- ```
295
-
296
- ### Connect to an existing breakpoint
297
-
298
- ```bash
299
- # Terminal: your app hits a `debugger` statement
300
- rdbg --open my_app.rb
301
- ```
302
-
303
- ```
304
- Agent: list_debug_sessions()
305
- Agent: connect(path: "/tmp/rdbg-1000/rdbg-12345")
306
- Agent: get_context()
307
- ```
308
-
309
- ## How it works
310
-
311
- ```
312
- ┌─────────────┐ STDIO or Streamable HTTP ┌───────────┐ TCP/Unix Socket ┌──────────────┐
313
- │ Claude Code │ ◄──────────────────────► │ girb-mcp │ ◄──────────────────► │ Ruby process │
314
- │ (MCP Client) │ (JSON-RPC) │(MCP Server)│ debug gem proto │ (rdbg) │
315
- └─────────────┘ └───────────┘ └──────────────┘
316
- ```
317
-
318
- 1. girb-mcp runs as an MCP server communicating via STDIO (default) or Streamable HTTP
319
- 2. The debug gem (`rdbg --open`) exposes a socket on the target Ruby process
320
- 3. girb-mcp connects to that socket using the debug gem's wire protocol
321
- 4. MCP tool calls are translated to debugger commands and results are returned
322
- 5. Idle sessions are automatically cleaned up after a configurable timeout
323
-
324
- ## Security
325
-
326
- girb-mcp is a debugging tool that intentionally provides deep runtime access. Here's what you should know:
327
-
328
- **Structured tools minimize arbitrary code execution.** Most debugging tasks — viewing variables, reading source code, inspecting model structure — are handled by dedicated tools that don't run arbitrary code. `evaluate_code` is available for runtime inspection, and a built-in safety checker warns about dangerous operations.
329
-
330
- **The debug gem has no authentication.** Anyone who can reach the debug socket can execute arbitrary code in the target process. Always bind to localhost (`127.0.0.1`) or use Unix sockets. See the [Docker section](#debug-a-dockerized-rails-app) for configuration examples.
331
-
332
- ## Part of the girb family
333
-
334
- girb-mcp is part of the [girb](https://github.com/rira100000000/girb) family:
335
-
336
- - **girb** — AI-powered IRB assistant (interactive, for humans)
337
- - **girb-mcp** — MCP server for LLM agents (programmatic, for agents)
338
- - **girb-ruby_llm** — LLM provider for girb via ruby_llm
339
- - **girb-gemini** — LLM provider for girb via Gemini API
340
-
341
- ## Development
342
-
343
- ```bash
344
- git clone https://github.com/rira100000000/girb-mcp.git
345
- cd girb-mcp
346
- bundle install
347
- ```
30
+ The `girb-mcp` deprecation shim still works as a transitional step (it `exec`s
31
+ `debug-mcp` / `debug-rails` after printing a deprecation warning), but please
32
+ migrate to `debug-mcp` directly.
348
33
 
349
- ## License
34
+ ## Why the rename?
350
35
 
351
- MIT
36
+ The new name better reflects what this gem does: an MCP server for Ruby's
37
+ [`debug` gem](https://github.com/ruby/debug). See the
38
+ [debug-mcp repository](https://github.com/rira100000000/debug-mcp) for the
39
+ current source and changelog.
data/exe/girb-mcp CHANGED
@@ -1,39 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require "girb_mcp"
5
- require "optparse"
4
+ $stderr.puts "[DEPRECATION] girb-mcp has been renamed to debug-mcp."
5
+ $stderr.puts " Replace 'girb-mcp' with 'debug-mcp' in your MCP client config."
6
+ $stderr.puts " See: https://github.com/rira100000000/debug-mcp"
7
+ $stderr.puts " This shim forwards to 'debug-mcp' for now, but will not receive updates."
6
8
 
7
- options = {}
8
-
9
- OptionParser.new do |opts|
10
- opts.banner = "Usage: girb-mcp [options]"
11
-
12
- opts.on("-t", "--transport TRANSPORT", %w[stdio http], "Transport type: stdio (default) or http") do |t|
13
- options[:transport] = t
14
- end
15
-
16
- opts.on("-p", "--port PORT", Integer, "HTTP port (default: 6029, only for http transport)") do |p|
17
- options[:port] = p
18
- end
19
-
20
- opts.on("--host HOST", "HTTP host (default: 127.0.0.1, only for http transport)") do |h|
21
- options[:host] = h
22
- end
23
-
24
- opts.on("--session-timeout SECONDS", Integer, "Session timeout in seconds (default: 1800)") do |t|
25
- options[:session_timeout] = t
26
- end
27
-
28
- opts.on("-v", "--version", "Show version") do
29
- puts "girb-mcp #{GirbMcp::VERSION}"
30
- exit
31
- end
32
-
33
- opts.on("-h", "--help", "Show this help") do
34
- puts opts
35
- exit
36
- end
37
- end.parse!
38
-
39
- GirbMcp::Server.new(**options).start
9
+ require "rubygems"
10
+ exec(Gem.bin_path("debug-mcp", "debug-mcp"), *ARGV)
data/exe/girb-rails CHANGED
@@ -1,127 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- class GirbRails
5
- DEFAULT_DEBUG_PORT = 12321
4
+ $stderr.puts "[DEPRECATION] girb-rails has been renamed to debug-rails."
5
+ $stderr.puts " Replace 'girb-rails' with 'debug-rails' in your scripts/configs."
6
+ $stderr.puts " See: https://github.com/rira100000000/debug-mcp"
7
+ $stderr.puts " This shim forwards to 'debug-rails' for now, but will not receive updates."
6
8
 
7
- def self.parse_args(argv)
8
- debug_port = nil
9
- show_help = false
10
-
11
- i = 0
12
- while i < argv.length
13
- case argv[i]
14
- when "--debug-port"
15
- i += 1
16
- raise ArgumentError, "--debug-port requires a port number" if i >= argv.length
17
- debug_port = parse_port(argv[i])
18
- i += 1
19
- when /\A--debug-port=(.+)\z/
20
- debug_port = parse_port($1)
21
- i += 1
22
- when "-h", "--help"
23
- show_help = true
24
- i += 1
25
- else
26
- break
27
- end
28
- end
29
-
30
- rails_args = argv[i..] || []
31
-
32
- if rails_args.empty? || rails_args.first.start_with?("-")
33
- rails_args.unshift("server")
34
- end
35
-
36
- { debug_port: debug_port, rails_args: rails_args, show_help: show_help }
37
- end
38
-
39
- def self.parse_port(value)
40
- port = Integer(value)
41
- raise ArgumentError unless port.positive?
42
- port
43
- rescue ArgumentError, TypeError
44
- raise ArgumentError, "--debug-port requires a valid port number, got: #{value.inspect}"
45
- end
46
-
47
- def self.build_env(debug_port:, docker:)
48
- if docker
49
- {
50
- "RUBY_DEBUG_HOST" => "0.0.0.0",
51
- "RUBY_DEBUG_PORT" => (debug_port || DEFAULT_DEBUG_PORT).to_s,
52
- }
53
- else
54
- env = { "RUBY_DEBUG_OPEN" => "true" }
55
- env["RUBY_DEBUG_PORT"] = debug_port.to_s if debug_port
56
- env
57
- end
58
- end
59
-
60
- def self.docker?
61
- File.exist?("/.dockerenv")
62
- end
63
-
64
- def self.print_help(io = $stdout)
65
- io.puts <<~HELP
66
- Usage: girb-rails [options] [rails-command] [rails-options]
67
-
68
- Launch a Rails server with Ruby debug gem enabled for girb-mcp debugging.
69
-
70
- Options:
71
- --debug-port PORT Debug port for TCP connection (default: #{DEFAULT_DEBUG_PORT} in Docker)
72
- -h, --help Show this help
73
-
74
- Examples:
75
- girb-rails # rails server with debug enabled
76
- girb-rails s -p 4000 # rails server on port 4000
77
- girb-rails --debug-port 3333 # use TCP debug port 3333
78
- girb-rails console # rails console with debug enabled
79
-
80
- Environment:
81
- Outside Docker: Sets RUBY_DEBUG_OPEN=true
82
- Inside Docker: Sets RUBY_DEBUG_HOST=0.0.0.0, RUBY_DEBUG_PORT=PORT
83
- HELP
84
- end
85
-
86
- def self.run(argv = ARGV)
87
- parsed = parse_args(argv)
88
-
89
- if parsed[:show_help]
90
- print_help
91
- exit 0
92
- end
93
-
94
- unless File.exist?("bin/rails")
95
- $stderr.puts "Error: bin/rails not found in current directory."
96
- $stderr.puts "Run this command from your Rails application root."
97
- exit 1
98
- end
99
-
100
- env = build_env(debug_port: parsed[:debug_port], docker: docker?)
101
- pid = spawn(env, "bin/rails", *parsed[:rails_args])
102
-
103
- force_quit_deadline = nil
104
-
105
- Signal.trap("INT") do
106
- if force_quit_deadline && Time.now < force_quit_deadline
107
- Process.kill("KILL", pid)
108
- else
109
- Process.kill("TERM", pid)
110
- $stderr.write "\nStopping... Press Ctrl+C again within 3s to force quit\n"
111
- force_quit_deadline = Time.now + 3
112
- end
113
- end
114
-
115
- Signal.trap("TERM") do
116
- Process.kill("TERM", pid)
117
- end
118
-
119
- _, status = Process.waitpid2(pid)
120
- exit(status.exitstatus || 1)
121
- rescue ArgumentError => e
122
- $stderr.puts "Error: #{e.message}"
123
- exit 1
124
- end
125
- end
126
-
127
- GirbRails.run unless defined?(RSpec)
9
+ require "rubygems"
10
+ exec(Gem.bin_path("debug-mcp", "debug-rails"), *ARGV)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GirbMcp
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
data/lib/girb_mcp.rb CHANGED
@@ -1,40 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "girb_mcp/version"
4
- require_relative "girb_mcp/debug_client"
5
- require_relative "girb_mcp/session_manager"
6
- require_relative "girb_mcp/exit_message_builder"
7
- require_relative "girb_mcp/stop_event_annotator"
8
- require_relative "girb_mcp/tcp_session_discovery"
9
- require_relative "girb_mcp/server"
10
4
 
11
- module GirbMcp
12
- class Error < StandardError; end
5
+ warn "[DEPRECATION] girb-mcp has been renamed to debug-mcp. " \
6
+ "Update your Gemfile to use 'debug-mcp' instead, and update any MCP " \
7
+ "client config that references the 'girb-mcp' / 'girb-rails' commands " \
8
+ "to 'debug-mcp' / 'debug-rails'. " \
9
+ "See https://github.com/rira100000000/debug-mcp for migration details."
13
10
 
14
- class ConnectionError < Error
15
- attr_reader :final_output
16
-
17
- def initialize(message = nil, final_output: nil)
18
- super(message)
19
- @final_output = final_output
20
- end
21
- end
22
-
23
- class SessionError < Error
24
- attr_reader :final_output
25
-
26
- def initialize(message = nil, final_output: nil)
27
- super(message)
28
- @final_output = final_output
29
- end
30
- end
31
-
32
- class TimeoutError < Error
33
- attr_reader :final_output
34
-
35
- def initialize(message = nil, final_output: nil)
36
- super(message)
37
- @final_output = final_output
38
- end
39
- end
40
- end
11
+ require "debug_mcp"