mcp-inspector 0.1.0 → 0.2.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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/NAMING_CONVENTION.md +145 -0
  3. data/QUICKSTART.md +166 -0
  4. data/README.md +44 -4
  5. data/WEB_README.md +392 -0
  6. data/exe/mcp-inspector +1 -1
  7. data/inspector/.dockerignore +51 -0
  8. data/inspector/.github/dependabot.yml +12 -0
  9. data/inspector/.github/workflows/ci.yml +55 -0
  10. data/inspector/.mcp-inspector.json +23 -0
  11. data/inspector/.rubocop.yml +8 -0
  12. data/inspector/.ruby-version +1 -0
  13. data/inspector/Dockerfile +72 -0
  14. data/inspector/Gemfile +56 -0
  15. data/inspector/Gemfile.lock +396 -0
  16. data/inspector/README.md +373 -0
  17. data/inspector/Rakefile +6 -0
  18. data/inspector/app/assets/images/.keep +0 -0
  19. data/inspector/app/assets/stylesheets/application.css +10 -0
  20. data/inspector/app/controllers/application_controller.rb +4 -0
  21. data/inspector/app/controllers/concerns/.keep +0 -0
  22. data/inspector/app/helpers/application_helper.rb +2 -0
  23. data/inspector/app/jobs/application_job.rb +7 -0
  24. data/inspector/app/models/application_record.rb +3 -0
  25. data/inspector/app/models/concerns/.keep +0 -0
  26. data/inspector/app/views/layouts/application.html.erb +27 -0
  27. data/inspector/app/views/pwa/manifest.json.erb +22 -0
  28. data/inspector/app/views/pwa/service-worker.js +26 -0
  29. data/inspector/bin/brakeman +7 -0
  30. data/inspector/bin/dev +2 -0
  31. data/inspector/bin/docker-entrypoint +14 -0
  32. data/inspector/bin/rails +4 -0
  33. data/inspector/bin/rake +4 -0
  34. data/inspector/bin/rubocop +8 -0
  35. data/inspector/bin/setup +34 -0
  36. data/inspector/bin/start +31 -0
  37. data/inspector/bin/thrust +5 -0
  38. data/inspector/config/application.rb +58 -0
  39. data/inspector/config/boot.rb +4 -0
  40. data/inspector/config/credentials.yml.enc +1 -0
  41. data/inspector/config/database.yml +37 -0
  42. data/inspector/config/environment.rb +9 -0
  43. data/inspector/config/environments/development.rb +57 -0
  44. data/inspector/config/environments/production.rb +70 -0
  45. data/inspector/config/environments/test.rb +42 -0
  46. data/inspector/config/initializers/assets.rb +7 -0
  47. data/inspector/config/initializers/content_security_policy.rb +25 -0
  48. data/inspector/config/initializers/filter_parameter_logging.rb +8 -0
  49. data/inspector/config/initializers/inflections.rb +16 -0
  50. data/inspector/config/locales/en.yml +31 -0
  51. data/inspector/config/master.key +1 -0
  52. data/inspector/config/puma.rb +41 -0
  53. data/inspector/config/routes.rb +17 -0
  54. data/inspector/config.ru +6 -0
  55. data/inspector/db/schema.rb +14 -0
  56. data/inspector/db/seeds.rb +9 -0
  57. data/inspector/lib/tasks/.keep +0 -0
  58. data/inspector/public/400.html +114 -0
  59. data/inspector/public/404.html +114 -0
  60. data/inspector/public/406-unsupported-browser.html +114 -0
  61. data/inspector/public/422.html +114 -0
  62. data/inspector/public/500.html +114 -0
  63. data/inspector/public/icon.png +0 -0
  64. data/inspector/public/icon.svg +3 -0
  65. data/inspector/public/robots.txt +1 -0
  66. data/inspector/script/.keep +0 -0
  67. data/inspector/vendor/.keep +0 -0
  68. data/lib/mcp_inspector/cli.rb +10 -10
  69. data/lib/mcp_inspector/data/config_manager.rb +3 -3
  70. data/lib/mcp_inspector/data/input_adapter.rb +1 -1
  71. data/lib/mcp_inspector/data/output_adapter.rb +3 -3
  72. data/lib/mcp_inspector/presentation/base_formatter.rb +1 -1
  73. data/lib/mcp_inspector/presentation/json_formatter.rb +1 -1
  74. data/lib/mcp_inspector/transport/base_adapter.rb +1 -1
  75. data/lib/mcp_inspector/transport/client_adapter.rb +50 -7
  76. data/lib/mcp_inspector/transport/server_config.rb +26 -5
  77. data/lib/mcp_inspector/version.rb +2 -2
  78. data/lib/mcp_inspector/web/app/controllers/mcp_inspector/web/application_controller.rb +23 -0
  79. data/lib/mcp_inspector/web/app/controllers/mcp_inspector/web/dashboard_controller.rb +15 -0
  80. data/lib/mcp_inspector/web/app/controllers/mcp_inspector/web/operations_controller.rb +90 -0
  81. data/lib/mcp_inspector/web/app/controllers/mcp_inspector/web/servers_controller.rb +76 -0
  82. data/lib/mcp_inspector/web/app/helpers/mcp_inspector/web/ui_resources_helper.rb +141 -0
  83. data/lib/mcp_inspector/web/app/views/layouts/mcp_inspector/web/application.html.erb +83 -0
  84. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/dashboard/index.html.erb +237 -0
  85. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/operations/_result.html.erb +47 -0
  86. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/operations/_ui_resource.html.erb +89 -0
  87. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/operations/result.turbo_stream.erb +3 -0
  88. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/servers/_info.html.erb +55 -0
  89. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/servers/_prompts.html.erb +65 -0
  90. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/servers/_resources.html.erb +61 -0
  91. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/servers/_tools.html.erb +65 -0
  92. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/servers/info.turbo_stream.erb +3 -0
  93. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/servers/prompts.turbo_stream.erb +3 -0
  94. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/servers/resources.turbo_stream.erb +3 -0
  95. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/servers/tools.turbo_stream.erb +3 -0
  96. data/lib/mcp_inspector/web/app/views/mcp_inspector/web/shared/_error.html.erb +18 -0
  97. data/lib/mcp_inspector/web/config/routes.rb +22 -0
  98. data/lib/mcp_inspector/web/connection_pool.rb +127 -0
  99. data/lib/mcp_inspector/web/engine.rb +68 -0
  100. data/lib/mcp_inspector.rb +2 -1
  101. data/lib/mcp_inspector_web.rb +13 -0
  102. metadata +117 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d4704c72568b86082e74cc0c70052fec7e4a4d6e31b0f8fad00e42e76af5b63
4
- data.tar.gz: fcb8bba16641850e3af1720ff8d9111a7c94ad325e5f063afc9685760bec8590
3
+ metadata.gz: 66bc1141435b3fef45e1bb3536ee65703a804499644fe91fe433520d9f3064d4
4
+ data.tar.gz: 07db01d952c3e50a20ea7dacd942c27390351d1a3669c10e5816af1d8bfef49d
5
5
  SHA512:
6
- metadata.gz: 896468351dee78dc3402113c403b80c92dcfa9388c90bce33b27835e31cd95a544efc36c1e70d0496390bb2009a085438ff92e6dcd85975e4b80e1a212cd58d4
7
- data.tar.gz: 3ae68d16805d58016150e1fdfc02cf48cf80a7b2080fbc73bcf8c038539759ea52146782503168e33fbbdbda454bfc0d7cda9ae8a1f84100aa3bd14d6ad1c179
6
+ metadata.gz: 0b08184300a2822dfe7127e6fd988cca938b41ed1d7793e0a74a7f7c931276c5347bf5e52b861598b3a349ca69a646c222fc74f24e5ed794feedf719d2c9e7ce
7
+ data.tar.gz: 573f2babc2f3a59650f11a0f448239981a31a26fd309e199b3a8181c28342c284aa35789b293a7a2c0a1047886a990a1acb58865bda1f79e882aa69f09054b0b
@@ -0,0 +1,145 @@
1
+ # Naming Convention Change
2
+
3
+ ## Summary
4
+
5
+ The gem has been renamed from `MCPInspector` to `McpInspector` to follow Ruby naming conventions and avoid complex inflection configuration.
6
+
7
+ ## Why the Change?
8
+
9
+ Ruby/Rails conventions dictate that:
10
+ - Acronyms should only stay fully uppercase when standalone (e.g., `MCP`) or at the end of a constant name (e.g., `ServerMCP`)
11
+ - In compound names, only the first letter of each word should be capitalized (e.g., `HttpClient`, not `HTTPClient`)
12
+ - `McpInspector` follows this convention, treating "Mcp" as a word rather than requiring special inflection rules
13
+
14
+ This change:
15
+ ✅ Simplifies autoloading (no custom Zeitwerk inflections needed)
16
+ ✅ Follows Rails conventions
17
+ ✅ Avoids conflicts between gem and Rails autoloaders
18
+ ✅ Makes the codebase more maintainable
19
+
20
+ ## What Changed
21
+
22
+ ### Module Names
23
+ - `MCPInspector` → `McpInspector`
24
+ - `MCPInspector::Web` → `McpInspector::Web`
25
+ - All nested modules updated accordingly
26
+
27
+ ### File Changes
28
+
29
+ **Core Library:**
30
+ - `lib/mcp_inspector.rb` - Removed inflection config
31
+ - `lib/mcp_inspector/version.rb` - Updated module name
32
+ - `lib/mcp_inspector/cli.rb` - Updated all class references
33
+ - All files in `lib/mcp_inspector/transport/` - Updated module names
34
+ - All files in `lib/mcp_inspector/data/` - Updated module names
35
+ - All files in `lib/mcp_inspector/presentation/` - Updated module names
36
+
37
+ **Web Engine:**
38
+ - `lib/mcp_inspector_web.rb` - Updated module name
39
+ - `lib/mcp_inspector/web/engine.rb` - Removed inflection initializer
40
+ - `lib/mcp_inspector/web/config/routes.rb` - Updated engine reference
41
+ - All controllers - Updated module names
42
+ - All views - Updated references (if any)
43
+
44
+ **Demo Application:**
45
+ - `inspector/config/routes.rb` - Updated mount statement
46
+ - `inspector/config/initializers/inflections.rb` - Removed MCP acronym
47
+ - `inspector/config/application.rb` - No changes needed (require still works)
48
+
49
+ **Documentation:**
50
+ - `README.md` - Updated all code examples
51
+ - `WEB_README.md` - Removed inflection step, updated examples
52
+ - `inspector/README.md` - Removed inflection section
53
+ - `QUICKSTART.md` - Removed inflection step
54
+ - `mcp-inspector.gemspec` - Updated version constant reference
55
+
56
+ ## Usage Examples
57
+
58
+ ### Before (with inflections)
59
+
60
+ ```ruby
61
+ # Needed inflection configuration
62
+ ActiveSupport::Inflector.inflections(:en) do |inflect|
63
+ inflect.acronym "MCP"
64
+ end
65
+
66
+ # Module reference
67
+ module MCPInspector
68
+ module Web
69
+ # ...
70
+ end
71
+ end
72
+
73
+ # Mount statement
74
+ mount MCPInspector::Web::Engine, at: '/mcp_inspector'
75
+ ```
76
+
77
+ ### After (no inflections needed)
78
+
79
+ ```ruby
80
+ # No inflection configuration needed!
81
+
82
+ # Module reference
83
+ module McpInspector
84
+ module Web
85
+ # ...
86
+ end
87
+ end
88
+
89
+ # Mount statement
90
+ mount McpInspector::Web::Engine, at: '/mcp_inspector'
91
+ ```
92
+
93
+ ## Migration Guide
94
+
95
+ If you have an existing installation:
96
+
97
+ 1. **Update your routes** (`config/routes.rb`):
98
+ ```ruby
99
+ # Old
100
+ mount MCPInspector::Web::Engine, at: '/mcp_inspector'
101
+
102
+ # New
103
+ mount McpInspector::Web::Engine, at: '/mcp_inspector'
104
+ ```
105
+
106
+ 2. **Remove inflection configuration** (`config/initializers/inflections.rb`):
107
+ ```ruby
108
+ # Remove this:
109
+ ActiveSupport::Inflector.inflections(:en) do |inflect|
110
+ inflect.acronym "MCP"
111
+ end
112
+ ```
113
+
114
+ 3. **Update any custom code** that references the modules:
115
+ ```ruby
116
+ # Old
117
+ MCPInspector::Data::ConfigManager
118
+
119
+ # New
120
+ McpInspector::Data::ConfigManager
121
+ ```
122
+
123
+ 4. **Restart your server**
124
+
125
+ That's it! No changes needed to configuration files or other aspects of the gem.
126
+
127
+ ## Benefits
128
+
129
+ - ✅ **Simpler setup** - No inflection configuration required
130
+ - ✅ **Standard Rails** - Follows Rails autoloading conventions
131
+ - ✅ **Less magic** - No custom Zeitwerk configuration
132
+ - ✅ **More maintainable** - Easier for other developers to understand
133
+ - ✅ **Fewer conflicts** - Avoids autoloader conflicts
134
+
135
+ ## Technical Details
136
+
137
+ The change affects:
138
+ - **14 Ruby files** in `lib/mcp_inspector/`
139
+ - **4 controller files** in the web engine
140
+ - **1 routes file** in the web engine
141
+ - **1 engine file**
142
+ - **4 documentation files**
143
+ - **Demo app configuration**
144
+
145
+ All references to `MCPInspector` have been systematically replaced with `McpInspector` throughout the codebase.
data/QUICKSTART.md ADDED
@@ -0,0 +1,166 @@
1
+ # MCP Inspector - Quick Start Guide
2
+
3
+ Get the MCP Inspector web interface running in under 5 minutes!
4
+
5
+ ## For the Web Interface (Demo App)
6
+
7
+ ### Prerequisites
8
+ - Ruby 2.7+ installed
9
+ - Node.js and npm installed (for MCP servers)
10
+ - Bundler installed (`gem install bundler`)
11
+
12
+ ### Quick Start (3 commands)
13
+
14
+ ```bash
15
+ # 1. Navigate to the demo app
16
+ cd inspector
17
+
18
+ # 2. Run the start script (installs dependencies and starts server)
19
+ bin/start
20
+
21
+ # 3. Open your browser to http://localhost:3000
22
+ ```
23
+
24
+ That's it! You should now see the MCP Inspector web interface.
25
+
26
+ ### What's Included
27
+
28
+ The demo comes pre-configured with two MCP servers:
29
+
30
+ 1. **filesystem-server** - Interact with files in `/tmp` directory
31
+ 2. **github-server** - Interact with GitHub (requires GITHUB_TOKEN)
32
+
33
+ ### Your First Test
34
+
35
+ 1. **Create a test file**:
36
+ ```bash
37
+ echo "Hello MCP Inspector!" > /tmp/test.txt
38
+ ```
39
+
40
+ 2. **In the browser**:
41
+ - Select "filesystem-server" from the dropdown
42
+ - Click "List Tools"
43
+ - Find "read_file" tool and click "Execute"
44
+ - Enter: `{"path": "/tmp/test.txt"}`
45
+ - Click "Execute Tool"
46
+ - See your file contents appear!
47
+
48
+ ### Optional: GitHub Server Setup
49
+
50
+ To use the GitHub server:
51
+
52
+ ```bash
53
+ export GITHUB_TOKEN=your_github_token_here
54
+ ```
55
+
56
+ Get a token at: https://github.com/settings/tokens
57
+
58
+ Then restart the server and select "github-server" from the dropdown.
59
+
60
+ ## Integrating Into Your Own Rails App
61
+
62
+ To add MCP Inspector to your existing Rails application:
63
+
64
+ 1. **Mount the engine** in `config/routes.rb`:
65
+ ```ruby
66
+ mount McpInspector::Web::Engine, at: '/mcp_inspector'
67
+ ```
68
+
69
+ 2. **Require the engine** in `config/application.rb`:
70
+ ```ruby
71
+ require 'mcp_inspector_web'
72
+ ```
73
+
74
+ 3. **Restart your server** and visit `/mcp_inspector`
75
+
76
+ See [WEB_README.md](WEB_README.md) for complete documentation.
77
+
78
+ ## For the CLI Tool
79
+
80
+ If you prefer the command-line interface:
81
+
82
+ ```bash
83
+ # Install the gem
84
+ gem install mcp-inspector
85
+
86
+ # Create configuration
87
+ mcp-inspector config init
88
+
89
+ # List available tools
90
+ mcp-inspector list tools --server filesystem-server
91
+
92
+ # Execute a tool
93
+ mcp-inspector execute read_file --server filesystem-server --args '{"path": "/tmp/test.txt"}'
94
+ ```
95
+
96
+ ## What's Next?
97
+
98
+ - **Web Interface Documentation**: See [WEB_README.md](WEB_README.md)
99
+ - **CLI Documentation**: See [README.md](README.md)
100
+ - **Demo App Details**: See [inspector/README.md](inspector/README.md)
101
+ - **Add Your Own MCP Servers**: Edit `.mcp-inspector.json`
102
+
103
+ ## Troubleshooting
104
+
105
+ ### "Command not found: npx"
106
+ Install Node.js from https://nodejs.org/
107
+
108
+ ### "Bundle not found"
109
+ ```bash
110
+ gem install bundler
111
+ ```
112
+
113
+ ### "Connection failed"
114
+ Make sure the MCP server is installed:
115
+ ```bash
116
+ npx -y @modelcontextprotocol/server-filesystem /tmp
117
+ ```
118
+
119
+ ### Need Help?
120
+ - Check the comprehensive [WEB_README.md](WEB_README.md)
121
+ - Check the demo app [README](inspector/README.md)
122
+ - Open an issue on GitHub
123
+
124
+ ## Architecture Overview
125
+
126
+ ```
127
+ ┌─────────────────────────────────────┐
128
+ │ Browser (Web Interface) │
129
+ │ http://localhost:3000 │
130
+ └──────────────┬──────────────────────┘
131
+
132
+
133
+ ┌─────────────────────────────────────┐
134
+ │ Rails Engine (MCP Inspector Web) │
135
+ │ - Controllers │
136
+ │ - Views (Tailwind CSS) │
137
+ │ - Turbo Streams │
138
+ └──────────────┬──────────────────────┘
139
+
140
+
141
+ ┌─────────────────────────────────────┐
142
+ │ MCP Inspector Core │
143
+ │ - Transport Layer │
144
+ │ - Data Layer │
145
+ │ - Configuration Management │
146
+ └──────────────┬──────────────────────┘
147
+
148
+
149
+ ┌─────────────────────────────────────┐
150
+ │ MCP Servers │
151
+ │ - filesystem-server │
152
+ │ - github-server │
153
+ │ - your-custom-server │
154
+ └─────────────────────────────────────┘
155
+ ```
156
+
157
+ ## Key Features
158
+
159
+ ✅ **Zero Configuration** - Pre-configured demo app ready to run
160
+ ✅ **Interactive UI** - Click, type, execute - no command-line needed
161
+ ✅ **Real-time Updates** - Turbo Streams for seamless interactions
162
+ ✅ **Multiple Transports** - stdio, SSE, WebSocket support
163
+ ✅ **Secure** - CSRF protection, input validation, timeouts
164
+ ✅ **Extensible** - Add your own MCP servers easily
165
+
166
+ Happy inspecting! 🔍
data/README.md CHANGED
@@ -6,9 +6,10 @@ A Ruby gem that provides a command-line tool for connecting to and inspecting MC
6
6
 
7
7
  - **Multi-transport support**: Connect to MCP servers via stdio, SSE, or WebSocket
8
8
  - **Command-based CLI**: Execute operations without persistent sessions
9
+ - **Web Interface**: Rails Engine for browser-based MCP server inspection
9
10
  - **JSON configuration**: Configure multiple servers in a single JSON file
10
11
  - **Structured output**: All output in JSON format for easy parsing and automation
11
- - **Three-layer architecture**: Designed for future web adaptation
12
+ - **Three-layer architecture**: Designed for both CLI and web interfaces
12
13
 
13
14
  ## Installation
14
15
 
@@ -224,15 +225,54 @@ mcp-inspector list resources --server github-server
224
225
  mcp-inspector execute search_repositories --server github-server --args '{"query": "ruby mcp"}'
225
226
  ```
226
227
 
228
+ ## Web Interface
229
+
230
+ MCP Inspector includes a Rails Engine for browser-based inspection of MCP servers. The web interface provides:
231
+
232
+ - Interactive server selection and operation execution
233
+ - Real-time updates using Hotwire/Turbo Streams
234
+ - Modern UI with Tailwind CSS
235
+ - Easy mounting in existing Rails applications
236
+
237
+ ### Quick Setup
238
+
239
+ 1. Add to your Rails app's `config/routes.rb`:
240
+
241
+ ```ruby
242
+ mount McpInspector::Web::Engine, at: '/mcp_inspector'
243
+ ```
244
+
245
+ 2. Require the web engine in `config/application.rb`:
246
+
247
+ ```ruby
248
+ require 'mcp_inspector_web'
249
+ ```
250
+
251
+ 3. Start your Rails server and visit `/mcp_inspector`
252
+
253
+ ### Demo Application
254
+
255
+ A complete working demo is available in the `inspector/` directory:
256
+
257
+ ```bash
258
+ cd inspector
259
+ bin/start
260
+ # Visit http://localhost:3000
261
+ ```
262
+
263
+ For detailed documentation:
264
+ - Web interface: [WEB_README.md](WEB_README.md)
265
+ - Demo application: [inspector/README.md](inspector/README.md)
266
+
227
267
  ## Architecture
228
268
 
229
269
  The gem uses a three-layer architecture:
230
270
 
231
271
  1. **Transport Layer**: Handles connections to MCP servers
232
- 2. **Data Layer**: Manages configuration and input/output processing
233
- 3. **Presentation Layer**: Formats output for display
272
+ 2. **Data Layer**: Manages configuration and input/output processing
273
+ 3. **Presentation Layer**: Formats output for display (CLI and Web)
234
274
 
235
- This design makes it easy to add new output formats or adapt for web interfaces in the future.
275
+ This design makes it easy to add new output formats and provides both CLI and web interfaces using the same core functionality.
236
276
 
237
277
  ## Development
238
278